summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_boolhuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_boolhuff.c')
-rw-r--r--vp9/encoder/vp9_boolhuff.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_boolhuff.c b/vp9/encoder/vp9_boolhuff.c
index 7619dfadf..2689ab601 100644
--- a/vp9/encoder/vp9_boolhuff.c
+++ b/vp9/encoder/vp9_boolhuff.c
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
+#include <assert.h>
#include "vp9_boolhuff.h"
#if defined(SECTIONBITS_OUTPUT)
@@ -64,6 +64,15 @@ void vp9_encode_value(BOOL_CODER *br, int data, int bits) {
encode_bool(br, (1 & (data >> bit)), 0x80);
}
+void vp9_encode_unsigned_max(BOOL_CODER *br, int data, int max) {
+ assert(data <= max);
+ while (max) {
+ encode_bool(br, data & 1, 128);
+ data >>= 1;
+ max >>= 1;
+ }
+}
+
int vp9_recenter_nonneg(int v, int m) {
if (v > (m << 1)) return v;
else if (v >= m) return ((v - m) << 1);