aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2023-02-17 18:35:39 +0100
committerNiklas Haas <git@haasn.dev>2023-02-17 18:35:39 +0100
commiteabc304d123bb4193ae8dc7a602530c2e0d86450 (patch)
tree263eacdeacfa37c1b8b20c4311c00c8320357a7f
parentaeceefa6220ccb8eac625f78c6fa90d048ccd2de (diff)
downloadffmpeg-eabc304d123bb4193ae8dc7a602530c2e0d86450.tar.gz
avfilter/vf_libplacebo: add SMPTE ST2094 tone-mappers
libplacebo gained these exciting new functions upstream.
-rw-r--r--doc/filters.texi12
-rw-r--r--libavfilter/vf_libplacebo.c30
2 files changed, 32 insertions, 10 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index d65f6ca69d..381a15a17d 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16074,6 +16074,18 @@ Automatic selection based on internal heuristics. This is the default.
Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
accuracy for in-range colors but completely destroys out-of-range information.
Does not perform any black point adaptation. Not configurable.
+@item st2094-40
+EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
+dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
+is adjusted based on the ratio between the targeted and actual display peak
+luminances.
+@item st2094-10
+EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
+average luminance in addition to the maximum/minimum. The configurable contrast
+parameter influences the slope of the linear output segment, defaulting to
+@code{1.0} for no increase/decrease in contrast. Note that this does not
+currently include the subjective gain/offset/gamma controls defined in Annex
+B.3.
@item bt.2390
EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
segment. The knee point offset is configurable. Note that this parameter
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 5b31077107..7cd495de26 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -29,6 +29,8 @@
enum {
TONE_MAP_AUTO,
TONE_MAP_CLIP,
+ TONE_MAP_ST2094_40,
+ TONE_MAP_ST2094_10,
TONE_MAP_BT2390,
TONE_MAP_BT2446A,
TONE_MAP_SPLINE,
@@ -41,16 +43,20 @@ enum {
};
static const struct pl_tone_map_function * const tonemapping_funcs[TONE_MAP_COUNT] = {
- [TONE_MAP_AUTO] = &pl_tone_map_auto,
- [TONE_MAP_CLIP] = &pl_tone_map_clip,
- [TONE_MAP_BT2390] = &pl_tone_map_bt2390,
- [TONE_MAP_BT2446A] = &pl_tone_map_bt2446a,
- [TONE_MAP_SPLINE] = &pl_tone_map_spline,
- [TONE_MAP_REINHARD] = &pl_tone_map_reinhard,
- [TONE_MAP_MOBIUS] = &pl_tone_map_mobius,
- [TONE_MAP_HABLE] = &pl_tone_map_hable,
- [TONE_MAP_GAMMA] = &pl_tone_map_gamma,
- [TONE_MAP_LINEAR] = &pl_tone_map_linear,
+ [TONE_MAP_AUTO] = &pl_tone_map_auto,
+ [TONE_MAP_CLIP] = &pl_tone_map_clip,
+#if PL_API_VER >= 246
+ [TONE_MAP_ST2094_40] = &pl_tone_map_st2094_40,
+ [TONE_MAP_ST2094_10] = &pl_tone_map_st2094_10,
+#endif
+ [TONE_MAP_BT2390] = &pl_tone_map_bt2390,
+ [TONE_MAP_BT2446A] = &pl_tone_map_bt2446a,
+ [TONE_MAP_SPLINE] = &pl_tone_map_spline,
+ [TONE_MAP_REINHARD] = &pl_tone_map_reinhard,
+ [TONE_MAP_MOBIUS] = &pl_tone_map_mobius,
+ [TONE_MAP_HABLE] = &pl_tone_map_hable,
+ [TONE_MAP_GAMMA] = &pl_tone_map_gamma,
+ [TONE_MAP_LINEAR] = &pl_tone_map_linear,
};
typedef struct LibplaceboContext {
@@ -790,6 +796,10 @@ static const AVOption libplacebo_options[] = {
{ "tonemapping", "Tone-mapping algorithm", OFFSET(tonemapping), AV_OPT_TYPE_INT, {.i64 = TONE_MAP_AUTO}, 0, TONE_MAP_COUNT - 1, DYNAMIC, "tonemap" },
{ "auto", "Automatic selection", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_AUTO}, 0, 0, STATIC, "tonemap" },
{ "clip", "No tone mapping (clip", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_CLIP}, 0, 0, STATIC, "tonemap" },
+#if PL_API_VER >= 246
+ { "st2094-40", "SMPTE ST 2094-40", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_ST2094_40}, 0, 0, STATIC, "tonemap" },
+ { "st2094-10", "SMPTE ST 2094-10", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_ST2094_10}, 0, 0, STATIC, "tonemap" },
+#endif
{ "bt.2390", "ITU-R BT.2390 EETF", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_BT2390}, 0, 0, STATIC, "tonemap" },
{ "bt.2446a", "ITU-R BT.2446 Method A", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_BT2446A}, 0, 0, STATIC, "tonemap" },
{ "spline", "Single-pivot polynomial spline", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_SPLINE}, 0, 0, STATIC, "tonemap" },