/usr/share/psychtoolbox-3/PsychCal/DropCalBits.m is in psychtoolbox-3-common 3.0.11.20140816.dfsg1-1.
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 35 36 37 38 39 40 | function cal = DropCalBits(cal,whichScreen,forceBits)
% cal = DropCalBits(cal,whichScreen,[forceBit])
%
% Drops the bitdepth of a calibration file if
% necessary. Useful for running programs
% transparently on 8 and 10 bit hardware.
%
% If arg forceBits is passed, it is used as
% the current hardware depth. Otherwise the
% reported DACBits of whichScreen is used.
%
% This code assumes calibration was done at
% equally spaced levels in RGB settings, as is
% the case with our calibration routines. May
% not generalize, and I haven't worried about
% the roundoff errors. Certainly OK for basic
% use.
%
% 2/13/05 dhb Wrote it.
% Get hardware dac level. Note that the application
% code should use LoadClut, not SetClut, to access
% full bit depth.
if (nargin > 2 && ~isempty(forceBits))
hardwareBits = forceBits;
else
hardwareBits = Screen(whichScreen,'Preference','DACBits');
end
% Force calibration down to 8 bits, which is how we plan to use it.
% Simply refit raw data at correct number of input levels.
if (cal.describe.dacsize > hardwareBits)
cal.describe.dacsize = hardwareBits;
nInputLevels = 2^cal.describe.dacsize;
cal.rawdata.rawGammaInput = round(linspace(nInputLevels/cal.describe.nMeas,nInputLevels-1,cal.describe.nMeas))';
cal = CalibrateFitGamma(cal);
elseif (cal.describe.dacsize < hardwareBits)
error('Current hardware has greater bit depth than at calibration.');
end
|