/usr/share/psychtoolbox-3/PsychCal/GamutToSettingsExhaust.m is in psychtoolbox-3-common 3.0.14.20170103+git6-g605ff5c.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 | function settings = GamutToSettingsExhaust(gammaInput, gammaTable, gamut)
% settings = GamutToSettingsExhaust(gammaInput, gammaTable, gamut)
%
% Find the best device settings to produce
% the passed linear device coordinates.
%
% This version works by exhaustive search of the fit gamma table,
% and returns the value in that table that produces output closest
% to desired.
%
% The passed coordinates should be in the range [0,1].
% The returned settings also run from [0,1], but after
% inversion of the device's gamma measurements.
%
% 5/26/12 dhb Wrote it.
% Check dimensions and table sizes
[m,n] = size(gamut);
ng = size(gammaTable,2);
if (m > ng)
error('Mismatch between device coordinate dimensions and gamma table');
end
% Use a search routine to find the best gamma function
settings = zeros(m,n);
for i = 1:m
for j = 1:n
[~,index] = min(abs(gammaTable(:,i)-gamut(i,j)));
settings(i,j) = gammaInput(index);
end
end
|