Of all these VLCs here, only VLC.table was really used after init, so use the ff_vlc_init_tables API to get rid of them.
Unified · Split
| @@ -45,11 +45,11 @@ · 44 unmodified lines | ||
| 45 | 45 | #define ASV1_LEVEL_VLC_BITS 4 |
| 46 | 46 | #define ASV2_LEVEL_VLC_BITS 10 |
| 47 | 47 | |
| 48 | −static VLC ccp_vlc; | |
| 49 | −static VLC level_vlc; | |
| 50 | −static VLC dc_ccp_vlc; | |
| 51 | −static VLC ac_ccp_vlc; | |
| 52 | −static VLC asv2_level_vlc; | |
| 48 | +static VLCElem ccp_vlc[32]; | |
| 49 | +static VLCElem level_vlc[16]; | |
| 50 | +static VLCElem dc_ccp_vlc[16]; | |
| 51 | +static VLCElem ac_ccp_vlc[64]; | |
| 52 | +static VLCElem asv2_level_vlc[1024]; | |
| 53 | 53 | |
| 54 | 54 | typedef struct ASVDecContext { |
| 55 | 55 | ASVCommonContext c; |
| @@ -67,26 +67,26 @@ typedef struct ASVDecContext { · 11 unmodified lines | ||
| 67 | 67 | |
| 68 | 68 | static av_cold void init_vlcs(void) |
| 69 | 69 | { |
| 70 | − VLC_INIT_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, | |
| 71 | − &ff_asv_ccp_tab[0][1], 2, 1, | |
| 72 | − &ff_asv_ccp_tab[0][0], 2, 1, 32); | |
| 73 | − VLC_INIT_LE_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, | |
| 74 | − &ff_asv_dc_ccp_tab[0][1], 2, 1, | |
| 75 | − &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); | |
| 76 | − VLC_INIT_LE_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, | |
| 77 | − &ff_asv_ac_ccp_tab[0][1], 2, 1, | |
| 78 | − &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); | |
| 79 | − VLC_INIT_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, | |
| 80 | − &ff_asv_level_tab[0][1], 2, 1, | |
| 81 | − &ff_asv_level_tab[0][0], 2, 1, 16); | |
| 82 | − VLC_INIT_LE_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, | |
| 83 | − &ff_asv2_level_tab[0][1], 4, 2, | |
| 84 | − &ff_asv2_level_tab[0][0], 4, 2, 1024); | |
| 70 | + VLC_INIT_STATIC_TABLE(ccp_vlc, CCP_VLC_BITS, 17, | |
| 71 | + &ff_asv_ccp_tab[0][1], 2, 1, | |
| 72 | + &ff_asv_ccp_tab[0][0], 2, 1, 0); | |
| 73 | + VLC_INIT_STATIC_TABLE(dc_ccp_vlc, DC_CCP_VLC_BITS, 8, | |
| 74 | + &ff_asv_dc_ccp_tab[0][1], 2, 1, | |
| 75 | + &ff_asv_dc_ccp_tab[0][0], 2, 1, VLC_INIT_LE); | |
| 76 | + VLC_INIT_STATIC_TABLE(ac_ccp_vlc, AC_CCP_VLC_BITS, 16, | |
| 77 | + &ff_asv_ac_ccp_tab[0][1], 2, 1, | |
| 78 | + &ff_asv_ac_ccp_tab[0][0], 2, 1, VLC_INIT_LE); | |
| 79 | + VLC_INIT_STATIC_TABLE(level_vlc, ASV1_LEVEL_VLC_BITS, 7, | |
| 80 | + &ff_asv_level_tab[0][1], 2, 1, | |
| 81 | + &ff_asv_level_tab[0][0], 2, 1, 0); | |
| 82 | + VLC_INIT_STATIC_TABLE(asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, | |
| 83 | + &ff_asv2_level_tab[0][1], 4, 2, | |
| 84 | + &ff_asv2_level_tab[0][0], 4, 2, VLC_INIT_LE); | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | static inline int asv1_get_level(GetBitContext *gb) |
| 88 | 88 | { |
| 89 | − int code = get_vlc2(gb, level_vlc.table, ASV1_LEVEL_VLC_BITS, 1); | |
| 89 | + int code = get_vlc2(gb, level_vlc, ASV1_LEVEL_VLC_BITS, 1); | |
| 90 | 90 | |
| 91 | 91 | if (code == 3) |
| 92 | 92 | return get_sbits(gb, 8); |
| @@ -115,7 +115,7 @@ static inline int asv2_get_vlc2(GetBitContext *gb, const VLCElem *table, int bit · 22 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | static inline int asv2_get_level(GetBitContext *gb) |
| 117 | 117 | { |
| 118 | − int code = asv2_get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS); | |
| 118 | + int code = asv2_get_vlc2(gb, asv2_level_vlc, ASV2_LEVEL_VLC_BITS); | |
| 119 | 119 | |
| 120 | 120 | if (code == 31) |
| 121 | 121 | return (int8_t) get_bits_le(gb, 8); |
| @@ -130,7 +130,7 @@ static inline int asv1_decode_block(ASVDecContext *a, int16_t block[64]) · 8 unmodified lines | ||
| 130 | 130 | block[0] = 8 * get_bits(&a->gb, 8); |
| 131 | 131 | |
| 132 | 132 | for (i = 0; i < 11; i++) { |
| 133 | − const int ccp = get_vlc2(&a->gb, ccp_vlc.table, CCP_VLC_BITS, 1); | |
| 133 | + const int ccp = get_vlc2(&a->gb, ccp_vlc, CCP_VLC_BITS, 1); | |
| 134 | 134 | |
| 135 | 135 | if (ccp) { |
| 136 | 136 | if (ccp == 16) |
| @@ -162,7 +162,7 @@ static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64]) · 25 unmodified lines | ||
| 162 | 162 | |
| 163 | 163 | block[0] = 8 * get_bits_le(&a->gb, 8); |
| 164 | 164 | |
| 165 | − ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc.table, DC_CCP_VLC_BITS); | |
| 165 | + ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc, DC_CCP_VLC_BITS); | |
| 166 | 166 | if (ccp) { |
| 167 | 167 | if (ccp & 4) |
| 168 | 168 | block[a->permutated_scantable[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4; |
| @@ -173,7 +173,7 @@ static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64]) · 4 unmodified lines | ||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | for (i = 1; i < count + 1; i++) { |
| 176 | − const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc.table, AC_CCP_VLC_BITS); | |
| 176 | + const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc, AC_CCP_VLC_BITS); | |
| 177 | 177 | |
| 178 | 178 | if (ccp) { |
| 179 | 179 | if (ccp & 8) |