From 024edb29913cbef676ebdc234afe91193849de20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 11 Feb 2024 00:50:02 +0100 Subject: [PATCH] vf_format: add hdr10plus sub-parameter to format video filter --- DOCS/interface-changes.rst | 1 + DOCS/man/vf.rst | 4 ++++ video/filter/vf_format.c | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 146ed0f6b0df6..14557de1b5ab3 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -62,6 +62,7 @@ Interface changes over blending alpha components into specific background types - add `--border-background` option - add `video-target-params` property + - add `hdr10plus` sub-parameter to `format` video filter --- mpv 0.37.0 --- - `--save-position-on-quit` and its associated commands now store state files in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows. diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst index 1d067e31f4874..59175e79eff6a 100644 --- a/DOCS/man/vf.rst +++ b/DOCS/man/vf.rst @@ -316,6 +316,10 @@ Available mpv-only filters are: Whether or not to include Dolby Vision metadata (default: yes). If disabled, any Dolby Vision metadata will be stripped from frames. + ```` + Whether or not to include HDR10+ metadata (default: yes). If + disabled, any HDR10+ metadata will be stripped from frames. + ```` Whether or not to include film grain metadata (default: yes). If disabled, any film grain metadata will be stripped from frames. diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index 4a2916864c3d9..f226bf22a7ad0 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -60,6 +60,7 @@ struct vf_format_opts { bool convert; int force_scaler; bool dovi; + bool hdr10plus; bool film_grain; }; @@ -178,6 +179,13 @@ static void vf_format_process(struct mp_filter *f) }); } + if (!priv->opts->hdr10plus) { + memset(img->params.color.hdr.scene_max, 0, + sizeof(img->params.color.hdr.scene_max)); + img->params.color.hdr.scene_avg = 0; + img->params.color.hdr.ootf = (struct pl_hdr_bezier){0}; + } + if (!priv->opts->film_grain) av_buffer_unref(&img->film_grain); @@ -240,6 +248,7 @@ static const m_option_t vf_opts_fields[] = { {"dar", OPT_DOUBLE(dar)}, {"convert", OPT_BOOL(convert)}, {"dolbyvision", OPT_BOOL(dovi)}, + {"hdr10plus", OPT_BOOL(hdr10plus)}, {"film-grain", OPT_BOOL(film_grain)}, {"force-scaler", OPT_CHOICE(force_scaler, {"auto", MP_SWS_AUTO}, @@ -256,6 +265,7 @@ const struct mp_user_filter_entry vf_format = { .priv_defaults = &(const OPT_BASE_STRUCT){ .rotate = -1, .dovi = true, + .hdr10plus = true, .film_grain = true, }, .options = vf_opts_fields,