/usr/share/psychtoolbox-3/PsychCal/GamutToSettingsTbl.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | function [settings] = GamutToSettingsTbl(iGammaTable,gamut)
% [settings] = GamutToSettingsTbl(iGammaTable,gamut)
%
% Find the best integer device settings to produce
% the passed linear device coordinates. Use a precomputed
% inverse gamma table.
%
% The passed coordinates should be in the range [0,1].
% The returned values run from [0,nlevels-1], where nlevels
% is the number of quantized levels available on the device.
%
% 1/21/95 dhb Wrote it.
% 5/26/12 dhb Remove reference in comments to a return value that does not exist.
% Get number of levels
[nLevels,ng] = size(iGammaTable);
% Check dimensions and table sizes
[m,n] = size(gamut);
if (m > ng)
error('Mismatch between device coordinate dimensions and gamma table');
end
% Use table lookup to find the answers
epsilon = 1/(100*nLevels);
indices = fix((gamut*nLevels)-epsilon)+1;
settings = zeros(size(gamut));
for j = 1:m
settings(j,:) = iGammaTable(indices(j,:)',j)';
end
|