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