diff mbox series

[FFmpeg-devel,3/8] avfilter/vf_alphamerge: warn if input not full range

Message ID 20231027170446.63684-3-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,1/8] swscale: fix sws_setColorspaceDetails after sws_init_context | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Niklas Haas Oct. 27, 2023, 5:04 p.m. UTC
From: Niklas Haas <git@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(+)

Comments

Michael Niedermayer Oct. 27, 2023, 9:29 p.m. UTC | #1
On Fri, Oct 27, 2023 at 07:04:41PM +0200, Niklas Haas wrote:
> From: Niklas Haas <git@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(+)

should be ok

[...]

thx
diff mbox series

Patch

diff --git a/libavfilter/vf_alphamerge.c b/libavfilter/vf_alphamerge.c
index 4bbc06da36..b814aa64f0 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!",
+               av_color_range_name(alpha_buf->color_range));
+    }
+
     if (s->is_packed_rgb) {
         int x, y;
         uint8_t *pin, *pout;