summaryrefslogtreecommitdiffstats
path: root/third_party/aom/aom/aom_integer.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/aom/aom_integer.h')
-rw-r--r--third_party/aom/aom/aom_integer.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/third_party/aom/aom/aom_integer.h b/third_party/aom/aom/aom_integer.h
index bd1fe270b..907d4cbec 100644
--- a/third_party/aom/aom/aom_integer.h
+++ b/third_party/aom/aom/aom_integer.h
@@ -8,7 +8,6 @@
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-
#ifndef AOM_AOM_INTEGER_H_
#define AOM_AOM_INTEGER_H_
@@ -61,6 +60,47 @@ typedef size_t uintptr_t;
#include <inttypes.h>
#endif
+#if !defined(INT8_MAX)
+#define INT8_MAX 127
+#endif
+
+#if !defined(INT32_MAX)
+#define INT32_MAX 2147483647
+#endif
+
+#if !defined(INT32_MIN)
+#define INT32_MIN (-2147483647 - 1)
+#endif
+
#define NELEMENTS(x) (int)(sizeof(x) / sizeof(x[0]))
+#if defined(__cplusplus)
+extern "C" {
+#endif // __cplusplus
+
+// Returns size of uint64_t when encoded using LEB128.
+size_t aom_uleb_size_in_bytes(uint64_t value);
+
+// Returns 0 on success, -1 on decode failure.
+// On success, 'value' stores the decoded LEB128 value and 'length' stores
+// the number of bytes decoded.
+int aom_uleb_decode(const uint8_t *buffer, size_t available, uint64_t *value,
+ size_t *length);
+
+// Encodes LEB128 integer. Returns 0 when successful, and -1 upon failure.
+int aom_uleb_encode(uint64_t value, size_t available, uint8_t *coded_value,
+ size_t *coded_size);
+
+// Encodes LEB128 integer to size specified. Returns 0 when successful, and -1
+// upon failure.
+// Note: This will write exactly pad_to_size bytes; if the value cannot be
+// encoded in this many bytes, then this will fail.
+int aom_uleb_encode_fixed_size(uint64_t value, size_t available,
+ size_t pad_to_size, uint8_t *coded_value,
+ size_t *coded_size);
+
+#if defined(__cplusplus)
+} // extern "C"
+#endif // __cplusplus
+
#endif // AOM_AOM_INTEGER_H_