[xiph-cvs] cvs commit: vorbis/lib floor1.c analysis.c backends.h floor0.c psytune.c registry.c registry.h

Monty xiphmont at xiph.org
Wed Apr 4 17:22:50 PDT 2001



xiphmont    01/04/04 17:22:50

  Modified:    lib      Tag: monty-branch-20010404 analysis.c backends.h
                        floor0.c psytune.c registry.c registry.h
  Added:       lib      Tag: monty-branch-20010404 floor1.c
  Log:
  Taking Snotfish down for the move.  Putting all in-progress work
  (floor 1) into CVS on a branch so I can work while Snotfish is asleep
  on a truck.
  
  Monty

Revision  Changes    Path
No                   revision

No                   revision

1.43.4.1  +8 -3      vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.43
retrieving revision 1.43.4.1
diff -u -r1.43 -r1.43.4.1
--- analysis.c	2001/02/26 03:50:41	1.43
+++ analysis.c	2001/04/05 00:22:48	1.43.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.43 2001/02/26 03:50:41 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.43.4.1 2001/04/05 00:22:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -75,8 +75,7 @@
 }
 
 /* there was no great place to put this.... */
-void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){
-#ifdef ANALYSIS
+void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB){
   int j;
   FILE *of;
   char buffer[80];
@@ -102,5 +101,11 @@
     }
   }
   fclose(of);
+}
+
+void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){
+#ifdef ANALYSIS
+  _analysis_output_always(base,i,v,n,bark,dB);
 #endif
 }
+

1.6.4.1   +19 -2     vorbis/lib/backends.h

Index: backends.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/backends.h,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -r1.6 -r1.6.4.1
--- backends.h	2001/02/26 03:50:41	1.6
+++ backends.h	2001/04/05 00:22:48	1.6.4.1
@@ -12,7 +12,7 @@
 
  function: libvorbis backend and mapping structures; needed for 
            static mode headers
- last mod: $Id: backends.h,v 1.6 2001/02/26 03:50:41 xiphmont Exp $
+ last mod: $Id: backends.h,v 1.6.4.1 2001/04/05 00:22:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -61,7 +61,7 @@
   void (*free_info) (vorbis_info_floor *);
   void (*free_look) (vorbis_look_floor *);
   int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
-		     float *);
+		     float *, float *);
   int  (*inverse)   (struct vorbis_block *,vorbis_look_floor *,
                      float *);
 } vorbis_func_floor;
@@ -81,6 +81,23 @@
   float greaterthan;  /* encode-only config setting hacks for libvorbis */
 
 } vorbis_info_floor0;
+
+typedef struct{
+  long  maxrange;
+  int   rangeres;       /* 6, 7 or 8 */
+
+  int   ranges;         /* up to 8 */
+  int   rangesizes[8];  /* 1 to 8 */
+  int   rangelist[64]; 
+  
+  int   positionbook[8];
+  int   ampbook[8];
+
+  float maxover;  /* encode side analysis parameter */
+  float maxunder; /* encode side analysis parameter */
+  float maxerr;   /* encode side analysis parameter */
+
+} vorbis_info_floor1;
 
 /* Residue backend generic *****************************************/
 typedef struct{

1.39.4.1  +19 -2     vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.39
retrieving revision 1.39.4.1
diff -u -r1.39 -r1.39.4.1
--- floor0.c	2001/02/26 03:50:41	1.39
+++ floor0.c	2001/04/05 00:22:48	1.39.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.39 2001/02/26 03:50:41 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.39.4.1 2001/04/05 00:22:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -197,6 +197,7 @@
   float *work=alloca(sizeof(float)*mapped);
   int i,j,last=0;
   int bark=0;
+  static int seq=0;
 
   memset(work,0,sizeof(float)*mapped);
   
@@ -232,6 +233,20 @@
   /* If we're over-ranged to avoid edge effects, fill in the end of spectrum gap */
   for(i=bark+1;i<mapped;i++)
     work[i]=work[i-1];
+
+
+  /**********************/
+
+  for(i=0;i<l->n;i++)
+    curve[i]-=150;
+
+  _analysis_output_always("barkfloor",seq,work,bark,0,0);
+  _analysis_output_always("barkcurve",seq++,curve,l->n,1,0);
+
+  for(i=0;i<l->n;i++)
+    curve[i]+=150;
+
+  /**********************/
   
   return vorbis_lpc_from_curve(work,lpc,&(l->lpclook));
 }
@@ -240,7 +255,7 @@
 /* didn't need in->out seperation, modifies the flr[] vector; takes in
    a dB scale floor, puts out linear */
 static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
-		    float *flr){
+		    float *flr,float *dummy){
   long j;
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   vorbis_info_floor0 *info=look->vi;
@@ -369,6 +384,8 @@
     /* take the coefficients back to a spectral envelope curve */
     vorbis_lsp_to_curve(flr,look->linearmap,look->n,look->ln,
                         lspwork,look->m,amp,info->ampdB);
+
+    _analysis_output_always("barklsp",seq-1,flr,look->n,1,1);
     _analysis_output("lsp3",seq-1,flr,look->n,0,1);
     return(val);
   }

1.14.4.1  +117 -49   vorbis/lib/psytune.c

Index: psytune.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psytune.c,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -u -r1.14 -r1.14.4.1
--- psytune.c	2001/02/26 03:50:43	1.14
+++ psytune.c	2001/04/05 00:22:48	1.14.4.1
@@ -12,7 +12,7 @@
 
  function: simple utility that runs audio through the psychoacoustics
            without encoding
- last mod: $Id: psytune.c,v 1.14 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.14.4.1 2001/04/05 00:22:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -33,7 +33,7 @@
 
 static vorbis_info_psy _psy_set0={
   1,/*athp*/
-  0,/*decayp*/
+  1,/*decayp*/
 
   -100.f,
   -140.f,
@@ -43,38 +43,33 @@
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-
    1,/* tonemaskp */
   /*  0   10   20   30   40   50   60   70   80   90   100 */
   {
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-   //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*175*/
-   //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*250*/
-   //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*350*/
-   //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*500*/
-   //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*700*/
-
-   //   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
-   //   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
-   //   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
+   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f
+}, /*63*/
+   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f
+}, /*88*/
+   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f
+}, /*125*/
+
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
 
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+
+   {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+   {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
+   {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
 
-   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
-   {-30.f,-30.f,-30.f,-40.f,-40.f,-45.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
-   {-30.f,-30.f,-30.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*16000*/
   },
 
   1,/* peakattp */
@@ -98,35 +93,36 @@
   },
 
   1,/*noisemaskp */
-  -0.f,  /* suppress any noise curve over maxspec+n */
+  -24.f,  /* suppress any noise curve over maxspec+n */
   .5f,   /* low window */
   .5f,   /* high window */
   25,
   25,
-  {.000f, /*63*/
-   .000f, /*88*/
-   .000f, /*125*/
-   .000f, /*175*/
-   .000f, /*250*/
-   .000f, /*350*/
-   .000f, /*500*/
-   .200f, /*700*/
-   .300f, /*1000*/
-   .400f, /*1400*/
-   .400f, /*2000*/
-   .400f, /*2800*/
-   .700f, /*4000*/
-   .900f, /*5600*/
-   .900f, /*8000*/
-   .900f, /*11500*/
-   .900f, /*16000*/
+  {.000f, 0.f, /*63*/
+   .000f, 0.f, /*88*/
+   .000f, 0.f, /*125*/
+   .000f, 0.f, /*175*/
+   .000f, 0.f, /*250*/
+   .000f, 0.f, /*350*/
+   .000f, 0.f, /*500*/
+   .200f, 0.f, /*700*/
+   .300f, 0.f, /*1000*/
+   .400f, 0.f, /*1400*/
+   .400f, 0.f, /*2000*/
+   .400f, 0.f, /*2800*/
+   .700f, 0.f, /*4000*/
+   .850f, 0.f, /*5600*/
+   .900f, 0.f, /*8000*/
+   .900f, 0.f, /*11500*/
+   .900f, 1.f, /*16000*/
   },
  
-  105.f,  /* even decade + 5 is important; saves an rint() later in a
+  95.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
   -28.,
 
-  -0.f, -.004f   /* attack/decay control */
+  -0.f, -.004f,   /* attack/decay control */
+
 };
 
 static int noisy=0;
@@ -194,6 +190,75 @@
   }
 }
 
+/*****************************************************************/
+/* fine floor partitioner */
+
+static char amplitude_split[8000];
+static char frequency_split[8000];
+
+/* brute force it for now */
+void partition_split(float *floor,int f0,int f1,int a0,int a1,char *list,int d){
+  int i;
+  for(i=f0;i<f1;i++)
+    if(floor[i]>=a0 && floor[i]<a1)break;
+
+  if(i<f1)
+    strcat(list,"1");
+  else{
+    strcat(list,"0");
+    return;
+  }
+
+  if(f1-f0 >= a1-a0){
+    if(f1-f0==2)return;
+
+    partition_split(floor,f0,(f1+f0)/2,a0,a1,frequency_split,d+1);
+    partition_split(floor,(f1+f0)/2,f1,a0,a1,frequency_split,d+1);
+
+  }else{
+
+    partition_split(floor,f0,f1,a0,(a1+a0)/2,amplitude_split,d+1);
+    partition_split(floor,f0,f1,(a1+a0)/2,a1,amplitude_split,d+1);
+
+  }
+}
+
+
+void partition_setup(float *floor,float *data,int n){
+  int i;
+  float foo[n];
+  amplitude_split[0]='\0';
+  frequency_split[0]='\0';
+
+  for(i=0;i<n;i++){
+    if(data[i]>0){
+      if(data[i]/fromdB(floor[i])>.5){
+	foo[i]=todB(data[i]);
+	data[i]=fromdB(rint(todB(data[i])));
+      }else{
+	foo[i]=-999;
+	data[i]=0.;
+      }
+    }else{
+      if(data[i]/fromdB(floor[i])<-.5){
+	foo[i]=todB(data[i]);
+	data[i]=-fromdB(rint(todB(data[i])));
+      }else{
+	foo[i]=-999;
+	data[i]=0.;
+      }
+    }
+  }
+
+  partition_split(foo,0,n,-128,0,frequency_split,0);
+
+  fprintf(stderr,"%d:%d,  ",strlen(frequency_split),strlen(amplitude_split));
+}
+
+
+
+/****************************************************************/
+
 int main(int argc,char *argv[]){
   int eos=0;
   float nonz=0.f;
@@ -330,6 +395,9 @@
 
         analysis("mask",frameno,flr,framesize/2,0,0);
 
+	partition_setup(flr,pcm[i],framesize/2);
+
+	/*
         for(j=0;j<framesize/2;j++)
           mask[j]=flr[j]+140.;
 
@@ -345,7 +413,6 @@
 
         analysis("quant",frameno,pcm[i],framesize/2,0,0);
 
-	/* re-add floor */
         for(j=0;j<framesize/2;j++){
           float val=rint(pcm[i][j]);
           tot++;
@@ -357,7 +424,8 @@
             pcm[i][j]=0.f;
           }
         }
-	
+	*/
+
         analysis("final",frameno,pcm[i],framesize/2,0,1);
 
         /* take it back to time */

1.6.4.1   +3 -1      vorbis/lib/registry.c

Index: registry.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.c,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -r1.6 -r1.6.4.1
--- registry.c	2001/02/26 03:50:43	1.6
+++ registry.c	2001/04/05 00:22:48	1.6.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.6 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: registry.c,v 1.6.4.1 2001/04/05 00:22:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,6 +24,7 @@
 
 extern vorbis_func_time      time0_exportbundle;
 extern vorbis_func_floor     floor0_exportbundle;
+extern vorbis_func_floor     floor1_exportbundle;
 extern vorbis_func_residue   residue0_exportbundle;
 extern vorbis_func_mapping   mapping0_exportbundle;
 
@@ -33,6 +34,7 @@
 
 vorbis_func_floor     *_floor_P[]={
   &floor0_exportbundle,
+  &floor1_exportbundle,
 };
 
 vorbis_func_residue   *_residue_P[]={

1.5.4.1   +2 -2      vorbis/lib/registry.h

Index: registry.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.h,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -r1.5 -r1.5.4.1
--- registry.h	2001/02/26 03:50:43	1.5
+++ registry.h	2001/04/05 00:22:48	1.5.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h,v 1.5 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: registry.h,v 1.5.4.1 2001/04/05 00:22:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -23,7 +23,7 @@
 #define VI_TRANSFORMB 1
 #define VI_WINDOWB 1
 #define VI_TIMEB 1
-#define VI_FLOORB 1
+#define VI_FLOORB 2
 #define VI_RESB 1
 #define VI_MAPB 1
 

No                   revision

No                   revision

1.1.2.1   +288 -0    vorbis/lib/Attic/floor1.c

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