ref: 811759d8685095e69c3fa710bacfe59d62dbf831
parent: 1658b2f47a3bfd7c06477afaf83691fe6cf421fb
parent: 867f25c83002a176cb0c570c99802e212f69bfdf
author: Johann Koenig <johannkoenig@google.com>
date: Wed Oct 31 18:39:08 EDT 2018
Merge "vp8 boolcoder: normalize to "bc""
--- a/vp8/encoder/boolhuff.c
+++ b/vp8/encoder/boolhuff.c
@@ -42,26 +42,26 @@
12, 10, 9, 7, 6, 4, 3, 1, 1
};
-void vp8_start_encode(BOOL_CODER *br, unsigned char *source,
+void vp8_start_encode(BOOL_CODER *bc, unsigned char *source,
unsigned char *source_end) {
- br->lowvalue = 0;
- br->range = 255;
- br->count = -24;
- br->buffer = source;
- br->buffer_end = source_end;
- br->pos = 0;
+ bc->lowvalue = 0;
+ bc->range = 255;
+ bc->count = -24;
+ bc->buffer = source;
+ bc->buffer_end = source_end;
+ bc->pos = 0;
}
-void vp8_stop_encode(BOOL_CODER *br) {
+void vp8_stop_encode(BOOL_CODER *bc) {
int i;
- for (i = 0; i < 32; ++i) vp8_encode_bool(br, 0, 128);
+ for (i = 0; i < 32; ++i) vp8_encode_bool(bc, 0, 128);
}
-void vp8_encode_value(BOOL_CODER *br, int data, int bits) {
+void vp8_encode_value(BOOL_CODER *bc, int data, int bits) {
int bit;
for (bit = bits - 1; bit >= 0; bit--) {
- vp8_encode_bool(br, (1 & (data >> bit)), 0x80);
+ vp8_encode_bool(bc, (1 & (data >> bit)), 0x80);
}
}
--- a/vp8/encoder/boolhuff.h
+++ b/vp8/encoder/boolhuff.h
@@ -35,11 +35,11 @@
struct vpx_internal_error_info *error;
} BOOL_CODER;
-void vp8_start_encode(BOOL_CODER *br, unsigned char *source,
+void vp8_start_encode(BOOL_CODER *bc, unsigned char *source,
unsigned char *source_end);
-void vp8_encode_value(BOOL_CODER *br, int data, int bits);
-void vp8_stop_encode(BOOL_CODER *br);
+void vp8_encode_value(BOOL_CODER *bc, int data, int bits);
+void vp8_stop_encode(BOOL_CODER *bc);
extern const unsigned int vp8_prob_cost[256];
DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
@@ -56,11 +56,11 @@
return 0;
}
-static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
+static void vp8_encode_bool(BOOL_CODER *bc, int bit, int probability) {
unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
+ int count = bc->count;
+ unsigned int range = bc->range;
+ unsigned int lowvalue = bc->lowvalue;
int shift;
#ifdef VP8_ENTROPY_STATS
@@ -80,7 +80,7 @@
if (bit) {
lowvalue += split;
- range = br->range - split;
+ range = bc->range - split;
}
shift = vp8_norm[range];
@@ -92,18 +92,18 @@
int offset = shift - count;
if ((lowvalue << (offset - 1)) & 0x80000000) {
- int x = br->pos - 1;
+ int x = bc->pos - 1;
- while (x >= 0 && br->buffer[x] == 0xff) {
- br->buffer[x] = (unsigned char)0;
+ while (x >= 0 && bc->buffer[x] == 0xff) {
+ bc->buffer[x] = (unsigned char)0;
x--;
}
- br->buffer[x] += 1;
+ bc->buffer[x] += 1;
}
- validate_buffer(br->buffer + br->pos, 1, br->buffer_end, br->error);
- br->buffer[br->pos++] = (lowvalue >> (24 - offset));
+ validate_buffer(bc->buffer + bc->pos, 1, bc->buffer_end, bc->error);
+ bc->buffer[bc->pos++] = (lowvalue >> (24 - offset));
lowvalue <<= offset;
shift = count;
@@ -112,9 +112,9 @@
}
lowvalue <<= shift;
- br->count = count;
- br->lowvalue = lowvalue;
- br->range = range;
+ bc->count = count;
+ bc->lowvalue = lowvalue;
+ bc->range = range;
}
#ifdef __cplusplus