[Jdlraw-discussion] jdlRaw/Sources jdlDcRaw.cpp, 1.18, 1.19 jdlExposure.cpp, 1.2, 1.3 jdlTool_RGB_E
Status: Beta
Brought to you by:
jdla
|
From: Jos De L. <jd...@us...> - 2010-05-26 19:08:54
|
Update of /cvsroot/jdlraw/jdlRaw/Sources In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv27710/Sources Modified Files: jdlDcRaw.cpp jdlExposure.cpp jdlTool_RGB_Exposure.cpp jdlTool_RGB_Exposure.i Log Message: *) Changed the RGB exposure function (film curve) such that one can define now till what level it is linear before falling of. This showed useful in some photographs with much hightones that become otherwise dull by simple filmcurve application. Now this can be resolved by using clipping modes or a filmcurve starting for instance at 90%. Index: jdlTool_RGB_Exposure.cpp =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlTool_RGB_Exposure.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** jdlTool_RGB_Exposure.cpp 13 Apr 2010 19:49:11 -0000 1.16 --- jdlTool_RGB_Exposure.cpp 26 May 2010 19:08:46 -0000 1.17 *************** *** 195,198 **** --- 195,201 ---- jdlRaw->m_Settings->GetDouble(QString("RGB_Exposure")+Instance); + double RelativeL = + jdlRaw->m_Settings->GetDouble(QString("RGB_ExposureRelativeL")+Instance); + switch (ExposureMode) { case jdlExposureMode_Manual : *************** *** 268,272 **** m_ExposureCurve->SetCurveFromFunction(ExposureFunction, ExposureFactor, ! 0); WorkImage->ToRGB(WorkColor); WorkImage->ApplyCurve(m_ExposureCurve,7); --- 271,275 ---- m_ExposureCurve->SetCurveFromFunction(ExposureFunction, ExposureFactor, ! RelativeL/ExposureFactor); WorkImage->ToRGB(WorkColor); WorkImage->ApplyCurve(m_ExposureCurve,7); *************** *** 364,367 **** --- 367,376 ---- VLayout->addWidget(ExposureClipModeWidget); + QWidget* RelativeLWidget = new QWidget(m_ToolWidget); + RelativeLWidget->setObjectName( + QString("RGB_ExposureRelativeL_%1Widget").arg(m_Instance)); + + VLayout->addWidget(RelativeLWidget); + QWidget* WhiteFractionWidget = new QWidget(m_ToolWidget); WhiteFractionWidget->setObjectName( *************** *** 452,455 **** --- 461,470 ---- emit(RequestInput(jdlRequestMode_IfNeeded)); } else if (Sender->objectName() == + QString("RGB_ExposureRelativeL")+Instance) { + short ExposureClipMode = jdlRaw->m_Settings->GetInt(QString("RGB_ExposureClipMode")+Instance); + if (ExposureClipMode == jdlExposureClipMode_Curve) { + emit(RequestInput(jdlRequestMode_IfNeeded)); + } + } else if (Sender->objectName() == QString("RGB_ExposureClipMode")+Instance) { emit(RequestInput(jdlRequestMode_IfNeeded)); Index: jdlTool_RGB_Exposure.i =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlTool_RGB_Exposure.i,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** jdlTool_RGB_Exposure.i 27 Feb 2010 19:02:42 -0000 1.3 --- jdlTool_RGB_Exposure.i 26 May 2010 19:08:46 -0000 1.4 *************** *** 58,61 **** --- 58,75 ---- {"RGB_Exposure", + "RGB_ExposureRelativeL", + jdlGT_InputSlider, + 2, + 1, + 1, + 0.0, + 0.0, + 0.99, + 0.01, + 2, + _("FilmCurve Linearity"), + _("Till where filmcurve is linear (L/E,L)")}, + + {"RGB_Exposure", "RGB_ExposureWhiteFraction", jdlGT_InputSlider, Index: jdlDcRaw.cpp =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlDcRaw.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** jdlDcRaw.cpp 2 May 2010 10:14:02 -0000 1.18 --- jdlDcRaw.cpp 26 May 2010 19:08:46 -0000 1.19 *************** *** 3681,3684 **** --- 3681,3691 ---- } + if (m_UserSetting_CameraWb) { + TRACEKEYVALS("CamMult[0]","%f",VALUE(m_CameraMultipliers[0])); + TRACEKEYVALS("CamMult[1]","%f",VALUE(m_CameraMultipliers[1])); + TRACEKEYVALS("CamMult[2]","%f",VALUE(m_CameraMultipliers[2])); + TRACEKEYVALS("CamMult[3]","%f",VALUE(m_CameraMultipliers[3])); + } + if (m_UserSetting_CameraWb && VALUE(m_CameraMultipliers[0]) != -1) { memset (sum, 0, sizeof sum); *************** *** 4769,4774 **** homo = (char (*)[TS][TS]) (buffer + 24*TS*TS); ! const int chunk = m_Height/16; // XXX JDLA extension ! #pragma omp for schedule(dynamic,chunk) for (top=2; top < m_Height-5; top += TS-6) { --- 4776,4780 ---- homo = (char (*)[TS][TS]) (buffer + 24*TS*TS); ! #pragma omp for schedule(dynamic,m_Height/16) for (top=2; top < m_Height-5; top += TS-6) { Index: jdlExposure.cpp =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlExposure.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** jdlExposure.cpp 27 Feb 2010 19:02:42 -0000 1.2 --- jdlExposure.cpp 26 May 2010 19:08:46 -0000 1.3 *************** *** 26,50 **** #include <assert.h> #include <math.h> double Alpha; double ExposureForWhichAlphaIsCalculated = -1; - //////////////////////////////////////////////////////////////////////////////// // // FindAlpha (helper for ExposureFunction) - // such that f(x)=(1-exp(-Alpha*x)/(1-exp(-Alpha)) - // f(x) is then foto curve for which : - // f(0) = 0 - // f(1) = 1 - // f'(0)= Exposure // ! //////////////////////////////////////////////////////////////////////////////// ! double FindAlpha(double Exposure) { assert(Exposure > 1.0); double Alpha; ! double fDerivedAt0; if (Exposure<2) { Alpha=(Exposure-1)/2; --- 26,62 ---- #include <assert.h> #include <math.h> + #include <jdlDefines.h> double Alpha; double ExposureForWhichAlphaIsCalculated = -1; + double LForWhichAlphaIsCalculated = -1; + + // + // General + // + // The here used 'exposure function' is existing of + // an exponentional end on a linear beginning. + // + // E*r for r < L + // + // A+B*exp(-Alpha*(r-L)/(1-L)) for r > L + // with A = (1-L*E*exp(-Alpha))/(1-exp(-Alpha)) + // and B = ((L*E-1)/(1-exp(-Alpha)) + // (this makes the exposurefunction E*r at L, and 1 at 1 , thus continous) + // Alpha is chosen such that f'(r=L) = E (so also continous first derivative) + // Therefore Alpha is solution of Alpha/((1-L)*(1-exp(-Alpha)) = E + // // // FindAlpha (helper for ExposureFunction) // ! ////////////////////////////////////////////////////////////////////////////// ! double FindAlpha(double Exposure,double L) { assert(Exposure > 1.0); double Alpha; ! double fDerivedAtL; if (Exposure<2) { Alpha=(Exposure-1)/2; *************** *** 52,59 **** Alpha=Exposure; } ! fDerivedAt0 = Alpha/(1-exp(-Alpha)); ! while (fabs(fDerivedAt0-Exposure)>0.001) { ! Alpha = Alpha + (Exposure-fDerivedAt0); ! fDerivedAt0 = Alpha/(1-exp(-Alpha)); } return Alpha; --- 64,71 ---- Alpha=Exposure; } ! fDerivedAtL = (Alpha/(1-L))/(1-exp(-Alpha)); ! while (fabs(fDerivedAtL-Exposure)>0.001) { ! Alpha = Alpha + (Exposure-fDerivedAtL); ! fDerivedAtL = (Alpha/(1-L))/(1-exp(-Alpha)); } return Alpha; *************** *** 67,76 **** //////////////////////////////////////////////////////////////////////////////// ! ! double ExposureFunction(double r,double Exposure,double) { ! if (Exposure != ExposureForWhichAlphaIsCalculated) { ! Alpha = FindAlpha(Exposure); } ! return (1-exp(-Alpha*r))/(1-exp(-Alpha)); } --- 79,98 ---- //////////////////////////////////////////////////////////////////////////////// ! double ExposureFunction(double r,double Exposure,double L) { ! if (Exposure != ExposureForWhichAlphaIsCalculated || ! L != LForWhichAlphaIsCalculated) { ! Alpha = FindAlpha(Exposure,L); ! ExposureForWhichAlphaIsCalculated = Exposure; ! LForWhichAlphaIsCalculated = L; } ! double Tmp; ! if (r<L) { ! Tmp = MIN(r*Exposure,1.0); // Linear part. ! } else { ! Tmp = 1-L*Exposure*exp(-Alpha); ! Tmp += (L*Exposure-1)*exp(-Alpha*(r-L)/(1-L)); ! Tmp /= 1-exp(-Alpha); ! } ! return Tmp; } |