Skip to content

Commit

Permalink
vf_format: add hdr10plus sub-parameter to format video filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 authored and Dudemanguy committed Mar 9, 2024
1 parent d9c1e9b commit 024edb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions DOCS/interface-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions DOCS/man/vf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

``<hdr10plus=yes|no>``
Whether or not to include HDR10+ metadata (default: yes). If
disabled, any HDR10+ metadata will be stripped from frames.

``<film-grain=yes|no>``
Whether or not to include film grain metadata (default: yes). If
disabled, any film grain metadata will be stripped from frames.
Expand Down
10 changes: 10 additions & 0 deletions video/filter/vf_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct vf_format_opts {
bool convert;
int force_scaler;
bool dovi;
bool hdr10plus;
bool film_grain;
};

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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},
Expand All @@ -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,
Expand Down

0 comments on commit 024edb2

Please sign in to comment.