Unified · Split
| @@ -192,12 +192,12 @@ av_cold void ff_atrac3p_init_vlcs(void) · 191 unmodified lines | |||
| 192 | 192 | ||
| 193 | /* build huffman tables for spectrum decoding */ | 193 | /* build huffman tables for spectrum decoding */ |
| 194 | for (i = 0; i < 112; i++) { | 194 | for (i = 0; i < 112; i++) { |
| 195 | if (atrac3p_spectra_tabs[i].cb) | 195 | if (atrac3p_spectra_tabs[i].redirect < 0) |
| 196 | build_canonical_huff(atrac3p_spectra_tabs[i].cb, | 196 | build_canonical_huff(atrac3p_spectra_tabs[i].cb, |
| 197 | atrac3p_spectra_tabs[i].xlat, | 197 | atrac3p_spectra_tabs[i].xlat, |
| 198 | &tab_offset, &spec_vlc_tabs[i]); | 198 | &tab_offset, &spec_vlc_tabs[i]); |
| 199 | else | 199 | else /* Reuse already initialized VLC table */ |
| 200 | spec_vlc_tabs[i].table = 0; | 200 | spec_vlc_tabs[i] = spec_vlc_tabs[atrac3p_spectra_tabs[i].redirect]; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | /* build huffman tables for gain data decoding */ | 203 | /* build huffman tables for gain data decoding */ |
| @@ -880,10 +880,6 @@ static void decode_spectrum(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, · 676 unmodified lines | |||
| 880 | tab_index = (chan->table_type * 8 + codetab) * 7 + wordlen - 1; | 880 | tab_index = (chan->table_type * 8 + codetab) * 7 + wordlen - 1; |
| 881 | tab = &atrac3p_spectra_tabs[tab_index]; | 881 | tab = &atrac3p_spectra_tabs[tab_index]; |
| 882 | 882 | ||
| 883 | /* this allows reusing VLC tables */ | ||
| 884 | if (tab->redirect >= 0) | ||
| 885 | tab_index = tab->redirect; | ||
| 886 | |||
| 887 | decode_qu_spectra(gb, tab, &spec_vlc_tabs[tab_index], | 883 | decode_qu_spectra(gb, tab, &spec_vlc_tabs[tab_index], |
| 888 | &chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]], | 884 | &chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]], |
| 889 | num_specs); | 885 | num_specs); |