diff mbox series

[FFmpeg-devel,v2,21/32] avfilter/palettegen: add a warning about supporting only sRGB

Message ID 20221227231814.2520181-22-u@pkh.me
State Accepted
Commit 2441e53c0aeef4b0ec1453a295624a874dec7a6c
Headers show
Series [FFmpeg-devel,v2,01/32] avfilter/palettegen: allow a minimum of 2 colors | expand

Checks

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

Commit Message

Clément Bœsch Dec. 27, 2022, 11:18 p.m. UTC
---
 libavfilter/vf_palettegen.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index 3178c43ab9..ba81739d27 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -451,9 +451,13 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
     AVFilterContext *ctx = inlink->dst;
     PaletteGenContext *s = ctx->priv;
-    int ret = s->prev_frame ? update_histogram_diff(s->histogram, s->prev_frame, in)
-                            : update_histogram_frame(s->histogram, in);
+    int ret;
+
+    if (in->color_trc != AVCOL_TRC_UNSPECIFIED && in->color_trc != AVCOL_TRC_IEC61966_2_1)
+        av_log(ctx, AV_LOG_WARNING, "The input frame is not in sRGB, colors may be off\n");
 
+    ret = s->prev_frame ? update_histogram_diff(s->histogram, s->prev_frame, in)
+                        : update_histogram_frame(s->histogram, in);
     if (ret > 0)
         s->nb_refs += ret;