[xiph-cvs] cvs commit: vorbis/lib res0.c

Monty xiphmont at xiph.org
Wed Aug 8 18:14:20 PDT 2001



xiphmont    01/08/08 18:14:19

  Modified:    lib      Tag: branch_monty_20010708 res0.c
  Log:
  logic bug; classifier was breaking an abstraction barrier and was
  choosing partition type based on uncoupled data.
  
  Monty

Revision  Changes    Path
No                   revision

No                   revision

1.32.2.8  +11 -5     vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.32.2.7
retrieving revision 1.32.2.8
diff -u -r1.32.2.7 -r1.32.2.8
--- res0.c	2001/08/08 05:23:32	1.32.2.7
+++ res0.c	2001/08/09 01:14:19	1.32.2.8
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.32.2.7 2001/08/08 05:23:32 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.32.2.8 2001/08/09 01:14:19 xiphmont Exp $
 
  ********************************************************************/
 
@@ -443,7 +443,7 @@
 
   for(i=0,j=0,k=0,l=info->begin;i<partvals;i++){
     for(k=0;k<samples_per_partition;k++){
-      work[k]=vb->pcm[j][l];
+      work[k]=in[j][l];
       j++;
       if(j>=ch){
         j=0;
@@ -488,6 +488,8 @@
   int n=info->end-info->begin;
 
   int partvals=n/samples_per_partition;
+  long resbits[128];
+  long resvals[128];
 
 #ifdef TRAIN_RES
   FILE *of;
@@ -503,6 +505,9 @@
     fclose(of);
   }
 #endif      
+
+  memset(resbits,0,sizeof(resbits));
+  memset(resvals,0,sizeof(resvals));
   
   /* we code the partition words for each channel, then the residual
      words for a partition per channel until we've written all the
@@ -539,13 +544,14 @@
         long offset=i*samples_per_partition+info->begin;
         
         for(j=0;j<ch;j++){
+	  if(s==0)resvals[partword[j][i]]+=samples_per_partition;
           if(info->secondstages[partword[j][i]]&(1<<s)){
             codebook *statebook=look->partbooks[partword[j][i]][s];
             if(statebook){
               int ret=encode(&vb->opb,in[j]+offset,samples_per_partition,
                              statebook,look);
               look->postbits+=ret;
-	      
+	      resbits[partword[j][i]]+=ret;
             }
           }
         }
@@ -553,7 +559,7 @@
     }
   }
 
-  /*{
+  {
     long total=0;
     long totalbits=0;
     fprintf(stderr,"%d :: ",vb->mode);
@@ -564,7 +570,7 @@
     }
 
     fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total);
-    }*/ 
+    }
   return(0);
 }
 

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list