From 88db1a15c54a69407e791636cfea1d02bed52152 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Thu, 10 Aug 2006 21:55:31 +0000 Subject: [PATCH] misc tweaks in vorbis_residue_decode(). 4% faster vorbis. Originally committed as revision 5977 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/vorbis.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c index 97214a6306..2a8d608b7e 100644 --- a/libavcodec/vorbis.c +++ b/libavcodec/vorbis.c @@ -1374,6 +1374,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa voffset=vr->begin; for(partition_count=0;partition_countclassifications]; for(j_times_ptns_to_read=0, j=0;jcodebooks[vr->classbook].vlc.table, @@ -1385,7 +1386,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa for(i=0;iclassifications])>>32; + temp2=(((uint_fast64_t)temp) * inverse_class)>>32; if (partition_count+c_p_c-1-i < ptns_to_read) { classifs[j_times_ptns_to_read+partition_count+c_p_c-1-i]=temp-temp2*vr->classifications; } @@ -1405,7 +1406,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa if (vqbook>=0) { uint_fast16_t coffs; - uint_fast8_t dim= vc->codebooks[vqbook].dimensions; + unsigned dim= vc->codebooks[vqbook].dimensions; // not uint_fast8_t: 64bit is slower here on amd64 uint_fast16_t step= dim==1 ? vr->partition_size : FASTDIV(vr->partition_size, dim); vorbis_codebook codebook= vc->codebooks[vqbook]; @@ -1414,8 +1415,8 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa voffs=voffset+j*vlen; for(k=0;ktype==1) { voffs=voffset+j*vlen; for(k=0;ktype==2 && ch==2 && (voffset&1)==0 && (codebook.dimensions&1)==0) { // most frequent case optimized + else if (vr->type==2 && ch==2 && (voffset&1)==0 && (dim&1)==0) { // most frequent case optimized voffs=voffset>>1; + if(dim==2) { + for(k=0;k