Merge branch 'dev' into testoutputprofile

This commit is contained in:
Hombre
2018-07-09 22:12:08 +02:00
76 changed files with 1697 additions and 837 deletions

View File

@@ -66,7 +66,11 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4],
if (ri->isBayer()) {
const int height = ri->get_iheight();
const int width = ri->get_iwidth();
const bool isFloat = ri->isFloat();
const int top_margin = ri->get_topmargin();
const int left_margin = ri->get_leftmargin();
const int raw_width = ri->get_rawwidth();
const float * const float_raw_image = ri->get_FloatRawImage();
#ifdef _OPENMP
#pragma omp parallel for if(multiThread)
#endif
@@ -76,8 +80,15 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4],
int col = 0;
for (; col < width - 1; col += 2) {
float val0 = image[row * width + col][c0];
float val1 = image[row * width + col + 1][c1];
float val0;
float val1;
if (isFloat) {
val0 = float_raw_image[(row + top_margin) * raw_width + col + left_margin];
val1 = float_raw_image[(row + top_margin) * raw_width + col + left_margin + 1];
} else {
val0 = image[row * width + col][c0];
val1 = image[row * width + col + 1][c1];
}
val0 -= cblack[c0];
val1 -= cblack[c1];
val0 *= scale_mul[c0];
@@ -87,7 +98,12 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4],
}
if (col < width) { // in case width is odd
float val0 = image[row * width + col][c0];
float val0;
if (isFloat) {
val0 = float_raw_image[(row + top_margin) * raw_width + col + left_margin];
} else {
val0 = image[row * width + col][c0];
}
val0 -= cblack[c0];
val0 *= scale_mul[c0];
image[row * width + col][c0] = rtengine::CLIP (val0);
@@ -96,6 +112,11 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4],
} else if (ri->isXtrans()) {
const int height = ri->get_iheight();
const int width = ri->get_iwidth();
const bool isFloat = ri->isFloat();
const int top_margin = ri->get_topmargin();
const int left_margin = ri->get_leftmargin();
const int raw_width = ri->get_rawwidth();
const float * const float_raw_image = ri->get_FloatRawImage();
#ifdef _OPENMP
#pragma omp parallel for if(multiThread)
@@ -111,7 +132,12 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4],
for (; col < width - 5; col += 6) {
for (int i = 0; i < 6; ++i) {
const unsigned ccol = c[i];
float val = image[row * width + col + i][ccol];
float val;
if (isFloat) {
val = float_raw_image[(row + top_margin) * raw_width + col + i + left_margin];
} else {
val = image[row * width + col + i][ccol];
}
val -= cblack[ccol];
val *= scale_mul[ccol];
image[row * width + col + i][ccol] = rtengine::CLIP (val);
@@ -120,7 +146,12 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4],
for (; col < width; ++col) { // remaining columns
const unsigned ccol = ri->XTRANSFC (row, col);
float val = image[row * width + col][ccol];
float val;
if (isFloat) {
val = float_raw_image[(row + top_margin) * raw_width + col + left_margin];
} else {
val = image[row * width + col][ccol];
}
val -= cblack[ccol];
val *= scale_mul[ccol];
image[row * width + col][ccol] = rtengine::CLIP (val);