Everything besides VLC.table is basically write-only and even VLC.table can be removed by accessing the underlying table directly.
Unified · Split
| @@ -71,10 +71,10 @@ static const uint8_t unscaled_quant_matrix[64] = { · 70 unmodified lines | |||
| 71 | 27, 29, 35, 38, 46, 56, 69, 83 | 71 | 27, 29, 35, 38, 46, 56, 69, 83 |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | static VLC dc_lum_vlc_le; | 74 | static VLCElem dc_lum_vlc_le[512]; |
| 75 | static VLC dc_chroma_vlc_le; | 75 | static VLCElem dc_chroma_vlc_le[514]; |
| 76 | static VLC dc_alpha_run_vlc_le; | 76 | static VLCElem dc_alpha_run_vlc_le[160]; |
| 77 | static VLC dc_alpha_level_vlc_le; | 77 | static VLCElem dc_alpha_level_vlc_le[288]; |
| 78 | 78 | ||
| 79 | static RL_VLC_ELEM speedhq_rl_vlc[674]; | 79 | static RL_VLC_ELEM speedhq_rl_vlc[674]; |
| 80 | 80 | ||
| @@ -83,9 +83,9 @@ static inline int decode_dc_le(GetBitContext *gb, int component) · 2 unmodified lines | |||
| 83 | int code, diff; | 83 | int code, diff; |
| 84 | 84 | ||
| 85 | if (component == 0 || component == 3) { | 85 | if (component == 0 || component == 3) { |
| 86 | code = get_vlc2(gb, dc_lum_vlc_le.table, DC_VLC_BITS, 2); | 86 | code = get_vlc2(gb, dc_lum_vlc_le, DC_VLC_BITS, 2); |
| 87 | } else { | 87 | } else { |
| 88 | code = get_vlc2(gb, dc_chroma_vlc_le.table, DC_VLC_BITS, 2); | 88 | code = get_vlc2(gb, dc_chroma_vlc_le, DC_VLC_BITS, 2); |
| 89 | } | 89 | } |
| 90 | if (!code) { | 90 | if (!code) { |
| 91 | diff = 0; | 91 | diff = 0; |
| @@ -109,7 +109,7 @@ static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uin · 17 unmodified lines | |||
| 109 | int run, level; | 109 | int run, level; |
| 110 | 110 | ||
| 111 | UPDATE_CACHE_LE(re, gb); | 111 | UPDATE_CACHE_LE(re, gb); |
| 112 | GET_VLC(run, re, gb, dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2); | 112 | GET_VLC(run, re, gb, dc_alpha_run_vlc_le, ALPHA_VLC_BITS, 2); |
| 113 | 113 | ||
| 114 | if (run < 0) break; | 114 | if (run < 0) break; |
| 115 | i += run; | 115 | i += run; |
| @@ -117,7 +117,7 @@ static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uin · 1 unmodified line | |||
| 117 | return AVERROR_INVALIDDATA; | 117 | return AVERROR_INVALIDDATA; |
| 118 | 118 | ||
| 119 | UPDATE_CACHE_LE(re, gb); | 119 | UPDATE_CACHE_LE(re, gb); |
| 120 | GET_VLC(level, re, gb, dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2); | 120 | GET_VLC(level, re, gb, dc_alpha_level_vlc_le, ALPHA_VLC_BITS, 2); |
| 121 | block[i++] = level; | 121 | block[i++] = level; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| @@ -506,11 +506,11 @@ static av_cold void compute_alpha_vlcs(void) · 382 unmodified lines | |||
| 506 | 506 | ||
| 507 | av_assert0(entry == FF_ARRAY_ELEMS(run_code)); | 507 | av_assert0(entry == FF_ARRAY_ELEMS(run_code)); |
| 508 | 508 | ||
| 509 | VLC_INIT_LE_SPARSE_STATIC(&dc_alpha_run_vlc_le, ALPHA_VLC_BITS, | 509 | VLC_INIT_STATIC_SPARSE_TABLE(dc_alpha_run_vlc_le, ALPHA_VLC_BITS, |
| 510 | FF_ARRAY_ELEMS(run_code), | 510 | FF_ARRAY_ELEMS(run_code), |
| 511 | run_bits, 1, 1, | 511 | run_bits, 1, 1, |
| 512 | run_code, 2, 2, | 512 | run_code, 2, 2, |
| 513 | run_symbols, 2, 2, 160); | 513 | run_symbols, 2, 2, VLC_INIT_LE); |
| 514 | 514 | ||
| 515 | /* Initialize VLC for alpha level. */ | 515 | /* Initialize VLC for alpha level. */ |
| 516 | entry = 0; | 516 | entry = 0; |
| @@ -546,24 +546,24 @@ static av_cold void compute_alpha_vlcs(void) · 29 unmodified lines | |||
| 546 | 546 | ||
| 547 | av_assert0(entry == FF_ARRAY_ELEMS(level_code)); | 547 | av_assert0(entry == FF_ARRAY_ELEMS(level_code)); |
| 548 | 548 | ||
| 549 | VLC_INIT_LE_SPARSE_STATIC(&dc_alpha_level_vlc_le, ALPHA_VLC_BITS, | 549 | VLC_INIT_STATIC_SPARSE_TABLE(dc_alpha_level_vlc_le, ALPHA_VLC_BITS, |
| 550 | FF_ARRAY_ELEMS(level_code), | 550 | FF_ARRAY_ELEMS(level_code), |
| 551 | level_bits, 1, 1, | 551 | level_bits, 1, 1, |
| 552 | level_code, 2, 2, | 552 | level_code, 2, 2, |
| 553 | level_symbols, 2, 2, 288); | 553 | level_symbols, 2, 2, VLC_INIT_LE); |
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | static av_cold void speedhq_static_init(void) | 556 | static av_cold void speedhq_static_init(void) |
| 557 | { | 557 | { |
| 558 | /* Exactly the same as MPEG-2, except for a little-endian reader. */ | 558 | /* Exactly the same as MPEG-2, except for a little-endian reader. */ |
| 559 | VLC_INIT_CUSTOM_STATIC(&dc_lum_vlc_le, DC_VLC_BITS, 12, | 559 | VLC_INIT_STATIC_TABLE(dc_lum_vlc_le, DC_VLC_BITS, 12, |
| 560 | ff_mpeg12_vlc_dc_lum_bits, 1, 1, | 560 | ff_mpeg12_vlc_dc_lum_bits, 1, 1, |
| 561 | ff_mpeg12_vlc_dc_lum_code, 2, 2, | 561 | ff_mpeg12_vlc_dc_lum_code, 2, 2, |
| 562 | VLC_INIT_OUTPUT_LE, 512); | 562 | VLC_INIT_OUTPUT_LE); |
| 563 | VLC_INIT_CUSTOM_STATIC(&dc_chroma_vlc_le, DC_VLC_BITS, 12, | 563 | VLC_INIT_STATIC_TABLE(dc_chroma_vlc_le, DC_VLC_BITS, 12, |
| 564 | ff_mpeg12_vlc_dc_chroma_bits, 1, 1, | 564 | ff_mpeg12_vlc_dc_chroma_bits, 1, 1, |
| 565 | ff_mpeg12_vlc_dc_chroma_code, 2, 2, | 565 | ff_mpeg12_vlc_dc_chroma_code, 2, 2, |
| 566 | VLC_INIT_OUTPUT_LE, 514); | 566 | VLC_INIT_OUTPUT_LE); |
| 567 | 567 | ||
| 568 | ff_init_2d_vlc_rl(ff_speedhq_vlc_table, speedhq_rl_vlc, ff_speedhq_run, | 568 | ff_init_2d_vlc_rl(ff_speedhq_vlc_table, speedhq_rl_vlc, ff_speedhq_run, |
| 569 | ff_speedhq_level, SPEEDHQ_RL_NB_ELEMS, | 569 | ff_speedhq_level, SPEEDHQ_RL_NB_ELEMS, |