shithub: dav1d

Download patch

ref: d439328844afdb853d4ff23f74d310bfc1211109
parent: d5421c300785f9234dc9a31597ed259551290243
author: Janne Grunau <[email protected]>
date: Sun Nov 4 17:23:02 EST 2018

move rl32() to its only user tools/dav1d/input/ivf.c

Replace it with the version used in dav1d_fuzzer to avoid an integer
promotion.

--- a/include/common/intops.h
+++ b/include/common/intops.h
@@ -60,14 +60,6 @@
     return 63 - clzll(v);
 }
 
-static inline unsigned rl16(const uint8_t *const ptr) {
-    return (ptr[1] << 8) | ptr[0];
-}
-
-static inline unsigned rl32(const uint8_t *const ptr) {
-    return (rl16(&ptr[2]) << 16) | rl16(ptr);
-}
-
 static inline unsigned inv_recenter(const unsigned r, const unsigned v) {
     if (v > (r << 1))
         return v;
--- a/tools/input/ivf.c
+++ b/tools/input/ivf.c
@@ -34,13 +34,15 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "common/intops.h"
-
 #include "input/demuxer.h"
 
 typedef struct DemuxerPriv {
     FILE *f;
 } IvfInputContext;
+
+static unsigned rl32(const uint8_t *const p) {
+    return ((uint32_t)p[3] << 24U) | (p[2] << 16U) | (p[1] << 8U) | p[0];
+}
 
 static int ivf_open(IvfInputContext *const c, const char *const file,
                     unsigned fps[2], unsigned *const num_frames)