[FFmpeg-devel] [PATCH v2 7/8] avfilter/vf_colorspace: strip color volume metadata

Niklas Haas ffmpeg at haasn.xyz
Wed Dec 4 16:51:08 EET 2024


From: Niklas Haas <git at haasn.dev>

---
 libavfilter/vf_colorspace.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 62055aa1bf..ea0d470bd7 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -25,6 +25,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/csp.h"
+#include "libavutil/frame.h"
 #include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/opt.h"
@@ -750,6 +751,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
     } else {
         out->color_trc   = s->user_trc;
     }
+
+    if (out->color_primaries != in->color_primaries || out->color_trc != in->color_trc)
+        av_frame_remove_side_data_by_props(out, AV_SIDE_DATA_PROP_COLOR_DEPENDENT);
+
     if (rgb_sz != s->rgb_sz) {
         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(out->format);
         int uvw = in->width >> desc->log2_chroma_w;
-- 
2.47.0



More information about the ffmpeg-devel mailing list