comparison atrac1.c @ 10224:47f2b03e0c62 libavcodec

Use ff_sine_32 in atrac1.
author banan
date Tue, 22 Sep 2009 17:03:28 +0000
parents 84a9a55135f4
children d884c0b7af2f
comparison
equal deleted inserted replaced
10223:b08865f6d4e3 10224:47f2b03e0c62
80 FFTContext mdct_ctx[3]; 80 FFTContext mdct_ctx[3];
81 int channels; 81 int channels;
82 DSPContext dsp; 82 DSPContext dsp;
83 } AT1Ctx; 83 } AT1Ctx;
84 84
85 DECLARE_ALIGNED_16(static float, short_window[32]);
86
87 /** size of the transform in samples in the long mode for each QMF band */ 85 /** size of the transform in samples in the long mode for each QMF band */
88 static const uint16_t samples_per_band[3] = {128, 128, 256}; 86 static const uint16_t samples_per_band[3] = {128, 128, 256};
89 static const uint8_t mdct_long_nbits[3] = {7, 7, 8}; 87 static const uint8_t mdct_long_nbits[3] = {7, 7, 8};
90 88
91 89
132 at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos], nbits, band_num); 130 at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos], nbits, band_num);
133 pos += block_size; // move to the next mdct block in the spectrum 131 pos += block_size; // move to the next mdct block in the spectrum
134 132
135 /* overlap and window long blocks */ 133 /* overlap and window long blocks */
136 q->dsp.vector_fmul_window(q->bands[band_num], &su->spectrum[1][ref_pos + band_samples - 16], 134 q->dsp.vector_fmul_window(q->bands[band_num], &su->spectrum[1][ref_pos + band_samples - 16],
137 &su->spectrum[0][ref_pos], short_window, 0, 16); 135 &su->spectrum[0][ref_pos], ff_sine_32, 0, 16);
138 memcpy(q->bands[band_num] + 32, &su->spectrum[0][ref_pos + 16], 240 * sizeof(float)); 136 memcpy(q->bands[band_num] + 32, &su->spectrum[0][ref_pos + 16], 240 * sizeof(float));
139 } else { 137 } else {
140 /* short blocks */ 138 /* short blocks */
141 float *prev_buf; 139 float *prev_buf;
142 start_pos = 0; 140 start_pos = 0;
144 for (; num_blocks != 0; num_blocks--) { 142 for (; num_blocks != 0; num_blocks--) {
145 at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos + start_pos], 5, band_num); 143 at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos + start_pos], 5, band_num);
146 144
147 /* overlap and window between short blocks */ 145 /* overlap and window between short blocks */
148 q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf, 146 q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
149 &su->spectrum[0][ref_pos + start_pos], short_window, 0, 16); 147 &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 0, 16);
150 148
151 prev_buf = &su->spectrum[0][ref_pos+start_pos + 16]; 149 prev_buf = &su->spectrum[0][ref_pos+start_pos + 16];
152 start_pos += 32; // use hardcoded block_size 150 start_pos += 32; // use hardcoded block_size
153 pos += 32; 151 pos += 32;
154 } 152 }
340 /* Init the mdct transforms */ 338 /* Init the mdct transforms */
341 ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15)); 339 ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15));
342 ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15)); 340 ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15));
343 ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15)); 341 ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15));
344 342
345 ff_sine_window_init(short_window, 32); 343 ff_sine_window_init(ff_sine_32, 32);
346 344
347 atrac_generate_tables(); 345 atrac_generate_tables();
348 346
349 dsputil_init(&q->dsp, avctx); 347 dsputil_init(&q->dsp, avctx);
350 348