Mercurial > libavcodec.hg
comparison nellymoserdec.c @ 8614:ff10b38304d2 libavcodec
Use shared sine window instead of defining another one.
author | vitor |
---|---|
date | Sat, 17 Jan 2009 20:06:08 +0000 |
parents | ef9f95604644 |
children | e49a2e1f0020 |
comparison
equal
deleted
inserted
replaced
8613:e75610c5da69 | 8614:ff10b38304d2 |
---|---|
51 DSPContext dsp; | 51 DSPContext dsp; |
52 MDCTContext imdct_ctx; | 52 MDCTContext imdct_ctx; |
53 DECLARE_ALIGNED_16(float,imdct_out[NELLY_BUF_LEN * 2]); | 53 DECLARE_ALIGNED_16(float,imdct_out[NELLY_BUF_LEN * 2]); |
54 } NellyMoserDecodeContext; | 54 } NellyMoserDecodeContext; |
55 | 55 |
56 static DECLARE_ALIGNED_16(float,sine_window[128]); | |
57 | |
58 static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *audio, float *a_in) | 56 static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *audio, float *a_in) |
59 { | 57 { |
60 int bot, top; | 58 int bot, top; |
61 | 59 |
62 bot = 0; | 60 bot = 0; |
63 top = NELLY_BUF_LEN-1; | 61 top = NELLY_BUF_LEN-1; |
64 | 62 |
65 while (bot < NELLY_BUF_LEN) { | 63 while (bot < NELLY_BUF_LEN) { |
66 audio[bot] = a_in [bot]*sine_window[bot] | 64 audio[bot] = a_in [bot]*ff_sine_128[bot] |
67 +state[bot]*sine_window[top] + s->add_bias; | 65 +state[bot]*ff_sine_128[top] + s->add_bias; |
68 | 66 |
69 bot++; | 67 bot++; |
70 top--; | 68 top--; |
71 } | 69 } |
72 memcpy(state, a_in + NELLY_BUF_LEN, sizeof(float)*NELLY_BUF_LEN); | 70 memcpy(state, a_in + NELLY_BUF_LEN, sizeof(float)*NELLY_BUF_LEN); |
142 s->add_bias = 0; | 140 s->add_bias = 0; |
143 s->scale_bias = 1.0/(1*8); | 141 s->scale_bias = 1.0/(1*8); |
144 } | 142 } |
145 | 143 |
146 /* Generate overlap window */ | 144 /* Generate overlap window */ |
147 if (!sine_window[0]) | 145 if (!ff_sine_128[127]) |
148 ff_sine_window_init(sine_window, 128); | 146 ff_sine_window_init(ff_sine_128, 128); |
149 | 147 |
150 avctx->sample_fmt = SAMPLE_FMT_S16; | 148 avctx->sample_fmt = SAMPLE_FMT_S16; |
151 avctx->channel_layout = CH_LAYOUT_MONO; | 149 avctx->channel_layout = CH_LAYOUT_MONO; |
152 return 0; | 150 return 0; |
153 } | 151 } |