aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/flac.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2007-09-25 23:31:13 +0000
committerLoren Merritt <lorenm@u.washington.edu>2007-09-25 23:31:13 +0000
commitbd49d4fd4962d28447cb6edfaba8a218cf60b2da (patch)
treecbed07433df9cc7c5b1f2c27988f0de350a84239 /libavcodec/flac.c
parentf74471e043c6788a59bf6e8143f71d3968353152 (diff)
downloadffmpeg-bd49d4fd4962d28447cb6edfaba8a218cf60b2da.tar.gz
optimize decode_subframe_lpc()
50%/67%/43% faster on core2/k8/p4, making flac decoding overall 24%/25%/11% faster Originally committed as revision 10586 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flac.c')
-rw-r--r--libavcodec/flac.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index 74b245d0e5..d8e8813d9e 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -359,10 +359,25 @@ static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order)
s->decoded[channel][i] += sum >> qlevel;
}
} else {
- int sum;
- for (i = pred_order; i < s->blocksize; i++)
+ for (i = pred_order; i < s->blocksize-1; i += 2)
{
- sum = 0;
+ int c = coeffs[pred_order-1];
+ int s0 = c * s->decoded[channel][i-pred_order];
+ int s1 = 0;
+ for (j = pred_order-1; j > 0; j--)
+ {
+ int d = s->decoded[channel][i-j];
+ s1 += c*d;
+ c = coeffs[j-1];
+ s0 += c*d;
+ }
+ s0 = s->decoded[channel][i] += s0 >> qlevel;
+ s1 += c * s0;
+ s->decoded[channel][i+1] += s1 >> qlevel;
+ }
+ if (i < s->blocksize)
+ {
+ int sum = 0;
for (j = 0; j < pred_order; j++)
sum += coeffs[j] * s->decoded[channel][i-j-1];
s->decoded[channel][i] += sum >> qlevel;