summaryrefslogtreecommitdiff
path: root/apps/codecs/libtremor/sharedbook.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-03-05 09:48:07 +0000
committerNils Wallménius <nils@rockbox.org>2010-03-05 09:48:07 +0000
commitb382d8334bcfff7fe49ba3ab850b069a6fd95505 (patch)
tree68b47fc848036894d73063a2ad17f81ad6c45cca /apps/codecs/libtremor/sharedbook.c
parent3c878249705755d1dfb6c5320302f1670dd87a67 (diff)
downloadrockbox-b382d8334bcfff7fe49ba3ab850b069a6fd95505.zip
rockbox-b382d8334bcfff7fe49ba3ab850b069a6fd95505.tar.gz
rockbox-b382d8334bcfff7fe49ba3ab850b069a6fd95505.tar.bz2
rockbox-b382d8334bcfff7fe49ba3ab850b069a6fd95505.tar.xz
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/libtremor/sharedbook.c')
-rw-r--r--apps/codecs/libtremor/sharedbook.c236
1 files changed, 118 insertions, 118 deletions
diff --git a/apps/codecs/libtremor/sharedbook.c b/apps/codecs/libtremor/sharedbook.c
index 10fae80..c47476b 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;
+ }
+ }
}
}
}