1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

lavfi/vf_libplacebo: add contrast recovery options

New upstream option. Enabled by default in the high-quality preset
upstream, so enable it by default here.
This commit is contained in:
Niklas Haas 2023-07-08 12:54:49 +02:00
parent 2e83ba001d
commit 13e9899014
2 changed files with 21 additions and 0 deletions

View File

@ -16664,6 +16664,19 @@ output color volumes. Disabled by default.
Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
@code{256}. Note that this figure is squared when combined with
@code{peak_detect}.
@item contrast_recovery
Contrast recovery strength. If set to a value above @code{0.0}, the source
image will be divided into high-frequency and low-frequency components, and a
portion of the high-frequency image is added back onto the tone-mapped output.
May cause excessive ringing artifacts for some HDR sources, but can improve the
subjective sharpness and detail left over in the image after tone-mapping.
Defaults to @code{0.30}.
@item contrast_smoothness
Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
decreasing this will affect the visual appearance substantially. Has no effect
when @code{contrast_recovery} is disabled.
@end table
@subsubsection Dithering

View File

@ -219,6 +219,8 @@ typedef struct LibplaceboContext {
float tonemapping_param;
int inverse_tonemapping;
int tonemapping_lut_size;
float contrast_recovery;
float contrast_smoothness;
#if FF_API_LIBPLACEBO_OPTS
/* for backwards compatibility */
@ -431,6 +433,10 @@ static int update_settings(AVFilterContext *ctx)
.tone_mapping_param = s->tonemapping_param,
.inverse_tone_mapping = s->inverse_tonemapping,
.lut_size = s->tonemapping_lut_size,
#if PL_API_VER >= 285
.contrast_recovery = s->contrast_recovery,
.contrast_smoothness = s->contrast_smoothness,
#endif
);
set_gamut_mode(&s->color_map_params, gamut_mode);
@ -1398,6 +1404,8 @@ static const AVOption libplacebo_options[] = {
{ "tonemapping_param", "Tunable parameter for some tone-mapping functions", OFFSET(tonemapping_param), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 100.0, .flags = DYNAMIC },
{ "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC },
{ "contrast_recovery", "HDR contrast recovery strength", OFFSET(contrast_recovery), AV_OPT_TYPE_FLOAT, {.dbl = 0.30}, 0.0, 3.0, DYNAMIC },
{ "contrast_smoothness", "HDR contrast recovery smoothness", OFFSET(contrast_smoothness), AV_OPT_TYPE_FLOAT, {.dbl = 3.50}, 1.0, 32.0, DYNAMIC },
#if FF_API_LIBPLACEBO_OPTS
/* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */