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

Monty xiphmont at xiph.org
Fri Mar 29 17:56:59 PST 2002



xiphmont    02/03/29 17:56:59

  Modified:    lib      envelope.c envelope.h
               lib/modes psych_44.h
  Log:
  Add one additional low frequency band to preecho detection

Revision  Changes    Path
1.47      +18 -20    vorbis/lib/envelope.c

Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- envelope.c	2002/03/29 08:18:23	1.46
+++ envelope.c	2002/03/30 01:56:58	1.47
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data envelope analysis 
- last mod: $Id: envelope.c,v 1.46 2002/03/29 08:18:23 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.47 2002/03/30 01:56:58 xiphmont Exp $
 
  ********************************************************************/
 
@@ -50,12 +50,13 @@
   }
 
   /* magic follows */
-  e->band[0].begin=4;  e->band[0].end=8;
-  e->band[1].begin=8;  e->band[1].end=10;
-  e->band[2].begin=14; e->band[2].end=12;
-  e->band[3].begin=20; e->band[3].end=16;
-  e->band[4].begin=28; e->band[4].end=20;
-  e->band[5].begin=40; e->band[5].end=20;
+  e->band[0].begin=2;  e->band[0].end=4;
+  e->band[1].begin=4;  e->band[1].end=8;
+  e->band[2].begin=6;  e->band[2].end=10;
+  e->band[3].begin=12; e->band[3].end=12;
+  e->band[4].begin=18; e->band[4].end=16;
+  e->band[5].begin=26; e->band[5].end=20;
+  e->band[6].begin=36; e->band[6].end=24;
 
   for(j=0;j<VE_BANDS;j++){
     n=e->band[j].end;
@@ -83,8 +84,6 @@
   memset(e,0,sizeof(*e));
 }
 
-extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off);
-
 /* fairly straight threshhold-by-band based until we find something
    that works better and isn't patented. */
 
@@ -121,7 +120,7 @@
     vec[i]=data[i]*ve->mdct_win[i];
   mdct_forward(&ve->mdct,vec,vec);
   
-  /* _analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
+  /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
 
   /* near-DC spreading function; this has nothing to do with
      psychoacoustics, just sidelobe leakage and window size */
@@ -159,7 +158,7 @@
     decay-=8.;
   }
 
-  /* _analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
+  /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
   
   /* perform preecho/postecho triggering by band */
   for(j=0;j<VE_BANDS;j++){
@@ -193,17 +192,20 @@
       valmin=postmin-premin;
       valmax=postmax-premax;
 
+      filters[j].markers[pos]=valmax;
+
       filters[j].ampbuf[this]=acc;
       filters[j].ampptr++;
       if(filters[j].ampptr>=VE_AMP)filters[j].ampptr=0;
     }
 
     /* look at min/max, decide trigger */
-    if(valmax>gi->preecho_thresh[j]+penalty)ret|=1;
+    if(valmax>gi->preecho_thresh[j]+penalty){
+      ret|=1;
+      ret|=4;
+    }
     if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
   }
-
-  if(ret&1)ve->stretch=-1;
  
   return(ret);
 }
@@ -247,6 +249,8 @@
       ve->mark[j]=1;
       if(j>0)ve->mark[j-1]=1;
     }
+
+    if(ret&4)ve->stretch=-1;
   }
 
   ve->current=last*ve->searchstep;
@@ -299,9 +303,6 @@
               _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
             }
             
-	    for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->stretchm[l]*.1;
-	    _analysis_output_always("stretch",seq,marker,v->pcm_current,0,0,totalshift);
-	    
             seq++;
             
           }
@@ -352,14 +353,11 @@
 
   memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
   
-  #if 0
+#if 0
   for(i=0;i<VE_BANDS*e->ch;i++)
     memmove(e->filter[i].markers,
             e->filter[i].markers+smallshift,
             (1024-smallshift)*sizeof(*(*e->filter).markers));
-  memmove(e->stretchm,
-	  e->stretchm+smallshift,
-	  (1024-smallshift)*sizeof(*e->stretchm));
   totalshift+=shift;
 #endif 
 

<p><p>1.23      +4 -2      vorbis/lib/envelope.h

Index: envelope.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- envelope.h	2002/03/29 07:10:39	1.22
+++ envelope.h	2002/03/30 01:56:58	1.23
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.h,v 1.22 2002/03/29 07:10:39 xiphmont Exp $
+ last mod: $Id: envelope.h,v 1.23 2002/03/30 01:56:58 xiphmont Exp $
 
  ********************************************************************/
 
@@ -25,7 +25,7 @@
 #define VE_POST   2
 #define VE_AMP    (VE_PRE+VE_POST-1)
 
-#define VE_BANDS  6
+#define VE_BANDS  7
 #define VE_NEARDC 15
 
 #define VE_MINSTRETCH 2   /* a bit less than short block */
@@ -39,6 +39,8 @@
   float nearDC_acc;
   float nearDC_partialacc;
   int   nearptr;
+
+  float markers[1024];
 } envelope_filter_state;
 
 typedef struct {

<p><p>1.13      +11 -11    vorbis/lib/modes/psych_44.h

Index: psych_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/psych_44.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- psych_44.h	2002/03/29 07:10:40	1.12
+++ psych_44.h	2002/03/30 01:56:59	1.13
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h,v 1.12 2002/03/29 07:10:40 xiphmont Exp $
+ last mod: $Id: psych_44.h,v 1.13 2002/03/30 01:56:59 xiphmont Exp $
 
  ********************************************************************/
 
@@ -21,28 +21,28 @@
 static vorbis_info_psy_global _psy_global_44[5]={
 
   {8,   /* lines per eighth octave */
-   {20.f,14.f,10.f,10.f,10.f,10.f}, 
-   {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f}, 4,-75.f,
+   {20.f,14.f,10.f,10.f,10.f,10.f,10.f}, 
+   {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 4,-75.f,
    -6.f, 0,
   },
   {8,   /* lines per eighth octave */
-   {16.f,12.f,8.f,8.f,8.f,8.f}, 
-   {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f}, 4,-80.f,
+   {14.f,10.f,8.f,8.f,8.f,8.f,8.f}, 
+   {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f,-25.f}, 4,-80.f,
    -6.f, 0,
   },
   {8,   /* lines per eighth octave */
-   {14.f,10.f,6.f,6.f,6.f,6.f}, 
-   {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f}, 4,-80.f,
+   {12.f,8.f,8.f,8.f,8.f,8.f,8.f}, 
+   {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f,-15.f}, 4,-80.f,
    -6.f, 0,
   },
   {8,   /* lines per eighth octave */
-   {14.f,8.f,6.f,6.f,6.f,6.f}, 
-   {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f}, 2,-80.f,
+   {10.f,8.f,6.f,6.f,6.f,6.f,6.f}, 
+   {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 2,-80.f,
    -6.f, 0,
   },
   {8,   /* lines per eighth octave */
-   {14.f,10.f,6.f,6.f,6.f,6.f}, 
-   {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f}, 2,-85.f,
+   {10.f,6.f,6.f,6.f,6.f,6.f,6.f}, 
+   {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 2,-85.f,
    -6.f, 0,
   },
 };

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