comparison nellymoserenc.c @ 9707:b69723e55653 libavcodec

Move a DECLARE_ALIGNED_16 variable in the Nellymoser encoder from the stack into the context to avoid issues when stack variables can not be aligned reliably.
author reimar
date Mon, 25 May 2009 12:17:02 +0000
parents 67a20f0eb42c
children 38ab367d4231
comparison
equal deleted inserted replaced
9706:473fbc242b43 9707:b69723e55653
52 int bufsel; 52 int bufsel;
53 int have_saved; 53 int have_saved;
54 DSPContext dsp; 54 DSPContext dsp;
55 MDCTContext mdct_ctx; 55 MDCTContext mdct_ctx;
56 DECLARE_ALIGNED_16(float, mdct_out[NELLY_SAMPLES]); 56 DECLARE_ALIGNED_16(float, mdct_out[NELLY_SAMPLES]);
57 DECLARE_ALIGNED_16(float, in_buff[NELLY_SAMPLES]);
57 DECLARE_ALIGNED_16(float, buf[2][3 * NELLY_BUF_LEN]); ///< sample buffer 58 DECLARE_ALIGNED_16(float, buf[2][3 * NELLY_BUF_LEN]); ///< sample buffer
58 float (*opt )[NELLY_BANDS]; 59 float (*opt )[NELLY_BANDS];
59 uint8_t (*path)[NELLY_BANDS]; 60 uint8_t (*path)[NELLY_BANDS];
60 } NellyMoserEncodeContext; 61 } NellyMoserEncodeContext;
61 62
109 static const float quant_lut_add[7] = { 0.0, 0.0, 2.0, 7.0, 21.0, 56.0, 157.0 }; 110 static const float quant_lut_add[7] = { 0.0, 0.0, 2.0, 7.0, 21.0, 56.0, 157.0 };
110 static const uint8_t quant_lut_offset[8] = { 0, 0, 1, 4, 11, 32, 81, 230 }; 111 static const uint8_t quant_lut_offset[8] = { 0, 0, 1, 4, 11, 32, 81, 230 };
111 112
112 void apply_mdct(NellyMoserEncodeContext *s) 113 void apply_mdct(NellyMoserEncodeContext *s)
113 { 114 {
114 DECLARE_ALIGNED_16(float, in_buff[NELLY_SAMPLES]); 115 memcpy(s->in_buff, s->buf[s->bufsel], NELLY_BUF_LEN * sizeof(float));
115 116 s->dsp.vector_fmul(s->in_buff, ff_sine_128, NELLY_BUF_LEN);
116 memcpy(in_buff, s->buf[s->bufsel], NELLY_BUF_LEN * sizeof(float)); 117 s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
117 s->dsp.vector_fmul(in_buff, ff_sine_128, NELLY_BUF_LEN);
118 s->dsp.vector_fmul_reverse(in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
119 NELLY_BUF_LEN); 118 NELLY_BUF_LEN);
120 ff_mdct_calc(&s->mdct_ctx, s->mdct_out, in_buff); 119 ff_mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
121 120
122 s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN); 121 s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN);
123 s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128, 122 s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128,
124 NELLY_BUF_LEN); 123 NELLY_BUF_LEN);
125 ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN); 124 ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);