diff options
author | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2009-05-20 07:26:09 +0000 |
---|---|---|
committer | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2009-05-20 07:26:09 +0000 |
commit | 373177949fa729cd5e435c535fc5aec955191b5b (patch) | |
tree | 6292d361dee9b77a57c3e60ffe5c4979f587f591 | |
parent | 7dfed8e1dce97a45f501ddedbdd69f30f09f0468 (diff) | |
download | ffmpeg-373177949fa729cd5e435c535fc5aec955191b5b.tar.gz |
Use iMDCT output scaling to simplify ffvorbis and make it slightly faster.
Originally committed as revision 18879 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/vorbis_dec.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 827619efa0..d5d2972e8a 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -210,11 +210,6 @@ static void vorbis_free(vorbis_context *vc) { av_free(vc->mappings[i].mux); } av_freep(&vc->mappings); - - if(vc->exp_bias){ - av_freep(&vc->win[0]); - av_freep(&vc->win[1]); - } } // Parse setup header ------------------------------------------------- @@ -876,16 +871,6 @@ static int vorbis_parse_id_hdr(vorbis_context *vc){ vc->win[0]=ff_vorbis_vwin[bl0-6]; vc->win[1]=ff_vorbis_vwin[bl1-6]; - if(vc->exp_bias){ - int i, j; - for(j=0; j<2; j++){ - float *win = av_malloc(vc->blocksize[j]/2 * sizeof(float)); - for(i=0; i<vc->blocksize[j]/2; i++) - win[i] = vc->win[j][i] * (1<<15); - vc->win[j] = win; - } - } - if ((get_bits1(gb)) == 0) { av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (framing flag not set). \n"); return 2; @@ -896,8 +881,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc){ vc->saved = av_mallocz((vc->blocksize[1]/4)*vc->audio_channels * sizeof(float)); vc->previous_window=0; - ff_mdct_init(&vc->mdct[0], bl0, 1, -1.0); - ff_mdct_init(&vc->mdct[1], bl1, 1, -1.0); + ff_mdct_init(&vc->mdct[0], bl0, 1, vc->exp_bias ? -(1<<15) : -1.0); + ff_mdct_init(&vc->mdct[1], bl1, 1, vc->exp_bias ? -(1<<15) : -1.0); AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ", vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]); @@ -1410,8 +1395,7 @@ static void copy_normalize(float *dst, float *src, int len, int exp_bias, float { int i; if(exp_bias) { - for(i=0; i<len; i++) - ((uint32_t*)dst)[i] = ((uint32_t*)src)[i] + exp_bias; // dst[k]=src[i]*(1<<bias) + memcpy(dst, src, len * sizeof(float)); } else { for(i=0; i<len; i++) dst[i] = src[i] + add_bias; |