summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2012-10-04 19:20:55 +0200
committerNils Wallménius <nils@rockbox.org>2012-10-04 19:20:55 +0200
commit6d2ad505dccda640439b6fa75fb742caf2981e11 (patch)
tree97a9759cb9230ffeb0b685932eaa8b44f5a5d6ef
parent283277e5ab95b3c74a9bee0bef25cb55d55e016b (diff)
downloadrockbox-6d2ad505dccda640439b6fa75fb742caf2981e11.tar.gz
rockbox-6d2ad505dccda640439b6fa75fb742caf2981e11.zip
opus: put arrays frequently used by pulse decoding on the stack
speeds up decoding of a 64kbps test file by 14MHz on h300 (cf) and 1MHz on c200 (pp) Change-Id: I852cb66808676ea51109423f5b70cfc8782dd109
-rw-r--r--lib/rbcodec/codecs/libopus/celt/cwrs.c8
-rw-r--r--lib/rbcodec/codecs/libopus/celt/vq.c12
2 files changed, 13 insertions, 7 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/cwrs.c b/lib/rbcodec/codecs/libopus/celt/cwrs.c
index 3d5dd790d9..b8ade96fce 100644
--- a/lib/rbcodec/codecs/libopus/celt/cwrs.c
+++ b/lib/rbcodec/codecs/libopus/celt/cwrs.c
@@ -35,6 +35,7 @@
35#include "cwrs.h" 35#include "cwrs.h"
36#include "mathops.h" 36#include "mathops.h"
37#include "arch.h" 37#include "arch.h"
38#include "rate.h"
38 39
39#ifdef CUSTOM_MODES 40#ifdef CUSTOM_MODES
40 41
@@ -632,11 +633,12 @@ void decode_pulses(int *_y,int _n,int _k,ec_dec *_dec)
632 default: 633 default:
633 { 634 {
634#endif 635#endif
635 VARDECL(opus_uint32,u); 636/* VARDECL(opus_uint32,u);
636 SAVE_STACK; 637 SAVE_STACK;
637 ALLOC(u,_k+2U,opus_uint32); 638 ALLOC(u,_k+2U,opus_uint32); */
639 opus_uint32 u[MAX_PULSES+2];
638 cwrsi(_n,_k,ec_dec_uint(_dec,ncwrs_urow(_n,_k,u)),_y,u); 640 cwrsi(_n,_k,ec_dec_uint(_dec,ncwrs_urow(_n,_k,u)),_y,u);
639 RESTORE_STACK; 641/* RESTORE_STACK; */
640#ifndef SMALL_FOOTPRINT 642#ifndef SMALL_FOOTPRINT
641 } 643 }
642 break; 644 break;
diff --git a/lib/rbcodec/codecs/libopus/celt/vq.c b/lib/rbcodec/codecs/libopus/celt/vq.c
index 6a00edf9cd..f6b6e4fc64 100644
--- a/lib/rbcodec/codecs/libopus/celt/vq.c
+++ b/lib/rbcodec/codecs/libopus/celt/vq.c
@@ -325,12 +325,16 @@ unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B,
325 int i; 325 int i;
326 opus_val32 Ryy; 326 opus_val32 Ryy;
327 unsigned collapse_mask; 327 unsigned collapse_mask;
328 VARDECL(int, iy); 328/* VARDECL(int, iy);
329 SAVE_STACK; 329 SAVE_STACK; */
330
331 /* the difference between the last two values of eband5ms shifted by maxLM
332 which is 22 << 3 with the static mode */
333 int iy[176];
330 334
331 celt_assert2(K>0, "alg_unquant() needs at least one pulse"); 335 celt_assert2(K>0, "alg_unquant() needs at least one pulse");
332 celt_assert2(N>1, "alg_unquant() needs at least two dimensions"); 336 celt_assert2(N>1, "alg_unquant() needs at least two dimensions");
333 ALLOC(iy, N, int); 337/* ALLOC(iy, N, int); */
334 decode_pulses(iy, N, K, dec); 338 decode_pulses(iy, N, K, dec);
335 Ryy = 0; 339 Ryy = 0;
336 i=0; 340 i=0;
@@ -340,7 +344,7 @@ unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B,
340 normalise_residual(iy, X, N, Ryy, gain); 344 normalise_residual(iy, X, N, Ryy, gain);
341 exp_rotation(X, N, -1, B, K, spread); 345 exp_rotation(X, N, -1, B, K, spread);
342 collapse_mask = extract_collapse_mask(iy, N, B); 346 collapse_mask = extract_collapse_mask(iy, N, B);
343 RESTORE_STACK; 347/* RESTORE_STACK; */
344 return collapse_mask; 348 return collapse_mask;
345} 349}
346 350