[xiph-cvs] cvs commit: theora/lib quant.c

Ralph Giles giles at xiph.org
Sun Mar 7 18:11:46 PST 2004



giles       04/03/07 21:11:46

  Modified:    lib      quant.c
  Log:
  Save the range value in the q matrix mapping table as 'range-1' instead
  of 'range'. Suggestion from derf.
  
  This trades possible incorrect values of '0' for values of '64'; a
  failure to advance the index pointer can cause more problems than other
  way to run off the end of q matrix array, a condition one already has to
  check for.

Revision  Changes    Path
1.18      +5 -4      theora/lib/quant.c

Index: quant.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- quant.c	8 Mar 2004 00:43:19 -0000	1.17
+++ quant.c	8 Mar 2004 02:11:46 -0000	1.18
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function:
-  last mod: $Id: quant.c,v 1.17 2004/03/08 00:43:19 giles Exp $
+  last mod: $Id: quant.c,v 1.18 2004/03/08 02:11:46 giles Exp $
 
  ********************************************************************/
 
@@ -150,16 +150,16 @@
   }
   /* table mapping */
   oggpackB_write(opb, 0, 2);  /* matrix 0 for intra Y */
-  oggpackB_write(opb, 63, 6); /* used for every q */
+  oggpackB_write(opb, 62, 6); /* used for every q */
   oggpackB_write(opb, 0, 2);
   oggpackB_write(opb, 1, 1);  /* next range is explicit */
   oggpackB_write(opb, 1, 2);  /* matrix 1 for intra U */
-  oggpackB_write(opb, 63, 6);
+  oggpackB_write(opb, 62, 6);
   oggpackB_write(opb, 1, 2);
   oggpackB_write(opb, 0, 1);  /* intra V is the same */
   oggpackB_write(opb, 1, 1);  /* next range is explicit */
   oggpackB_write(opb, 2, 2);  /* matrix 2 for inter Y */
-  oggpackB_write(opb, 63, 6);
+  oggpackB_write(opb, 62, 6);
   oggpackB_write(opb, 2, 2);
   oggpackB_write(opb, 0, 2);  /* inter U the same */
   oggpackB_write(opb, 0, 2);  /* inter V the same */
@@ -173,7 +173,8 @@
   theora_read(opb,_ilog(N-1),&index); /* qi=0 index */
   //fprintf(stderr, " [%d]",index);
   while(qi<63) {
-    theora_read(opb,_ilog(63-qi),&range); /* range to next code q matrix */
+    theora_read(opb,_ilog(62-qi),&range); /* range to next code q matrix */
+    range++;
     //fprintf(stderr," %d",range);
     if(range<=0) return OC_BADHEADER;
     qi+=range;

<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