diff options
author | Nils Wallménius <nils@rockbox.org> | 2010-03-05 09:48:07 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2010-03-05 09:48:07 +0000 |
commit | b382d8334bcfff7fe49ba3ab850b069a6fd95505 (patch) | |
tree | 68b47fc848036894d73063a2ad17f81ad6c45cca /apps/codecs | |
parent | 3c878249705755d1dfb6c5320302f1670dd87a67 (diff) |
Fix broken whitespace after r24862
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25031 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/libtremor/asm_arm.h | 74 | ||||
-rw-r--r-- | apps/codecs/libtremor/backends.h | 10 | ||||
-rw-r--r-- | apps/codecs/libtremor/codebook.c | 214 | ||||
-rw-r--r-- | apps/codecs/libtremor/codebook.h | 18 | ||||
-rw-r--r-- | apps/codecs/libtremor/floor0.c | 36 | ||||
-rw-r--r-- | apps/codecs/libtremor/framing.c | 4 | ||||
-rw-r--r-- | apps/codecs/libtremor/info.c | 64 | ||||
-rw-r--r-- | apps/codecs/libtremor/ivorbiscodec.h | 4 | ||||
-rw-r--r-- | apps/codecs/libtremor/ivorbisfile.h | 6 | ||||
-rw-r--r-- | apps/codecs/libtremor/lsp_lookup.h | 104 | ||||
-rw-r--r-- | apps/codecs/libtremor/misc.h | 32 | ||||
-rw-r--r-- | apps/codecs/libtremor/sharedbook.c | 236 | ||||
-rw-r--r-- | apps/codecs/libtremor/window.h | 4 |
13 files changed, 399 insertions, 407 deletions
diff --git a/apps/codecs/libtremor/asm_arm.h b/apps/codecs/libtremor/asm_arm.h index 8da7ed75cc..95f3bef0fc 100644 --- a/apps/codecs/libtremor/asm_arm.h +++ b/apps/codecs/libtremor/asm_arm.h @@ -35,11 +35,11 @@ static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) { static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { int lo,hi; asm volatile("smull %0, %1, %2, %3\n\t" - "movs %0, %0, lsr #15\n\t" - "adc %1, %0, %1, lsl #17\n\t" + "movs %0, %0, lsr #15\n\t" + "adc %1, %0, %1, lsl #17\n\t" : "=&r"(lo),"=&r"(hi) : "%r"(x),"r"(y) - : "cc"); + : "cc"); return(hi); } @@ -47,42 +47,42 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { { \ long l; \ asm( "smull %0, %1, %4, %6\n\t" \ - "rsb %3, %4, #0\n\t" \ - "smlal %0, %1, %5, %7\n\t" \ - "smull %0, %2, %5, %6\n\t" \ - "smlal %0, %2, %3, %7" \ - : "=&r" (l), "=&r" (x), "=&r" (y), "=r" ((a)) \ - : "3" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) ); \ + "rsb %3, %4, #0\n\t" \ + "smlal %0, %1, %5, %7\n\t" \ + "smull %0, %2, %5, %6\n\t" \ + "smlal %0, %2, %3, %7" \ + : "=&r" (l), "=&r" (x), "=&r" (y), "=r" ((a)) \ + : "3" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) ); \ } static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { int x1, y1, l; asm( "smull %0, %1, %4, %6\n\t" - "rsb %3, %4, #0\n\t" - "smlal %0, %1, %5, %7\n\t" - "smull %0, %2, %5, %6\n\t" - "smlal %0, %2, %3, %7" - : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a) - : "3" (a), "r" (b), "r" (t), "r" (v) ); + "rsb %3, %4, #0\n\t" + "smlal %0, %1, %5, %7\n\t" + "smull %0, %2, %5, %6\n\t" + "smlal %0, %2, %3, %7" + : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a) + : "3" (a), "r" (b), "r" (t), "r" (v) ); *x = x1 << 1; *y = y1 << 1; } static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { int x1, y1, l; asm( "smull %0, %1, %3, %5\n\t" - "rsb %2, %4, #0\n\t" - "smlal %0, %1, %2, %6\n\t" - "smull %0, %2, %4, %5\n\t" - "smlal %0, %2, %3, %6" - : "=&r" (l), "=&r" (x1), "=&r" (y1) - : "r" (a), "r" (b), "r" (t), "r" (v) ); + "rsb %2, %4, #0\n\t" + "smlal %0, %1, %2, %6\n\t" + "smull %0, %2, %4, %5\n\t" + "smlal %0, %2, %3, %6" + : "=&r" (l), "=&r" (x1), "=&r" (y1) + : "r" (a), "r" (b), "r" (t), "r" (v) ); *x = x1 << 1; *y = y1 << 1; } @@ -217,13 +217,13 @@ static inline void vect_copy(ogg_int32_t *x, const ogg_int32_t *y, int n) static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { int tmp; asm volatile("subs %1, %0, #32768\n\t" - "movpl %0, #0x7f00\n\t" - "orrpl %0, %0, #0xff\n" - "adds %1, %0, #32768\n\t" - "movmi %0, #0x8000" - : "+r"(x),"=r"(tmp) - : - : "cc"); + "movpl %0, #0x7f00\n\t" + "orrpl %0, %0, #0xff\n" + "adds %1, %0, #32768\n\t" + "movmi %0, #0x8000" + : "+r"(x),"=r"(tmp) + : + : "cc"); return(x); } @@ -233,9 +233,9 @@ static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { #define _V_LSP_MATH_ASM static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip, - ogg_int32_t *qexpp, - ogg_int32_t *ilsp,ogg_int32_t wi, - ogg_int32_t m){ + ogg_int32_t *qexpp, + ogg_int32_t *ilsp,ogg_int32_t wi, + ogg_int32_t m){ ogg_uint32_t qi=*qip,pi=*pip; ogg_int32_t qexp=*qexpp; @@ -289,9 +289,9 @@ static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip, //qi=(pi>>shift)*labs(ilsp[j]-wi); //pi=(qi>>shift)*labs(ilsp[j+1]-wi); //qexp+=shift; - + //} - + /* normalize to max 16 sig figs */ "2:" "mov r2,#0;" diff --git a/apps/codecs/libtremor/backends.h b/apps/codecs/libtremor/backends.h index 677bc8fdc2..29ab935993 100644 --- a/apps/codecs/libtremor/backends.h +++ b/apps/codecs/libtremor/backends.h @@ -34,12 +34,12 @@ typedef struct{ vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *); vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *, - vorbis_info_floor *); + vorbis_info_floor *); void (*free_info) (vorbis_info_floor *); void (*free_look) (vorbis_look_floor *); void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *); int (*inverse2) (struct vorbis_block *,vorbis_look_floor *, - void *buffer,ogg_int32_t *); + void *buffer,ogg_int32_t *); } vorbis_func_floor; typedef struct{ @@ -77,11 +77,11 @@ typedef struct{ typedef struct{ vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *); vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *, - vorbis_info_residue *); + vorbis_info_residue *); void (*free_info) (vorbis_info_residue *); void (*free_look) (vorbis_look_residue *); int (*inverse) (struct vorbis_block *,vorbis_look_residue *, - ogg_int32_t **,int *,int); + ogg_int32_t **,int *,int); } vorbis_func_residue; typedef struct vorbis_info_residue0{ @@ -101,7 +101,7 @@ typedef struct vorbis_info_residue0{ typedef struct{ vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *); vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *, - vorbis_info_mapping *); + vorbis_info_mapping *); void (*free_info) (vorbis_info_mapping *); void (*free_look) (vorbis_look_mapping *); int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *); diff --git a/apps/codecs/libtremor/codebook.c b/apps/codecs/libtremor/codebook.c index 6ed6a08672..8d34b6df03 100644 --- a/apps/codecs/libtremor/codebook.c +++ b/apps/codecs/libtremor/codebook.c @@ -49,19 +49,19 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ /* yes, unused entries */ for(i=0;i<s->entries;i++){ - if(oggpack_read(opb,1)){ - long num=oggpack_read(opb,5); - if(num==-1)goto _eofout; - s->lengthlist[i]=num+1; - }else - s->lengthlist[i]=0; + if(oggpack_read(opb,1)){ + long num=oggpack_read(opb,5); + if(num==-1)goto _eofout; + s->lengthlist[i]=num+1; + }else + s->lengthlist[i]=0; } }else{ /* all entries used; no tagging */ for(i=0;i<s->entries;i++){ - long num=oggpack_read(opb,5); - if(num==-1)goto _eofout; - s->lengthlist[i]=num+1; + long num=oggpack_read(opb,5); + if(num==-1)goto _eofout; + s->lengthlist[i]=num+1; } } @@ -73,11 +73,11 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries); for(i=0;i<s->entries;){ - long num=oggpack_read(opb,_ilog(s->entries-i)); - if(num==-1)goto _eofout; - for(j=0;j<num && i<s->entries;j++,i++) - s->lengthlist[i]=length; - length++; + long num=oggpack_read(opb,_ilog(s->entries-i)); + if(num==-1)goto _eofout; + for(j=0;j<num && i<s->entries;j++,i++) + s->lengthlist[i]=length; + length++; } } break; @@ -104,17 +104,17 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ int quantvals=0; switch(s->maptype){ case 1: - quantvals=_book_maptype1_quantvals(s); - break; + quantvals=_book_maptype1_quantvals(s); + break; case 2: - quantvals=s->entries*s->dim; - break; + quantvals=s->entries*s->dim; + break; } /* quantized values */ s->quantlist=(long *)_ogg_malloc(sizeof(*s->quantlist)*quantvals); for(i=0;i<quantvals;i++) - s->quantlist[i]=oggpack_read(opb,s->q_quant); + s->quantlist[i]=oggpack_read(opb,s->q_quant); if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout; } @@ -216,7 +216,7 @@ static inline ogg_uint32_t bitreverse(register ogg_uint32_t x) } STIN long decode_packed_entry_number(codebook *book, - oggpack_buffer *b){ + oggpack_buffer *b){ int read=book->dec_maxlength; long lo,hi; long lok = oggpack_look(b,book->dec_firsttablen); @@ -284,43 +284,39 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b, ptr = (ogg_uint32_t *)(adr&~3); bitend = ((adr&3)+b->headend)*8; while (bufptr<bufend){ - long entry, lo, hi; - if (UNLIKELY(cachesize<book->dec_maxlength)) { - if (bit-cachesize+32>=bitend) - break; - bit-=cachesize; - cache=letoh32(ptr[bit>>5]) >> (bit&31); - if (bit&31) - cache|=letoh32(ptr[(bit>>5)+1]) << (32-(bit&31)); - cachesize=32; - bit+=32; - } + long entry, lo, hi; + if (UNLIKELY(cachesize<book->dec_maxlength)) { + if (bit-cachesize+32>=bitend) + break; + bit-=cachesize; + cache=letoh32(ptr[bit>>5]) >> (bit&31); + if (bit&31) + cache|=letoh32(ptr[(bit>>5)+1]) << (32-(bit&31)); + cachesize=32; + bit+=32; + } - entry=book->dec_firsttable[cache&((1<<book->dec_firsttablen)-1)]; - if(UNLIKELY(entry&0x80000000UL)){ - lo=(entry>>15)&0x7fff; - hi=book->used_entries-(entry&0x7fff); - { - ogg_uint32_t testword=bitreverse((ogg_uint32_t)cache); - - while(LIKELY(hi-lo>1)){ - long p=(hi-lo)>>1; - if (book->codelist[lo+p]>testword) - hi-=p; - else - lo+=p; - } - entry=lo; + entry=book->dec_firsttable[cache&((1<<book->dec_firsttablen)-1)]; + if(UNLIKELY(entry&0x80000000UL)){ + lo=(entry>>15)&0x7fff; + hi=book->used_entries-(entry&0x7fff); + ogg_uint32_t testword=bitreverse((ogg_uint32_t)cache); + + while(LIKELY(hi-lo>1)){ + long p=(hi-lo)>>1; + if (book->codelist[lo+p]>testword) + hi-=p; + else + lo+=p; } - }else - entry--; - - *bufptr++=entry; - { - int l=book->dec_codelengths[entry]; - cachesize-=l; - cache>>=l; - } + entry=lo; + }else + entry--; + + *bufptr++=entry; + int l=book->dec_codelengths[entry]; + cachesize-=l; + cache>>=l; } adr=(unsigned long)b->headptr; @@ -366,7 +362,7 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ /* returns 0 on OK or -1 on eof *************************************/ long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a, - oggpack_buffer *b,int n,int point){ + oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int step=n/book->dim; long *entry = (long *)alloca(sizeof(*entry)*step); @@ -376,29 +372,29 @@ long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a, if(shift>=0){ for (i = 0; i < step; i++) { - entry[i]=decode_packed_entry_number(book,b); - if(entry[i]==-1)return(-1); - t[i] = book->valuelist+entry[i]*book->dim; + entry[i]=decode_packed_entry_number(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; } for(i=0,o=0;i<book->dim;i++,o+=step) - for (j=0;j<step;j++) - a[o+j]+=t[j][i]>>shift; + for (j=0;j<step;j++) + a[o+j]+=t[j][i]>>shift; }else{ for (i = 0; i < step; i++) { - entry[i]=decode_packed_entry_number(book,b); - if(entry[i]==-1)return(-1); - t[i] = book->valuelist+entry[i]*book->dim; + entry[i]=decode_packed_entry_number(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; } for(i=0,o=0;i<book->dim;i++,o+=step) - for (j=0;j<step;j++) - a[o+j]+=t[j][i]<<-shift; + for (j=0;j<step;j++) + a[o+j]+=t[j][i]<<-shift; } } return(0); } long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, - oggpack_buffer *b,int n,int point){ + oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; @@ -406,20 +402,20 @@ long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, if(shift>=0){ for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+entry*book->dim; - for (j=0;j<book->dim;) - a[i++]+=t[j++]>>shift; + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + for (j=0;j<book->dim;) + a[i++]+=t[j++]>>shift; } }else{ shift = -shift; for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+entry*book->dim; - for (j=0;j<book->dim;) - a[i++]+=t[j++]<<shift; + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + for (j=0;j<book->dim;) + a[i++]+=t[j++]<<shift; } } } @@ -427,7 +423,7 @@ long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, } long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, - oggpack_buffer *b,int n,int point){ + oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; @@ -436,22 +432,22 @@ long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, if(shift>=0){ for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+entry*book->dim; - for (j=0;j<book->dim;){ - a[i++]=t[j++]>>shift; - } + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + for (j=0;j<book->dim;){ + a[i++]=t[j++]>>shift; + } } }else{ shift = -shift; for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+entry*book->dim; - for (j=0;j<book->dim;){ - a[i++]=t[j++]<<shift; - } + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + for (j=0;j<book->dim;){ + a[i++]=t[j++]<<shift; + } } } }else{ @@ -459,7 +455,7 @@ long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, int i,j; for(i=0;i<n;){ for (j=0;j<book->dim;){ - a[i++]=0; + a[i++]=0; } } } @@ -516,8 +512,8 @@ static long vorbis_book_decodevv_add_2ch_even(codebook *book,ogg_int32_t **a, } long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a, - long offset,int ch, - oggpack_buffer *b,int n,int point){ + long offset,int ch, + oggpack_buffer *b,int n,int point){ if(LIKELY(book->used_entries>0)){ long i,j,k,chunk,read; int chptr=0; @@ -535,14 +531,14 @@ long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a, chunk=((offset+n-i)*ch+book->dim-1)/book->dim; read = decode_packed_block(book,b,entries,chunk); for(k=0;k<read;k++){ - const ogg_int32_t *t = book->valuelist+entries[k]*book->dim; - for (j=0;j<book->dim;j++){ - a[chptr++][i]+=t[j]>>shift; - if(chptr==ch){ - chptr=0; - i++; - } - } + const ogg_int32_t *t = book->valuelist+entries[k]*book->dim; + for (j=0;j<book->dim;j++){ + a[chptr++][i]+=t[j]>>shift; + if(chptr==ch){ + chptr=0; + i++; + } + } } if (read<chunk)return-1; } @@ -554,14 +550,14 @@ long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a, chunk=((offset+n-i)*ch+book->dim-1)/book->dim; read = decode_packed_block(book,b,entries,chunk); for(k=0;k<read;k++){ - const ogg_int32_t *t = book->valuelist+entries[k]*book->dim; - for (j=0;j<book->dim;j++){ - a[chptr++][i]+=t[j]<<shift; - if(chptr==ch){ - chptr=0; - i++; - } - } + const ogg_int32_t *t = book->valuelist+entries[k]*book->dim; + for (j=0;j<book->dim;j++){ + a[chptr++][i]+=t[j]<<shift; + if(chptr==ch){ + chptr=0; + i++; + } + } } if (read<chunk)return-1; } diff --git a/apps/codecs/libtremor/codebook.h b/apps/codecs/libtremor/codebook.h index 0fc6834daa..b13334d8d7 100644 --- a/apps/codecs/libtremor/codebook.h +++ b/apps/codecs/libtremor/codebook.h @@ -40,8 +40,8 @@ typedef struct static_codebook{ /* mapping ***************************************************************/ int maptype; /* 0=none - 1=implicitly populated values from map column - 2=listed arbitrary values */ + 1=implicitly populated values from map column + 2=listed arbitrary values */ /* The below does a linear, single monotonic sequence mapping. */ long q_min; /* packed 32 bit float; quant value 0 maps to minval */ @@ -50,8 +50,8 @@ typedef struct static_codebook{ int q_sequencep; /* bitflag */ long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map - map == 2: list of dim*entries quantized entry vals - */ + map == 2: list of dim*entries quantized entry vals + */ } static_codebook; typedef struct codebook{ @@ -87,14 +87,14 @@ extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, - oggpack_buffer *b,int n,int point); + oggpack_buffer *b,int n,int point); extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, - oggpack_buffer *b,int n,int point); + oggpack_buffer *b,int n,int point); extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, - oggpack_buffer *b,int n,int point); + oggpack_buffer *b,int n,int point); extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a, - long off,int ch, - oggpack_buffer *b,int n,int point); + long off,int ch, + oggpack_buffer *b,int n,int point); extern int _ilog(unsigned int v); diff --git a/apps/codecs/libtremor/floor0.c b/apps/codecs/libtremor/floor0.c index 9c890e6bad..5062450748 100644 --- a/apps/codecs/libtremor/floor0.c +++ b/apps/codecs/libtremor/floor0.c @@ -74,7 +74,7 @@ static inline ogg_int32_t vorbis_coslook_i(long a){ int i=a>>COS_LOOKUP_I_SHIFT; int d=a&COS_LOOKUP_I_MASK; return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>> - COS_LOOKUP_I_SHIFT); + COS_LOOKUP_I_SHIFT); } /* interpolated lookup based cos function */ @@ -181,7 +181,7 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, qi=((qi*qi)>>16); if(m&1){ - qexp= qexp*2-28*((m+1)>>1)+m; + qexp= qexp*2-28*((m+1)>>1)+m; pi*=(1<<14)-((wi*wi)>>14); qi+=pi>>14; }else{ @@ -205,15 +205,15 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, for(j=3;j<m;j+=2){ if(!(shift=MLOOP_1[(pi|qi)>>25])) - if(!(shift=MLOOP_2[(pi|qi)>>19])) - shift=MLOOP_3[(pi|qi)>>16]; + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; qi=(qi>>shift)*labs(ilsp[j-1]-wi); pi=(pi>>shift)*labs(ilsp[j]-wi); qexp+=shift; } if(!(shift=MLOOP_1[(pi|qi)>>25])) if(!(shift=MLOOP_2[(pi|qi)>>19])) - shift=MLOOP_3[(pi|qi)>>16]; + shift=MLOOP_3[(pi|qi)>>16]; /* pi,qi normalized collectively, both tracked using qexp */ @@ -225,8 +225,8 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, qexp+=shift; if(!(shift=MLOOP_1[(pi|qi)>>25])) - if(!(shift=MLOOP_2[(pi|qi)>>19])) - shift=MLOOP_3[(pi|qi)>>16]; + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; pi>>=shift; qi>>=shift; @@ -243,7 +243,7 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, /* even order filter; still symmetric */ /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't - worth tracking step by step */ + worth tracking step by step */ pi>>=shift; qi>>=shift; @@ -268,15 +268,15 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, qi>>=1; qexp++; }else while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/ - qi<<=1; qexp--; + qi<<=1; qexp--; } #endif amp=vorbis_fromdBlook_i(ampi* /* n.4 */ - vorbis_invsqlook_i(qi,qexp)- - /* m.8, m+n<=8 */ - ampoffseti); /* 8.12[0] */ + vorbis_invsqlook_i(qi,qexp)- + /* m.8, m+n<=8 */ + ampoffseti); /* 8.12[0] */ #ifdef _LOW_ACCURACY_ amp>>=9; @@ -366,7 +366,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi for(j=0;j<look->n;j++){ int val=(look->ln* - ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11; + ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11; if(val>=look->ln)val=look->ln-1; /* guard against the approximation */ look->linearmap[j]=val; @@ -398,10 +398,10 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1)); for(j=0;j<look->m;j+=b->dim) - if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop; + if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop; for(j=0;j<look->m;){ - for(k=0;k<b->dim;k++,j++)lsp[j]+=last; - last=lsp[j-1]; + for(k=0;k<b->dim;k++,j++)lsp[j]+=last; + last=lsp[j-1]; } lsp[look->m]=amp; @@ -413,7 +413,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ } static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, - void *memo,ogg_int32_t *out){ + void *memo,ogg_int32_t *out){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; (void)vb; @@ -424,7 +424,7 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, /* take the coefficients back to a spectral envelope curve */ vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln, - lsp,look->m,amp,info->ampdB,look->lsp_look); + lsp,look->m,amp,info->ampdB,look->lsp_look); return(1); } memset(out,0,sizeof(*out)*look->n); diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c index 0b08167da8..ac95831d5d 100644 --- a/apps/codecs/libtremor/framing.c +++ b/apps/codecs/libtremor/framing.c @@ -1003,11 +1003,11 @@ STATICIRAM_NOT_MDCT int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){ /* split the body contents off */ if(op){ op->packet=ogg_buffer_split(&os->body_tail,&os->body_head, - os->body_fill&FINMASK); + os->body_fill&FINMASK); op->bytes=os->body_fill&FINMASK; }else{ os->body_tail=ogg_buffer_pretruncate(os->body_tail, - os->body_fill&FINMASK); + os->body_fill&FINMASK); if(os->body_tail==0)os->body_head=0; } diff --git a/apps/codecs/libtremor/info.c b/apps/codecs/libtremor/info.c index 935fa03269..9bfa7d03b0 100644 --- a/apps/codecs/libtremor/info.c +++ b/apps/codecs/libtremor/info.c @@ -47,7 +47,7 @@ void vorbis_comment_clear(vorbis_comment *vc){ for(i=0;i<vc->comments;i++) if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); if(vc->user_comments)_ogg_free(vc->user_comments); - if(vc->comment_lengths)_ogg_free(vc->comment_lengths); + if(vc->comment_lengths)_ogg_free(vc->comment_lengths); if(vc->vendor)_ogg_free(vc->vendor); memset(vc,0,sizeof(*vc)); } @@ -77,26 +77,26 @@ void vorbis_info_clear(vorbis_info *vi){ for(i=0;i<ci->maps;i++) /* unpack does the range checking */ if(ci->map_param[i]) - _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); + _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); for(i=0;i<ci->floors;i++) /* unpack does the range checking */ if(ci->floor_param[i]) - _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); + _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); for(i=0;i<ci->residues;i++) /* unpack does the range checking */ if(ci->residue_param[i]) - _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); + _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); for(i=0;i<ci->books;i++){ if(ci->book_param[i]){ - /* knows if the book was not alloced */ - vorbis_staticbook_destroy(ci->book_param[i]); + /* knows if the book was not alloced */ + vorbis_staticbook_destroy(ci->book_param[i]); } if(ci->fullbooks) - vorbis_book_clear(ci->fullbooks+i); + vorbis_book_clear(ci->fullbooks+i); } if(ci->fullbooks) - _ogg_free(ci->fullbooks); + _ogg_free(ci->fullbooks); _ogg_free(ci); } @@ -278,42 +278,42 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op) memset(buffer,0,6); _v_readstring(&opb,buffer,6); if(memcmp(buffer,"vorbis",6)){ - /* not a vorbis header */ - return(OV_ENOTVORBIS); + /* not a vorbis header */ + return(OV_ENOTVORBIS); } switch(packtype){ case 0x01: /* least significant *bit* is read first */ - if(!op->b_o_s){ - /* Not the initial packet */ - return(OV_EBADHEADER); - } - if(vi->rate!=0){ - /* previously initialized info header */ - return(OV_EBADHEADER); - } + if(!op->b_o_s){ + /* Not the initial packet */ + return(OV_EBADHEADER); + } + if(vi->rate!=0){ + /* previously initialized info header */ + return(OV_EBADHEADER); + } - return(_vorbis_unpack_info(vi,&opb)); + return(_vorbis_unpack_info(vi,&opb)); case 0x03: /* least significant *bit* is read first */ - if(vi->rate==0){ - /* um... we didn't get the initial header */ - return(OV_EBADHEADER); - } + if(vi->rate==0){ + /* um... we didn't get the initial header */ + return(OV_EBADHEADER); + } - return(_vorbis_unpack_comment(vc,&opb)); + return(_vorbis_unpack_comment(vc,&opb)); case 0x05: /* least significant *bit* is read first */ - if(vi->rate==0 || vc->vendor==NULL){ - /* um... we didn;t get the initial header or comments yet */ - return(OV_EBADHEADER); - } + if(vi->rate==0 || vc->vendor==NULL){ + /* um... we didn;t get the initial header or comments yet */ + return(OV_EBADHEADER); + } - return(_vorbis_unpack_books(vi,&opb)); + return(_vorbis_unpack_books(vi,&opb)); default: - /* Not a valid vorbis header type */ - return(OV_EBADHEADER); - break; + /* Not a valid vorbis header type */ + return(OV_EBADHEADER); + break; } } } diff --git a/apps/codecs/libtremor/ivorbiscodec.h b/apps/codecs/libtremor/ivorbiscodec.h index 0f3c940216..561c5d8732 100644 --- a/apps/codecs/libtremor/ivorbiscodec.h +++ b/apps/codecs/libtremor/ivorbiscodec.h @@ -157,7 +157,7 @@ extern int vorbis_info_blocksize(vorbis_info *vi,int zo); extern void vorbis_comment_init(vorbis_comment *vc); extern void vorbis_comment_add(vorbis_comment *vc, char *comment); extern void vorbis_comment_add_tag(vorbis_comment *vc, - char *tag, char *contents); + char *tag, char *contents); extern void vorbis_comment_clear(vorbis_comment *vc); extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); @@ -167,7 +167,7 @@ extern void vorbis_dsp_clear(vorbis_dsp_state *v); /* Vorbis PRIMITIVES: synthesis layer *******************************/ extern int vorbis_synthesis_idheader(ogg_packet *op); extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, - ogg_packet *op); + ogg_packet *op); extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); extern int vorbis_synthesis_restart(vorbis_dsp_state *v); diff --git a/apps/codecs/libtremor/ivorbisfile.h b/apps/codecs/libtremor/ivorbisfile.h index 4aa82cf9a0..39a648961a 100644 --- a/apps/codecs/libtremor/ivorbisfile.h +++ b/apps/codecs/libtremor/ivorbisfile.h @@ -89,11 +89,11 @@ typedef struct OggVorbis_File { extern int ov_clear(OggVorbis_File *vf); //extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); + char *initial, long ibytes, ov_callbacks callbacks); //extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); + char *initial, long ibytes, ov_callbacks callbacks); extern int ov_test_open(OggVorbis_File *vf); extern long ov_bitrate(OggVorbis_File *vf,int i); @@ -120,7 +120,7 @@ extern vorbis_info *ov_info(OggVorbis_File *vf,int link); extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); extern long ov_read(OggVorbis_File *vf,char *buffer,int length, - int *bitstream); + int *bitstream); extern long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels, int length,int *bitstream); diff --git a/apps/codecs/libtremor/lsp_lookup.h b/apps/codecs/libtremor/lsp_lookup.h index 42940bd39b..d996677ca1 100644 --- a/apps/codecs/libtremor/lsp_lookup.h +++ b/apps/codecs/libtremor/lsp_lookup.h @@ -51,23 +51,23 @@ static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ] ={ #define INVSQ_LOOKUP_I_SHIFT 10 #define INVSQ_LOOKUP_I_MASK 1023 static const long INVSQ_LOOKUP_I[64+1] ={ - 92682, 91966, 91267, 90583, - 89915, 89261, 88621, 87995, - 87381, 86781, 86192, 85616, - 85051, 84497, 83953, 83420, - 82897, 82384, 81880, 81385, - 80899, 80422, 79953, 79492, - 79039, 78594, 78156, 77726, - 77302, 76885, 76475, 76072, - 75674, 75283, 74898, 74519, - 74146, 73778, 73415, 73058, - 72706, 72359, 72016, 71679, - 71347, 71019, 70695, 70376, - 70061, 69750, 69444, 69141, - 68842, 68548, 68256, 67969, - 67685, 67405, 67128, 66855, - 66585, 66318, 66054, 65794, - 65536, + 92682, 91966, 91267, 90583, + 89915, 89261, 88621, 87995, + 87381, 86781, 86192, 85616, + 85051, 84497, 83953, 83420, + 82897, 82384, 81880, 81385, + 80899, 80422, 79953, 79492, + 79039, 78594, 78156, 77726, + 77302, 76885, 76475, 76072, + 75674, 75283, 74898, 74519, + 74146, 73778, 73415, 73058, + 72706, 72359, 72016, 71679, + 71347, 71019, 70695, 70376, + 70061, 69750, 69444, 69141, + 68842, 68548, 68256, 67969, + 67685, 67405, 67128, 66855, + 66585, 66318, 66054, 65794, + 65536, }; static const long INVSQ_LOOKUP_IDel[64] ={ @@ -93,44 +93,40 @@ static const long INVSQ_LOOKUP_IDel[64] ={ #define COS_LOOKUP_I_MASK 511 #define COS_LOOKUP_I_SZ 128 static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1] ={ - 16384, 16379, 16364, 16340, - 16305, 16261, 16207, 16143, - 16069, 15986, 15893, 15791, - 15679, 15557, 15426, 15286, - 15137, 14978, 14811, 14635, - 14449, 14256, 14053, 13842, - 13623, 13395, 13160, 12916, - 12665, 12406, 12140, 11866, - 11585, 11297, 11003, 10702, - 10394, 10080, 9760, 9434, - 9102, 8765, 8423, 8076, - 7723, 7366, 7005, 6639, - 6270, 5897, 5520, 5139, - 4756, 4370, 3981, 3590, - 3196, 2801, 2404, 2006, - 1606, 1205, 804, 402, - 0, -401, -803, -1204, - -1605, -2005, -2403, -2800, - -3195, -3589, -3980, -4369, - -4755, -5138, -5519, -5896, - -6269, -6638, -7004, -7365, - -7722, -8075, -8422, -8764, - -9101, -9433, -9759, -10079, - -10393, -10701, -11002, -11296, - -11584, -11865, -12139, -12405, - -12664, -12915, -13159, -13394, - -13622, -13841, -14052, -14255, - -14448, -14634, -14810, -14977, - -15136, -15285, -15425, -15556, - -15678, -15790, -15892, -15985, - -16068, -16142, -16206, -16260, - -16304, -16339, -16363, -16378, - -16383, + 16384, 16379, 16364, 16340, + 16305, 16261, 16207, 16143, + 16069, 15986, 15893, 15791, + 15679, 15557, 15426, 15286, + 15137, 14978, 14811, 14635, + 14449, 14256, 14053, 13842, + 13623, 13395, 13160, 12916, + 12665, 12406, 12140, 11866, + 11585, 11297, 11003, 10702, + 10394, 10080, 9760, 9434, + 9102, 8765, 8423, 8076, + 7723, 7366, 7005, 6639, + 6270, 5897, 5520, 5139, + 4756, 4370, 3981, 3590, + 3196, 2801, 2404, 2006, + 1606, 1205, 804, 402, + 0, -401, -803, -1204, + -1605, -2005, -2403, -2800, + -3195, -3589, -3980, -4369, + -4755, -5138, -5519, -5896, + -6269, -6638, -7004, -7365, + -7722, -8075, -8422, -8764, + -9101, -9433, -9759, -10079, + -10393, -10701, -11002, -11296, + -11584, -11865, -12139, -12405, + -12664, -12915, -13159, -13394, + -13622, -13841, -14052, -14255, + -14448, -14634, -14810, -14977, + -15136, -15285, -15425, -15556, + -15678, -15790, -15892, -15985, + -16068, -16142, -16206, -16260, + -16304, -16339, -16363, -16378, + -16383, }; #endif - - - - diff --git a/apps/codecs/libtremor/misc.h b/apps/codecs/libtremor/misc.h index 6e22f20008..a64a95d137 100644 --- a/apps/codecs/libtremor/misc.h +++ b/apps/codecs/libtremor/misc.h @@ -119,33 +119,33 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { /* replaced XPROD32 with a macro to avoid memory reference _x, _y are the results (must be l-values) */ -#define XPROD32(_a, _b, _t, _v, _x, _y) \ - { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ +#define XPROD32(_a, _b, _t, _v, _x, _y) \ + { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ (_y)=MULT32(_b,_t)-MULT32(_a,_v); } #ifdef __i386__ -#define XPROD31(_a, _b, _t, _v, _x, _y) \ - { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \ +#define XPROD31(_a, _b, _t, _v, _x, _y) \ + { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \ *(_y)=MULT31(_b,_t)-MULT31(_a,_v); } -#define XNPROD31(_a, _b, _t, _v, _x, _y) \ - { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \ +#define XNPROD31(_a, _b, _t, _v, _x, _y) \ + { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \ *(_y)=MULT31(_b,_t)+MULT31(_a,_v); } #else static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { *x = MULT31(a, t) + MULT31(b, v); *y = MULT31(b, t) - MULT31(a, v); } static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { *x = MULT31(a, t) - MULT31(b, v); *y = MULT31(b, t) + MULT31(a, v); @@ -217,8 +217,8 @@ static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { #endif static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, - ogg_int32_t b,ogg_int32_t bp, - ogg_int32_t *p){ + ogg_int32_t b,ogg_int32_t bp, + ogg_int32_t *p){ if(a && b){ #ifndef _LOW_ACCURACY_ *p=ap+bp+32; @@ -232,16 +232,16 @@ static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, } static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap, - ogg_int32_t i, - ogg_int32_t *p){ + ogg_int32_t i, + ogg_int32_t *p){ int ip=_ilog(abs(i))-31; return VFLOAT_MULT(a,ap,i<<-ip,ip,p); } static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap, - ogg_int32_t b,ogg_int32_t bp, - ogg_int32_t *p){ + ogg_int32_t b,ogg_int32_t bp, + ogg_int32_t *p){ if(!a){ *p=bp; diff --git a/apps/codecs/libtremor/sharedbook.c b/apps/codecs/libtremor/sharedbook.c index 10fae80c84..c47476bdd7 100644 --- a/apps/codecs/libtremor/sharedbook.c +++ b/apps/codecs/libtremor/sharedbook.c @@ -80,45 +80,45 @@ static ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ ogg_uint32_t entry=marker[length]; /* when we claim a node for an entry, we also claim the nodes - below it (pruning off the imagined tree that may have dangled - from it) as well as blocking the use of any nodes directly - above for leaves */ + below it (pruning off the imagined tree that may have dangled + from it) as well as blocking the use of any nodes directly + above for leaves */ /* update ourself */ if(length<32 && (entry>>length)){ - /* error condition; the lengths must specify an overpopulated tree */ - _ogg_free(r); - return(NULL); + /* error condition; the lengths must specify an overpopulated tree */ + _ogg_free(r); + return(NULL); } r[count++]=entry; /* Look to see if the next shorter marker points to the node - above. if so, update it and repeat. */ + above. if so, update it and repeat. */ { - for(j=length;j>0;j--){ - - if(marker[j]&1){ - /* have to jump branches */ - if(j==1) - marker[1]++; - else - marker[j]=marker[j-1]<<1; - break; /* invariant says next upper marker would already - have been moved if it was on the same path */ - } - marker[j]++; - } + for(j=length;j>0;j--){ + + if(marker[j]&1){ + /* have to jump branches */ + if(j==1) + marker[1]++; + else + marker[j]=marker[j-1]<<1; + break; /* invariant says next upper marker would already + have been moved if it was on the same path */ + } + marker[j]++; + } } /* prune the tree; the implicit invariant says all the longer - markers were dangling from our just-taken node. Dangle them - from our *new* node. */ + markers were dangling from our just-taken node. Dangle them + from our *new* node. */ for(j=length+1;j<33;j++) - if((marker[j]>>1) == entry){ - entry=marker[j]; - marker[j]=marker[j-1]<<1; - }else - break; + if((marker[j]>>1) == entry){ + entry=marker[j]; + marker[j]=marker[j-1]<<1; + }else + break; }else if(sparsecount==0)count++; } @@ -134,7 +134,7 @@ static ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ if(sparsecount){ if(l[i]) - r[count++]=temp; + r[count++]=temp; }else r[count++]=temp; } @@ -162,9 +162,9 @@ long _book_maptype1_quantvals(const static_codebook *b){ return(vals); }else{ if(acc>b->entries){ - vals--; + vals--; }else{ - vals++; + vals++; } } } @@ -197,85 +197,85 @@ static ogg_int32_t *_book_unquantize(const static_codebook *b,int n, switch(b->maptype){ case 1: /* most of the time, entries%dimensions == 0, but we need to be - well defined. We define that the possible vales at each - scalar is values == entries/dim. If entries%dim != 0, we'll - have 'too few' values (values*dim<entries), which means that - we'll have 'left over' entries; left over entries use zeroed - values (and are wasted). So don't generate codebooks like - that */ + well defined. We define that the possible vales at each + scalar is values == entries/dim. If entries%dim != 0, we'll + have 'too few' values (values*dim<entries), which means that + we'll have 'left over' entries; left over entries use zeroed + values (and are wasted). So don't generate codebooks like + that */ quantvals=_book_maptype1_quantvals(b); for(j=0;j<b->entries;j++){ - if((sparsemap && b->lengthlist[j]) || !sparsemap){ - ogg_int32_t last=0; - int lastpoint=0; - int indexdiv=1; - for(k=0;k<b->dim;k++){ - int index= (j/indexdiv)%quantvals; - int point=0; - int val=VFLOAT_MULTI(delta,delpoint, - abs(b->quantlist[index]),&point); - - val=VFLOAT_ADD(mindel,minpoint,val,point,&point); - val=VFLOAT_ADD(last,lastpoint,val,point,&point); - - if(b->q_sequencep){ - last=val; - lastpoint=point; + if((sparsemap && b->lengthlist[j]) || !sparsemap){ + ogg_int32_t last=0; + int lastpoint=0; + int indexdiv=1; + for(k=0;k<b->dim;k++){ + int index= (j/indexdiv)%quantvals; + int point=0; + int val=VFLOAT_MULTI(delta,delpoint, + abs(b->quantlist[index]),&point); + + val=VFLOAT_ADD(mindel,minpoint,val,point,&point); + val=VFLOAT_ADD(last,lastpoint,val,point,&point); + + if(b->q_sequencep){ + last=val; + lastpoint=point; + } + + if(sparsemap){ + r[sparsemap[count]*b->dim+k]=val; + rp[sparsemap[count]*b->dim+k]=point; + }else{ + r[count*b->dim+k]=val; + rp[count*b->dim+k]=point; + } + if(*maxpoint<point)*maxpoint=point; + indexdiv*=quantvals; + } + count++; } - - if(sparsemap){ - r[sparsemap[count]*b->dim+k]=val; - rp[sparsemap[count]*b->dim+k]=point; - }else{ - r[count*b->dim+k]=val; - rp[count*b->dim+k]=point; - } - if(*maxpoint<point)*maxpoint=point; - indexdiv*=quantvals; - } - count++; - } } break; case 2: for(j=0;j<b->entries;j++){ - if((sparsemap && b->lengthlist[j]) || !sparsemap){ - ogg_int32_t last=0; - int lastpoint=0; - - for(k=0;k<b->dim;k++){ - int point=0; - int val=VFLOAT_MULTI(delta,delpoint, - abs(b->quantlist[j*b->dim+k]),&point); - - val=VFLOAT_ADD(mindel,minpoint,val,point,&point); - val=VFLOAT_ADD(last,lastpoint,val,point,&point); - - if(b->q_sequencep){ - last=val; - lastpoint=point; - } - - if(sparsemap){ - r[sparsemap[count]*b->dim+k]=val; - rp[sparsemap[count]*b->dim+k]=point; - }else{ - r[count*b->dim+k]=val; - rp[count*b->dim+k]=point; + if((sparsemap && b->lengthlist[j]) || !sparsemap){ + ogg_int32_t last=0; + int lastpoint=0; + + for(k=0;k<b->dim;k++){ + int point=0; + int val=VFLOAT_MULTI(delta,delpoint, + abs(b->quantlist[j*b->dim+k]),&point); + + val=VFLOAT_ADD(mindel,minpoint,val,point,&point); + val=VFLOAT_ADD(last,lastpoint,val,point,&point); + + if(b->q_sequencep){ + last=val; + lastpoint=point; + } + + if(sparsemap){ + r[sparsemap[count]*b->dim+k]=val; + rp[sparsemap[count]*b->dim+k]=point; + }else{ + r[count*b->dim+k]=val; + rp[count*b->dim+k]=point; + } + if(*maxpoint<point)*maxpoint=point; + } + count++; } - if(*maxpoint<point)*maxpoint=point; - } - count++; - } } break; } for(j=0;j<n*b->dim;j++) if(rp[j]<*maxpoint) - r[j]>>=*maxpoint-rp[j]; - + r[j]>>=*maxpoint-rp[j]; + _ogg_free(rp); return(r); } @@ -383,12 +383,12 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ for(n=0,i=0;i<s->entries;i++) if(s->lengthlist[i]>0) - c->dec_index[sortindex[n++]]=i; + c->dec_index[sortindex[n++]]=i; c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths)); for(n=0,i=0;i<s->entries;i++) if(s->lengthlist[i]>0) - c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; + c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; _ogg_free(sortindex); c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */ @@ -401,11 +401,11 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ for(i=0;i<n;i++){ if(c->dec_maxlength<c->dec_codelengths[i]) - c->dec_maxlength=c->dec_codelengths[i]; + c->dec_maxlength=c->dec_codelengths[i]; if(c->dec_codelengths[i]<=c->dec_firsttablen){ - ogg_uint32_t orig=bitreverse(c->codelist[i]); - for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) - c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1; + ogg_uint32_t orig=bitreverse(c->codelist[i]); + for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) + c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1; } } @@ -416,24 +416,24 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ long lo=0,hi=0; for(i=0;i<tabn;i++){ - ogg_uint32_t word=i<<(32-c->dec_firsttablen); - if(c->dec_firsttable[bitreverse(word)]==0){ - while((lo+1)<n && c->codelist[lo+1]<=word)lo++; - while( hi<n && word>=(c->codelist[hi]&mask))hi++; - - /* we only actually have 15 bits per hint to play with here. - In order to overflow gracefully (nothing breaks, efficiency - just drops), encode as the difference from the extremes. */ - { - unsigned long loval=lo; - unsigned long hival=n-hi; - - if(loval>0x7fff)loval=0x7fff; - if(hival>0x7fff)hival=0x7fff; - c->dec_firsttable[bitreverse(word)]= - 0x80000000UL | (loval<<15) | hival; - } - } + ogg_uint32_t word=i<<(32-c->dec_firsttablen); + if(c->dec_firsttable[bitreverse(word)]==0){ + while((lo+1)<n && c->codelist[lo+1]<=word)lo++; + while( hi<n && word>=(c->codelist[hi]&mask))hi++; + + /* we only actually have 15 bits per hint to play with here. + In order to overflow gracefully (nothing breaks, efficiency + just drops), encode as the difference from the extremes. */ + { + unsigned long loval=lo; + unsigned long hival=n-hi; + + if(loval>0x7fff)loval=0x7fff; + if(hival>0x7fff)hival=0x7fff; + c->dec_firsttable[bitreverse(word)]= + 0x80000000UL | (loval<<15) | hival; + } + } } } } diff --git a/apps/codecs/libtremor/window.h b/apps/codecs/libtremor/window.h index f11742e1dd..b242ec2354 100644 --- a/apps/codecs/libtremor/window.h +++ b/apps/codecs/libtremor/window.h @@ -20,8 +20,8 @@ extern const void *_vorbis_window(int type,int left); extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2], - long *blocksizes, - int lW,int W,int nW); + long *blocksizes, + int lW,int W,int nW); #endif |