merge with dev

This commit is contained in:
U-PC-BUREAU\jacques
2018-07-07 13:46:18 +02:00
92 changed files with 2399 additions and 1322 deletions

View File

@@ -591,8 +591,8 @@ void RawImageSource::transformRect(const PreviewProps &pp, int tran, int &ssx1,
} else {
ssx1 = sx1;
ssy1 = sy1;
width = (sx2 - sx1) / pp.getSkip() + ((sx2 - sx1) % pp.getSkip() > 0);
height = (sy2 - sy1) / pp.getSkip() + ((sy2 - sy1) % pp.getSkip() > 0);
width = (sx2 + 1 - sx1) / pp.getSkip() + ((sx2 + 1 - sx1) % pp.getSkip() > 0);
height = (sy2 + 1 - sy1) / pp.getSkip() + ((sy2 + 1 - sy1) % pp.getSkip() > 0);
}
}
@@ -747,14 +747,11 @@ void RawImageSource::getImage(const ColorTemp &ctemp, int tran, Imagefloat* imag
for (int ix = 0; ix < imheight; ix++) {
int i = sy1 + skip * ix;
if (i >= maxy - skip) {
i = maxy - skip - 1; // avoid trouble
}
i = std::min(i, maxy - skip); // avoid trouble
if (ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS || ri->get_colors() == 1) {
for (int j = 0, jx = sx1; j < imwidth; j++, jx += skip) {
jx = std::min(jx, maxx - skip - 1); // avoid trouble
jx = std::min(jx, maxx - skip); // avoid trouble
float rtot = 0.f, gtot = 0.f, btot = 0.f;
@@ -2083,7 +2080,7 @@ void RawImageSource::preprocess(const RAWParams &raw, const LensProfParams &lens
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void RawImageSource::demosaic(const RAWParams &raw)
void RawImageSource::demosaic(const RAWParams &raw, bool autoContrast, double &contrastThreshold)
{
MyTime t1, t2;
t1.set();
@@ -2097,10 +2094,17 @@ void RawImageSource::demosaic(const RAWParams &raw)
ahd_demosaic();
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE)) {
amaze_demosaic_RT(0, 0, W, H, rawData, red, green, blue);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4) ) {
amaze_vng4_demosaic_RT (W, H, rawData, red, green, blue, raw.bayersensor.dualDemosaicContrast);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4)
|| raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCBVNG4)
|| raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::RCDVNG4)) {
if (!autoContrast) {
double threshold = raw.bayersensor.dualDemosaicContrast;
dual_demosaic_RT (true, raw, W, H, rawData, red, green, blue, threshold, false);
} else {
dual_demosaic_RT (true, raw, W, H, rawData, red, green, blue, contrastThreshold, true, 0, 0);
}
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) {
pixelshift(0, 0, W, H, raw.bayersensor, currFrame, ri->get_maker(), ri->get_model(), raw.expos);
pixelshift(0, 0, W, H, raw, currFrame, ri->get_maker(), ri->get_model(), raw.expos);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCB)) {
dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::EAHD)) {
@@ -2118,9 +2122,6 @@ void RawImageSource::demosaic(const RAWParams &raw)
} else {
nodemosaic(false);
}
//if (raw.all_enhance) refinement_lassus();
} else if (ri->getSensorType() == ST_FUJI_XTRANS) {
if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST)) {
fast_xtrans_interpolate(rawData, red, green, blue);
@@ -2128,8 +2129,13 @@ void RawImageSource::demosaic(const RAWParams &raw)
xtrans_interpolate(1, false);
} else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS)) {
xtrans_interpolate(3, true);
} else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FOUR_PASS)) {
xtrans_4pass_demosaic_RT(3, true, raw.xtranssensor.dualDemosaicContrast);
} else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FOUR_PASS) || raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::TWO_PASS)) {
if (!autoContrast) {
double threshold = raw.xtranssensor.dualDemosaicContrast;
dual_demosaic_RT (false, raw, W, H, rawData, red, green, blue, threshold, false);
} else {
dual_demosaic_RT (false, raw, W, H, rawData, red, green, blue, contrastThreshold, true, 0, 0);
}
} else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::MONO)) {
nodemosaic(true);
} else {