More double promote fixes
This commit is contained in:
parent
2c831a11a7
commit
f0b5ca02e7
@ -85,7 +85,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ImageSource () : references (1), redAWBMul(-1.), greenAWBMul(-1.), blueAWBMul(-1.),
|
ImageSource () : references (1), redAWBMul(-1.), greenAWBMul(-1.), blueAWBMul(-1.),
|
||||||
embProfile(nullptr), idata(nullptr), dirpyrdenoiseExpComp(INFINITY) {}
|
embProfile(nullptr), idata(nullptr), dirpyrdenoiseExpComp(RT_INFINITY) {}
|
||||||
|
|
||||||
~ImageSource () override {}
|
~ImageSource () override {}
|
||||||
virtual int load (const Glib::ustring &fname) = 0;
|
virtual int load (const Glib::ustring &fname) = 0;
|
||||||
|
@ -897,10 +897,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
|
|||||||
//init for edge and denoise
|
//init for edge and denoise
|
||||||
float vari[4];
|
float vari[4];
|
||||||
|
|
||||||
vari[0] = 8.f * SQR((cp.lev0n / 125.0) * (1.0 + cp.lev0n / 25.0));
|
vari[0] = 8.f * SQR((cp.lev0n / 125.f) * (1.f + cp.lev0n / 25.f));
|
||||||
vari[1] = 8.f * SQR((cp.lev1n / 125.0) * (1.0 + cp.lev1n / 25.0));
|
vari[1] = 8.f * SQR((cp.lev1n / 125.f) * (1.f + cp.lev1n / 25.f));
|
||||||
vari[2] = 8.f * SQR((cp.lev2n / 125.0) * (1.0 + cp.lev2n / 25.0));
|
vari[2] = 8.f * SQR((cp.lev2n / 125.f) * (1.f + cp.lev2n / 25.f));
|
||||||
vari[3] = 8.f * SQR((cp.lev3n / 125.0) * (1.0 + cp.lev3n / 25.0));
|
vari[3] = 8.f * SQR((cp.lev3n / 125.f) * (1.f + cp.lev3n / 25.f));
|
||||||
|
|
||||||
if((cp.lev0n > 0.1f || cp.lev1n > 0.1f || cp.lev2n > 0.1f || cp.lev3n > 0.1f) && cp.noiseena) {
|
if((cp.lev0n > 0.1f || cp.lev1n > 0.1f || cp.lev2n > 0.1f || cp.lev3n > 0.1f) && cp.noiseena) {
|
||||||
int edge = 1;
|
int edge = 1;
|
||||||
@ -1116,7 +1116,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
|
|||||||
float Chprov1 = sqrtf(SQR(a) + SQR(b));
|
float Chprov1 = sqrtf(SQR(a) + SQR(b));
|
||||||
yBuffer[col] = (Chprov1 == 0.f) ? 1.f : a / Chprov1;
|
yBuffer[col] = (Chprov1 == 0.f) ? 1.f : a / Chprov1;
|
||||||
xBuffer[col] = (Chprov1 == 0.f) ? 0.f : b / Chprov1;
|
xBuffer[col] = (Chprov1 == 0.f) ? 0.f : b / Chprov1;
|
||||||
chprovBuffer[col] = Chprov1 / 327.68;
|
chprovBuffer[col] = Chprov1 / 327.68f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1280,7 +1280,7 @@ void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &aver
|
|||||||
|
|
||||||
for(int i = 0; i < datalen; i++) {
|
for(int i = 0; i < datalen; i++) {
|
||||||
if(DataList[i] >= thres) {
|
if(DataList[i] >= thres) {
|
||||||
averaP += DataList[i];
|
averaP += static_cast<double>(DataList[i]);
|
||||||
|
|
||||||
if(DataList[i] > lmax) {
|
if(DataList[i] > lmax) {
|
||||||
lmax = DataList[i];
|
lmax = DataList[i];
|
||||||
@ -1288,7 +1288,7 @@ void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &aver
|
|||||||
|
|
||||||
countP++;
|
countP++;
|
||||||
} else if(DataList[i] < -thres) {
|
} else if(DataList[i] < -thres) {
|
||||||
averaN += DataList[i];
|
averaN += static_cast<double>(DataList[i]);
|
||||||
|
|
||||||
if(DataList[i] < lmin) {
|
if(DataList[i] < lmin) {
|
||||||
lmin = DataList[i];
|
lmin = DataList[i];
|
||||||
@ -1334,10 +1334,10 @@ void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float aver
|
|||||||
|
|
||||||
for(int i = 0; i < datalen; i++) {
|
for(int i = 0; i < datalen; i++) {
|
||||||
if(DataList[i] >= thres) {
|
if(DataList[i] >= thres) {
|
||||||
variP += SQR(DataList[i] - averagePlus);
|
variP += static_cast<double>(SQR(DataList[i] - averagePlus));
|
||||||
countP++;
|
countP++;
|
||||||
} else if(DataList[i] <= -thres) {
|
} else if(DataList[i] <= -thres) {
|
||||||
variN += SQR(DataList[i] - averageNeg);
|
variN += static_cast<double>(SQR(DataList[i] - averageNeg));
|
||||||
countN++;
|
countN++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1613,7 +1613,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < W_L * H_L; i++) {
|
for (int i = 0; i < W_L * H_L; i++) {
|
||||||
avedbl += WavCoeffs_L0[i];
|
avedbl += static_cast<double>(WavCoeffs_L0[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
@ -1702,7 +1702,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
|
|||||||
#pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1)
|
#pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(contrast != 0.f && cp.resena && max0 > 0.0) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step
|
if(contrast != 0.f && cp.resena && max0 > 0.f) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step
|
||||||
{
|
{
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp for
|
#pragma omp for
|
||||||
@ -2011,7 +2011,7 @@ void ImProcFunctions::WaveletAandBAllAB(wavelet_decomposition &WaveletCoeffs_a,
|
|||||||
editWhatever->v(i,j) = valpar;
|
editWhatever->v(i,j) = valpar;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
float valparam = float((hhCurve->getVal(Color::huelab_to_huehsv2(hueR)) - 0.5f) * 1.7f) + hueR; //get H=f(H) 1.7 optimisation !
|
float valparam = (static_cast<float>(hhCurve->getVal(Color::huelab_to_huehsv2(hueR))) - 0.5f) * 1.7f + hueR; //get H=f(H) 1.7 optimisation !
|
||||||
float2 sincosval = xsincosf(valparam);
|
float2 sincosval = xsincosf(valparam);
|
||||||
WavCoeffs_a0[i * W_L + j] = chR * sincosval.y;
|
WavCoeffs_a0[i * W_L + j] = chR * sincosval.y;
|
||||||
WavCoeffs_b0[i * W_L + j] = chR * sincosval.x;
|
WavCoeffs_b0[i * W_L + j] = chR * sincosval.x;
|
||||||
@ -3016,9 +3016,8 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
|
|||||||
if(Chutili) {
|
if(Chutili) {
|
||||||
int i_i = i / W_L;
|
int i_i = i / W_L;
|
||||||
int j_j = i - i_i * W_L;
|
int j_j = i - i_i * W_L;
|
||||||
double lr;
|
|
||||||
float modhue2 = varhue[i_i][j_j];
|
float modhue2 = varhue[i_i][j_j];
|
||||||
float valparam = float((ChCurve->getVal(lr = Color::huelab_to_huehsv2(modhue2)) - 0.5f)); //get valparam=f(H)
|
float valparam = static_cast<float>(ChCurve->getVal(Color::huelab_to_huehsv2(modhue2))) - 0.5f; //get valparam=f(H)
|
||||||
|
|
||||||
if(valparam > 0.f) {
|
if(valparam > 0.f) {
|
||||||
scale2 = 1.f + 3.f * valparam; //arbitrary value
|
scale2 = 1.f + 3.f * valparam; //arbitrary value
|
||||||
|
@ -171,7 +171,7 @@ void RawImage::get_colorsCoeff( float *pre_mul_, float *scale_mul_, float *cblac
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int c = 0; c < 4; c++) {
|
for (int c = 0; c < 4; c++) {
|
||||||
dsumthr[c] += sum[c];
|
dsumthr[c] += static_cast<double>(sum[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_block2:
|
skip_block2:
|
||||||
@ -195,7 +195,7 @@ skip_block2:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(int c = 0; c < 4; c++) {
|
for(int c = 0; c < 4; c++) {
|
||||||
dsum[c] -= cblack_[c] * dsum[c + 4];
|
dsum[c] -= static_cast<double>(cblack_[c]) * dsum[c + 4];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(isXtrans()) {
|
} else if(isXtrans()) {
|
||||||
@ -241,7 +241,7 @@ skip_block2:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int c = 0; c < 8; c++) {
|
for (int c = 0; c < 8; c++) {
|
||||||
dsumthr[c] += sum[c];
|
dsumthr[c] += static_cast<double>(sum[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_block3:
|
skip_block3:
|
||||||
@ -365,18 +365,14 @@ skip_block:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (dmin = DBL_MAX, dmax = c = 0; c < 4; c++) {
|
for (dmin = DBL_MAX, dmax = c = 0; c < 4; c++) {
|
||||||
if (dmin > pre_mul_[c]) {
|
dmin = rtengine::min<double>(dmin, pre_mul_[c]);
|
||||||
dmin = pre_mul_[c];
|
dmax = rtengine::max<double>(dmax, pre_mul_[c]);
|
||||||
}
|
|
||||||
|
|
||||||
if (dmax < pre_mul_[c]) {
|
|
||||||
dmax = pre_mul_[c];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = 0; c < 4; c++) {
|
for (c = 0; c < 4; c++) {
|
||||||
int sat = this->get_white(c) - cblack_[c];
|
int sat = this->get_white(c) - cblack_[c];
|
||||||
scale_mul_[c] = (pre_mul_[c] /= dmax) * 65535.0 / sat;
|
pre_mul_[c] /= static_cast<float>(dmax);
|
||||||
|
scale_mul_[c] = pre_mul_[c] * 65535.f / sat;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->verbose) {
|
if (settings->verbose) {
|
||||||
@ -387,25 +383,30 @@ skip_block:
|
|||||||
asn[c] = 0;
|
asn[c] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asn[c] > dmax) {
|
if (asn[c] > static_cast<float>(dmax)) {
|
||||||
dmax = asn[c];
|
dmax = asn[c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = 0; c < 4; c++) {
|
for (c = 0; c < 4; c++) {
|
||||||
asn[c] /= dmax;
|
asn[c] /= static_cast<float>(dmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("cam_mul:[%f %f %f %f], AsShotNeutral:[%f %f %f %f]\n",
|
printf("cam_mul:[%f %f %f %f], AsShotNeutral:[%f %f %f %f]\n",
|
||||||
cam_mul[0], cam_mul[1], cam_mul[2], cam_mul[3], asn[0], asn[1], asn[2], asn[3]);
|
static_cast<double>(cam_mul[0]), static_cast<double>(cam_mul[1]),
|
||||||
|
static_cast<double>(cam_mul[2]), static_cast<double>(cam_mul[3]),
|
||||||
|
static_cast<double>(asn[0]), static_cast<double>(asn[1]), static_cast<double>(asn[2]), static_cast<double>(asn[3]));
|
||||||
printf("pre_mul:[%f %f %f %f], scale_mul:[%f %f %f %f], cblack:[%f %f %f %f]\n",
|
printf("pre_mul:[%f %f %f %f], scale_mul:[%f %f %f %f], cblack:[%f %f %f %f]\n",
|
||||||
pre_mul_[0], pre_mul_[1], pre_mul_[2], pre_mul_[3],
|
static_cast<double>(pre_mul_[0]), static_cast<double>(pre_mul_[1]),
|
||||||
scale_mul_[0], scale_mul_[1], scale_mul_[2], scale_mul_[3],
|
static_cast<double>(pre_mul_[2]), static_cast<double>(pre_mul_[3]),
|
||||||
cblack_[0], cblack_[1], cblack_[2], cblack_[3]);
|
static_cast<double>(scale_mul_[0]), static_cast<double>(scale_mul_[1]),
|
||||||
|
static_cast<double>(scale_mul_[2]), static_cast<double>(scale_mul_[3]),
|
||||||
|
static_cast<double>(cblack_[0]), static_cast<double>(cblack_[1]),
|
||||||
|
static_cast<double>(cblack_[2]), static_cast<double>(cblack_[3]));
|
||||||
printf("rgb_cam:[ [ %f %f %f], [%f %f %f], [%f %f %f] ]%s\n",
|
printf("rgb_cam:[ [ %f %f %f], [%f %f %f], [%f %f %f] ]%s\n",
|
||||||
rgb_cam[0][0], rgb_cam[1][0], rgb_cam[2][0],
|
static_cast<double>(rgb_cam[0][0]), static_cast<double>(rgb_cam[1][0]), static_cast<double>(rgb_cam[2][0]),
|
||||||
rgb_cam[0][1], rgb_cam[1][1], rgb_cam[2][1],
|
static_cast<double>(rgb_cam[0][1]), static_cast<double>(rgb_cam[1][1]), static_cast<double>(rgb_cam[2][1]),
|
||||||
rgb_cam[0][2], rgb_cam[1][2], rgb_cam[2][2],
|
static_cast<double>(rgb_cam[0][2]), static_cast<double>(rgb_cam[1][2]), static_cast<double>(rgb_cam[2][2]),
|
||||||
(!this->isBayer()) ? " (not bayer)" : "");
|
(!this->isBayer()) ? " (not bayer)" : "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
|
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "camconst.h"
|
#include "camconst.h"
|
||||||
@ -98,7 +99,7 @@ void transLineFuji (const float* const red, const float* const green, const floa
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Fuji SuperCCD rotation + coarse rotation
|
// Fuji SuperCCD rotation + coarse rotation
|
||||||
int start = ABS(fw - i);
|
int start = std::abs(fw - i);
|
||||||
int w = fw * 2 + 1;
|
int w = fw * 2 + 1;
|
||||||
int h = (imheight - fw) * 2 + 1;
|
int h = (imheight - fw) * 2 + 1;
|
||||||
int end = min(h + fw - i, w - fw + i);
|
int end = min(h + fw - i, w - fw + i);
|
||||||
@ -422,10 +423,6 @@ void transLineD1x (const float* const red, const float* const green, const float
|
|||||||
namespace rtengine
|
namespace rtengine
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ABS
|
|
||||||
|
|
||||||
#define ABS(a) ((a)<0?-(a):(a))
|
|
||||||
|
|
||||||
RawImageSource::RawImageSource ()
|
RawImageSource::RawImageSource ()
|
||||||
: ImageSource()
|
: ImageSource()
|
||||||
, W(0), H(0)
|
, W(0), H(0)
|
||||||
@ -615,7 +612,7 @@ float calculate_scale_mul(float scale_mul[4], const float pre_mul_[4], const flo
|
|||||||
{
|
{
|
||||||
if (isMono || colors == 1) {
|
if (isMono || colors == 1) {
|
||||||
for (int c = 0; c < 4; c++) {
|
for (int c = 0; c < 4; c++) {
|
||||||
scale_mul[c] = 65535.0 / (c_white[c] - c_black[c]);
|
scale_mul[c] = 65535.f / (c_white[c] - c_black[c]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float pre_mul[4];
|
float pre_mul[4];
|
||||||
@ -631,7 +628,7 @@ float calculate_scale_mul(float scale_mul[4], const float pre_mul_[4], const flo
|
|||||||
float maxpremul = max(pre_mul[0], pre_mul[1], pre_mul[2], pre_mul[3]);
|
float maxpremul = max(pre_mul[0], pre_mul[1], pre_mul[2], pre_mul[3]);
|
||||||
|
|
||||||
for (int c = 0; c < 4; c++) {
|
for (int c = 0; c < 4; c++) {
|
||||||
scale_mul[c] = (pre_mul[c] / maxpremul) * 65535.0 / (c_white[c] - c_black[c]);
|
scale_mul[c] = (pre_mul[c] / maxpremul) * 65535.f / (c_white[c] - c_black[c]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +667,7 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima
|
|||||||
|| (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO));
|
|| (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO));
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
c_white[i] = (ri->get_white(i) - cblacksom[i]) / raw.expos + cblacksom[i];
|
c_white[i] = (ri->get_white(i) - cblacksom[i]) / static_cast<float>(raw.expos) + cblacksom[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
float gain = calculate_scale_mul(new_scale_mul, new_pre_mul, c_white, cblacksom, isMono, ri->get_colors());
|
float gain = calculate_scale_mul(new_scale_mul, new_pre_mul, c_white, cblacksom, isMono, ri->get_colors());
|
||||||
@ -679,21 +676,21 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima
|
|||||||
bm = new_scale_mul[2] / scale_mul[2] * gain;
|
bm = new_scale_mul[2] / scale_mul[2] * gain;
|
||||||
//fprintf(stderr, "camera gain: %f, current wb gain: %f, diff in stops %f\n", camInitialGain, gain, log2(camInitialGain) - log2(gain));
|
//fprintf(stderr, "camera gain: %f, current wb gain: %f, diff in stops %f\n", camInitialGain, gain, log2(camInitialGain) - log2(gain));
|
||||||
} else {
|
} else {
|
||||||
// old scaling: used a fixed reference gain based on camera (as-shot) white balance
|
// // old scaling: used a fixed reference gain based on camera (as-shot) white balance
|
||||||
|
//
|
||||||
// how much we need to scale each channel to get our new white balance
|
// // how much we need to scale each channel to get our new white balance
|
||||||
rm = refwb_red / rm;
|
// rm = refwb_red / rm;
|
||||||
gm = refwb_green / gm;
|
// gm = refwb_green / gm;
|
||||||
bm = refwb_blue / bm;
|
// bm = refwb_blue / bm;
|
||||||
// normalize so larger multiplier becomes 1.0
|
// // normalize so larger multiplier becomes 1.0
|
||||||
float minval = min(rm, gm, bm);
|
// float minval = min(rm, gm, bm);
|
||||||
rm /= minval;
|
// rm /= minval;
|
||||||
gm /= minval;
|
// gm /= minval;
|
||||||
bm /= minval;
|
// bm /= minval;
|
||||||
// multiply with reference gain, ie as-shot WB
|
// // multiply with reference gain, ie as-shot WB
|
||||||
rm *= camInitialGain;
|
// rm *= camInitialGain;
|
||||||
gm *= camInitialGain;
|
// gm *= camInitialGain;
|
||||||
bm *= camInitialGain;
|
// bm *= camInitialGain;
|
||||||
}
|
}
|
||||||
|
|
||||||
defGain = 0.0;
|
defGain = 0.0;
|
||||||
@ -872,13 +869,13 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima
|
|||||||
for (int i = 1; i < image->getHeight() - 1; i++) {
|
for (int i = 1; i < image->getHeight() - 1; i++) {
|
||||||
for (int j = 2 - (a + i + 1) % 2; j < image->getWidth() - 1; j += 2) {
|
for (int j = 2 - (a + i + 1) % 2; j < image->getWidth() - 1; j += 2) {
|
||||||
// edge-adaptive interpolation
|
// edge-adaptive interpolation
|
||||||
double dh = (ABS(image->r(i, j + 1) - image->r(i, j - 1)) + ABS(image->g(i, j + 1) - image->g(i, j - 1)) + ABS(image->b(i, j + 1) - image->b(i, j - 1))) / 1.0;
|
float dh = (std::fabs(image->r(i, j + 1) - image->r(i, j - 1)) + std::fabs(image->g(i, j + 1) - image->g(i, j - 1)) + std::fabs(image->b(i, j + 1) - image->b(i, j - 1)));
|
||||||
double dv = (ABS(image->r(i + 1, j) - image->r(i - 1, j)) + ABS(image->g(i + 1, j) - image->g(i - 1, j)) + ABS(image->b(i + 1, j) - image->b(i - 1, j))) / 1.0;
|
float dv = (std::fabs(image->r(i + 1, j) - image->r(i - 1, j)) + std::fabs(image->g(i + 1, j) - image->g(i - 1, j)) + std::fabs(image->b(i + 1, j) - image->b(i - 1, j)));
|
||||||
double eh = 1.0 / (1.0 + dh);
|
float eh = 1.f / (1.f + dh);
|
||||||
double ev = 1.0 / (1.0 + dv);
|
float ev = 1.f / (1.f + dv);
|
||||||
image->r(i, j) = (eh * (image->r(i, j + 1) + image->r(i, j - 1)) + ev * (image->r(i + 1, j) + image->r(i - 1, j))) / (2.0 * (eh + ev));
|
image->r(i, j) = (eh * (image->r(i, j + 1) + image->r(i, j - 1)) + ev * (image->r(i + 1, j) + image->r(i - 1, j))) / (2.f * (eh + ev));
|
||||||
image->g(i, j) = (eh * (image->g(i, j + 1) + image->g(i, j - 1)) + ev * (image->g(i + 1, j) + image->g(i - 1, j))) / (2.0 * (eh + ev));
|
image->g(i, j) = (eh * (image->g(i, j + 1) + image->g(i, j - 1)) + ev * (image->g(i + 1, j) + image->g(i - 1, j))) / (2.f * (eh + ev));
|
||||||
image->b(i, j) = (eh * (image->b(i, j + 1) + image->b(i, j - 1)) + ev * (image->b(i + 1, j) + image->b(i - 1, j))) / (2.0 * (eh + ev));
|
image->b(i, j) = (eh * (image->b(i, j + 1) + image->b(i, j - 1)) + ev * (image->b(i + 1, j) + image->b(i - 1, j))) / (2.f * (eh + ev));
|
||||||
}
|
}
|
||||||
|
|
||||||
// first pixel
|
// first pixel
|
||||||
@ -1542,7 +1539,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prepareDenoise && dirpyrdenoiseExpComp == INFINITY) {
|
if(prepareDenoise && dirpyrdenoiseExpComp == RT_INFINITY) {
|
||||||
LUTu aehist;
|
LUTu aehist;
|
||||||
int aehistcompr;
|
int aehistcompr;
|
||||||
double clip = 0;
|
double clip = 0;
|
||||||
@ -3873,7 +3870,7 @@ void RawImageSource::getRowStartEnd (int x, int &start, int &end)
|
|||||||
{
|
{
|
||||||
if (fuji) {
|
if (fuji) {
|
||||||
int fw = ri->get_FujiWidth();
|
int fw = ri->get_FujiWidth();
|
||||||
start = ABS(fw - x) + border;
|
start = std::abs(fw - x) + border;
|
||||||
end = min(H + W - fw - x, fw + x) - border;
|
end = min(H + W - fw - x, fw + x) - border;
|
||||||
} else {
|
} else {
|
||||||
start = border;
|
start = border;
|
||||||
@ -3914,7 +3911,7 @@ void RawImageSource::getAutoWBMultipliers (double &rm, double &gm, double &bm)
|
|||||||
if (fuji) {
|
if (fuji) {
|
||||||
for (int i = 32; i < H - 32; i++) {
|
for (int i = 32; i < H - 32; i++) {
|
||||||
int fw = ri->get_FujiWidth();
|
int fw = ri->get_FujiWidth();
|
||||||
int start = ABS(fw - i) + 32;
|
int start = std::abs(fw - i) + 32;
|
||||||
int end = min(H + W - fw - i, fw + i) - 32;
|
int end = min(H + W - fw - i, fw + i) - 32;
|
||||||
|
|
||||||
for (int j = start; j < end; j++) {
|
for (int j = start; j < end; j++) {
|
||||||
|
@ -27,6 +27,37 @@
|
|||||||
#undef THREAD_PRIORITY_NORMAL
|
#undef THREAD_PRIORITY_NORMAL
|
||||||
#include "opthelper.h"
|
#include "opthelper.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void fillLuminance(rtengine::Imagefloat* img, float** luminance, const float lumi[3], int W, int H) // fill with luminance
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel for
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int i = 0; i < H; i++)
|
||||||
|
for (int j = 0; j < W; j++) {
|
||||||
|
luminance[i][j] = lumi[0] * std::max(img->r(i, j), 0.f) + lumi[1] * std::max(img->g(i, j), 0.f) + lumi[2] * std::max(img->b(i, j), 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void fillLuminanceL(float** L, float** luminance, int W, int H) // fill with luminance
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel for
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int i = 0; i < H; i++)
|
||||||
|
for (int j = 0; j < W; j++) {
|
||||||
|
luminance[i][j] = std::max(L[i][j], 0.f) ;//we can put here some enhancements Gamma, compression data,...
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
namespace rtengine
|
namespace rtengine
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -51,39 +82,13 @@ SHMap::~SHMap ()
|
|||||||
delete [] map;
|
delete [] map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHMap::fillLuminance( Imagefloat * img, float **luminance, double lumi[3] ) // fill with luminance
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef _OPENMP
|
|
||||||
#pragma omp parallel for
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i = 0; i < H; i++)
|
|
||||||
for (int j = 0; j < W; j++) {
|
|
||||||
luminance[i][j] = lumi[0] * std::max(img->r(i, j), 0.f) + lumi[1] * std::max(img->g(i, j), 0.f) + lumi[2] * std::max(img->b(i, j), 0.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHMap::fillLuminanceL( float ** L, float **luminance) // fill with luminance
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef _OPENMP
|
|
||||||
#pragma omp parallel for
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i = 0; i < H; i++)
|
|
||||||
for (int j = 0; j < W; j++) {
|
|
||||||
luminance[i][j] = std::max(L[i][j], 0.f) ;//we can put here some enhancements Gamma, compression data,...
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int skip)
|
void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int skip)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const float lumif[3] = { static_cast<float>(lumi[0]), static_cast<float>(lumi[1]), static_cast<float>(lumi[2]) };
|
||||||
|
|
||||||
if (!hq) {
|
if (!hq) {
|
||||||
fillLuminance( img, map, lumi);
|
fillLuminance(img, map, lumif, W, H);
|
||||||
|
|
||||||
const bool useBoxBlur = radius > 40.0; // boxblur is less prone to artifacts for large radi
|
const bool useBoxBlur = radius > 40.0; // boxblur is less prone to artifacts for large radi
|
||||||
|
|
||||||
@ -91,7 +96,7 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int
|
|||||||
#pragma omp parallel if (!useBoxBlur)
|
#pragma omp parallel if (!useBoxBlur)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
gaussianBlur (map, map, W, H, radius, useBoxBlur);
|
gaussianBlur(map, map, W, H, radius, useBoxBlur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +104,7 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int
|
|||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
//experimental dirpyr shmap
|
//experimental dirpyr shmap
|
||||||
|
|
||||||
float thresh = (100.f * radius); //1000;
|
float thresh = 100.0 * radius; //1000;
|
||||||
|
|
||||||
// set up range function
|
// set up range function
|
||||||
// calculate size of Lookup table. That's possible because from a value k for all i>=k rangefn[i] will be exp(-10)
|
// calculate size of Lookup table. That's possible because from a value k for all i>=k rangefn[i] will be exp(-10)
|
||||||
@ -142,7 +147,7 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int
|
|||||||
dirpyrlo[1] = buffer;
|
dirpyrlo[1] = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillLuminance( img, dirpyrlo[0], lumi);
|
fillLuminance(img, dirpyrlo[0], lumif, W, H);
|
||||||
|
|
||||||
scale = 1;
|
scale = 1;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
@ -181,28 +186,18 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int
|
|||||||
for (int j = 0; j < W; j++) {
|
for (int j = 0; j < W; j++) {
|
||||||
_val = map[i][j];
|
_val = map[i][j];
|
||||||
|
|
||||||
if (_val < _min_f) {
|
_min_f = std::min(_min_f, _val);
|
||||||
_min_f = _val;
|
_max_f = std::max(_max_f, _val);
|
||||||
}
|
|
||||||
|
|
||||||
if (_val > _max_f) {
|
_avg += static_cast<double>(_val);
|
||||||
_max_f = _val;
|
|
||||||
}
|
|
||||||
|
|
||||||
_avg += _val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(_min_f < min_f ) {
|
min_f = std::min(min_f, _min_f);
|
||||||
min_f = _min_f;
|
max_f = std::max(max_f, _max_f);
|
||||||
}
|
|
||||||
|
|
||||||
if(_max_f > max_f ) {
|
|
||||||
max_f = _max_f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_avg /= ((H) * (W));
|
_avg /= ((H) * (W));
|
||||||
@ -214,7 +209,7 @@ void SHMap::updateL (float** L, double radius, bool hq, int skip)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!hq) {
|
if (!hq) {
|
||||||
fillLuminanceL( L, map);
|
fillLuminanceL(L, map, W, H);
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
#endif
|
#endif
|
||||||
@ -228,7 +223,7 @@ void SHMap::updateL (float** L, double radius, bool hq, int skip)
|
|||||||
{
|
{
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
//experimental dirpyr shmap
|
//experimental dirpyr shmap
|
||||||
float thresh = (100.f * radius); //1000;
|
float thresh = 100.0 * radius; //1000;
|
||||||
int levrad; // = 16;
|
int levrad; // = 16;
|
||||||
levrad = 2; //for retinex - otherwise levrad = 16
|
levrad = 2; //for retinex - otherwise levrad = 16
|
||||||
// set up range function
|
// set up range function
|
||||||
@ -274,7 +269,7 @@ void SHMap::updateL (float** L, double radius, bool hq, int skip)
|
|||||||
dirpyrlo[1] = buffer;
|
dirpyrlo[1] = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillLuminanceL( L, dirpyrlo[0]);
|
fillLuminanceL(L, dirpyrlo[0], W, H);
|
||||||
|
|
||||||
scale = 1;
|
scale = 1;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
@ -313,28 +308,18 @@ void SHMap::updateL (float** L, double radius, bool hq, int skip)
|
|||||||
for (int j = 0; j < W; j++) {
|
for (int j = 0; j < W; j++) {
|
||||||
_val = map[i][j];
|
_val = map[i][j];
|
||||||
|
|
||||||
if (_val < _min_f) {
|
_min_f = std::min(_min_f, _val);
|
||||||
_min_f = _val;
|
_max_f = std::max(_max_f, _val);
|
||||||
}
|
|
||||||
|
|
||||||
if (_val > _max_f) {
|
_avg += static_cast<double>(_val);
|
||||||
_max_f = _val;
|
|
||||||
}
|
|
||||||
|
|
||||||
_avg += _val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(_min_f < min_f ) {
|
min_f = std::min(min_f, _min_f);
|
||||||
min_f = _min_f;
|
max_f = std::max(max_f, _max_f);
|
||||||
}
|
|
||||||
|
|
||||||
if(_max_f > max_f ) {
|
|
||||||
max_f = _max_f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_avg /= ((H) * (W));
|
_avg /= ((H) * (W));
|
||||||
|
@ -48,8 +48,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
int W, H;
|
int W, H;
|
||||||
|
|
||||||
void fillLuminance( Imagefloat * img, float **luminance, double lumi[3] );
|
|
||||||
void fillLuminanceL( float ** L, float **luminance );
|
|
||||||
void dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, const LUTf& rangefn, int level, int scale);
|
void dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, const LUTf& rangefn, int level, int scale);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -994,7 +994,7 @@ private:
|
|||||||
ipf.rgbProc (baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve, options.chunkSizeRGB, options.measure);
|
ipf.rgbProc (baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve, options.chunkSizeRGB, options.measure);
|
||||||
|
|
||||||
if (settings->verbose) {
|
if (settings->verbose) {
|
||||||
printf ("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob);
|
printf ("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", static_cast<double>(autor), static_cast<double>(autog), static_cast<double>(autob));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if clut was used and size of clut cache == 1 we free the memory used by the clutstore (default clut cache size = 1 for 32 bit OS)
|
// if clut was used and size of clut cache == 1 we free the memory used by the clutstore (default clut cache size = 1 for 32 bit OS)
|
||||||
@ -1162,10 +1162,10 @@ private:
|
|||||||
adap = 2000.;
|
adap = 2000.;
|
||||||
}//if no exif data or wrong
|
}//if no exif data or wrong
|
||||||
else {
|
else {
|
||||||
float E_V = fcomp + log2 ((fnum * fnum) / fspeed / (fiso / 100.f));
|
double E_V = fcomp + log2 ((fnum * fnum) / fspeed / (fiso / 100.f));
|
||||||
E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV
|
E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV
|
||||||
E_V += log2 (params.raw.expos); // exposure raw white point ; log2 ==> linear to EV
|
E_V += log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV
|
||||||
adap = powf (2.f, E_V - 3.f); //cd / m2
|
adap = std::pow(2.0, E_V - 3.0); //cd / m2
|
||||||
}
|
}
|
||||||
|
|
||||||
LUTf CAMBrightCurveJ;
|
LUTf CAMBrightCurveJ;
|
||||||
|
@ -124,7 +124,7 @@ void CropWindow::initZoomSteps()
|
|||||||
zoomSteps.push_back(ZoomStep(" 8%", 1.0/12.0, 120, true));
|
zoomSteps.push_back(ZoomStep(" 8%", 1.0/12.0, 120, true));
|
||||||
char lbl[64];
|
char lbl[64];
|
||||||
for (int s = 100; s >= 11; --s) {
|
for (int s = 100; s >= 11; --s) {
|
||||||
float z = 10./float(s);
|
float z = 10.f / s;
|
||||||
sprintf(lbl, "% 2d%%", int(z * 100));
|
sprintf(lbl, "% 2d%%", int(z * 100));
|
||||||
bool is_major = (s == s/10 * 10);
|
bool is_major = (s == s/10 * 10);
|
||||||
zoomSteps.push_back(ZoomStep(lbl, z, s, is_major));
|
zoomSteps.push_back(ZoomStep(lbl, z, s, is_major));
|
||||||
|
@ -37,7 +37,7 @@ Defringe::Defringe () : FoldableToolPanel(this, "defringe", M("TP_DEFRINGE_LABEL
|
|||||||
float R, G, B;
|
float R, G, B;
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
float x = float(i) * (1.0f / 6.0);
|
float x = i / 6.f;
|
||||||
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
||||||
bottomMilestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
|
bottomMilestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
|
||||||
}
|
}
|
||||||
|
@ -477,13 +477,13 @@ void DiagonalCurveEditorSubGroup::pipetteMouseOver(EditDataProvider *provider, i
|
|||||||
double pos[3];
|
double pos[3];
|
||||||
shcSelector->getPositions(pos[0], pos[1], pos[2]);
|
shcSelector->getPositions(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if (pipetteVal >= pos[2]) {
|
if (static_cast<double>(pipetteVal) >= pos[2]) {
|
||||||
editedAdjuster = highlights;
|
editedAdjuster = highlights;
|
||||||
paramCurve->setActiveParam(4);
|
paramCurve->setActiveParam(4);
|
||||||
} else if(pipetteVal >= pos[1]) {
|
} else if(static_cast<double>(pipetteVal) >= pos[1]) {
|
||||||
editedAdjuster = lights;
|
editedAdjuster = lights;
|
||||||
paramCurve->setActiveParam(5);
|
paramCurve->setActiveParam(5);
|
||||||
} else if(pipetteVal >= pos[0]) {
|
} else if(static_cast<double>(pipetteVal) >= pos[0]) {
|
||||||
editedAdjuster = darks;
|
editedAdjuster = darks;
|
||||||
paramCurve->setActiveParam(6);
|
paramCurve->setActiveParam(6);
|
||||||
} else {
|
} else {
|
||||||
|
@ -428,7 +428,7 @@ void DirPyrEqualizer::lumacontrastPlusPressed ()
|
|||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
float inc = 0.05 * (6 - i);
|
double inc = 0.05 * (6 - i);
|
||||||
multiplier[i]->setValue(multiplier[i]->getValue() + inc);
|
multiplier[i]->setValue(multiplier[i]->getValue() + inc);
|
||||||
adjusterChanged(multiplier[i], multiplier[i]->getValue());
|
adjusterChanged(multiplier[i], multiplier[i]->getValue());
|
||||||
}
|
}
|
||||||
@ -439,7 +439,7 @@ void DirPyrEqualizer::lumacontrastMinusPressed ()
|
|||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
float inc = -0.05 * (6 - i);
|
double inc = -0.05 * (6 - i);
|
||||||
multiplier[i]->setValue(multiplier[i]->getValue() + inc);
|
multiplier[i]->setValue(multiplier[i]->getValue() + inc);
|
||||||
adjusterChanged(multiplier[i], multiplier[i]->getValue());
|
adjusterChanged(multiplier[i], multiplier[i]->getValue());
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void Gradient::updateGeometry(const int centerX, const int centerY, const double
|
|||||||
const auto decay = feather * rtengine::norm2<double> (imW, imH) / 200.0;
|
const auto decay = feather * rtengine::norm2<double> (imW, imH) / 200.0;
|
||||||
rtengine::Coord origin (imW / 2 + centerX * imW / 200, imH / 2 + centerY * imH / 200);
|
rtengine::Coord origin (imW / 2 + centerX * imW / 200, imH / 2 + centerY * imH / 200);
|
||||||
|
|
||||||
const auto updateLine = [&](Geometry* geometry, const float radius, const float begin, const float end)
|
const auto updateLine = [&](Geometry* geometry, const double radius, const double begin, const double end)
|
||||||
{
|
{
|
||||||
const auto line = static_cast<Line*>(geometry);
|
const auto line = static_cast<Line*>(geometry);
|
||||||
line->begin = PolarCoord(radius, -degree + begin);
|
line->begin = PolarCoord(radius, -degree + begin);
|
||||||
@ -173,7 +173,7 @@ void Gradient::updateGeometry(const int centerX, const int centerY, const double
|
|||||||
line->end += origin;
|
line->end += origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto updateLineWithDecay = [&](Geometry* geometry, const float radius, const float offSetAngle)
|
const auto updateLineWithDecay = [&](Geometry* geometry, const double radius, const double offSetAngle)
|
||||||
{
|
{
|
||||||
const auto line = static_cast<Line*>(geometry);
|
const auto line = static_cast<Line*>(geometry);
|
||||||
line->begin = PolarCoord (radius, -degree + 180.) + PolarCoord (decay, -degree + offSetAngle);
|
line->begin = PolarCoord (radius, -degree + 180.) + PolarCoord (decay, -degree + offSetAngle);
|
||||||
|
@ -518,26 +518,26 @@ void HistogramRGBArea::updateBackBuffer (int r, int g, int b, const Glib::ustrin
|
|||||||
// Luma
|
// Luma
|
||||||
cc->set_source_rgb(1.0, 1.0, 1.0);
|
cc->set_source_rgb(1.0, 1.0, 1.0);
|
||||||
if (options.histogramDrawMode < 2) {
|
if (options.histogramDrawMode < 2) {
|
||||||
cc->move_to(Lab_L * (winw - 3.*s) / 100.0 + 0.5*s, 0);
|
cc->move_to(static_cast<double>(Lab_L) * (winw - 3. * s) / 100.0 + 0.5 * s, 0);
|
||||||
cc->line_to(Lab_L * (winw - 3.*s) / 100.0 + 0.5*s, winh - 0);
|
cc->line_to(static_cast<double>(Lab_L) * (winw - 3. * s) / 100.0 + 0.5 * s, winh - 0);
|
||||||
} else {
|
} else {
|
||||||
cc->move_to(HistogramScaling::log (100, Lab_L) * (winw - 1.) / 100.0 + 0.5*s, 0);
|
cc->move_to(HistogramScaling::log(100, Lab_L) * (winw - 1.) / 100.0 + 0.5 * s, 0);
|
||||||
cc->line_to(HistogramScaling::log (100, Lab_L) * (winw - 1.) / 100.0 + 0.5*s, winh - 0);
|
cc->line_to(HistogramScaling::log(100, Lab_L) * (winw - 1.) / 100.0 + 0.5 * s, winh - 0);
|
||||||
}
|
}
|
||||||
cc->stroke();
|
cc->stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needChroma) {
|
if (needChroma) {
|
||||||
// Chroma
|
// Chroma
|
||||||
float chromaval = sqrt(Lab_a * Lab_a + Lab_b * Lab_b) / 1.8;
|
double chromaval = sqrt(Lab_a * Lab_a + Lab_b * Lab_b) / 1.8;
|
||||||
// float chromaval = sqrt(Lab_a*Lab_a + Lab_b*Lab_b);
|
// float chromaval = sqrt(Lab_a*Lab_a + Lab_b*Lab_b);
|
||||||
cc->set_source_rgb(0.9, 0.9, 0.0);
|
cc->set_source_rgb(0.9, 0.9, 0.0);
|
||||||
if (options.histogramDrawMode < 2) {
|
if (options.histogramDrawMode < 2) {
|
||||||
cc->move_to(chromaval * (winw - 1.) / 100.0 + 0.5*s, 0);
|
cc->move_to(chromaval * (winw - 1.) / 100.0 + 0.5 * s, 0);
|
||||||
cc->line_to(chromaval * (winw - 1.) / 100.0 + 0.5*s, winh - 0);
|
cc->line_to(chromaval * (winw - 1.) / 100.0 + 0.5 * s, winh - 0);
|
||||||
} else {
|
} else {
|
||||||
cc->move_to(HistogramScaling::log (100, chromaval) * (winw - 1.) / 100.0 + 0.5*s, 0);
|
cc->move_to(HistogramScaling::log(100, chromaval) * (winw - 1.) / 100.0 + 0.5 * s, 0);
|
||||||
cc->line_to(HistogramScaling::log (100, chromaval) * (winw - 1.) / 100.0 + 0.5*s, winh - 0);
|
cc->line_to(HistogramScaling::log(100, chromaval) * (winw - 1.) / 100.0 + 0.5 * s, winh - 0);
|
||||||
}
|
}
|
||||||
cc->stroke();
|
cc->stroke();
|
||||||
}
|
}
|
||||||
@ -989,7 +989,7 @@ void HistogramArea::drawCurve(Cairo::RefPtr<Cairo::Context> &cr,
|
|||||||
|
|
||||||
cr->set_line_width(s);
|
cr->set_line_width(s);
|
||||||
cr->move_to (0, vsize - 1);
|
cr->move_to (0, vsize - 1);
|
||||||
scale = scale <= 0.f ? 0.001f : scale; // avoid division by zero and negative values
|
scale = scale <= 0.0 ? 0.001 : scale; // avoid division by zero and negative values
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
double val = data[i] * (double)vsize / scale;
|
double val = data[i] * (double)vsize / scale;
|
||||||
|
@ -38,7 +38,7 @@ HSVEqualizer::HSVEqualizer () : FoldableToolPanel(this, "hsvequalizer", M("TP_HS
|
|||||||
|
|
||||||
// -0.1 rad < Hue < 1.6 rad
|
// -0.1 rad < Hue < 1.6 rad
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
float x = float(i) * (1.0f / 6.0);
|
float x = i / 6.0;
|
||||||
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
||||||
bottomMilestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
|
bottomMilestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL"),
|
|||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
float R, G, B;
|
float R, G, B;
|
||||||
float x = float(i) * (1.0f / 6.0);
|
float x = i / 6.0;
|
||||||
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
||||||
milestones.emplace_back(x, R, G, B);
|
milestones.emplace_back(x, R, G, B);
|
||||||
}
|
}
|
||||||
|
@ -209,8 +209,8 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
|||||||
float x, y, z;
|
float x, y, z;
|
||||||
int ii = i - cells/2;
|
int ii = i - cells/2;
|
||||||
int jj = j - cells/2;
|
int jj = j - cells/2;
|
||||||
float a = step * (ii + 0.5);
|
float a = step * (ii + 0.5f);
|
||||||
float b = step * (jj + 0.5);
|
float b = step * (jj + 0.5f);
|
||||||
Color::Lab2XYZ(25000.f, a, b, x, y, z);
|
Color::Lab2XYZ(25000.f, a, b, x, y, z);
|
||||||
Color::xyz2srgb(x, y, z, R, G, B);
|
Color::xyz2srgb(x, y, z, R, G, B);
|
||||||
cr->set_source_rgb(R / 65535.f, G / 65535.f, B / 65535.f);
|
cr->set_source_rgb(R / 65535.f, G / 65535.f, B / 65535.f);
|
||||||
@ -231,10 +231,10 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
|||||||
// drawing the connection line
|
// drawing the connection line
|
||||||
cr->set_antialias(Cairo::ANTIALIAS_DEFAULT);
|
cr->set_antialias(Cairo::ANTIALIAS_DEFAULT);
|
||||||
float loa, hia, lob, hib;
|
float loa, hia, lob, hib;
|
||||||
loa = .5f * (width + width * low_a);
|
loa = .5 * (width + width * low_a);
|
||||||
hia = .5f * (width + width * high_a);
|
hia = .5 * (width + width * high_a);
|
||||||
lob = .5f * (height + height * low_b);
|
lob = .5 * (height + height * low_b);
|
||||||
hib = .5f * (height + height * high_b);
|
hib = .5 * (height + height * high_b);
|
||||||
cr->set_line_width(2. * double(s));
|
cr->set_line_width(2. * double(s));
|
||||||
cr->set_source_rgb(0.6, 0.6, 0.6);
|
cr->set_source_rgb(0.6, 0.6, 0.6);
|
||||||
cr->move_to(loa, lob);
|
cr->move_to(loa, lob);
|
||||||
@ -319,8 +319,8 @@ bool LabGridArea::on_motion_notify_event(GdkEventMotion *event)
|
|||||||
int height = get_allocated_height() - 2 * inset * s - padding.get_top() - padding.get_bottom();
|
int height = get_allocated_height() - 2 * inset * s - padding.get_top() - padding.get_bottom();
|
||||||
const float mouse_x = std::min(double(std::max(event->x - inset * s - padding.get_right(), 0.)), double(width));
|
const float mouse_x = std::min(double(std::max(event->x - inset * s - padding.get_right(), 0.)), double(width));
|
||||||
const float mouse_y = std::min(double(std::max(get_allocated_height() - 1 - event->y - inset * s - padding.get_bottom(), 0.)), double(height));
|
const float mouse_y = std::min(double(std::max(get_allocated_height() - 1 - event->y - inset * s - padding.get_bottom(), 0.)), double(height));
|
||||||
const float ma = (2.0 * mouse_x - width) / (float)width;
|
const float ma = (2.f * mouse_x - width) / width;
|
||||||
const float mb = (2.0 * mouse_y - height) / (float)height;
|
const float mb = (2.f * mouse_y - height) / height;
|
||||||
if (isDragged) {
|
if (isDragged) {
|
||||||
if (litPoint == LOW) {
|
if (litPoint == LOW) {
|
||||||
low_a = ma;
|
low_a = ma;
|
||||||
|
@ -37,7 +37,7 @@ void LockableColorPicker::updateBackBuffer ()
|
|||||||
int newW, newH;
|
int newW, newH;
|
||||||
|
|
||||||
// -------------------- setting some key constants ---------------------
|
// -------------------- setting some key constants ---------------------
|
||||||
constexpr float circlePadding = 3.f; // keep this value odd
|
constexpr double circlePadding = 3.0; // keep this value odd
|
||||||
constexpr double opacity = 0.62;
|
constexpr double opacity = 0.62;
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
@ -121,18 +121,18 @@ void LockableColorPicker::updateBackBuffer ()
|
|||||||
bbcr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL);
|
bbcr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL);
|
||||||
bbcr->set_line_width (0.);
|
bbcr->set_line_width (0.);
|
||||||
|
|
||||||
float center = (float)size / 2.f + circlePadding;
|
double center = static_cast<double>(size) / 2.0 + circlePadding;
|
||||||
|
|
||||||
// black background of the whole color picker
|
// black background of the whole color picker
|
||||||
bbcr->set_line_width (0.);
|
bbcr->set_line_width (0.);
|
||||||
bbcr->set_source_rgba (0., 0., 0., opacity);
|
bbcr->set_source_rgba (0., 0., 0., opacity);
|
||||||
bbcr->arc_negative (center, center, center, 0., (double)rtengine::RT_PI);
|
bbcr->arc_negative (center, center, center, 0., rtengine::RT_PI);
|
||||||
bbcr->line_to (0, 2. * center + textHeight);
|
bbcr->line_to (0, 2. * center + textHeight);
|
||||||
bbcr->arc_negative (2. * textPadding, 2. * center + textHeight, 2. * textPadding, (double)rtengine::RT_PI, (double)rtengine::RT_PI / 2.);
|
bbcr->arc_negative (2. * textPadding, 2. * center + textHeight, 2. * textPadding, rtengine::RT_PI, rtengine::RT_PI / 2.);
|
||||||
bbcr->line_to (textWidth, 2. * center + textHeight + 2. * textPadding);
|
bbcr->line_to (textWidth, 2. * center + textHeight + 2. * textPadding);
|
||||||
bbcr->arc_negative (textWidth, 2. * center + textHeight, 2. * textPadding, (double)rtengine::RT_PI / 2., 0.);
|
bbcr->arc_negative (textWidth, 2. * center + textHeight, 2. * textPadding, rtengine::RT_PI / 2., 0.);
|
||||||
bbcr->line_to (textWidth + 2. * textPadding, 2. * center + 2. * textPadding);
|
bbcr->line_to (textWidth + 2. * textPadding, 2. * center + 2. * textPadding);
|
||||||
bbcr->arc_negative (textWidth, 2. * center + 2. * textPadding, 2. * textPadding, 0., (double)rtengine::RT_PI * 1.5);
|
bbcr->arc_negative (textWidth, 2. * center + 2. * textPadding, 2. * textPadding, 0., rtengine::RT_PI * 1.5);
|
||||||
bbcr->line_to (2. * center, 2. * center);
|
bbcr->line_to (2. * center, 2. * center);
|
||||||
bbcr->close_path();
|
bbcr->close_path();
|
||||||
bbcr->set_line_join (Cairo::LINE_JOIN_BEVEL);
|
bbcr->set_line_join (Cairo::LINE_JOIN_BEVEL);
|
||||||
@ -222,7 +222,7 @@ void LockableColorPicker::updateBackBuffer ()
|
|||||||
|
|
||||||
bbcr->set_antialias(Cairo::ANTIALIAS_SUBPIXEL);
|
bbcr->set_antialias(Cairo::ANTIALIAS_SUBPIXEL);
|
||||||
|
|
||||||
float center = (float)size / 2.f + circlePadding;
|
double center = static_cast<double>(size) / 2. + circlePadding;
|
||||||
|
|
||||||
// light grey circle around the color mark
|
// light grey circle around the color mark
|
||||||
bbcr->arc (center, center, center - circlePadding / 2., 0., 2. * (double)rtengine::RT_PI);
|
bbcr->arc (center, center, center - circlePadding / 2., 0., 2. * (double)rtengine::RT_PI);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user