diff mbox series

[FFmpeg-devel,03/13] lavc/h264dec.h: move find_start_code and MMCOOpcode to h264_parse.h

Message ID 20220124170014.17189-3-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/13] lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNT | expand

Commit Message

Anton Khirnov Jan. 24, 2022, 5 p.m. UTC
Both parser and decoder use these, so h264_parse is the proper place for
them.
---
 libavcodec/h264_parse.h | 28 ++++++++++++++++++++++++++++
 libavcodec/h264dec.h    | 23 -----------------------
 2 files changed, 28 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h
index 4d01620125..9f329db77a 100644
--- a/libavcodec/h264_parse.h
+++ b/libavcodec/h264_parse.h
@@ -24,8 +24,26 @@ 
 #ifndef AVCODEC_H264_PARSE_H
 #define AVCODEC_H264_PARSE_H
 
+#include <stdint.h>
+
+#include "libavutil/common.h"
+
 #include "get_bits.h"
 #include "h264_ps.h"
+#include "internal.h"
+
+/**
+ * Memory management control operation opcode.
+ */
+typedef enum MMCOOpcode {
+    MMCO_END = 0,
+    MMCO_SHORT2UNUSED,
+    MMCO_LONG2UNUSED,
+    MMCO_SHORT2LONG,
+    MMCO_SET_MAX_LONG,
+    MMCO_RESET,
+    MMCO_LONG,
+} MMCOOpcode;
 
 typedef struct H264PredWeightTable {
     int use_weight;
@@ -90,4 +108,14 @@  int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps,
  */
 int ff_h264_get_profile(const SPS *sps);
 
+static inline int find_start_code(const uint8_t *buf, int buf_size,
+                                  int buf_index, int next_avc)
+{
+    uint32_t state = -1;
+
+    buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1;
+
+    return FFMIN(buf_index, buf_size);
+}
+
 #endif /* AVCODEC_H264_PARSE_H */
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index ca3001ec4b..1e1f84ef33 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -103,19 +103,6 @@ 
 #define IS_REF0(a)         ((a) & MB_TYPE_REF0)
 #define IS_8x8DCT(a)       ((a) & MB_TYPE_8x8DCT)
 
-/**
- * Memory management control operation opcode.
- */
-typedef enum MMCOOpcode {
-    MMCO_END = 0,
-    MMCO_SHORT2UNUSED,
-    MMCO_LONG2UNUSED,
-    MMCO_SHORT2LONG,
-    MMCO_SET_MAX_LONG,
-    MMCO_RESET,
-    MMCO_LONG,
-} MMCOOpcode;
-
 /**
  * Memory management control operation.
  */
@@ -831,16 +818,6 @@  static av_always_inline int get_dct8x8_allowed(const H264Context *h, H264SliceCo
                   0x0001000100010001ULL));
 }
 
-static inline int find_start_code(const uint8_t *buf, int buf_size,
-                           int buf_index, int next_avc)
-{
-    uint32_t state = -1;
-
-    buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1;
-
-    return FFMIN(buf_index, buf_size);
-}
-
 int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup);
 
 int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src);