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>
This commit is contained in:
Andreas Rheinhardt 2024-06-02 18:48:39 +02:00
parent 4cdd684e86
commit 0876b160d6
3 changed files with 8 additions and 8 deletions

View File

@ -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;

View File

@ -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,

View File

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