RawTherapee
RawTherapee copied to clipboard
Fix regression with demosaiced DNGs caused by 831a9bbd
Demosaiced DNGs (aka LinearRAW PhotometricInterpretation) have 3 samples per pixel, so rawData.getWidth() returns triple the width Only throw an assert if getWidth is not a multiple of W. This new implementation assumes that getWidth() will never be zero when getHeight() is nonzero
Fixes #6996
It's probably best to refactor these checks (including the first if-statement in getRawValues
) to use a function that checks the validity of the dimensions.
bool checkRawDataDimensions(const array2D<float> &rawData, const RawImage &rawImage, int width, int height)
{
const int colors = (rawImage.getSensorType() == ST_BAYER ||
rawImage.getSensorType() == ST_FUJI_XTRANS ||
rawImage.get_colors() == 1)
? 1
: 3;
return rawData.getHeight() == height && rawData.getWidth() == colors * width;
}
Great! Thanks for the suggestions including where to get the equivalent of SamplesPerPixel. I've had a few too many Tasty Beverages for tonight, I'll work on this refactor tomorrow.