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

Git pushed a commit to branch master
in repository ffmpeg.

commit f1f8fee6aa89d4bf1f6300d3f4b86b3f0a919305
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Sep 5 03:45:52 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Sep 19 18:50:08 2026 +0000

    avcodec/decode: share the metadata-only decode check between decoders
---
 libavcodec/decode.h     | 11 +++++++++++
 libavcodec/h264_slice.c |  8 ++++----
 libavcodec/h264dec.c    |  5 +++--
 libavcodec/h264dec.h    | 11 -----------
 4 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index 215b862020..42f5e1e9df 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -77,6 +77,17 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext 
*avctx,
  */
 int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
 
+static inline int ff_decode_skip_all_pixels(const AVCodecContext *avctx)
+{
+    return avctx->skip_pred >= AVDISCARD_ALL &&
+           avctx->skip_idct >= AVDISCARD_ALL &&
+           !avctx->err_recognition &&
+           !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS) &&
+           !(avctx->export_side_data & (AV_CODEC_EXPORT_DATA_MVS |
+                                        
AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS)) &&
+           !(avctx->debug & (FF_DEBUG_QP | FF_DEBUG_MB_TYPE));
+}
+
 /**
  * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
  * try to allocate it from hw_device_ctx. If that is not possible, an error
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index cd17ed919a..c303cb33c1 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -223,7 +223,7 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
         atomic_init(pic->decode_error_flags, 0);
     }
 
-    if (CONFIG_GRAY && !h->avctx->hwaccel && 
!ff_h264_skip_all_pixels(h->avctx) &&
+    if (CONFIG_GRAY && !h->avctx->hwaccel && 
!ff_decode_skip_all_pixels(h->avctx) &&
         h->flags & AV_CODEC_FLAG_GRAY && pic->f->data[2]) {
         int h_chroma_shift, v_chroma_shift;
         av_pix_fmt_get_chroma_sub_sample(pic->f->format,
@@ -526,7 +526,7 @@ static int h264_frame_start(H264Context *h)
     pic->needs_fg =
         h->sei.common.film_grain_characteristics &&
         h->sei.common.film_grain_characteristics->present &&
-        !ff_h264_skip_all_pixels(h->avctx) &&
+        !ff_decode_skip_all_pixels(h->avctx) &&
         !h->avctx->hwaccel &&
         !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN);
 
@@ -1580,7 +1580,7 @@ static int h264_field_start(H264Context *h, const 
H264SliceContext *sl,
                 if (h->short_ref[0]->field_picture)
                     ff_thread_report_progress(&h->short_ref[0]->tf, INT_MAX, 
1);
             } else if (!h->frame_recovered) {
-                if (!h->avctx->hwaccel && !ff_h264_skip_all_pixels(h->avctx))
+                if (!h->avctx->hwaccel && !ff_decode_skip_all_pixels(h->avctx))
                     color_frame(h->short_ref[0]->f, c);
                 h->short_ref[0]->gray = 1;
             }
@@ -2888,7 +2888,7 @@ int ff_h264_execute_decode_slices(H264Context *h)
     if (h->avctx->hwaccel || context_count < 1)
         return 0;
 
-    if (ff_h264_skip_all_pixels(avctx)) {
+    if (ff_decode_skip_all_pixels(avctx)) {
         h->mb_y = h->mb_height;
         goto finish;
     }
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 7eef18de2a..c38f95f48c 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -42,6 +42,7 @@
 #include "internal.h"
 #include "error_resilience.h"
 #include "avcodec.h"
+#include "decode.h"
 #include "h264.h"
 #include "h264dec.h"
 #include "h2645_parse.h"
@@ -831,7 +832,7 @@ end:
      * causes problems for the first MB line, too.
      */
     if (!FIELD_PICTURE(h) && h->current_slice && h->enable_er &&
-        !ff_h264_skip_all_pixels(h->avctx)) {
+        !ff_decode_skip_all_pixels(h->avctx)) {
 
         H264SliceContext *sl = h->slice_ctx;
         int use_last_pic = h->last_pic_for_ec.f->buf[0] && !sl->ref_count[0];
@@ -986,7 +987,7 @@ static int finalize_frame(H264Context *h, AVFrame *dst, 
H264Picture *out, int *g
         )
             return 0;
 
-        if (!h->avctx->hwaccel && !ff_h264_skip_all_pixels(h->avctx) &&
+        if (!h->avctx->hwaccel && !ff_decode_skip_all_pixels(h->avctx) &&
             (out->field_poc[0] == INT_MAX ||
              out->field_poc[1] == INT_MAX)
            ) {
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 8ad2ccabfc..7bce897021 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -683,17 +683,6 @@ static av_always_inline int get_chroma_qp(const PPS *pps, 
int t, int qscale)
     return pps->chroma_qp_table[t][qscale];
 }
 
-static inline int ff_h264_skip_all_pixels(const AVCodecContext *avctx)
-{
-    return avctx->skip_pred >= AVDISCARD_ALL &&
-           avctx->skip_idct >= AVDISCARD_ALL &&
-           !avctx->err_recognition &&
-           !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS) &&
-           !(avctx->export_side_data & (AV_CODEC_EXPORT_DATA_MVS |
-                                        
AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS)) &&
-           !(avctx->debug & (FF_DEBUG_QP | FF_DEBUG_MB_TYPE));
-}
-
 int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup);
 
 int ff_h264_ref_picture(H264Picture *dst, const H264Picture *src);

-- 
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