aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-02 18:48:39 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-20 18:58:38 +0200
commit0876b160d6d9fd4c960585927c4381baaffb15ad (patch)
tree5132bf162124fad8bc242f2235492502fed95b76
parent4cdd684e86136c42719632cbdcc7647d0f60f87f (diff)
downloadffmpeg-0876b160d6d9fd4c960585927c4381baaffb15ad.tar.gz
avcodec/h261dec: Use VLC symbol table
This is possible now that MB_TYPE_CBP and MB_TYPE_QUANT fit into an int16_t; only MB_TYPE_H261_FIL needs to be remapped to MB_TYPE_CODEC_SPECIFIC. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/h261.h5
-rw-r--r--libavcodec/h261data.c2
-rw-r--r--libavcodec/h261dec.c9
3 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/h261.h b/libavcodec/h261.h
index 67c362be93..11a8a8685a 100644
--- a/libavcodec/h261.h
+++ b/libavcodec/h261.h
@@ -28,6 +28,7 @@
#ifndef AVCODEC_H261_H
#define AVCODEC_H261_H
+#include "mpegutils.h"
#include "mpegvideo.h"
#include "rl.h"
@@ -38,13 +39,13 @@ typedef struct H261Context {
int mtype;
} H261Context;
-#define MB_TYPE_H261_FIL 0x800000
+#define MB_TYPE_H261_FIL MB_TYPE_CODEC_SPECIFIC
extern const uint8_t ff_h261_mba_code[35];
extern const uint8_t ff_h261_mba_bits[35];
extern const uint8_t ff_h261_mtype_code[10];
extern const uint8_t ff_h261_mtype_bits[10];
-extern const int ff_h261_mtype_map[10];
+extern const uint16_t ff_h261_mtype_map[10];
extern const uint8_t ff_h261_mv_tab[17][2];
extern const uint8_t ff_h261_cbp_tab[63][2];
extern RLTable ff_h261_rl_tcoeff;
diff --git a/libavcodec/h261data.c b/libavcodec/h261data.c
index a9891edd0a..bccd9e5f56 100644
--- a/libavcodec/h261data.c
+++ b/libavcodec/h261data.c
@@ -72,7 +72,7 @@ const uint8_t ff_h261_mtype_bits[10] = {
2, 6
};
-const int ff_h261_mtype_map[10] = {
+const uint16_t ff_h261_mtype_map[10] = {
MB_TYPE_INTRA4x4,
MB_TYPE_INTRA4x4 | MB_TYPE_QUANT,
MB_TYPE_CBP,
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 392f1aef1d..05279b9ec5 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -67,9 +67,10 @@ static av_cold void h261_decode_init_static(void)
VLC_INIT_STATIC_TABLE(h261_mba_vlc, H261_MBA_VLC_BITS, 35,
ff_h261_mba_bits, 1, 1,
ff_h261_mba_code, 1, 1, 0);
- VLC_INIT_STATIC_TABLE(h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
- ff_h261_mtype_bits, 1, 1,
- ff_h261_mtype_code, 1, 1, 0);
+ VLC_INIT_STATIC_SPARSE_TABLE(h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
+ ff_h261_mtype_bits, 1, 1,
+ ff_h261_mtype_code, 1, 1,
+ ff_h261_mtype_map, 2, 2, 0);
VLC_INIT_STATIC_TABLE(h261_mv_vlc, H261_MV_VLC_BITS, 17,
&ff_h261_mv_tab[0][1], 2, 1,
&ff_h261_mv_tab[0][0], 2, 1, 0);
@@ -418,8 +419,6 @@ static int h261_decode_mb(H261DecContext *h)
com->mtype);
return SLICE_ERROR;
}
- av_assert0(com->mtype < FF_ARRAY_ELEMS(ff_h261_mtype_map));
- com->mtype = ff_h261_mtype_map[com->mtype];
// Read mquant
if (IS_QUANT(com->mtype))