diff options
author | Monty <xiphmont@xiph.org> | 2001-08-09 01:14:19 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2001-08-09 01:14:19 +0000 |
commit | 4028ff3db0c6ffa3b68df44261a22d37d89da811 (patch) | |
tree | 222bad36e45ca0ab45bb1b306655192a2172e872 /lib | |
parent | e92d3ae3acadf1a4bf3789fbec9ff2ac9cafca6a (diff) | |
download | libvorbis-git-4028ff3db0c6ffa3b68df44261a22d37d89da811.tar.gz |
logic bug; classifier was breaking an abstraction barrier and was
choosing partition type based on uncoupled data.
Monty
svn path=/branches/branch_monty_20010708/vorbis/; revision=1715
Diffstat (limited to 'lib')
-rw-r--r-- | lib/res0.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl, 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 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, 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 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, 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 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, 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 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, } } - /*{ + { long total=0; long totalbits=0; fprintf(stderr,"%d :: ",vb->mode); @@ -564,7 +570,7 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, } fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total); - }*/ + } return(0); } |