[FFmpeg-cvslog] avfilter/vf_libplacebo: add SMPTE ST2094 tone-mappers
Niklas Haas
git at videolan.org
Fri Feb 17 19:45:57 EET 2023
ffmpeg | branch: master | Niklas Haas <git at haasn.dev> | Fri Feb 17 18:35:39 2023 +0100| [eabc304d123bb4193ae8dc7a602530c2e0d86450] | committer: Niklas Haas
avfilter/vf_libplacebo: add SMPTE ST2094 tone-mappers
libplacebo gained these exciting new functions upstream.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eabc304d123bb4193ae8dc7a602530c2e0d86450
---
doc/filters.texi | 12 ++++++++++++
libavfilter/vf_libplacebo.c | 30 ++++++++++++++++++++----------
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.
+ at 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.
+ at 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
+ at 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" },
More information about the ffmpeg-cvslog
mailing list