Issue 2803: adjusted clipping behavior of raw image

This commit is contained in:
torger 2015-07-09 21:55:37 +02:00
parent d155a9a086
commit 0f0e46c560

View File

@ -347,9 +347,16 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
btot*=bm; btot*=bm;
if (!hrp.hrenabled && (rtot > hlmax[0] || gtot > hlmax[1] || btot > hlmax[2])) if (!hrp.hrenabled && (rtot > hlmax[0] || gtot > hlmax[1] || btot > hlmax[2]))
{ {
rtot=CLIP(rtot); // make a sort of luminance recovery. Note that as we don't desaturate
gtot=CLIP(gtot); // surrounding unclipped highlights the transition into clipping may not
btot=CLIP(btot); // be smooth, meaning that stuff like RGB-HSV desaturation will look bad.
// We accept this drawback though, those that really need highlight reconstruction
// should enable that.
float L = rtot*0.2126729f + gtot*0.7151521f + btot*0.0721750f;
rtot = gtot = btot = L;
//rtot=CLIP(rtot);
//gtot=CLIP(gtot);
//btot=CLIP(btot);
} }
line_red[j] = rtot; line_red[j] = rtot;
line_grn[j] = gtot; line_grn[j] = gtot;
@ -371,9 +378,11 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
btot*=bm; btot*=bm;
if (!hrp.hrenabled && (rtot > hlmax[0] || gtot > hlmax[1] || btot > hlmax[2])) if (!hrp.hrenabled && (rtot > hlmax[0] || gtot > hlmax[1] || btot > hlmax[2]))
{ {
rtot=CLIP(rtot); float L = rtot*0.2126729f + gtot*0.7151521f + btot*0.0721750f;
gtot=CLIP(gtot); rtot = gtot = btot = L;
btot=CLIP(btot); //rtot=CLIP(rtot);
//gtot=CLIP(gtot);
//btot=CLIP(btot);
} }
line_red[j] = rtot; line_red[j] = rtot;
line_grn[j] = gtot; line_grn[j] = gtot;