From 580b307fd791c0997a8831bc800bba87797bfb7e Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Mon, 20 May 2013 22:25:57 +0200 Subject: Sync opus codec to upstream git Sync opus codec to upstream commit 02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013) This brings in a lot of optimizations but also makes the diff between our codec and the upstream much smaller as most of our optimizations have been upstreamed or supeceded. Speedups across the board for CELT mode files: 64kbps 128kbps H300 9.82MHz 15.48MHz c200 4.86MHz 9.63MHz fuze v1 10.32MHz 15.92MHz For the silk mode test file (16kbps) arm targets get a speedup of about 2MHz while the H300 is 7.8MHz slower, likely because it's now using the pseudostack more rather than the real stack which is in iram. Patches to get around that are upcomming. Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3 --- lib/rbcodec/codecs/libopus/celt/celt_lpc.c | 196 +++++++++++++++++++++++------ 1 file changed, 158 insertions(+), 38 deletions(-) (limited to 'lib/rbcodec/codecs/libopus/celt/celt_lpc.c') diff --git a/lib/rbcodec/codecs/libopus/celt/celt_lpc.c b/lib/rbcodec/codecs/libopus/celt/celt_lpc.c index 66aed1de09..7ffe90a357 100644 --- a/lib/rbcodec/codecs/libopus/celt/celt_lpc.c +++ b/lib/rbcodec/codecs/libopus/celt/celt_lpc.c @@ -26,12 +26,13 @@ */ #ifdef HAVE_CONFIG_H -#include "opus_config.h" +#include "config.h" #endif #include "celt_lpc.h" #include "stack_alloc.h" #include "mathops.h" +#include "pitch.h" void _celt_lpc( opus_val16 *_lpc, /* out: [0...p-1] LPC coefficients */ @@ -87,42 +88,71 @@ int p #endif } -void celt_fir(const opus_val16 *x, +void celt_fir(const opus_val16 *_x, const opus_val16 *num, - opus_val16 *y, + opus_val16 *_y, int N, int ord, opus_val16 *mem) { int i,j; + VARDECL(opus_val16, rnum); + VARDECL(opus_val16, x); + SAVE_STACK; + ALLOC(rnum, ord, opus_val16); + ALLOC(x, N+ord, opus_val16); + for(i=0;i=1;j--) - { - mem[j]=mem[j-1]; + sum = MAC16_16(sum,rnum[j],x[i+j]); } - mem[0] = x[i]; - y[i] = ROUND16(sum, SIG_SHIFT); + _y[i] = SATURATE16(PSHR32(sum, SIG_SHIFT)); } +#else + for (i=0;i0); celt_assert(overlap>=0); - for (i=0;i0) + { + for(i=0;i=0) + celt_pitch_xcorr(xptr, xptr, ac, fastN, lag+1); + for (k=0;k<=lag;k++) { - for (i = lag, d = 0; i < n; i++) - d += xx[i] * xx[i-lag]; - ac[lag] = d; - /*printf ("%f ", ac[lag]);*/ - lag--; + for (i = k+fastN, d = 0; i < n; i++) + d = MAC16_16(d, xptr[i], xptr[i-k]); + ac[k] += d; } - /*printf ("\n");*/ - ac[0] += 10; +#ifdef FIXED_POINT + shift = 2*shift; + if (shift<=0) + ac[0] += SHL32((opus_int32)1, -shift); + if (ac[0] < 268435456) + { + int shift2 = 29 - EC_ILOG(ac[0]); + for (i=0;i<=lag;i++) + ac[i] = SHL32(ac[i], shift2); + shift -= shift2; + } else if (ac[0] >= 536870912) + { + int shift2=1; + if (ac[0] >= 1073741824) + shift2++; + for (i=0;i<=lag;i++) + ac[i] = SHR32(ac[i], shift2); + shift += shift2; + } +#endif RESTORE_STACK; + return shift; } -- cgit v1.2.3