[xiph-cvs] cvs commit: Tremor bitwise.c block.c framing.c ivorbisfile.h misc.h

Monty xiphmont at xiph.org
Fri Mar 28 19:02:48 PST 2003



xiphmont    03/03/28 22:02:48

  Modified:    .        Tag: libogg2-branch bitwise.c block.c framing.c
                        ivorbisfile.h misc.h
  Log:
  One last seeking fix required by rolling vorbisfile optimizations back
  into tremor from reference.

Revision  Changes    Path
No                   revision

<p>No                   revision

<p>1.3.4.2   +2 -3      Tremor/bitwise.c

Index: bitwise.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/bitwise.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -r1.3.4.1 -r1.3.4.2
--- bitwise.c	29 Mar 2003 01:07:59 -0000	1.3.4.1
+++ bitwise.c	29 Mar 2003 03:02:47 -0000	1.3.4.2
@@ -85,7 +85,7 @@
 
   bits+=b->headbit;
 
-  if(bits >= b->headend*8){
+  if(bits >= b->headend<<3){
     int            end=b->headend;
     unsigned char *ptr=b->headptr;
     ogg_reference *head=b->head;
@@ -141,10 +141,9 @@
 /* limited to 32 at a time */
 void oggpack_adv(oggpack_buffer *b,int bits){
   bits+=b->headbit;
-  b->headend-=bits/8;
   b->headbit=bits&7;
   b->headptr+=bits/8;
-  _span(b);
+  if((b->headend-=bits/8)<1)_span(b);
 }
 
 /* spans forward and finds next byte.  Never halts */

<p><p>1.3.4.2   +61 -60    Tremor/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/block.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -r1.3.4.1 -r1.3.4.2
--- block.c	29 Mar 2003 01:07:59 -0000	1.3.4.1
+++ block.c	29 Mar 2003 03:02:47 -0000	1.3.4.2
@@ -274,7 +274,8 @@
 
   v->sequence=vb->sequence;
   
-  {
+  if(vb->pcm){  /* no pcm to process if vorbis_synthesis_trackonly 
+                   was called on block */
     int n=ci->blocksizes[v->W]/2;
     int n0=ci->blocksizes[0]/2;
     int n1=ci->blocksizes[1]/2;
@@ -357,75 +358,75 @@
         ci->blocksizes[v->lW]/4+
         ci->blocksizes[v->W]/4;
     }
+
+  }
     
-    /* track the frame number... This is for convenience, but also
-       making sure our last packet doesn't end with added padding.  If
-       the last packet is partial, the number of samples we'll have to
-       return will be past the vb->granulepos.
-       
-       This is not foolproof!  It will be confused if we begin
-       decoding at the last page after a seek or hole.  In that case,
-       we don't have a starting point to judge where the last frame
-       is.  For this reason, vorbisfile will always try to make sure
-       it reads the last two marked pages in proper sequence */
-    
-    if(b->sample_count==-1){
-      b->sample_count=0;
-    }else{
-      b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
-    }
+  /* track the frame number... This is for convenience, but also
+     making sure our last packet doesn't end with added padding.  If
+     the last packet is partial, the number of samples we'll have to
+     return will be past the vb->granulepos.
+     
+     This is not foolproof!  It will be confused if we begin
+     decoding at the last page after a seek or hole.  In that case,
+     we don't have a starting point to judge where the last frame
+     is.  For this reason, vorbisfile will always try to make sure
+     it reads the last two marked pages in proper sequence */
+  
+  if(b->sample_count==-1){
+    b->sample_count=0;
+  }else{
+    b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
+  }
     
-    if(v->granulepos==-1){
-      if(vb->granulepos!=-1){ /* only set if we have a position to set to */
-	
-	v->granulepos=vb->granulepos;
-	
-	/* is this a short page? */
-	if(b->sample_count>v->granulepos){
-	  /* corner case; if this is both the first and last audio page,
-	     then spec says the end is cut, not beginning */
-	  if(vb->eofflag){
-	    /* trim the end */
-	    /* no preceeding granulepos; assume we started at zero (we'd
-	       have to in a short single-page stream) */
-	    /* granulepos could be -1 due to a seek, but that would result
-	       in a long coun`t, not short count */
-	    
-	    v->pcm_current-=(b->sample_count-v->granulepos);
-	  }else{
-	    /* trim the beginning */
-	    v->pcm_returned+=(b->sample_count-v->granulepos);
-	    if(v->pcm_returned>v->pcm_current)
-	      v->pcm_returned=v->pcm_current;
-	  }
+  if(v->granulepos==-1){
+    if(vb->granulepos!=-1){ /* only set if we have a position to set to */
+      
+      v->granulepos=vb->granulepos;
+      
+      /* is this a short page? */
+      if(b->sample_count>v->granulepos){
+	/* corner case; if this is both the first and last audio page,
+	   then spec says the end is cut, not beginning */
+	if(vb->eofflag){
+	  /* trim the end */
+	  /* no preceeding granulepos; assume we started at zero (we'd
+	     have to in a short single-page stream) */
+	  /* granulepos could be -1 due to a seek, but that would result
+	     in a long coun`t, not short count */
           
+	  v->pcm_current-=(b->sample_count-v->granulepos);
+	}else{
+	  /* trim the beginning */
+	  v->pcm_returned+=(b->sample_count-v->granulepos);
+	  if(v->pcm_returned>v->pcm_current)
+	    v->pcm_returned=v->pcm_current;
         }
         
       }
-    }else{
-      v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
-      if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
+      
+    }
+  }else{
+    v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
+    if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
+      
+      if(v->granulepos>vb->granulepos){
+	long extra=v->granulepos-vb->granulepos;
         
-	if(v->granulepos>vb->granulepos){
-	  long extra=v->granulepos-vb->granulepos;
-	  
-	  if(extra)
-	    if(vb->eofflag){
-	      /* partial last frame.  Strip the extra samples off */
-	      v->pcm_current-=extra;
-	    } /* else {Shouldn't happen *unless* the bitstream is out of
-		 spec.  Either way, believe the bitstream } */
-	} /* else {Shouldn't happen *unless* the bitstream is out of
-	     spec.  Either way, believe the bitstream } */
-	v->granulepos=vb->granulepos;
-      }
+	if(extra)
+	  if(vb->eofflag){
+	    /* partial last frame.  Strip the extra samples off */
+	    v->pcm_current-=extra;
+	  } /* else {Shouldn't happen *unless* the bitstream is out of
+	       spec.  Either way, believe the bitstream } */
+      } /* else {Shouldn't happen *unless* the bitstream is out of
+	   spec.  Either way, believe the bitstream } */
+      v->granulepos=vb->granulepos;
     }
-    
-    /* Update, cleanup */
-    
-    if(vb->eofflag)v->eofflag=1;
   }
   
+  /* Update, cleanup */
+  
+  if(vb->eofflag)v->eofflag=1;
   return(0);
 }
 

<p><p>1.4.4.3   +2 -7      Tremor/framing.c

Index: framing.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/framing.c,v
retrieving revision 1.4.4.2
retrieving revision 1.4.4.3
diff -u -r1.4.4.2 -r1.4.4.3
--- framing.c	29 Mar 2003 01:20:14 -0000	1.4.4.2
+++ framing.c	29 Mar 2003 03:02:47 -0000	1.4.4.3
@@ -22,6 +22,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include "ogg.h"
+#include "misc.h"
+
 
 /* A complete description of Ogg framing exists in docs/framing.html */
 
@@ -42,18 +44,11 @@
    finish destruction. */
 
 /* call the helper while holding lock */
-#include <stdio.h>
 static void _ogg_buffer_destroy(ogg_buffer_state *bs){
   ogg_buffer *bt;
   ogg_reference *rt;
 
   if(bs->shutdown){
-
-    fprintf(stderr,"\nZero-copy pool %p lazy destroy: %d buffers outstanding.\n"
-	    ,
-            bs,bs->outstanding);
-    if(!bs->outstanding)
-      fprintf(stderr,"Finishing memory cleanup of %p.\n",bs);
 
     bt=bs->unused_buffers;
     rt=bs->unused_references;

<p><p>1.2.4.2   +0 -1      Tremor/ivorbisfile.h

Index: ivorbisfile.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/ivorbisfile.h,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -u -r1.2.4.1 -r1.2.4.2
--- ivorbisfile.h	29 Mar 2003 01:07:59 -0000	1.2.4.1
+++ ivorbisfile.h	29 Mar 2003 03:02:47 -0000	1.2.4.2
@@ -27,7 +27,6 @@
 #include "ivorbiscodec.h"
 
 #define CHUNKSIZE 1024
-
 /* The function prototypes for the callbacks are basically the same as for
  * the stdio functions fread, fseek, fclose, ftell. 
  * The one difference is that the FILE * arguments have been replaced with

<p><p>1.6.4.2   +1 -1      Tremor/misc.h

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/misc.h,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -u -r1.6.4.1 -r1.6.4.2
--- misc.h	29 Mar 2003 01:07:59 -0000	1.6.4.1
+++ misc.h	29 Mar 2003 03:02:47 -0000	1.6.4.2
@@ -20,7 +20,7 @@
 #include "ivorbiscodec.h"
 #include "os_types.h"
 
-#define _VDBG_GRAPHFILE "0.m"
+//#define _VDBG_GRAPHFILE "_0.m"
 extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); 
 extern void _VDBG_free(void *ptr,char *file,long line); 
 

<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