summaryrefslogtreecommitdiff
path: root/apps/codecs/libtremor/codebook.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-12-06 14:36:52 +0000
committerNils Wallménius <nils@rockbox.org>2010-12-06 14:36:52 +0000
commit67efbc13870ee87ce3df442f7c396c13481921ec (patch)
treeeaf63d36c5bf2d41a6b3bb2addecb4d3c05f7eef /apps/codecs/libtremor/codebook.c
parent1f64b7fb1fa5058e3b7871078055156eac0c511d (diff)
downloadrockbox-67efbc13870ee87ce3df442f7c396c13481921ec.zip
rockbox-67efbc13870ee87ce3df442f7c396c13481921ec.tar.gz
rockbox-67efbc13870ee87ce3df442f7c396c13481921ec.tar.bz2
rockbox-67efbc13870ee87ce3df442f7c396c13481921ec.tar.xz
libtremor:
Merge in upstream revision 17375. This removes tremor's internal ogg code and now uses libogg instead so a bunch of changes are just adjusting to the new api. Also brings in improvements to vorbisfile which fixes FS#10484. Disabled a lot of unused code in the libogg files and moved some small functions into the ogg.h header so they can be inlined. Some small tweaks to fix warnings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28742 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libtremor/codebook.c')
-rw-r--r--apps/codecs/libtremor/codebook.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/codecs/libtremor/codebook.c b/apps/codecs/libtremor/codebook.c
index 561b597..860cf07 100644
--- a/apps/codecs/libtremor/codebook.c
+++ b/apps/codecs/libtremor/codebook.c
@@ -279,7 +279,7 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b,
long *bufend = buf + n;
while (bufptr<bufend) {
- if (b->headend > 8) {
+ if(b->endbyte < b->storage - 8) {
ogg_uint32_t *ptr;
unsigned long bit, bitend;
unsigned long adr;
@@ -292,10 +292,10 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b,
const ogg_uint32_t *book_codelist = book->codelist;
const char *book_dec_codelengths = book->dec_codelengths;
- adr = (unsigned long)b->headptr;
- bit = (adr&3)*8+b->headbit;
+ adr = (unsigned long)b->ptr;
+ bit = (adr&3)*8+b->endbit;
ptr = (ogg_uint32_t*)(adr&~3);
- bitend = ((adr&3)+b->headend)*8;
+ bitend = ((adr&3)+(b->storage-b->endbyte))*8;
while (bufptr<bufend){
if (UNLIKELY(cachesize<book_dec_maxlength)) {
if (bit-cachesize+32>=bitend)
@@ -323,11 +323,11 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b,
cache >>= l;
}
- adr=(unsigned long)b->headptr;
+ adr=(unsigned long)b->ptr;
bit-=(adr&3)*8+cachesize;
- b->headend-=(bit/8);
- b->headptr+=bit/8;
- b->headbit=bit%8;
+ b->endbyte+=bit/8;
+ b->ptr+=bit/8;
+ b->endbit=bit&7;
} else {
long r = decode_packed_entry_number(book, b);
if (r == -1) return bufptr-buf;
@@ -337,7 +337,6 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b,
return n;
}
-
/* Decode side is specced and easier, because we don't need to find
matches using different criteria; we simply read and map. There are
two things we need to do 'depending':
@@ -570,3 +569,4 @@ long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,
}
return(0);
}
+