diff mbox series

[FFmpeg-devel,1/4] avcodec/atrac3plus: Perform reusing of VLCs during init

Message ID 20201023205454.851696-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 5f8de7b74147e2a347481d7bc900ebecba6f340f
Headers show
Series [FFmpeg-devel,1/4] avcodec/atrac3plus: Perform reusing of VLCs during init | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 23, 2020, 8:54 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/atrac3plus.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Andreas Rheinhardt Oct. 26, 2020, 7:20 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/atrac3plus.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
> index 8d17889582..6b046a887e 100644
> --- a/libavcodec/atrac3plus.c
> +++ b/libavcodec/atrac3plus.c
> @@ -192,12 +192,12 @@ av_cold void ff_atrac3p_init_vlcs(void)
>  
>      /* build huffman tables for spectrum decoding */
>      for (i = 0; i < 112; i++) {
> -        if (atrac3p_spectra_tabs[i].cb)
> +        if (atrac3p_spectra_tabs[i].redirect < 0)
>              build_canonical_huff(atrac3p_spectra_tabs[i].cb,
>                                   atrac3p_spectra_tabs[i].xlat,
>                                   &tab_offset, &spec_vlc_tabs[i]);
> -        else
> -            spec_vlc_tabs[i].table = 0;
> +        else /* Reuse already initialized VLC table */
> +            spec_vlc_tabs[i] = spec_vlc_tabs[atrac3p_spectra_tabs[i].redirect];
>      }
>  
>      /* build huffman tables for gain data decoding */
> @@ -880,10 +880,6 @@ static void decode_spectrum(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
>                  tab_index = (chan->table_type * 8 + codetab) * 7 + wordlen - 1;
>                  tab       = &atrac3p_spectra_tabs[tab_index];
>  
> -                /* this allows reusing VLC tables */
> -                if (tab->redirect >= 0)
> -                    tab_index = tab->redirect;
> -
>                  decode_qu_spectra(gb, tab, &spec_vlc_tabs[tab_index],
>                                    &chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]],
>                                    num_specs);
> 
Will apply the rest of this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
index 8d17889582..6b046a887e 100644
--- a/libavcodec/atrac3plus.c
+++ b/libavcodec/atrac3plus.c
@@ -192,12 +192,12 @@  av_cold void ff_atrac3p_init_vlcs(void)
 
     /* build huffman tables for spectrum decoding */
     for (i = 0; i < 112; i++) {
-        if (atrac3p_spectra_tabs[i].cb)
+        if (atrac3p_spectra_tabs[i].redirect < 0)
             build_canonical_huff(atrac3p_spectra_tabs[i].cb,
                                  atrac3p_spectra_tabs[i].xlat,
                                  &tab_offset, &spec_vlc_tabs[i]);
-        else
-            spec_vlc_tabs[i].table = 0;
+        else /* Reuse already initialized VLC table */
+            spec_vlc_tabs[i] = spec_vlc_tabs[atrac3p_spectra_tabs[i].redirect];
     }
 
     /* build huffman tables for gain data decoding */
@@ -880,10 +880,6 @@  static void decode_spectrum(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
                 tab_index = (chan->table_type * 8 + codetab) * 7 + wordlen - 1;
                 tab       = &atrac3p_spectra_tabs[tab_index];
 
-                /* this allows reusing VLC tables */
-                if (tab->redirect >= 0)
-                    tab_index = tab->redirect;
-
                 decode_qu_spectra(gb, tab, &spec_vlc_tabs[tab_index],
                                   &chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]],
                                   num_specs);