Mercurial > libavcodec.hg
diff vorbis.c @ 3536:545a15c19c91 libavcodec
sse & sse2 implementations of vorbis channel coupling.
9% faster vorbis (on a K8).
author | lorenm |
---|---|
date | Thu, 03 Aug 2006 03:18:47 +0000 |
parents | a14c98a0ca3d |
children | f31fda209742 |
line wrap: on
line diff
--- a/vorbis.c Thu Aug 03 02:18:07 2006 +0000 +++ b/vorbis.c Thu Aug 03 03:18:47 2006 +0000 @@ -929,6 +929,7 @@ int i, j, hdr_type; vc->avccontext = avccontext; + dsputil_init(&vc->dsp, avccontext); if (!headers_len) { av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n"); @@ -1443,6 +1444,31 @@ return 0; } +void vorbis_inverse_coupling(float *mag, float *ang, int blocksize) +{ + int i; + for(i=0; i<blocksize; i++) + { + if (mag[i]>0.0) { + if (ang[i]>0.0) { + ang[i]=mag[i]-ang[i]; + } else { + float temp=ang[i]; + ang[i]=mag[i]; + mag[i]+=temp; + } + } else { + if (ang[i]>0.0) { + ang[i]+=mag[i]; + } else { + float temp=ang[i]; + ang[i]=mag[i]; + mag[i]-=temp; + } + } + } +} + // Decode the audio packet using the functions above #define BIAS 385 @@ -1541,26 +1567,7 @@ mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; - for(j=0;j<blocksize/2;++j) { - float temp; - if (mag[j]>0.0) { - if (ang[j]>0.0) { - ang[j]=mag[j]-ang[j]; - } else { - temp=ang[j]; - ang[j]=mag[j]; - mag[j]+=temp; - } - } else { - if (ang[j]>0.0) { - ang[j]+=mag[j]; - } else { - temp=ang[j]; - ang[j]=mag[j]; - mag[j]-=temp; - } - } - } + vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); } // Dotproduct