shithub: dav1d

Download patch

ref: 9e08ac7112b6a4fef6e1dde6152ceef1117aa6f4
parent: 8ec9793a9a0abc31f84f3e118deb58b00af1a158
author: Jean-Yves Avenard <[email protected]>
date: Thu Nov 29 13:16:37 EST 2018

Make Dav1dDataProps::timestamp and offset signed.

--- a/include/dav1d/common.h
+++ b/include/dav1d/common.h
@@ -52,9 +52,9 @@
  * used internally.
  */
 typedef struct Dav1dDataProps {
-    uint64_t timestamp; ///< container timestamp of input data, default -1
+    int64_t timestamp; ///< container timestamp of input data, default INT64_MIN
     uint64_t duration; ///< container duration of input data, default -1
-    uint64_t offset; ///< stream offset of input data, default -1
+    int64_t offset; ///< stream offset of input data, default INT64_MIN
     size_t size; ///< packet size, default Dav1dData.sz
 } Dav1dDataProps;
 
--- a/src/data.c
+++ b/src/data.c
@@ -28,6 +28,7 @@
 #include "config.h"
 
 #include <errno.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -45,7 +46,8 @@
     if (!buf->ref) return NULL;
     buf->data = buf->ref->const_data;
     buf->sz = buf->m.size = sz;
-    buf->m.timestamp = buf->m.duration = buf->m.offset = ~0ULL;
+    buf->m.timestamp = buf->m.offset = INT64_MIN;
+    buf->m.duration = ~0ULL;
 
     return buf->ref->data;
 }
@@ -62,7 +64,8 @@
     if (!buf->ref) return -ENOMEM;
     buf->data = ptr;
     buf->sz = buf->m.size = sz;
-    buf->m.timestamp = buf->m.duration = buf->m.offset = ~0ULL;
+    buf->m.timestamp = buf->m.offset = INT64_MIN;
+    buf->m.duration = ~0ULL;
 
     return 0;
 }
--- a/src/picture.c
+++ b/src/picture.c
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -116,7 +117,8 @@
 
     p->p.w = w;
     p->p.h = h;
-    p->m.timestamp = p->m.duration = p->m.offset = ~0ULL;
+    p->m.timestamp = p->m.offset = INT64_MIN;
+    p->m.duration = ~0ULL;
     p->p.layout = layout;
     p->p.bpc = bpc;
     int res = p_allocator->alloc_picture_callback(p, p_allocator->cookie);
--- a/tools/input/ivf.c
+++ b/tools/input/ivf.c
@@ -48,7 +48,7 @@
     return ((uint32_t)p[3] << 24U) | (p[2] << 16U) | (p[1] << 8U) | p[0];
 }
 
-static uint64_t rl64(const uint8_t *const p) {
+static int64_t rl64(const uint8_t *const p) {
     return (((uint64_t) rl32(&p[4])) << 32) | rl32(p);
 }