This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 1a43cb38e1964a1da80ec06c460b16e1ed9bde74
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Tue Nov 17 15:17:51 2026 -0800
Commit:     Baptiste Coudurier <[email protected]>
CommitDate: Wed Nov 18 07:05:10 2026 +0000

    avcodec/h264_slice: skip unsupported film grain parameters at frame start
    
    Avoids allocating and copying a grain buffer for every frame, as hevc and 
vvc do.
    
    Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavcodec/h264_slice.c | 10 ++++++++++
 libavcodec/h264dec.h    |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index b5953007ba..1e28f2bdfa 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -41,6 +41,7 @@
 #include "h264data.h"
 #include "h264chroma.h"
 #include "h264_ps.h"
+#include "h274.h"
 #include "golomb.h"
 #include "mathops.h"
 #include "mpegutils.h"
@@ -445,6 +446,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
                        FF_ARRAY_ELEMS(h->delayed_pic), h, h1);
 
     h->frame_recovered       = h1->frame_recovered;
+    h->film_grain_warning_shown = h1->film_grain_warning_shown;
 
     ret = ff_h2645_sei_ctx_replace(&h->sei.common, &h1->sei.common);
     if (ret < 0)
@@ -530,6 +532,14 @@ static int h264_frame_start(H264Context *h)
         !h->avctx->hwaccel &&
         !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN);
 
+    if (pic->needs_fg &&
+        
!ff_h274_film_grain_params_supported(h->sei.common.film_grain_characteristics->model_id,
+                                             h->avctx->pix_fmt)) {
+        av_log_once(h->avctx, AV_LOG_WARNING, AV_LOG_DEBUG, 
&h->film_grain_warning_shown,
+                    "Unsupported film grain parameters. Ignoring film 
grain.\n");
+        pic->needs_fg = 0;
+    }
+
     if ((ret = alloc_picture(h, pic)) < 0)
         return ret;
 
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 7bce897021..276ea1c4a0 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -553,6 +553,8 @@ typedef struct H264Context {
 
     int has_recovery_point;
 
+    int film_grain_warning_shown;
+
     int missing_fields;
 
     /* for frame threading, this is set to 1

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to