Cleaned up RAW white point simulation in thumbs
This commit is contained in:
@@ -37,7 +37,7 @@ void RawImageSource::processRawWhitepoint(float expos, float preser) {
|
|||||||
int width=W, height=H;
|
int width=W, height=H;
|
||||||
|
|
||||||
// exposure correction inspired from G.Luijk
|
// exposure correction inspired from G.Luijk
|
||||||
if (preser==0.0) {
|
if (fabs(preser)<0.001) {
|
||||||
// No highlight protection - simple mutiplication
|
// No highlight protection - simple mutiplication
|
||||||
#pragma omp parallel for shared(expos)
|
#pragma omp parallel for shared(expos)
|
||||||
for (int row=0;row<height;row++)
|
for (int row=0;row<height;row++)
|
||||||
|
@@ -609,6 +609,15 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
|||||||
gmi = 1024.0 * gm / mul_lum;
|
gmi = 1024.0 * gm / mul_lum;
|
||||||
bmi = 1024.0 * bm / mul_lum;
|
bmi = 1024.0 * bm / mul_lum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The RAW exposure is not reflected since it's done in preprocessing. If we only have e.g. the chached thumb,
|
||||||
|
// that is already preprocessed. So we simulate the effect here roughly my modifying the exposure accordingly
|
||||||
|
if (isRaw && fabs(1.0-params.raw.expos)>0.001) {
|
||||||
|
rmi*=params.raw.expos;
|
||||||
|
gmi*=params.raw.expos;
|
||||||
|
bmi*=params.raw.expos;
|
||||||
|
}
|
||||||
|
|
||||||
// resize to requested width and perform coarse transformation
|
// resize to requested width and perform coarse transformation
|
||||||
int rwidth;
|
int rwidth;
|
||||||
if (params.coarse.rotate==90 || params.coarse.rotate==270) {
|
if (params.coarse.rotate==90 || params.coarse.rotate==270) {
|
||||||
@@ -619,9 +628,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
|||||||
rwidth = thumbImg->width * rheight / thumbImg->height;
|
rwidth = thumbImg->width * rheight / thumbImg->height;
|
||||||
|
|
||||||
Image16* resImg = thumbImg->resize (rwidth, rheight, interp);
|
Image16* resImg = thumbImg->resize (rwidth, rheight, interp);
|
||||||
//Imagefloat* baseImg = resImg->tofloat();
|
|
||||||
//Image16* baseImg = thumbImg->resize (rwidth, rheight, interp);
|
|
||||||
|
|
||||||
|
|
||||||
if (params.coarse.rotate) {
|
if (params.coarse.rotate) {
|
||||||
Image16* tmp = resImg->rotate (params.coarse.rotate);
|
Image16* tmp = resImg->rotate (params.coarse.rotate);
|
||||||
@@ -629,21 +635,18 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
|||||||
rheight = tmp->height;
|
rheight = tmp->height;
|
||||||
delete resImg;
|
delete resImg;
|
||||||
resImg = tmp;
|
resImg = tmp;
|
||||||
//delete tmp;
|
|
||||||
}
|
}
|
||||||
if (params.coarse.hflip) {
|
if (params.coarse.hflip) {
|
||||||
Image16* tmp = resImg->hflip ();
|
Image16* tmp = resImg->hflip ();
|
||||||
delete resImg;
|
delete resImg;
|
||||||
resImg = tmp;
|
resImg = tmp;
|
||||||
//delete tmp;
|
|
||||||
}
|
}
|
||||||
if (params.coarse.vflip) {
|
if (params.coarse.vflip) {
|
||||||
Image16* tmp = resImg->vflip ();
|
Image16* tmp = resImg->vflip ();
|
||||||
delete resImg;
|
delete resImg;
|
||||||
resImg = tmp;
|
resImg = tmp;
|
||||||
//delete tmp;
|
|
||||||
}
|
}
|
||||||
// apply white balance
|
// apply white balance and raw white point (simulated)
|
||||||
int val;
|
int val;
|
||||||
for (int i=0; i<rheight; i++)
|
for (int i=0; i<rheight; i++)
|
||||||
for (int j=0; j<rwidth; j++) {
|
for (int j=0; j<rwidth; j++) {
|
||||||
@@ -712,10 +715,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
|||||||
if (params.toneCurve.autoexp && aeHistogram)
|
if (params.toneCurve.autoexp && aeHistogram)
|
||||||
ipf.getAutoExp (aeHistogram, aeHistCompression, logDefGain, params.toneCurve.clip, br, bl);
|
ipf.getAutoExp (aeHistogram, aeHistCompression, logDefGain, params.toneCurve.clip, br, bl);
|
||||||
|
|
||||||
// The RAW exposure is not reflected since it's done in preprocessing. If we only have e.g. the chached thumb,
|
|
||||||
// that is already preprocessed. So we simulate the effect here roughly my modifying the exposure accordingly
|
|
||||||
if (params.raw.expos!=1) br += (params.raw.expos-1.0);
|
|
||||||
|
|
||||||
LUTf curve1 (65536);
|
LUTf curve1 (65536);
|
||||||
LUTf curve2 (65536);
|
LUTf curve2 (65536);
|
||||||
LUTf curve (65536);
|
LUTf curve (65536);
|
||||||
|
Reference in New Issue
Block a user