From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <git@haasn.dev>
Subject: [FFmpeg-devel] [PATCH 4/6] avfilter/vf_libplacebo: update metadata stripping logic
Date: Fri, 26 Apr 2024 14:28:01 +0200
Message-ID: <20240426122803.19967-4-ffmpeg@haasn.xyz> (raw)
In-Reply-To: <20240426122803.19967-1-ffmpeg@haasn.xyz>
From: Niklas Haas <git@haasn.dev>
Switches to av_frame_remove_side_data_changed(), covering a number of
cases that we previously ignored. Additionally, stop stripping metadata
when merely changing colorspace or color range, since these do not
affect the actual color volume of the image data, only the encoding.
---
libavfilter/vf_libplacebo.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index be9000aa8e..17da6fc71d 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -806,7 +806,7 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
/* Construct and emit an output frame for a given timestamp */
static int output_frame(AVFilterContext *ctx, int64_t pts)
{
- int err = 0, ok, changed_csp;
+ int err = 0, ok, changed;
LibplaceboContext *s = ctx->priv;
pl_options opts = s->opts;
AVFilterLink *outlink = ctx->outputs[0];
@@ -842,6 +842,7 @@ static int output_frame(AVFilterContext *ctx, int64_t pts)
* output colorspace defaults */
out->color_primaries = AVCOL_PRI_BT2020;
out->color_trc = AVCOL_TRC_SMPTE2084;
+ changed |= AV_FRAME_CHANGED_COLOR_VOLUME;
}
if (s->color_trc >= 0)
@@ -849,21 +850,13 @@ static int output_frame(AVFilterContext *ctx, int64_t pts)
if (s->color_primaries >= 0)
out->color_primaries = s->color_primaries;
- changed_csp = ref->colorspace != out->colorspace ||
- ref->color_range != out->color_range ||
- ref->color_trc != out->color_trc ||
- ref->color_primaries != out->color_primaries;
-
/* Strip side data if no longer relevant */
- if (changed_csp) {
- av_frame_remove_side_data(out, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
- av_frame_remove_side_data(out, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
- av_frame_remove_side_data(out, AV_FRAME_DATA_ICC_PROFILE);
- }
- if (s->apply_dovi || changed_csp) {
- av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_RPU_BUFFER);
- av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_METADATA);
- }
+ if (out->width != ref->width || out->height != ref->height)
+ changed |= AV_FRAME_CHANGED_SIZE;
+ if (ref->color_trc != out->color_trc || ref->color_primaries != out->color_primaries)
+ changed |= AV_FRAME_CHANGED_COLOR_VOLUME;
+ av_frame_remove_side_data_changed(out, changed);
+
if (s->apply_filmgrain)
av_frame_remove_side_data(out, AV_FRAME_DATA_FILM_GRAIN_PARAMS);
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-04-26 12:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 12:27 [FFmpeg-devel] [PATCH 1/6] avutil/frame: add av_frame_remove_side_data_changed Niklas Haas
2024-04-26 12:27 ` [FFmpeg-devel] [PATCH 2/6] avfilter/vf_scale*: strip metadata on size change Niklas Haas
2024-04-26 12:28 ` [FFmpeg-devel] [PATCH 3/6] avfilter/vf_zscale: strip metadata on change Niklas Haas
2024-04-26 12:28 ` Niklas Haas [this message]
2024-04-26 12:28 ` [FFmpeg-devel] [PATCH 5/6] avfilter/vf_colorspace: strip color volume metadata Niklas Haas
2024-04-26 12:28 ` [FFmpeg-devel] [PATCH 6/6] avfilter/vf_lut*: " Niklas Haas
2024-04-26 12:36 ` [FFmpeg-devel] [PATCH 1/6] avutil/frame: add av_frame_remove_side_data_changed Niklas Haas
2024-04-26 13:24 ` epirat07
2024-04-26 19:29 ` James Almer
2024-05-02 10:11 ` Niklas Haas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240426122803.19967-4-ffmpeg@haasn.xyz \
--to=ffmpeg@haasn.xyz \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=git@haasn.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git