[xiph-cvs] cvs commit: vorbis/lib/modes residue_44.h

Monty xiphmont at xiph.org
Thu Dec 6 01:58:57 PST 2001



xiphmont    01/12/06 01:58:57

  Modified:    lib      Tag: branch_monty_20011009 vorbisenc.c
               lib/modes Tag: branch_monty_20011009 residue_44.h
  Log:
  continued debugging of vorbisenc.c

Revision  Changes    Path
No                   revision

No                   revision

1.17.2.5  +24 -11    vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.17.2.4
retrieving revision 1.17.2.5
diff -u -r1.17.2.4 -r1.17.2.5
--- vorbisenc.c	2001/12/06 08:56:16	1.17.2.4
+++ vorbisenc.c	2001/12/06 09:58:56	1.17.2.5
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.17.2.4 2001/12/06 08:56:16 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.17.2.5 2001/12/06 09:58:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -400,21 +400,15 @@
   r=ci->residue_param[block]=malloc(sizeof(*r));
   memcpy(r,in[iq].res,sizeof(*r));
 
-  n=r->end=ci->blocksizes[block?1:0]>>1; /* to be adjusted by lowpass later */
-
   if(block){
     r->grouping=32;
   }else{
     r->grouping=16;
   }
 
-  res_position=rint((double)c[iq]*1000/vi->rate*n);
-  partition_position=res_position/r->grouping;
-  for(i=0;i<r->partitions;i++)
-    if(r->blimit[i]<0)r->blimit[i]=partition_position;
-
   /* for uncoupled, we use type 1, else type 2 */
   if(coupled_p){
+    int k;
     vorbis_info_mapping0 *map=ci->map_param[block];
 
     map->coupling_steps=1;
@@ -435,6 +429,12 @@
     psy->couple_pass[0].couple_pass[1].outofphase_requant_limit=9e10;
     psy->couple_pass[0].couple_pass[1].amppost_point=stereo_threshholds[a[iq]];
     amplitude_select=a[iq];
+
+    for(i=0;i<r->partitions;i++)
+      for(k=0;k<3;k++)
+	if(in[iq].books_base[a[iq]][i][k])
+	  r->secondstages[i]|=(1<<k);
+      
     ci->passlimit[0]=3;
     
     if(stereo_backfill_p && a[iq]){
@@ -520,7 +520,20 @@
       }
     }
   }
-      
+
+  switch(ci->residue_type[block]){
+  case 1:
+    n=r->end=ci->blocksizes[block?1:0]>>1; /* to be adjusted by lowpass later */
+    break;
+  case 2:
+    n=r->end=ci->blocksizes[block?1:0]; /* to be adjusted by lowpass later */
+    break;
+  }
+
+  partition_position=rint((double)c[iq]*1000/(vi->rate/2)*n/r->grouping);
+  for(i=0;i<r->partitions;i++)
+    if(r->blimit[i]<0)r->blimit[i]=partition_position;
+  
   return(0);
 }      
 
@@ -547,14 +560,14 @@
     dq=q*10.-iq;
   }
   
-  freq=x[iq]*(1.-dq)+x[iq+1]*dq;
+  freq=(x[iq]*(1.-dq)+x[iq+1]*dq)*1000.;
 
   /* lowpass needs to be set in the floor and the residue. */
 
   /* in the floor, the granularity can be very fine; it doesn't alter
      the encoding structure, only the samples used to fit the floor
      approximation */
-  f->n=freq*1000/nyq*blocksize;
+  f->n=freq/nyq*blocksize;
 
   /* in the residue, we're constrained, physically, by partition
      boundaries.  We still lowpass 'wherever', but we have to round up

No                   revision

No                   revision

1.1.2.3   +22 -23    vorbis/lib/modes/Attic/residue_44.h

Index: residue_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/Attic/residue_44.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- residue_44.h	2001/12/05 08:03:20	1.1.2.2
+++ residue_44.h	2001/12/06 09:58:56	1.1.2.3
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: toplevel residue templates for 32/44.1/48kHz
- last mod: $Id: residue_44.h,v 1.1.2.2 2001/12/05 08:03:20 xiphmont Exp $
+ last mod: $Id: residue_44.h,v 1.1.2.3 2001/12/06 09:58:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -49,8 +49,7 @@
        0   4   4   4   3   4   4   4   3   7 */
 static vorbis_info_residue0 _residue_44_low={
   0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8     9 */
-  {   0,    4,    4,    4,    3,    4,    4,    4,    3,    7},
+  {0},
   {-1},
   {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
   {  .5,  1.5,  2.5,  4.5, 22.5,  1.5,  2.5,  4.5, 22.5},
@@ -70,7 +69,7 @@
 static vorbis_info_residue0 _residue_44_mid={
   0,-1, -1, 10,-1,
   /*  0     1     2     3     4     5     6     7     8     9 */
-  {   0,    4,    4,    4,    4,    4,    4,    3,    3,    7},
+  {0},
   {-1},
   {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
   {  .5,  1.5,  2.5,  4.5,  1.5,  2.5,  4.5, 22.5, 84.5},
@@ -91,7 +90,7 @@
 static vorbis_info_residue0 _residue_44_high={
   0,-1, -1, 10,-1,
   /*  0     1     2     3     4     5     6     7     8     9 */
-  {   0,    4,    3,    4,    4,    4,    4,    3,    3,    7},
+  {0},
   {-1},
   {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
   {  .5,  4.5, 22.5,  1.5,  2.5,  4.5,  7.5, 22.5, 84.5},
@@ -106,32 +105,32 @@
 static vorbis_residue_template _residue_template_44_stereo[11]={
   /* mode 0; 64-ish */
   {&_residue_44_low,  {&44c0_short,&44c0_long},
-   { {{-1}}, /* lossless stereo */
-     {{-1}}, /* 6dB (2.5) stereo */
-     {{-1}}, /* 12dB (4.5) stereo */
-     {{-1}}, /* 17dB (7.5) stereo */
-     {{&44c0_s0_p1_0},{&44c0_s0_p2_0},{&44c0_s0_p3_0},{&44c0_s0_p4_0,&44c0_p4_1},
-      {&44c0_s1_p5_0},{&44c0_s1_p6_0},{&44c0_s2_p7_0},{&44c0_s4_p8_0,&44c0_s4_p8_1},
+   { {{0}}, /* lossless stereo */
+     {{0}}, /* 6dB (2.5) stereo */
+     {{0}}, /* 12dB (4.5) stereo */
+     {{0}}, /* 17dB (7.5) stereo */
+     {{0,0,&44c0_s0_p1_0},{0,0,&44c0_s0_p2_0},{0,0,&44c0_s0_p3_0},{&44c0_s0_p4_0,&44c0_p4_1},
+      {0,0,&44c0_s1_p5_0},{0,0,&44c0_s1_p6_0},{0,0,&44c0_s2_p7_0},{&44c0_s4_p8_0,&44c0_s4_p8_1},
       {&44c0_s4_p9_0,&44c0_s4_p9_1,&44c0_s4_p9_2}}, /* 22dB (12.5) stereo */
-     {{-1}}, /* 27dB (22.5) stereo */
+     {{0}}, /* 27dB (22.5) stereo */
    },
-   { {-1}, /* lossless stereo */
-     {-1}, /* 6dB (2.5) stereo */
-     {-1}, /* 12dB (4.5) stereo */
-     {-1}, /* 17dB (7.5) stereo */
-     {-1,-1,-1,-1,-1,-1,-1,-1,&44c0_s4_s8,&44c0_s4_s9},/* 22dB (12.5) stereo */
-     {-1}, /* 27dB (22.5) stereo */
+   { {0}, /* lossless stereo */
+     {0}, /* 6dB (2.5) stereo */
+     {0}, /* 12dB (4.5) stereo */
+     {0}, /* 17dB (7.5) stereo */
+     {0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},/* 22dB (12.5) stereo */
+     {0}, /* 27dB (22.5) stereo */
    },
-   { {{-1}}, /* lossless stereo */
-     {{-1}}, /* 6dB (2.5) stereo */
-     {{-1}}, /* 12dB (4.5) stereo */
+   { {{0}}, /* lossless stereo */
+     {{0}}, /* 6dB (2.5) stereo */
+     {{0}}, /* 12dB (4.5) stereo */
      {{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
       {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
       {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
       {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
       {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}}, /* 17dB (7.5) stereo */
-     {{-1}}, /* 22dB (12.5) stereo */
-     {{-1}}, /* 27dB (22.5) stereo */
+     {{0}}, /* 22dB (12.5) stereo */
+     {{0}}, /* 27dB (22.5) stereo */
    },
   }
 

--- >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