Mercurial > libavcodec.hg
comparison cook.c @ 7094:b0820b8bd4dd libavcodec
Add generic ff_sine_window_init function and implement in codecs appropriately
author | superdump |
---|---|
date | Sun, 22 Jun 2008 15:12:27 +0000 |
parents | e943e1409077 |
children | af6510f5f7e1 |
comparison
equal
deleted
inserted
replaced
7093:544da38cb2c9 | 7094:b0820b8bd4dd |
---|---|
237 | 237 |
238 if ((q->mlt_window = av_malloc(sizeof(float)*mlt_size)) == 0) | 238 if ((q->mlt_window = av_malloc(sizeof(float)*mlt_size)) == 0) |
239 return -1; | 239 return -1; |
240 | 240 |
241 /* Initialize the MLT window: simple sine window. */ | 241 /* Initialize the MLT window: simple sine window. */ |
242 alpha = M_PI / (2.0 * (float)mlt_size); | 242 ff_sine_window_init(q->mlt_window, mlt_size); |
243 for(j=0 ; j<mlt_size ; j++) | 243 for(j=0 ; j<mlt_size ; j++) |
244 q->mlt_window[j] = sin((j + 0.5) * alpha) * sqrt(2.0 / q->samples_per_channel); | 244 q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel); |
245 | 245 |
246 /* Initialize the MDCT. */ | 246 /* Initialize the MDCT. */ |
247 if (ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size)+1, 1)) { | 247 if (ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size)+1, 1)) { |
248 av_free(q->mlt_window); | 248 av_free(q->mlt_window); |
249 return -1; | 249 return -1; |