Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /lib/codebook.c [18daa4] .. [6e3837] Maximize Restore

  Switch to side-by-side view

--- a/lib/codebook.c
+++ b/lib/codebook.c
@@ -56,10 +56,10 @@
       long this=c->lengthlist[i];
       long last=c->lengthlist[i-1];
       if(this>last){
-	for(j=last;j<this;j++){
-	  oggpack_write(opb,i-count,_ilog(c->entries-count));
-	  count=i;
-	}
+        for(j=last;j<this;j++){
+          oggpack_write(opb,i-count,_ilog(c->entries-count));
+          count=i;
+        }
       }
     }
     oggpack_write(opb,i-count,_ilog(c->entries-count));
@@ -78,16 +78,16 @@
     if(i==c->entries){
       oggpack_write(opb,0,1); /* no unused entries */
       for(i=0;i<c->entries;i++)
-	oggpack_write(opb,c->lengthlist[i]-1,5);
+        oggpack_write(opb,c->lengthlist[i]-1,5);
     }else{
       oggpack_write(opb,1,1); /* we have unused entries; thus we tag */
       for(i=0;i<c->entries;i++){
-	if(c->lengthlist[i]==0){
-	  oggpack_write(opb,0,1);
-	}else{
-	  oggpack_write(opb,1,1);
-	  oggpack_write(opb,c->lengthlist[i]-1,5);
-	}
+        if(c->lengthlist[i]==0){
+          oggpack_write(opb,0,1);
+        }else{
+          oggpack_write(opb,1,1);
+          oggpack_write(opb,c->lengthlist[i]-1,5);
+        }
       }
     }
   }
@@ -118,21 +118,21 @@
       int quantvals;
       switch(c->maptype){
       case 1:
-	/* a single column of (c->entries/c->dim) quantized values for
-	   building a full value list algorithmically (square lattice) */
-	quantvals=_book_maptype1_quantvals(c);
-	break;
+        /* a single column of (c->entries/c->dim) quantized values for
+           building a full value list algorithmically (square lattice) */
+        quantvals=_book_maptype1_quantvals(c);
+        break;
       case 2:
-	/* every value (c->entries*c->dim total) specified explicitly */
-	quantvals=c->entries*c->dim;
-	break;
+        /* every value (c->entries*c->dim total) specified explicitly */
+        quantvals=c->entries*c->dim;
+        break;
       default: /* NOT_REACHABLE */
-	quantvals=-1;
+        quantvals=-1;
       }
 
       /* quantized values */
       for(i=0;i<quantvals;i++)
-	oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
+        oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
 
     }
     break;
@@ -172,19 +172,19 @@
       /* 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;
       }
     }
     
@@ -196,11 +196,11 @@
       s->lengthlist=_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;
@@ -227,17 +227,17 @@
       int quantvals=0;
       switch(s->maptype){
       case 1:
-	quantvals=(s->dim==0?0:_book_maptype1_quantvals(s));
-	break;
+        quantvals=(s->dim==0?0:_book_maptype1_quantvals(s));
+        break;
       case 2:
-	quantvals=s->entries*s->dim;
-	break;
+        quantvals=s->entries*s->dim;
+        break;
       }
       
       /* quantized values */
       s->quantlist=_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;
     }
@@ -397,7 +397,7 @@
     }
     for(i=0,o=0;i<book->dim;i++,o+=step)
       for (j=0;j<step;j++)
-	a[o+j]+=t[j][i];
+        a[o+j]+=t[j][i];
   }
   return(0);
 }
@@ -409,38 +409,38 @@
     
     if(book->dim>8){
       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++];
+        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++];
       }
     }else{
       for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	j=0;
-	switch((int)book->dim){
-	case 8:
-	  a[i++]+=t[j++];
-	case 7:
-	  a[i++]+=t[j++];
-	case 6:
-	  a[i++]+=t[j++];
-	case 5:
-	  a[i++]+=t[j++];
-	case 4:
-	  a[i++]+=t[j++];
-	case 3:
-	  a[i++]+=t[j++];
-	case 2:
-	  a[i++]+=t[j++];
-	case 1:
-	  a[i++]+=t[j++];
-	case 0:
-	  break;
-	}
+        entry = decode_packed_entry_number(book,b);
+        if(entry==-1)return(-1);
+        t     = book->valuelist+entry*book->dim;
+        j=0;
+        switch((int)book->dim){
+        case 8:
+          a[i++]+=t[j++];
+        case 7:
+          a[i++]+=t[j++];
+        case 6:
+          a[i++]+=t[j++];
+        case 5:
+          a[i++]+=t[j++];
+        case 4:
+          a[i++]+=t[j++];
+        case 3:
+          a[i++]+=t[j++];
+        case 2:
+          a[i++]+=t[j++];
+        case 1:
+          a[i++]+=t[j++];
+        case 0:
+          break;
+        }
       }
     }    
   }
@@ -457,21 +457,21 @@
       if(entry==-1)return(-1);
       t     = book->valuelist+entry*book->dim;
       for (j=0;j<book->dim;)
-	a[i++]=t[j++];
+        a[i++]=t[j++];
     }
   }else{
     int i,j;
     
     for(i=0;i<n;){
       for (j=0;j<book->dim;)
-	a[i++]=0.f;
+        a[i++]=0.f;
     }
   }
   return(0);
 }
 
 long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
-			      oggpack_buffer *b,int n){
+                              oggpack_buffer *b,int n){
 
   long i,j,entry;
   int chptr=0;
@@ -480,14 +480,14 @@
       entry = decode_packed_entry_number(book,b);
       if(entry==-1)return(-1);
       {
-	const float *t = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;j++){
-	  a[chptr++][i]+=t[j];
-	  if(chptr==ch){
-	    chptr=0;
-	    i++;
-	  }
-	}
+        const float *t = book->valuelist+entry*book->dim;
+        for (j=0;j<book->dim;j++){
+          a[chptr++][i]+=t[j];
+          if(chptr==ch){
+            chptr=0;
+            i++;
+          }
+        }
       }
     }
   }
@@ -565,7 +565,7 @@
   30,-25,-30,-1,-5,-32,4,3,-2,0};
 
 static_codebook *testlist[]={&_vq_book_lsp20_0,
-			     &_vq_book_res0a_13,NULL};
+                             &_vq_book_res0a_13,NULL};
 float   *testvec[]={test1,test3};
 
 int main(){
@@ -614,16 +614,16 @@
 
     for(i=0;i<TESTSIZE;i+=c.dim)
       if(vorbis_book_decodev_set(&c,iv+i,&read,c.dim)==-1){
-	fprintf(stderr,"Error reading codebook test data (EOP).\n");
-	exit(1);
+        fprintf(stderr,"Error reading codebook test data (EOP).\n");
+        exit(1);
       }
     for(i=0;i<TESTSIZE;i++)
       if(fabs(qv[i]-iv[i])>.000001){
-	fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n",
-		iv[i],qv[i],i);
-	exit(1);
-      }
-	  
+        fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n",
+                iv[i],qv[i],i);
+        exit(1);
+      }
+          
     fprintf(stderr,"OK\n");
     ptr++;
   }