[ogg-dev] [PATCH] liboggz: Fix Dirac bitstream parsing

David Flynn davidf+nntp at woaf.net
Tue Nov 4 00:56:48 PST 2008


Quite a while ago, the specification was modified to change the
way the nondefault scan format was signalled; this patch fixes that.

Index: liboggz/dirac.c
===================================================================
--- liboggz/dirac.c	(revision 3759)
+++ liboggz/dirac.c	(working copy)
@@ -122,6 +122,10 @@
     1, 9, 10, 9, 10, 9, 10, 4, 3, 7, 6, 4, 3, 7, 6, 2, 2, 7, 6, 7, 6,
   };
 
+  static const int dirac_top_field_first[] = { /* extracted from table C.1 */
+    0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  };
+
   static const struct {
     ogg_uint32_t width, height;
   } dirac_fsize_tbl[] = { /* table 10.3 framesize */
@@ -150,11 +154,12 @@
   if (dirac_bool( &bs )) {
     info->chroma_format = dirac_uint( &bs ); /* chroma_format */
   }
+
   if (dirac_bool( &bs )) {
-    info->interlaced = 0;
-    if (dirac_bool( &bs )) { /* interlaced */
-        info->interlaced = 1;
-        info->top_field_first = dirac_bool( &bs ); /* top_field_first */
+    int i = dirac_uint( &bs ); /* scan_format */
+    if (i < 2) {
+        info->interlaced = i;
+        info->top_field_first = dirac_top_field_first[video_format];
     }
   }
 



More information about the ogg-dev mailing list