From 613378a757e3c35d5195acf75971f122ee548f77 Mon Sep 17 00:00:00 2001 From: learman Date: Tue, 25 Jul 2006 18:04:43 +0000 Subject: [PATCH] Vorbis: Improve ability to decode old files (using floor0). Not enough to be able to decode one test file though... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10323 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/Tremor/sharedbook.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/codecs/Tremor/sharedbook.c b/apps/codecs/Tremor/sharedbook.c index b61b6d099..d77c0c127 100644 --- a/apps/codecs/Tremor/sharedbook.c +++ b/apps/codecs/Tremor/sharedbook.c @@ -26,9 +26,10 @@ /* Size (in number of entries) for static buffers in book_init_decode, so * that large alloca() calls can be avoided, which is needed in Rockbox. - * This is enough for one certain test file... + * This is more than enough for one certain test file (which needs 6561 + * entries)... */ -#define BOOK_INIT_MAXSIZE 3072 +#define BOOK_INIT_MAXSIZE 8192 /* Max value in static_codebook.dim we expect to find in _book_unquantize. * Used to avoid some temporary allocations. Again, enough for some test @@ -83,7 +84,11 @@ static ogg_int32_t _float32_unpack(long val,int *point){ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ long i,j,count=0; ogg_uint32_t marker[33]; - ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); + /* Avoid temporary malloc; _make_words is only called from + * vorbis_book_init_decode, and the result is only used for a short while. + */ + static ogg_uint32_t r[BOOK_INIT_MAXSIZE]; + /* ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); */ memset(marker,0,sizeof(marker)); for(i=0;i>length)){ /* error condition; the lengths must specify an overpopulated tree */ - _ogg_free(r); + /* _ogg_free(r); */ return(NULL); } r[count++]=entry; @@ -401,7 +406,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ for(i=0;icodelist[sortindex[i]]=codes[i]; - _ogg_free(codes); + /* _ogg_free(codes); */ } -- 2.11.4.GIT