Commit 9adcccde authored by Reimar Döffinger's avatar Reimar Döffinger

mpegaudiodec, mpc and qdm2 all use the same mpa_synth window, so make

them use the same variable/global storage.
Saves 4 kB in .bss.

Originally committed as revision 20314 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8767fb4c
...@@ -33,11 +33,9 @@ ...@@ -33,11 +33,9 @@
#include "mpc.h" #include "mpc.h"
#include "mpcdata.h" #include "mpcdata.h"
static DECLARE_ALIGNED_16(MPA_INT, mpa_window[512]);
void ff_mpc_init(void) void ff_mpc_init(void)
{ {
ff_mpa_synth_init(mpa_window); ff_mpa_synth_init(ff_mpa_synth_window);
} }
/** /**
...@@ -53,7 +51,7 @@ static void mpc_synth(MPCContext *c, int16_t *out) ...@@ -53,7 +51,7 @@ static void mpc_synth(MPCContext *c, int16_t *out)
samples_ptr = samples + ch; samples_ptr = samples + ch;
for(i = 0; i < SAMPLES_PER_BAND; i++) { for(i = 0; i < SAMPLES_PER_BAND; i++) {
ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
mpa_window, &dither_state, ff_mpa_synth_window, &dither_state,
samples_ptr, 2, samples_ptr, 2,
c->sb_samples[ch][i]); c->sb_samples[ch][i]);
samples_ptr += 64; samples_ptr += 64;
......
...@@ -137,6 +137,7 @@ typedef struct HuffTable { ...@@ -137,6 +137,7 @@ typedef struct HuffTable {
int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf); int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate); int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
extern MPA_INT ff_mpa_synth_window[];
void ff_mpa_synth_init(MPA_INT *window); void ff_mpa_synth_init(MPA_INT *window);
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
MPA_INT *window, int *dither_state, MPA_INT *window, int *dither_state,
......
...@@ -120,7 +120,7 @@ static const int32_t scale_factor_mult2[3][3] = { ...@@ -120,7 +120,7 @@ static const int32_t scale_factor_mult2[3][3] = {
SCALE_GEN(4.0 / 9.0), /* 9 steps */ SCALE_GEN(4.0 / 9.0), /* 9 steps */
}; };
static DECLARE_ALIGNED_16(MPA_INT, window[512]); DECLARE_ALIGNED_16(MPA_INT, ff_mpa_synth_window[512]);
/** /**
* Convert region offsets to region sizes and truncate * Convert region offsets to region sizes and truncate
...@@ -351,7 +351,7 @@ static av_cold int decode_init(AVCodecContext * avctx) ...@@ -351,7 +351,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
scale_factor_mult[i][2]); scale_factor_mult[i][2]);
} }
ff_mpa_synth_init(window); ff_mpa_synth_init(ff_mpa_synth_window);
/* huffman decode tables */ /* huffman decode tables */
offset = 0; offset = 0;
...@@ -2238,7 +2238,7 @@ static int mp_decode_frame(MPADecodeContext *s, ...@@ -2238,7 +2238,7 @@ static int mp_decode_frame(MPADecodeContext *s,
samples_ptr = samples + ch; samples_ptr = samples + ch;
for(i=0;i<nb_frames;i++) { for(i=0;i<nb_frames;i++) {
ff_mpa_synth_filter(s->synth_buf[ch], &(s->synth_buf_offset[ch]), ff_mpa_synth_filter(s->synth_buf[ch], &(s->synth_buf_offset[ch]),
window, &s->dither_state, ff_mpa_synth_window, &s->dither_state,
samples_ptr, s->nb_channels, samples_ptr, s->nb_channels,
s->sb_samples[ch][i]); s->sb_samples[ch][i]);
samples_ptr += 32 * s->nb_channels; samples_ptr += 32 * s->nb_channels;
......
...@@ -219,8 +219,6 @@ static uint8_t random_dequant_index[256][5]; ...@@ -219,8 +219,6 @@ static uint8_t random_dequant_index[256][5];
static uint8_t random_dequant_type24[128][3]; static uint8_t random_dequant_type24[128][3];
static float noise_samples[128]; static float noise_samples[128];
static DECLARE_ALIGNED_16(MPA_INT, mpa_window[512]);
static av_cold void softclip_table_init(void) { static av_cold void softclip_table_init(void) {
int i; int i;
...@@ -1684,7 +1682,7 @@ static void qdm2_synthesis_filter (QDM2Context *q, int index) ...@@ -1684,7 +1682,7 @@ static void qdm2_synthesis_filter (QDM2Context *q, int index)
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
ff_mpa_synth_filter(q->synth_buf[ch], &(q->synth_buf_offset[ch]), ff_mpa_synth_filter(q->synth_buf[ch], &(q->synth_buf_offset[ch]),
mpa_window, &dither_state, ff_mpa_synth_window, &dither_state,
samples_ptr, q->nb_channels, samples_ptr, q->nb_channels,
q->sb_samples[ch][(8 * index) + i]); q->sb_samples[ch][(8 * index) + i]);
samples_ptr += 32 * q->nb_channels; samples_ptr += 32 * q->nb_channels;
...@@ -1713,7 +1711,7 @@ static av_cold void qdm2_init(QDM2Context *q) { ...@@ -1713,7 +1711,7 @@ static av_cold void qdm2_init(QDM2Context *q) {
initialized = 1; initialized = 1;
qdm2_init_vlc(); qdm2_init_vlc();
ff_mpa_synth_init(mpa_window); ff_mpa_synth_init(ff_mpa_synth_window);
softclip_table_init(); softclip_table_init();
rnd_table_init(); rnd_table_init();
init_noise_samples(); init_noise_samples();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment