[xiph-cvs] cvs commit: vorbis/lib block.c vorbisfile.c

Monty xiphmont at xiph.org
Sun Mar 2 13:32:00 PST 2003



xiphmont    03/03/02 16:32:00

  Modified:    lib      block.c vorbisfile.c
  Log:
  Some cleanup of ov_crosslap function

Revision  Changes    Path
1.70      +3 -14     vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- block.c	2 Mar 2003 11:45:17 -0000	1.69
+++ block.c	2 Mar 2003 21:32:00 -0000	1.70
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.69 2003/03/02 11:45:17 xiphmont Exp $
+ last mod: $Id: block.c,v 1.70 2003/03/02 21:32:00 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -938,19 +938,8 @@
 
 }
 
-void vorbis_splice(float *d,float *s,
-		   vorbis_dsp_state *v,int W){
-  
-  vorbis_info *vi=v->vi;
-  codec_setup_info *ci=vi->codec_setup;
+float *vorbis_window(vorbis_dsp_state *v,int W){
   private_state *b=v->backend_state;
-  int n=ci->blocksizes[W]/2;
-
-  float *wd=b->window[W];
-  float *ws=b->window[W]+n;
-  int i;
-
-  for(i=0;i<n;i++)
-    d[i]=d[i]*(*wd++) + s[i]*(*--ws);
+  return b->window[W];
 }
         

<p><p>1.66      +21 -11    vorbis/lib/vorbisfile.c

Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- vorbisfile.c	2 Mar 2003 11:45:17 -0000	1.65
+++ vorbisfile.c	2 Mar 2003 21:32:00 -0000	1.66
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.65 2003/03/02 11:45:17 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.66 2003/03/02 21:32:00 xiphmont Exp $
 
  ********************************************************************/
 
@@ -1623,8 +1623,24 @@
   }
 }
 
-extern void vorbis_splice(float *d,float *s,
-			  vorbis_dsp_state *v,int W);
+extern float *vorbis_window(vorbis_dsp_state *v,int W);
+
+static void _vorbis_splice(float *d,float *s,
+			  vorbis_dsp_state *v,int W){
+  
+  vorbis_info *vi=v->vi;
+  int n=vorbis_info_blocksize(vi,0)/2;
+  float *w=vorbis_window(v,W);
+  int i;
+
+  for(i=0;i<n;i++){
+    float wd=w[i]*w[i];
+    float ws=1.-wd;
+    d[i]=d[i]*wd + s[i]*ws;
+  }
+}
+	
+
         
 /* this sets up crosslapping of a sample by using trailing data from
    sample 1 and lapping it into the windowing buffer of the second */
@@ -1720,26 +1736,20 @@
       memcpy(lappcm[i]+lapcount,pcm[i],sizeof(**pcm)*samples);
     lapcount+=samples;
 
-    if(lapcount<lapsize){
-      fprintf(stderr,"GAR undersized lapping.\n");
-      exit(1);
-    }
+    if(lapcount<lapsize)return OV_EFAULT;
   }
 
   /* have a lapping buffer from vf1; now to splice it into the lapping
      buffer of vf2 */
 
   /* consolidate and expose the buffer. */
-  if(vorbis_synthesis_lapout(vd2,&pcm)<lapsize){
-    fprintf(stderr,"vf2 undersized lapping.\n");
-    exit(1);
-  }
+  if(vorbis_synthesis_lapout(vd2,&pcm)<lapsize)return OV_EFAULT;
 
   /* splice */
   for(j=0;j<vi1->channels;j++){
     float *s=lappcm[j];
     float *d=pcm[j];
-    vorbis_splice(d,s,winstate,0);
+    _vorbis_splice(d,s,winstate,0);
   }
 
   /* done */

<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