avcodec/aacps_common: Avoid superfluous VLC structures

For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-09-26 18:01:07 +02:00
parent 4fe91e3676
commit eb422c606a
1 changed files with 8 additions and 6 deletions

View File

@ -58,7 +58,7 @@ static const int huff_iid[] = {
huff_iid_dt1,
};
static VLC vlc_ps[10];
static const VLCElem *vlc_ps[10];
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION, NB_BITS, MAX_DEPTH) \
/** \
@ -77,7 +77,7 @@ static int read_ ## PAR ## _data(void *logctx, GetBitContext *gb, PSCommonContex
int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
{ \
int b, num = ps->nr_ ## PAR ## _par; \
const VLCElem *vlc_table = vlc_ps[table_idx].table; \
const VLCElem *vlc_table = vlc_ps[table_idx]; \
if (dt) { \
int e_prev = e ? e - 1 : ps->num_env_old - 1; \
e_prev = FFMAX(e_prev, 0); \
@ -289,16 +289,18 @@ err:
}
#define PS_INIT_VLC_STATIC(num, nb_bits, size) \
VLC_INIT_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
ps_tmp[num].ps_bits, 1, 1, \
ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
size);
vlc_ps[num] = ff_vlc_init_tables(&state, nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
ps_tmp[num].ps_bits, 1, 1, \
ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, 0);
#define PS_VLC_ROW(name) \
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
av_cold void ff_ps_init_common(void)
{
static VLCElem vlc_buf[(1544 + 832 + 1024 + 1036) +
(544 + 544) + (32 + 32 + 32 + 32)];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
// Syntax initialization
static const struct {
const void *ps_codes, *ps_bits;