[FFmpeg-devel] [PATCH v3 5/8] avfilter/vf_alphamerge: warn if input not full range

Niklas Haas ffmpeg at haasn.xyz
Tue Oct 31 16:54:47 EET 2023


From: Niklas Haas <git at haasn.dev>

Alpha planes must always be full range, so complain loudly if fed
limited range grayscale input.
---
 libavfilter/vf_alphamerge.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/vf_alphamerge.c b/libavfilter/vf_alphamerge.c
index 4bbc06da36..a5f5baf77e 100644
--- a/libavfilter/vf_alphamerge.c
+++ b/libavfilter/vf_alphamerge.c
@@ -60,6 +60,12 @@ static int do_alphamerge(FFFrameSync *fs)
     if (!alpha_buf)
         return ff_filter_frame(ctx->outputs[0], main_buf);
 
+    if (alpha_buf->color_range == AVCOL_RANGE_MPEG) {
+        av_log(ctx, AV_LOG_WARNING, "alpha plane color range tagged as %s, "
+               "output will be wrong!\n",
+               av_color_range_name(alpha_buf->color_range));
+    }
+
     if (s->is_packed_rgb) {
         int x, y;
         uint8_t *pin, *pout;
-- 
2.42.0



More information about the ffmpeg-devel mailing list