[FFmpeg-devel] [PATCH 11/17] avcodec/mpeg12: Use ff_rl_mpeg1.table_(run|level) directly

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Oct 23 22:36:04 EEST 2022


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/mpeg12.c     | 8 ++++----
 libavcodec/mpeg12data.c | 8 ++++----
 libavcodec/mpeg12vlc.h  | 3 +++
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 282e473700..b0e638bfcd 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -152,11 +152,11 @@ static av_cold void mpeg12_init_vlcs(void)
                     &table_mb_btype[0][1], 2, 1,
                     &table_mb_btype[0][0], 2, 1, 64);
 
-    ff_init_2d_vlc_rl(ff_mpeg1_vlc_table, ff_mpeg1_rl_vlc, ff_rl_mpeg1.table_run,
-                      ff_rl_mpeg1.table_level, ff_rl_mpeg1.n,
+    ff_init_2d_vlc_rl(ff_mpeg1_vlc_table, ff_mpeg1_rl_vlc, ff_mpeg12_run,
+                      ff_mpeg12_level, MPEG12_RL_NB_ELEMS,
                       FF_ARRAY_ELEMS(ff_mpeg1_rl_vlc), 0);
-    ff_init_2d_vlc_rl(ff_mpeg2_vlc_table, ff_mpeg2_rl_vlc, ff_rl_mpeg1.table_run,
-                      ff_rl_mpeg1.table_level, ff_rl_mpeg1.n,
+    ff_init_2d_vlc_rl(ff_mpeg2_vlc_table, ff_mpeg2_rl_vlc, ff_mpeg12_run,
+                      ff_mpeg12_level, MPEG12_RL_NB_ELEMS,
                       FF_ARRAY_ELEMS(ff_mpeg2_rl_vlc), 0);
 }
 
diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c
index 5803999153..1e3410bf2f 100644
--- a/libavcodec/mpeg12data.c
+++ b/libavcodec/mpeg12data.c
@@ -130,7 +130,7 @@ const uint16_t ff_mpeg2_vlc_table[MPEG12_RL_NB_ELEMS + 2][2] = {
   {0x06,4}, /* EOB */
 };
 
-static const int8_t mpeg1_level[111] = {
+const int8_t ff_mpeg12_level[MPEG12_RL_NB_ELEMS] = {
   1,  2,  3,  4,  5,  6,  7,  8,
   9, 10, 11, 12, 13, 14, 15, 16,
  17, 18, 19, 20, 21, 22, 23, 24,
@@ -147,7 +147,7 @@ static const int8_t mpeg1_level[111] = {
   1,  1,  1,  1,  1,  1,  1,
 };
 
-static const int8_t mpeg1_run[111] = {
+const int8_t ff_mpeg12_run[MPEG12_RL_NB_ELEMS] = {
   0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,
@@ -168,8 +168,8 @@ RLTable ff_rl_mpeg1 = {
     111,
     111,
     ff_mpeg1_vlc_table,
-    mpeg1_run,
-    mpeg1_level,
+    ff_mpeg12_run,
+    ff_mpeg12_level,
 };
 
 const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] = {
diff --git a/libavcodec/mpeg12vlc.h b/libavcodec/mpeg12vlc.h
index 71027d468f..15275c5269 100644
--- a/libavcodec/mpeg12vlc.h
+++ b/libavcodec/mpeg12vlc.h
@@ -54,6 +54,9 @@ void ff_mpeg12_init_vlcs(void);
 
 extern RLTable ff_rl_mpeg1;
 
+extern const int8_t ff_mpeg12_level[MPEG12_RL_NB_ELEMS];
+extern const int8_t ff_mpeg12_run[MPEG12_RL_NB_ELEMS];
+
 extern const uint16_t ff_mpeg1_vlc_table[MPEG12_RL_NB_ELEMS + 2][2];
 extern const uint16_t ff_mpeg2_vlc_table[MPEG12_RL_NB_ELEMS + 2][2];
 
-- 
2.34.1



More information about the ffmpeg-devel mailing list