History

aacdec: duplicate table initialization

Preparation to move all table init and support windowing functions.

Lynne committed 2 years ago

Commit a309aa41 parent e9fc7665 files · +57 −2Browse files

Showing the changes to libavcodec/aac (4 of 5 files). Show all

Unified · Split

4 files
  1. libavcodec/aac/aacdec.c +2 −0
  2. libavcodec/aac/aacdec_dsp_template.c +2 −0
  3. libavcodec/aac/aacdec_fixed.c +24 −2
  4. libavcodec/aac/aacdec_float.c +27 −0
libavcodec/aac/aacdec.c+2−0
@@ -120,6 +120,8 @@ av_cold int ff_aac_decode_init_common(AVCodecContext *avctx) · 119 unmodified lines
120120
121121 ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp;
122122
123+ ac->dsp.init_tables();
124+
123125 return 0;
124126 }
125127
libavcodec/aac/aacdec_dsp_template.c+2−0
@@ -311,6 +311,8 @@ static void AAC_RENAME(update_ltp)(AACDecContext *ac, SingleChannelElement *sce) · 310 unmodified lines
311311 }
312312
313313 const AACDecDSP AAC_RENAME(aac_dsp) = {
314+ .init_tables = &AAC_RENAME(init_tables),
315+
314316 .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
315317 .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
316318 .apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo),
libavcodec/aac/aacdec_fixed.c+24−2
@@ -31,12 +31,34 @@ · 30 unmodified lines
3131
3232 #define USE_FIXED 1
3333
34+#include "libavutil/thread.h"
35+
3436 #include "libavcodec/aac_defines.h"
3537
3638 #include "libavcodec/aactab.h"
3739 #include "libavcodec/sinewin_fixed_tablegen.h"
40+#include "libavcodec/kbdwin.h"
41+
42+DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024];
43+DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128];
44+DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_long_960))[960];
45+DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_short_120))[120];
46+
47+static void init_tables_fixed_fn(void)
48+{
49+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
50+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
51+
52+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
53+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
54+
55+ init_sine_windows_fixed();
56+}
3857
39−DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_long_1024))[1024];
40−DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_short_128))[128];
58+static void init_tables_fixed(void)
59+{
60+ static AVOnce init_fixed_once = AV_ONCE_INIT;
61+ ff_thread_once(&init_fixed_once, init_tables_fixed_fn);
62+}
4163
4264 #include "aacdec_dsp_template.c"
libavcodec/aac/aacdec_float.c+27−0
@@ -31,9 +31,36 @@ · 30 unmodified lines
3131
3232 #define USE_FIXED 0
3333
34+#include "libavutil/thread.h"
35+
3436 #include "libavcodec/aac_defines.h"
3537
3638 #include "libavcodec/aactab.h"
3739 #include "libavcodec/sinewin.h"
40+#include "libavcodec/kbdwin.h"
41+
42+DECLARE_ALIGNED(32, static float, sine_120)[120];
43+DECLARE_ALIGNED(32, static float, sine_960)[960];
44+DECLARE_ALIGNED(32, static float, aac_kbd_long_960)[960];
45+DECLARE_ALIGNED(32, static float, aac_kbd_short_120)[120];
46+
47+static void init_tables_float_fn(void)
48+{
49+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
50+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
51+
52+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
53+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
54+
55+ AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960);
56+ AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120);
57+ AAC_RENAME(ff_init_ff_sine_windows)(9);
58+}
59+
60+static void init_tables(void)
61+{
62+ static AVOnce init_float_once = AV_ONCE_INIT;
63+ ff_thread_once(&init_float_once, init_tables_float_fn);
64+}
3865
3966 #include "aacdec_dsp_template.c"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t