summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2006-07-25 18:04:43 +0000
committerMagnus Holmgren <magnushol@gmail.com>2006-07-25 18:04:43 +0000
commite0d64b95db0664bcf374dc6c52707adfac910759 (patch)
tree12c051f9c3b0a7e695e3eda5d5fbef21ce489c4e
parentf18f9a806142f96f435480473796e12b4a11e7b4 (diff)
downloadrockbox-e0d64b95db0664bcf374dc6c52707adfac910759.tar.gz
rockbox-e0d64b95db0664bcf374dc6c52707adfac910759.zip
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
-rw-r--r--apps/codecs/Tremor/sharedbook.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/codecs/Tremor/sharedbook.c b/apps/codecs/Tremor/sharedbook.c
index b61b6d0997..d77c0c1275 100644
--- a/apps/codecs/Tremor/sharedbook.c
+++ b/apps/codecs/Tremor/sharedbook.c
@@ -26,9 +26,10 @@
26 26
27/* Size (in number of entries) for static buffers in book_init_decode, so 27/* Size (in number of entries) for static buffers in book_init_decode, so
28 * that large alloca() calls can be avoided, which is needed in Rockbox. 28 * that large alloca() calls can be avoided, which is needed in Rockbox.
29 * This is enough for one certain test file... 29 * This is more than enough for one certain test file (which needs 6561
30 * entries)...
30 */ 31 */
31#define BOOK_INIT_MAXSIZE 3072 32#define BOOK_INIT_MAXSIZE 8192
32 33
33/* Max value in static_codebook.dim we expect to find in _book_unquantize. 34/* Max value in static_codebook.dim we expect to find in _book_unquantize.
34 * Used to avoid some temporary allocations. Again, enough for some test 35 * 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){
83ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ 84ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
84 long i,j,count=0; 85 long i,j,count=0;
85 ogg_uint32_t marker[33]; 86 ogg_uint32_t marker[33];
86 ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); 87 /* Avoid temporary malloc; _make_words is only called from
88 * vorbis_book_init_decode, and the result is only used for a short while.
89 */
90 static ogg_uint32_t r[BOOK_INIT_MAXSIZE];
91 /* ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); */
87 memset(marker,0,sizeof(marker)); 92 memset(marker,0,sizeof(marker));
88 93
89 for(i=0;i<n;i++){ 94 for(i=0;i<n;i++){
@@ -99,7 +104,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
99 /* update ourself */ 104 /* update ourself */
100 if(length<32 && (entry>>length)){ 105 if(length<32 && (entry>>length)){
101 /* error condition; the lengths must specify an overpopulated tree */ 106 /* error condition; the lengths must specify an overpopulated tree */
102 _ogg_free(r); 107 /* _ogg_free(r); */
103 return(NULL); 108 return(NULL);
104 } 109 }
105 r[count++]=entry; 110 r[count++]=entry;
@@ -401,7 +406,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
401 406
402 for(i=0;i<n;i++) 407 for(i=0;i<n;i++)
403 c->codelist[sortindex[i]]=codes[i]; 408 c->codelist[sortindex[i]]=codes[i];
404 _ogg_free(codes); 409 /* _ogg_free(codes); */
405 } 410 }
406 411
407 412