From 18f09dcbee6dfd466022e13eb80f3882dd2076ce Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 23 Sep 2017 16:20:50 +0200 Subject: [PATCH] Fix wrong thumbnails for Canon G3 and G5, fixes #4000, fixes #4099 --- rtengine/rawimage.cc | 13 +++++++++---- rtengine/rawimage.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index f36e798d9..de392623d 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -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) } } - free(image); // we don't need this anymore - image = nullptr; + if(freeImage) { + free(image); // we don't need this anymore + image = nullptr; + } return data; } diff --git a/rtengine/rawimage.h b/rtengine/rawimage.h index c2cdcb6ec..b8a45d708 100644 --- a/rtengine/rawimage.h +++ b/rtengine/rawimage.h @@ -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; }