diff --git a/rtdata/languages/default b/rtdata/languages/default index fb024b3d5..5ec37ce8b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1874,7 +1874,8 @@ TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, bu TP_RAW_HPHD;HPHD TP_RAW_IGV;IGV TP_RAW_IMAGENUM;Sub-image -TP_RAW_IMAGENUM_TOOLTIP;Some raw files consist of several sub-images (Pentax/Sony Pixel Shift, Pentax 3-in-1 HDR, Canon Dual Pixel).\n\nWhen using any demosaicing method other than Pixel Shift, this selects which sub-image is used.\n\nWhen using the Pixel Shift demosaicing method on a Pixel Shift raw, all sub-images are used, and this selects which sub-image should be used for moving parts. +TP_RAW_IMAGENUM_SN;SN mode +TP_RAW_IMAGENUM_TOOLTIP;Some raw files consist of several sub-images (Pentax/Sony Pixel Shift, Pentax 3-in-1 HDR, Canon Dual Pixel, Fuji EXR).\n\nWhen using any demosaicing method other than Pixel Shift, this selects which sub-image is used.\n\nWhen using the Pixel Shift demosaicing method on a Pixel Shift raw, all sub-images are used, and this selects which sub-image should be used for moving parts. TP_RAW_LABEL;Demosaicing TP_RAW_LMMSE;LMMSE TP_RAW_LMMSEITERATIONS;LMMSE enhancement steps diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index f551eb0dc..79922adbd 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1793,6 +1793,19 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le copyOriginalPixels(raw, riFrames[i], rid, rif, *rawDataFrames[i]); } } + } else if (numFrames == 2 && currFrame == 2) { // average the frames + if(!rawDataBuffer[0]) { + rawDataBuffer[0] = new array2D; + } + rawDataFrames[1] = rawDataBuffer[0]; + copyOriginalPixels(raw, riFrames[1], rid, rif, *rawDataFrames[1]); + copyOriginalPixels(raw, ri, rid, rif, rawData); + + for (int i = 0; i < H; ++i) { + for (int j = 0; j < W; ++j) { + rawData[i][j] = (rawData[i][j] + (*rawDataFrames[1])[i][j]) * 0.5f; + } + } } else { copyOriginalPixels(raw, ri, rid, rif, rawData); } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index a23e9c3cb..2c83b9bd3 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -201,8 +201,13 @@ public: static void init (); static void cleanup (); void setCurrentFrame(unsigned int frameNum) override { - currFrame = std::min(numFrames - 1, frameNum); - ri = riFrames[currFrame]; + if (numFrames == 2 && frameNum == 2) { // special case for averaging of two frames + currFrame = frameNum; + ri = riFrames[0]; + } else { + currFrame = std::min(numFrames - 1, frameNum); + ri = riFrames[currFrame]; + } } int getFrameCount() override {return numFrames;} int getFlatFieldAutoClipValue() override {return flatFieldAutoClipValue;} diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index 74cf27dde..279e68bd6 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -730,7 +730,10 @@ void BayerProcess::FrameCountChanged(int n, int frameNum) entry << i; imageNumber->append(entry.str()); } - imageNumber->set_active(std::min(frameNum, n - 1)); + if (n == 2) { + imageNumber->append(M("TP_RAW_IMAGENUM_SN")); + } + imageNumber->set_active(std::min(frameNum, n == 2 ? n : n - 1)); if (n == 1) { imageNumberBox->hide(); } else {