False color suppression with blown highlights problem

see issue 752
This commit is contained in:
Oliver Duis 2011-06-19 09:22:29 +02:00
parent 48a0b7962b
commit ee20b2a4db
3 changed files with 14 additions and 16 deletions

View File

@ -417,7 +417,7 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
// Color correction (only when running on full resolution)
if (ri->isBayer() && pp.skip==1)
correction_YIQ_LQ (image, raw.ccSteps);
processFalseColorCorrection (image, raw.ccSteps);
// Applying postmul
colorSpaceConversion (image, cmp, embProfile, camProfile, xyz_cam, defGain);
@ -1403,7 +1403,8 @@ int RawImageSource::defTransform (int tran) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void RawImageSource::correction_YIQ_LQ_ (Imagefloat* im, int row_from, int row_to) {
// Thread called part
void RawImageSource::processFalseColorCorrectionThread (Imagefloat* im, int row_from, int row_to) {
int W = im->width;
@ -1532,13 +1533,13 @@ void RawImageSource::correction_YIQ_LQ_ (Imagefloat* im, int row_from, int row_
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void RawImageSource::correction_YIQ_LQ (Imagefloat* im, int times) {
// correction_YIQ_LQ
void RawImageSource::processFalseColorCorrection (Imagefloat* im, int steps) {
if (im->height<4)
return;
for (int t=0; t<times; t++) {
for (int t=0; t<steps; t++) {
#ifdef _OPENMP
#pragma omp parallel
{
@ -1547,12 +1548,12 @@ void RawImageSource::correction_YIQ_LQ (Imagefloat* im, int times) {
int blk = (im->height-2)/nthreads;
if (tid<nthreads-1)
correction_YIQ_LQ_ (im, 1 + tid*blk, 1 + (tid+1)*blk);
processFalseColorCorrectionThread (im, 1 + tid*blk, 1 + (tid+1)*blk);
else
correction_YIQ_LQ_ (im, 1 + tid*blk, im->height - 1);
processFalseColorCorrectionThread (im, 1 + tid*blk, im->height - 1);
}
#else
correction_YIQ_LQ_ (im, 1 , im->height - 1);
processFalseColorCorrectionThread (im, 1 , im->height - 1);
#endif
}
}

View File

@ -106,7 +106,7 @@ class RawImageSource : public ImageSource {
void hphd_vertical (float** hpmap, int col_from, int col_to);
void hphd_horizontal (float** hpmap, int row_from, int row_to);
void hphd_green (float** hpmap);
void correction_YIQ_LQ_ (Imagefloat* im, int row_from, int row_to);
void processFalseColorCorrectionThread (Imagefloat* im, int row_from, int row_to);
void hlRecovery (std::string method, float* red, float* green, float* blue, int i, int sx1, int width, int skip, const RAWParams &raw);
int defTransform (int tran);
void rotateLine (float* line, float** channel, int tran, int i, int w, int h);
@ -157,7 +157,7 @@ class RawImageSource : public ImageSource {
protected:
typedef unsigned short ushort;
void correction_YIQ_LQ (Imagefloat* i, int times);
void processFalseColorCorrection (Imagefloat* i, int steps);
inline void convert_row_to_YIQ (float* r, float* g, float* b, float* Y, float* I, float* Q, int W);
inline void convert_row_to_RGB (float* r, float* g, float* b, float* Y, float* I, float* Q, int W);

View File

@ -42,12 +42,9 @@ inline void RawImageSource::convert_row_to_YIQ (float* r, float* g, float* b, fl
inline void RawImageSource::convert_row_to_RGB (float* r, float* g, float* b, float* Y, float* I, float* Q, int W) {
for (int j=1; j<W-1; j++) {
int ir = Y[j] + 0.956*I[j] + 0.621*Q[j];
int ig = Y[j] - 0.272*I[j] - 0.647*Q[j];
int ib = Y[j] - 1.105*I[j] + 1.702*Q[j];
r[j] = CLIP(ir);
g[j] = CLIP(ig);
b[j] = CLIP(ib);
r[j] = Y[j] + 0.956*I[j] + 0.621*Q[j];
g[j] = Y[j] - 0.272*I[j] - 0.647*Q[j];
b[j] = Y[j] - 1.105*I[j] + 1.702*Q[j];
}
}