[xiph-commits] r16894 - in trunk/vorbis: doc lib lib/modes

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Fri Feb 12 12:32:12 PST 2010


Author: xiphmont
Date: 2010-02-12 12:32:12 -0800 (Fri, 12 Feb 2010)
New Revision: 16894

Modified:
   trunk/vorbis/doc/Vorbis_I_spec.html
   trunk/vorbis/doc/Vorbis_I_spec.pdf
   trunk/vorbis/lib/highlevel.h
   trunk/vorbis/lib/modes/floor_all.h
   trunk/vorbis/lib/modes/setup_11.h
   trunk/vorbis/lib/modes/setup_16.h
   trunk/vorbis/lib/modes/setup_22.h
   trunk/vorbis/lib/modes/setup_32.h
   trunk/vorbis/lib/modes/setup_44.h
   trunk/vorbis/lib/modes/setup_44u.h
   trunk/vorbis/lib/modes/setup_8.h
   trunk/vorbis/lib/modes/setup_X.h
   trunk/vorbis/lib/psy.c
   trunk/vorbis/lib/vorbisenc.c
Log:
Some minor setup code rearrangement/cleanup toward 5.1/7.1 additions



Modified: trunk/vorbis/doc/Vorbis_I_spec.html
===================================================================
--- trunk/vorbis/doc/Vorbis_I_spec.html	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/doc/Vorbis_I_spec.html	2010-02-12 20:32:12 UTC (rev 16894)
@@ -7,7 +7,7 @@
 <meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
 <!-- html --> 
 <meta name="src" content="Vorbis_I_spec.tex"> 
-<meta name="date" content="2010-01-25 21:28:00"> 
+<meta name="date" content="2010-02-03 17:32:00"> 
 <link rel="stylesheet" type="text/css" href="Vorbis_I_spec.css"> 
 </head><body 
 >
@@ -24,7 +24,7 @@
 class="cmr-17">Xiph.org Foundation</span></div>
 <br />
 <div class="date" ><span 
-class="cmr-17">January 25, 2010</span></div>
+class="cmr-17">February 3, 2010</span></div>
 </div>
 <h3 class="likesectionHead"><a 
  id="x1-1000"></a>Contents</h3>

Modified: trunk/vorbis/doc/Vorbis_I_spec.pdf
===================================================================
(Binary files differ)

Modified: trunk/vorbis/lib/highlevel.h
===================================================================
--- trunk/vorbis/lib/highlevel.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/highlevel.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -27,8 +27,6 @@
   int   set_in_stone;
 
   double base_setting;
-  double long_setting;
-  double short_setting;
   double impulse_noisetune;
 
   int    managed;

Modified: trunk/vorbis/lib/modes/floor_all.h
===================================================================
--- trunk/vorbis/lib/modes/floor_all.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/floor_all.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -165,7 +165,7 @@
     {{1,2,3,4}},
     4,{0,128, 33,8,16,70},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  128
   },
   /* 256 x 4 */
   {
@@ -173,7 +173,7 @@
     {{1,2,3,4}},
     4,{0,256, 66,16,32,140},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  256
   },
   /* 128 x 7 */
   {
@@ -181,7 +181,7 @@
     {{-1,2,3,4},{-1,5,6,7}},
     4,{0,128, 14,4,58, 2,8,28,90},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  128
   },
   /* 256 x 7 */
   {
@@ -189,7 +189,7 @@
     {{-1,2,3,4},{-1,5,6,7}},
     4,{0,256, 28,8,116, 4,16,56,180},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  256
   },
   /* 128 x 11 */
   {
@@ -198,7 +198,7 @@
 
     2,{0,128,  8,33,  4,16,70,  2,6,12,  23,46,90},
 
-     60,30,500,   1,18.,  -1
+     60,30,500,   1,18.,  128
   },
   /* 128 x 17 */
   {
@@ -206,7 +206,7 @@
     {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
     2,{0,128,  12,46,  4,8,16,  23,33,70,  2,6,10,  14,19,28,  39,58,90},
 
-    60,30,500,    1,18.,  -1
+    60,30,500,    1,18.,  128
   },
   /* 256 x 4 (low bitrate version) */
   {
@@ -214,7 +214,7 @@
     {{1,2,3,4}},
     4,{0,256, 66,16,32,140},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  256
   },
   /* 1024 x 27 */
   {
@@ -223,7 +223,7 @@
     2,{0,1024,   93,23,372, 6,46,186,750,  14,33,65, 130,260,556,
        3,10,18,28,  39,55,79,111,  158,220,312,  464,650,850},
 
-    60,30,500,    3,18.,  -1 /* lowpass */
+    60,30,500,    3,18.,  1024
   },
   /* 2048 x 27 */
   {
@@ -232,7 +232,7 @@
     2,{0,2048,   186,46,744, 12,92,372,1500,  28,66,130, 260,520,1112,
        6,20,36,56,  78,110,158,222,  316,440,624,  928,1300,1700},
 
-    60,30,500,    3,18.,  -1 /* lowpass */
+    60,30,500,    3,18.,  2048
   },
   /* 512 x 17 */
   {
@@ -241,7 +241,7 @@
     2,{0,512,  46,186,  16,33,65,  93,130,278,
        7,23,39,  55,79,110,  156,232,360},
 
-    60,30,500,    1,18.,  -1 /* lowpass! */
+    60,30,500,    1,18.,  512
   },
 
 };

Modified: trunk/vorbis/lib/modes/setup_11.h
===================================================================
--- trunk/vorbis/lib/modes/setup_11.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_11.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -21,9 +21,12 @@
   512,512
 };
 
-static const int _floor_mapping_11[2]={
-  6,6,
+static const int _floor_mapping_11a[]={
+  6,6
 };
+static const int *_floor_mapping_11[]={
+  _floor_mapping_11a
+};
 
 static const double rate_mapping_11[3]={
   8000.,13000.,44000.,
@@ -82,8 +85,8 @@
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_11,
-  NULL,
 
   _mapres_template_8_stereo
 };
@@ -133,8 +136,8 @@
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_11,
-  NULL,
 
   _mapres_template_8_uncoupled
 };

Modified: trunk/vorbis/lib/modes/setup_16.h
===================================================================
--- trunk/vorbis/lib/modes/setup_16.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_16.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -25,12 +25,16 @@
   1024,1024,1024
 };
 
-static const int _floor_mapping_16_short[3]={
+static const int _floor_mapping_16a[]={
   9,3,3
 };
-static const int _floor_mapping_16[3]={
+static const int _floor_mapping_16b[]={
   9,9,9
 };
+static const int *_floor_mapping_16[]={
+  _floor_mapping_16a,
+  _floor_mapping_16b
+};
 
 static const double rate_mapping_16[4]={
   12000.,20000.,44000.,86000.
@@ -91,7 +95,7 @@
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_stereo
@@ -142,7 +146,7 @@
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_uncoupled

Modified: trunk/vorbis/lib/modes/setup_22.h
===================================================================
--- trunk/vorbis/lib/modes/setup_22.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_22.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -70,7 +70,7 @@
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_stereo
@@ -121,7 +121,7 @@
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_uncoupled

Modified: trunk/vorbis/lib/modes/setup_32.h
===================================================================
--- trunk/vorbis/lib/modes/setup_32.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_32.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -74,8 +74,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_stereo
 };
@@ -125,8 +125,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_uncoupled
 };

Modified: trunk/vorbis/lib/modes/setup_44.h
===================================================================
--- trunk/vorbis/lib/modes/setup_44.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_44.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -47,13 +47,19 @@
  0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
 };
 
-static const int _floor_short_mapping_44[11]={
+static const int _floor_mapping_44a[11]={
   1,0,0,2,2,4,5,5,5,5,5
 };
-static const int _floor_long_mapping_44[11]={
+
+static const int _floor_mapping_44b[11]={
   8,7,7,7,7,7,7,7,7,7,7
 };
 
+static const int *_floor_mapping_44[]={
+  _floor_mapping_44a,
+  _floor_mapping_44b,
+};
+
 static const ve_setup_data_template ve_setup_44_stereo={
   11,
   rate_mapping_44_stereo,
@@ -99,8 +105,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_stereo
 };

Modified: trunk/vorbis/lib/modes/setup_44u.h
===================================================================
--- trunk/vorbis/lib/modes/setup_44u.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_44u.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -67,8 +67,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_uncoupled
 };

Modified: trunk/vorbis/lib/modes/setup_8.h
===================================================================
--- trunk/vorbis/lib/modes/setup_8.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_8.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -22,10 +22,14 @@
   512,512
 };
 
-static const int _floor_mapping_8[2]={
-  6,6,
+static const int _floor_mapping_8a[]={
+  6,6
 };
 
+static const int *_floor_mapping_8[]={
+  _floor_mapping_8a
+};
+
 static const double rate_mapping_8[3]={
   6000.,9000.,32000.,
 };
@@ -87,8 +91,8 @@
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_stereo
 };
@@ -138,8 +142,8 @@
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_uncoupled
 };

Modified: trunk/vorbis/lib/modes/setup_X.h
===================================================================
--- trunk/vorbis/lib/modes/setup_X.h	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/modes/setup_X.h	2010-02-12 20:32:12 UTC (rev 16894)
@@ -65,8 +65,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_stereo
 };
@@ -116,8 +116,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_uncoupled
 };
@@ -167,8 +167,8 @@
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_stereo
 };
@@ -218,8 +218,8 @@
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_uncoupled
 };

Modified: trunk/vorbis/lib/psy.c
===================================================================
--- trunk/vorbis/lib/psy.c	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/psy.c	2010-02-12 20:32:12 UTC (rev 16894)
@@ -931,7 +931,7 @@
   int test1=fabs(*qA)>fabs(*qB);
   test1-= fabs(*qA)<fabs(*qB);
 
-  if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
+  //if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
   if(test1==1){
     *qB=(*qA>0.f?*qA-*qB:*qB-*qA);
   }else{
@@ -1148,7 +1148,6 @@
     if(nonzero[vi->coupling_mag[i]] ||
        nonzero[vi->coupling_ang[i]]){
 
-
       float *rM=res[vi->coupling_mag[i]];
       float *rA=res[vi->coupling_ang[i]];
       float *qM=rM+n;
@@ -1159,7 +1158,6 @@
       float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
       int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
       int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
-      int pointlimit=limit;
 
       nonzero[vi->coupling_mag[i]]=1;
       nonzero[vi->coupling_ang[i]]=1;
@@ -1178,7 +1176,6 @@
             if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
                (fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
 
-
               precomputed_couple_point(mag_memo[i][l],
                                        floorM[l],floorA[l],
                                        qM+l,qA+l);
@@ -1196,7 +1193,7 @@
         if(p->vi->normal_point_p){
           for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
             int l=mag_sort[i][j+k];
-            if(l<sliding_lowpass && l>=pointlimit && rint(qM[l])==0.f){
+            if(l<sliding_lowpass && l>=limit && rint(qM[l])==0.f){
               qM[l]=unitnorm(qM[l]);
               acc-=1.f;
             }

Modified: trunk/vorbis/lib/vorbisenc.c
===================================================================
--- trunk/vorbis/lib/vorbisenc.c	2010-02-11 18:59:31 UTC (rev 16893)
+++ trunk/vorbis/lib/vorbisenc.c	2010-02-12 20:32:12 UTC (rev 16894)
@@ -134,8 +134,8 @@
 
   const static_codebook *const *const *const floor_books;
   const vorbis_info_floor1 *floor_params;
-  const int *floor_short_mapping;
-  const int *floor_long_mapping;
+  const int floor_mappings;
+  const int **floor_mapping_list;
 
   const vorbis_mapping_template *maps;
 } ve_setup_data_template;
@@ -196,7 +196,7 @@
   return(OV_EINVAL);
 }
 
-static void vorbis_encode_floor_setup(vorbis_info *vi,double s,int block,
+static void vorbis_encode_floor_setup(vorbis_info *vi,int s,
                                      const static_codebook *const *const *const books,
                                      const vorbis_info_floor1 *in,
                                      const int *x){
@@ -205,8 +205,6 @@
   codec_setup_info *ci=vi->codec_setup;
 
   memcpy(f,in+x[is],sizeof(*f));
-  /* fill in the lowpass field, even if it's temporary */
-  f->n=ci->blocksizes[block]>>1;
 
   /* books */
   {
@@ -554,12 +552,20 @@
 
     /* this res may by limited by the maximum pointlimit of the mode,
        not the lowpass. the floor is always lowpass limited. */
-    if(res->limit_type){
+    switch(res->limit_type){
+    case 1: /* point stereo limited */
       if(ci->hi.managed)
         freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS-1]*1000.;
       else
         freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS/2]*1000.;
       if(freq>nyq)freq=nyq;
+      break;
+    case 2: /* LFE channel; lowpass at ~ 250Hz */
+      freq=250;
+      break;
+    default:
+      /* already set */
+      break;
     }
 
     /* in the residue, we're constrained, physically, by partition
@@ -572,6 +578,7 @@
     else
       r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */
         r->grouping;
+    if(r->end==0)r->end=r->grouping; /* LFE channel */
   }
 }
 
@@ -672,7 +679,7 @@
 
 /* the final setup call */
 int vorbis_encode_setup_init(vorbis_info *vi){
-  int i0=0,singleblock=0;
+  int i,i0=0,singleblock=0;
   codec_setup_info *ci=vi->codec_setup;
   ve_setup_data_template *setup=NULL;
   highlevel_encode_setup *hi=&ci->hi;
@@ -705,16 +712,12 @@
   if(ci->blocksizes[0]==ci->blocksizes[1])singleblock=1;
 
   /* floor setup; choose proper floor params.  Allocated on the floor
-     stack in order; if we alloc only long floor, it's 0 */
-  vorbis_encode_floor_setup(vi,hi->short_setting,0,
-                            setup->floor_books,
-                            setup->floor_params,
-                            setup->floor_short_mapping);
-  if(!singleblock)
-    vorbis_encode_floor_setup(vi,hi->long_setting,1,
+     stack in order; if we alloc only a single long floor, it's 0 */
+  for(i=0;i<setup->floor_mappings;i++)
+    vorbis_encode_floor_setup(vi,hi->base_setting,
                               setup->floor_books,
                               setup->floor_params,
-                              setup->floor_long_mapping);
+                              setup->floor_mapping_list[i]);
 
   /* setup of [mostly] short block detection and stereo*/
   vorbis_encode_global_psych_setup(vi,hi->trigger_setting,
@@ -723,23 +726,23 @@
   vorbis_encode_global_stereo(vi,hi,setup->stereo_modes);
 
   /* basic psych setup and noise normalization */
-  vorbis_encode_psyset_setup(vi,hi->short_setting,
+  vorbis_encode_psyset_setup(vi,hi->base_setting,
                              setup->psy_noise_normal_start[0],
                              setup->psy_noise_normal_partition[0],
                              setup->psy_noise_normal_thresh,
                              0);
-  vorbis_encode_psyset_setup(vi,hi->short_setting,
+  vorbis_encode_psyset_setup(vi,hi->base_setting,
                              setup->psy_noise_normal_start[0],
                              setup->psy_noise_normal_partition[0],
                              setup->psy_noise_normal_thresh,
                              1);
   if(!singleblock){
-    vorbis_encode_psyset_setup(vi,hi->long_setting,
+    vorbis_encode_psyset_setup(vi,hi->base_setting,
                                setup->psy_noise_normal_start[1],
                                setup->psy_noise_normal_partition[1],
                                     setup->psy_noise_normal_thresh,
                                2);
-    vorbis_encode_psyset_setup(vi,hi->long_setting,
+    vorbis_encode_psyset_setup(vi,hi->base_setting,
                                setup->psy_noise_normal_start[1],
                                setup->psy_noise_normal_partition[1],
                                setup->psy_noise_normal_thresh,
@@ -870,9 +873,6 @@
   is=hi->base_setting;
   ds=hi->base_setting-is;
 
-  hi->short_setting=hi->base_setting;
-  hi->long_setting=hi->base_setting;
-
   hi->managed=0;
 
   hi->impulse_block_p=1;



More information about the commits mailing list