From 6dfe6f95b88f896b2ade67033ae84282f245b2a6 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 6 Apr 2017 09:00:53 +0200 Subject: [PATCH] Fix wrong computation of black levels (in some cases) in RawImage::get_colorsCoeff Was happening e.g. with compressed DNG files --- rtengine/rawimage.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 9bf0588a4..19fcb6c16 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -98,7 +98,10 @@ void RawImage::get_colorsCoeff( float *pre_mul_, float *scale_mul_, float *cblac } } else if ((this->get_cblack(4) + 1) / 2 == 1 && (this->get_cblack(5) + 1) / 2 == 1) { for (int c = 0; c < 4; c++) { - cblack_[FC(c / 2, c % 2)] = this->get_cblack(6 + c / 2 % this->get_cblack(4) * this->get_cblack(5) + c % 2 % this->get_cblack(5)); + cblack_[c] = this->get_cblack(c); + } + for (int c = 0; c < 4; c++) { + cblack_[FC(c / 2, c % 2)] += this->get_cblack(6 + c / 2 % this->get_cblack(4) * this->get_cblack(5) + c % 2 % this->get_cblack(5)); pre_mul_[c] = this->get_pre_mul(c); } } else {