Fix wrong thumbnails for Canon G3 and G5, fixes #4000, fixes #4099

This commit is contained in:
heckflosse 2017-09-23 16:20:50 +02:00
parent 99b817e821
commit 18f09dcbee
2 changed files with 10 additions and 5 deletions

View File

@ -112,7 +112,10 @@ void RawImage::get_colorsCoeff( float *pre_mul_, float *scale_mul_, float *cblac
}
}
if (data && (this->get_cam_mul(0) == -1 || forceAutoWB)) {
if (this->get_cam_mul(0) == -1 || forceAutoWB) {
if(!data) { // this happens only for thumbnail creation when get_cam_mul(0) == -1
compress_image(0, false);
}
memset(dsum, 0, sizeof dsum);
if (this->isBayer()) {
@ -673,7 +676,7 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro
return 0;
}
float** RawImage::compress_image(int frameNum)
float** RawImage::compress_image(int frameNum, bool freeImage)
{
if( !image ) {
return nullptr;
@ -757,8 +760,10 @@ float** RawImage::compress_image(int frameNum)
}
}
if(freeImage) {
free(image); // we don't need this anymore
image = nullptr;
}
return data;
}

View File

@ -121,7 +121,7 @@ public:
{
return image;
}
float** compress_image(int frameNum); // revert to compressed pixels format and release image data
float** compress_image(int frameNum, bool freeImage = true); // revert to compressed pixels format and release image data
float** data; // holds pixel values, data[i][j] corresponds to the ith row and jth column
unsigned prefilters; // original filters saved ( used for 4 color processing )
unsigned int getFrameCount() const { return is_raw; }