diff mbox series

[FFmpeg-devel,v2,03/18] lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNT

Message ID AM7PR03MB6660D041CD101338BE5648D18F5E9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,v2,01/18] avcodec/h264dec: Move find_start_code() to its only user | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 24, 2022, 8:09 p.m. UTC
From: Anton Khirnov <anton@khirnov.net>

They apparently serve the same purpose; the latter is one larger and has
a comment explaining how the value is derived, so seems more
trustworthy.
---
 libavcodec/h264_parser.c | 2 +-
 libavcodec/h264_refs.c   | 2 +-
 libavcodec/h264dec.h     | 6 ++----
 3 files changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 881cab7536..aee7cdb934 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -219,7 +219,7 @@  static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
 
     if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
         int i;
-        for (i = 0; i < MAX_MMCO_COUNT; i++) {
+        for (i = 0; i < H264_MAX_MMCO_COUNT; i++) {
             MMCOOpcode opcode = get_ue_golomb_31(gb);
             if (opcode > (unsigned) MMCO_LONG) {
                 av_log(logctx, AV_LOG_ERROR,
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index dae8bd278a..93526b11e2 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -849,7 +849,7 @@  int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb,
     } else {
         sl->explicit_ref_marking = get_bits1(gb);
         if (sl->explicit_ref_marking) {
-            for (i = 0; i < MAX_MMCO_COUNT; i++) {
+            for (i = 0; i < FF_ARRAY_ELEMS(sl->mmco); i++) {
                 MMCOOpcode opcode = get_ue_golomb_31(gb);
 
                 mmco[i].opcode = opcode;
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index dffd723ba6..38a4e96e26 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -52,8 +52,6 @@ 
 
 #define H264_MAX_PICTURE_COUNT 36
 
-#define MAX_MMCO_COUNT         66
-
 #define MAX_DELAYED_PIC_COUNT  16
 
 /* Compiling in interlaced support reduces the speed
@@ -330,7 +328,7 @@  typedef struct H264SliceContext {
     uint8_t cabac_state[1024];
     int cabac_init_idc;
 
-    MMCO mmco[MAX_MMCO_COUNT];
+    MMCO mmco[H264_MAX_MMCO_COUNT];
     int  nb_mmco;
     int explicit_ref_marking;
 
@@ -489,7 +487,7 @@  typedef struct H264Context {
     /**
      * memory management control operations buffer.
      */
-    MMCO mmco[MAX_MMCO_COUNT];
+    MMCO mmco[H264_MAX_MMCO_COUNT];
     int  nb_mmco;
     int mmco_reset;
     int explicit_ref_marking;