shithub: dav1d

Download patch

ref: 4bf52cb5f211772d3755b8219b635d04f767d979
parent: 7f30c67f1798fc3562ab8520dad6333573a02b71
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Sat Nov 16 09:45:39 EST 2019

Make OBU_* types public

--- a/include/dav1d/headers.h
+++ b/include/dav1d/headers.h
@@ -41,6 +41,17 @@
 #define DAV1D_REFS_PER_FRAME 7
 #define DAV1D_TOTAL_REFS_PER_FRAME (DAV1D_REFS_PER_FRAME + 1)
 
+enum Dav1dObuType {
+    DAV1D_OBU_SEQ_HDR   = 1,
+    DAV1D_OBU_TD        = 2,
+    DAV1D_OBU_FRAME_HDR = 3,
+    DAV1D_OBU_TILE_GRP  = 4,
+    DAV1D_OBU_METADATA  = 5,
+    DAV1D_OBU_FRAME     = 6,
+    DAV1D_OBU_REDUNDANT_FRAME_HDR = 7,
+    DAV1D_OBU_PADDING   = 15,
+};
+
 enum Dav1dTxfmMode {
     DAV1D_TX_4X4_ONLY,
     DAV1D_TX_LARGEST,
--- a/src/levels.h
+++ b/src/levels.h
@@ -32,17 +32,6 @@
 
 #include "dav1d/headers.h"
 
-enum ObuType {
-    OBU_SEQ_HDR   = 1,
-    OBU_TD        = 2,
-    OBU_FRAME_HDR = 3,
-    OBU_TILE_GRP  = 4,
-    OBU_METADATA  = 5,
-    OBU_FRAME     = 6,
-    OBU_REDUNDANT_FRAME_HDR = 7,
-    OBU_PADDING   = 15,
-};
-
 enum ObuMetaType {
     OBU_META_HDR_CLL     = 1,
     OBU_META_HDR_MDCV    = 2,
--- a/src/obu.c
+++ b/src/obu.c
@@ -1178,7 +1178,7 @@
 
     // obu header
     dav1d_get_bits(&gb, 1); // obu_forbidden_bit
-    const enum ObuType type = dav1d_get_bits(&gb, 4);
+    const enum Dav1dObuType type = dav1d_get_bits(&gb, 4);
     const int has_extension = dav1d_get_bits(&gb, 1);
     const int has_length_field = dav1d_get_bits(&gb, 1);
     dav1d_get_bits(&gb, 1); // reserved
@@ -1217,7 +1217,7 @@
     if (len > in->sz - init_byte_pos) goto error;
 
     // skip obu not belonging to the selected temporal/spatial layer
-    if (type != OBU_SEQ_HDR && type != OBU_TD &&
+    if (type != DAV1D_OBU_SEQ_HDR && type != DAV1D_OBU_TD &&
         has_extension && c->operating_point_idc != 0)
     {
         const int in_temporal_layer = (c->operating_point_idc >> temporal_id) & 1;
@@ -1227,7 +1227,7 @@
     }
 
     switch (type) {
-    case OBU_SEQ_HDR: {
+    case DAV1D_OBU_SEQ_HDR: {
         Dav1dRef *ref = dav1d_ref_create(sizeof(Dav1dSequenceHeader));
         if (!ref) return DAV1D_ERR(ENOMEM);
         Dav1dSequenceHeader *seq_hdr = ref->data;
@@ -1266,11 +1266,11 @@
         c->seq_hdr = seq_hdr;
         break;
     }
-    case OBU_REDUNDANT_FRAME_HDR:
+    case DAV1D_OBU_REDUNDANT_FRAME_HDR:
         if (c->frame_hdr) break;
         // fall-through
-    case OBU_FRAME:
-    case OBU_FRAME_HDR:
+    case DAV1D_OBU_FRAME:
+    case DAV1D_OBU_FRAME_HDR:
         if (global) break;
         if (!c->seq_hdr) goto error;
         if (!c->frame_hdr_ref) {
@@ -1293,7 +1293,7 @@
             dav1d_data_unref_internal(&c->tile[n].data);
         c->n_tile_data = 0;
         c->n_tiles = 0;
-        if (type != OBU_FRAME) {
+        if (type != DAV1D_OBU_FRAME) {
             // This is actually a frame header OBU so read the
             // trailing bit and check for overrun.
             dav1d_get_bits(&gb, 1);
@@ -1312,7 +1312,7 @@
             return DAV1D_ERR(ERANGE);
         }
 
-        if (type != OBU_FRAME)
+        if (type != DAV1D_OBU_FRAME)
             break;
         // OBU_FRAMEs shouldn't be signaled with show_existing_frame
         if (c->frame_hdr->show_existing_frame) {
@@ -1325,7 +1325,7 @@
         // to align to the next byte.
         dav1d_bytealign_get_bits(&gb);
         // fall-through
-    case OBU_TILE_GRP: {
+    case DAV1D_OBU_TILE_GRP: {
         if (global) break;
         if (!c->frame_hdr) goto error;
         if (c->n_tile_data_alloc < c->n_tile_data + 1) {
@@ -1365,7 +1365,7 @@
         c->n_tile_data++;
         break;
     }
-    case OBU_METADATA: {
+    case DAV1D_OBU_METADATA: {
         // obu metadta type field
         const enum ObuMetaType meta_type = dav1d_get_uleb128(&gb);
         const int meta_type_len = (dav1d_get_bits_pos(&gb) - init_bit_pos) >> 3;
@@ -1479,8 +1479,8 @@
 
         break;
     }
-    case OBU_PADDING:
-    case OBU_TD:
+    case DAV1D_OBU_PADDING:
+    case DAV1D_OBU_TD:
         // ignore OBUs we don't care about
         break;
     default: