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

Unified · Split

5 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
  5. libavcodec/aacdec.h +2 −0
libavcodec/aac/aacdec.c+2−0
@@ -120,6 +120,8 @@ av_cold int ff_aac_decode_init_common(AVCodecContext *avctx) · 119 unmodified lines
120 120
121 ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp;121 ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp;
122 122
123 ac->dsp.init_tables();
124
123 return 0;125 return 0;
124}126}
125 127
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
311}311}
312 312
313const AACDecDSP AAC_RENAME(aac_dsp) = {313const AACDecDSP AAC_RENAME(aac_dsp) = {
314 .init_tables = &AAC_RENAME(init_tables),
315
314 .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),316 .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
315 .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),317 .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
316 .apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo),318 .apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo),
libavcodec/aac/aacdec_fixed.c+24−2
@@ -31,12 +31,34 @@ · 30 unmodified lines
31 31
32#define USE_FIXED 132#define USE_FIXED 1
33 33
34#include "libavutil/thread.h"
35
34#include "libavcodec/aac_defines.h"36#include "libavcodec/aac_defines.h"
35 37
36#include "libavcodec/aactab.h"38#include "libavcodec/aactab.h"
37#include "libavcodec/sinewin_fixed_tablegen.h"39#include "libavcodec/sinewin_fixed_tablegen.h"
40#include "libavcodec/kbdwin.h"
41
42DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024];
43DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128];
44DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_long_960))[960];
45DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_short_120))[120];
46
47static 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}
38 57
39DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_long_1024))[1024];58static void init_tables_fixed(void)
40DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_short_128))[128];59{
60 static AVOnce init_fixed_once = AV_ONCE_INIT;
61 ff_thread_once(&init_fixed_once, init_tables_fixed_fn);
62}
41 63
42#include "aacdec_dsp_template.c"64#include "aacdec_dsp_template.c"
libavcodec/aac/aacdec_float.c+27−0
@@ -31,9 +31,36 @@ · 30 unmodified lines
31 31
32#define USE_FIXED 032#define USE_FIXED 0
33 33
34#include "libavutil/thread.h"
35
34#include "libavcodec/aac_defines.h"36#include "libavcodec/aac_defines.h"
35 37
36#include "libavcodec/aactab.h"38#include "libavcodec/aactab.h"
37#include "libavcodec/sinewin.h"39#include "libavcodec/sinewin.h"
40#include "libavcodec/kbdwin.h"
41
42DECLARE_ALIGNED(32, static float, sine_120)[120];
43DECLARE_ALIGNED(32, static float, sine_960)[960];
44DECLARE_ALIGNED(32, static float, aac_kbd_long_960)[960];
45DECLARE_ALIGNED(32, static float, aac_kbd_short_120)[120];
46
47static 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
60static 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}
38 65
39#include "aacdec_dsp_template.c"66#include "aacdec_dsp_template.c"
libavcodec/aacdec.h+2−0
@@ -204,6 +204,8 @@ typedef struct DynamicRangeControl { · 203 unmodified lines
204 * DSP-specific primitives204 * DSP-specific primitives
205 */205 */
206typedef struct AACDecDSP {206typedef struct AACDecDSP {
207 void (*init_tables)(void);
208
207 void (*dequant_scalefactors)(SingleChannelElement *sce);209 void (*dequant_scalefactors)(SingleChannelElement *sce);
208 210
209 void (*apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe);211 void (*apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe);

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