From 684a5dc5e72a7d9094284deda14db5d1e5788cac Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 2 Nov 2015 00:36:57 +0100 Subject: [PATCH] Change order of Retinex and Colour Propagation --- rtengine/improccoordinator.cc | 31 +++++++++++++++++-------------- rtengine/simpleprocess.cc | 5 ++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 23904ba1b..4f40b855a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -242,20 +242,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (params.retinex.enabled) { - bool dehacontlutili = false; - bool useHsl = false; - LUTf cdcurve (65536, 0); - - imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, lhist16RETI, histLRETI); - float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, params.toneCurve, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI);//enabled Retinex - - if(dehaListener) { - dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); - } - } - // Updating toneCurve.hrenabled if necessary // It has to be done there, because the next 'if' statement will use the value computed here @@ -275,7 +261,24 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) MyMutex::MyLock initLock(minit); // Also used in crop window imgsrc->HLRecovery_Global( params.toneCurve); // this handles Color HLRecovery + } + if (params.retinex.enabled) { + bool dehacontlutili = false; + bool useHsl = false; + LUTf cdcurve (65536, 0); + + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, lhist16RETI, histLRETI); + float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; + imgsrc->retinex( params.icm, params.retinex, params.toneCurve, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI);//enabled Retinex + + if(dehaListener) { + dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + } + } + + if (todo & (M_INIT | M_LINDENOISE)) { + MyMutex::MyLock initLock(minit); // Also used in crop window if (settings->verbose) { printf ("Applying white balance, color correction & sRBG conversion...\n"); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 91b7df178..e0b470274 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -116,6 +116,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p pl->setProgress (0.30); } + imgsrc->HLRecovery_Global( params.toneCurve ); + if(params.retinex.enabled) { //enabled Retinex LUTf cdcurve (65536, 0); LUTu dummy; @@ -134,9 +136,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p pl->setProgress (0.40); } - imgsrc->HLRecovery_Global( params.toneCurve ); - - if (pl) { pl->setProgress (0.45); }