False color suppression with blown highlights problem
see issue 752
This commit is contained in:
parent
48a0b7962b
commit
ee20b2a4db
@ -417,7 +417,7 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
|
|||||||
|
|
||||||
// Color correction (only when running on full resolution)
|
// Color correction (only when running on full resolution)
|
||||||
if (ri->isBayer() && pp.skip==1)
|
if (ri->isBayer() && pp.skip==1)
|
||||||
correction_YIQ_LQ (image, raw.ccSteps);
|
processFalseColorCorrection (image, raw.ccSteps);
|
||||||
|
|
||||||
// Applying postmul
|
// Applying postmul
|
||||||
colorSpaceConversion (image, cmp, embProfile, camProfile, xyz_cam, defGain);
|
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;
|
int W = im->width;
|
||||||
|
|
||||||
@ -1532,13 +1533,13 @@ void RawImageSource::correction_YIQ_LQ_ (Imagefloat* im, int row_from, int row_
|
|||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
// correction_YIQ_LQ
|
||||||
void RawImageSource::correction_YIQ_LQ (Imagefloat* im, int times) {
|
void RawImageSource::processFalseColorCorrection (Imagefloat* im, int steps) {
|
||||||
|
|
||||||
if (im->height<4)
|
if (im->height<4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int t=0; t<times; t++) {
|
for (int t=0; t<steps; t++) {
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
{
|
{
|
||||||
@ -1547,12 +1548,12 @@ void RawImageSource::correction_YIQ_LQ (Imagefloat* im, int times) {
|
|||||||
int blk = (im->height-2)/nthreads;
|
int blk = (im->height-2)/nthreads;
|
||||||
|
|
||||||
if (tid<nthreads-1)
|
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
|
else
|
||||||
correction_YIQ_LQ_ (im, 1 + tid*blk, im->height - 1);
|
processFalseColorCorrectionThread (im, 1 + tid*blk, im->height - 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
correction_YIQ_LQ_ (im, 1 , im->height - 1);
|
processFalseColorCorrectionThread (im, 1 , im->height - 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class RawImageSource : public ImageSource {
|
|||||||
void hphd_vertical (float** hpmap, int col_from, int col_to);
|
void hphd_vertical (float** hpmap, int col_from, int col_to);
|
||||||
void hphd_horizontal (float** hpmap, int row_from, int row_to);
|
void hphd_horizontal (float** hpmap, int row_from, int row_to);
|
||||||
void hphd_green (float** hpmap);
|
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);
|
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);
|
int defTransform (int tran);
|
||||||
void rotateLine (float* line, float** channel, int tran, int i, int w, int h);
|
void rotateLine (float* line, float** channel, int tran, int i, int w, int h);
|
||||||
@ -157,7 +157,7 @@ class RawImageSource : public ImageSource {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef unsigned short ushort;
|
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_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);
|
inline void convert_row_to_RGB (float* r, float* g, float* b, float* Y, float* I, float* Q, int W);
|
||||||
|
|
||||||
|
@ -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) {
|
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++) {
|
for (int j=1; j<W-1; j++) {
|
||||||
int ir = Y[j] + 0.956*I[j] + 0.621*Q[j];
|
r[j] = Y[j] + 0.956*I[j] + 0.621*Q[j];
|
||||||
int ig = Y[j] - 0.272*I[j] - 0.647*Q[j];
|
g[j] = Y[j] - 0.272*I[j] - 0.647*Q[j];
|
||||||
int ib = Y[j] - 1.105*I[j] + 1.702*Q[j];
|
b[j] = Y[j] - 1.105*I[j] + 1.702*Q[j];
|
||||||
r[j] = CLIP(ir);
|
|
||||||
g[j] = CLIP(ig);
|
|
||||||
b[j] = CLIP(ib);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user