[xiph-commits] r9786 - trunk/theora/lib

giles at svn.xiph.org giles at svn.xiph.org
Sat Aug 20 11:27:41 PDT 2005


Author: giles
Date: 2005-08-20 11:27:40 -0700 (Sat, 20 Aug 2005)
New Revision: 9786

Modified:
   trunk/theora/lib/decode.c
Log:
Add code to read the alternate frame qi values if available. Since we
don't yet parse or use the per-block alt qi mapping, we return OC_IMPL
the number of qi values in the frame is different from 1.


Modified: trunk/theora/lib/decode.c
===================================================================
--- trunk/theora/lib/decode.c	2005-08-20 18:10:00 UTC (rev 9785)
+++ trunk/theora/lib/decode.c	2005-08-20 18:27:40 UTC (rev 9786)
@@ -61,7 +61,8 @@
 
 static int LoadFrameHeader(PB_INSTANCE *pbi){
   long ret;
-  unsigned char  DctQIndex;
+  int NQIndex;
+  unsigned char  DctQIndex[3];
   unsigned char  SpareBits;       /* Spare cfg bits */
 
   /* Is the frame and inter frame or a key frame */
@@ -69,15 +70,25 @@
   pbi->FrameType = (unsigned char)ret;
 
   /* Quality (Q) index */
+  NQIndex = 0;
   theora_read(pbi->opb,6,&ret);
-  DctQIndex = (unsigned char)ret;
+  DctQIndex[NQIndex++] = (unsigned char)ret;
 
-  /* spare bit for possible additional Q indicies - should be 0 */
   theora_read(pbi->opb,1,&ret);
   SpareBits = (unsigned char)ret;
-  /* todo: properly handle additional Q indicies */
-  if (SpareBits != 0) return OC_IMPL;
+  if (SpareBits) {
+    theora_read(pbi->opb,6,&ret);
+    DctQIndex[NQIndex++] = (unsigned char)ret;
+    theora_read(pbi->opb,1,&ret);
+    SpareBits = (unsigned char)ret;
+    if (SpareBits) {
+      theora_read(pbi->opb,6,&ret);
+      DctQIndex[NQIndex++] = (unsigned char)ret;
+    }
+  }
 
+  if (NQIndex != 1) return OC_IMPL;
+
   if ( (pbi->FrameType == KEY_FRAME) ){
     /* Read the type / coding method for the key frame. */
     theora_read(pbi->opb,1,&ret);
@@ -90,7 +101,7 @@
   }
 
   /* Set this frame quality value and tables from the coded Q Index */
-  UpdateQ(pbi, DctQIndex);
+  UpdateQ(pbi, DctQIndex[0]);
 
   return 1;
 }



More information about the commits mailing list