Fix bug in Lab adjustements - chromaticity negatives values see #issue1514

This commit is contained in:
jdc 2012-08-27 17:52:30 +02:00
parent 6eb08e8c7e
commit 2fba6057a5

View File

@ -607,16 +607,13 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
deltaHH=protect_redh;//transition hue deltaHH=protect_redh;//transition hue
float chromapro = (chromaticity + 100.0f)/100.0f; float chromapro = (chromaticity + 100.0f)/100.0f;
if(chromapro>1.0) Color::scalered ( rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext);//1.0 if(chromapro>0.0) Color::scalered ( rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext);//1.0
else Color::scalered ( 100.0-rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext);
if(chromapro>1.0) {interm=(chromapro-1.0f)*100.0f; if(chromapro>1.0) {interm=(chromapro-1.0f)*100.0f;
factorskin= 1.0f+(interm*scale)/100.0f; factorskin= 1.0f+(interm*scale)/100.0f;
factorskinext=1.0f+(interm*scaleext)/100.0f;} factorskinext=1.0f+(interm*scaleext)/100.0f;}
else { else {
interm=(1.0f-chromapro)*100.0f; factorskin= chromapro*scale;
factorskin= 1.0f-(interm*scale)/100.0f; factorskinext= chromapro*scaleext;
factorskinext=1.0f-(interm*scaleext)/100.0f;
} }
factorsat=chromapro; factorsat=chromapro;
factor=factorsat; factor=factorsat;
@ -646,8 +643,7 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
if(protect_redhcur>1.0f) protect_redhcur=1.0f;//avoid too big values if(protect_redhcur>1.0f) protect_redhcur=1.0f;//avoid too big values
deltaHH=protect_redhcur;//transition hue deltaHH=protect_redhcur;//transition hue
if(chromaCfactor>1.0) Color::scalered ( rstprotection, chromaCfactor, 0.0, HH, deltaHH, scale, scaleext);//1.0 if(chromaCfactor>0.0) Color::scalered ( rstprotection, chromaCfactor, 0.0, HH, deltaHH, scale, scaleext);//1.0
else Color::scalered ( 100.0-rstprotection, chromaCfactor, 0.0, HH, deltaHH, scale, scaleext);
if(chromaCfactor>1.0) { if(chromaCfactor>1.0) {
interm=(chromaCfactor-1.0f)*100.0f; //else interm=(1.0f-chromaCfactor)*100.0f; interm=(chromaCfactor-1.0f)*100.0f; //else interm=(1.0f-chromaCfactor)*100.0f;
@ -655,9 +651,8 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
factorskinext=1.0f+(interm*scaleext)/100.0f; factorskinext=1.0f+(interm*scaleext)/100.0f;
} }
else { else {
interm=(1.0f-chromaCfactor)*100.0f; factorskin= chromaCfactor*scale;
factorskin= 1.0f-(interm*scale)/100.0f; factorskinext=chromaCfactor*scaleext;
factorskinext=1.0f-(interm*scaleext)/100.0f;
} }
factorsat=chromaCfactor; factorsat=chromaCfactor;