Fix framing tool issues
* Print messages only in verbose mode * Linearize 8-bit values to 16-bit values properly * Fix memory leak
This commit is contained in:
parent
f983da5d16
commit
d3962c7e56
@ -1184,7 +1184,12 @@ Imagefloat* ImProcFunctions::drawFrame(Imagefloat* rgb, const FramingParams& par
|
|||||||
|
|
||||||
// Color::gamma2curve expects a 16-bit value, but the GUI sliders are
|
// Color::gamma2curve expects a 16-bit value, but the GUI sliders are
|
||||||
// using 8-bit values. Step up the user value to 16-bits.
|
// using 8-bit values. Step up the user value to 16-bits.
|
||||||
auto clip = [](int v) { return std::max(0, std::min(v, 255)) * 256; };
|
auto clip = [](int v) -> int {
|
||||||
|
int sanitized = std::max(0, std::min(v, 255));
|
||||||
|
|
||||||
|
double normalized = static_cast<double>(sanitized) / 255.0;
|
||||||
|
return normalized * 65535.0;
|
||||||
|
};
|
||||||
|
|
||||||
float r = Color::gamma2curve[clip(params.borderRed)];
|
float r = Color::gamma2curve[clip(params.borderRed)];
|
||||||
float g = Color::gamma2curve[clip(params.borderGreen)];
|
float g = Color::gamma2curve[clip(params.borderGreen)];
|
||||||
@ -1223,6 +1228,7 @@ Imagefloat* ImProcFunctions::drawFrame(Imagefloat* rgb, const FramingParams& par
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete rgb;
|
||||||
return framed;
|
return framed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1923,6 +1923,7 @@ private:
|
|||||||
|
|
||||||
// If framing is not enabled, resize values simply pass through to output
|
// If framing is not enabled, resize values simply pass through to output
|
||||||
ImProcFunctions::FramingData framingData = ipf.framing(framingArgs);
|
ImProcFunctions::FramingData framingData = ipf.framing(framingArgs);
|
||||||
|
if (settings->verbose) {
|
||||||
printf("Framing Parameters (enabled=%s)\n", framingData.enabled ? "yes" : "no");
|
printf("Framing Parameters (enabled=%s)\n", framingData.enabled ? "yes" : "no");
|
||||||
printf(" Crop: w=%d h=%d\n", cw, ch);
|
printf(" Crop: w=%d h=%d\n", cw, ch);
|
||||||
printf(" Original resize: w=%d h=%d s=%f\n",
|
printf(" Original resize: w=%d h=%d s=%f\n",
|
||||||
@ -1931,6 +1932,7 @@ private:
|
|||||||
framingData.imgWidth, framingData.imgHeight, framingData.scale);
|
framingData.imgWidth, framingData.imgHeight, framingData.scale);
|
||||||
printf(" Total size: w=%d h=%d\n",
|
printf(" Total size: w=%d h=%d\n",
|
||||||
framingData.framedWidth, framingData.framedHeight);
|
framingData.framedWidth, framingData.framedHeight);
|
||||||
|
}
|
||||||
|
|
||||||
bool labResize = params.resize.enabled && params.resize.method != "Nearest" &&
|
bool labResize = params.resize.enabled && params.resize.method != "Nearest" &&
|
||||||
(framingData.scale != 1.0 || params.prsharpening.enabled || framingData.enabled);
|
(framingData.scale != 1.0 || params.prsharpening.enabled || framingData.enabled);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user