aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-12-01 12:19:27 +0100
committerNiklas Haas <git@haasn.dev>2024-12-23 12:33:43 +0100
commit01ce9d796300be815351579fe6cb343c732e36f4 (patch)
tree7009191271f0a864de9ce2baf0dd2bf58b67eb0b
parent4315cc943aa2c82df640ae2ba04ca1242e760c45 (diff)
downloadffmpeg-01ce9d796300be815351579fe6cb343c732e36f4.tar.gz
avfilter/vf_scale: strip metadata when changing colorspace
This is no longer relevant after a change in color space.
-rw-r--r--libavfilter/vf_scale.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 77697f3f6a..566bf11cda 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -868,6 +868,18 @@ scale:
if (scale->out_transfer != -1)
out->color_trc = scale->out_transfer;
+ if (in->color_primaries != out->color_primaries ||
+ in->color_trc != out->color_trc)
+ {
+ av_frame_remove_side_data(out, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+ av_frame_remove_side_data(out, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
+ av_frame_remove_side_data(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID);
+ av_frame_remove_side_data(out, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+ av_frame_remove_side_data(out, AV_FRAME_DATA_ICC_PROFILE);
+ av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_METADATA);
+ av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_RPU_BUFFER);
+ }
+
av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
(int64_t)in->sample_aspect_ratio.num * outlink->h * link->w,
(int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,