summaryrefslogtreecommitdiff
path: root/vp8/encoder/boolhuff.h
diff options
context:
space:
mode:
authorclang-format <noreply@google.com>2016-07-13 22:26:28 -0700
committerJames Zern <jzern@google.com>2016-07-15 19:28:44 -0700
commit81a67395336bdf114dc3ffbf4321d39ae26fce05 (patch)
tree1afb6aaecb33dedf4e384c05e4a60653f256fdd8 /vp8/encoder/boolhuff.h
parent65daa4137894bd7b8bc6ec3be9fde20093ddf1c5 (diff)
downloadlibvpx-81a67395336bdf114dc3ffbf4321d39ae26fce05.tar
libvpx-81a67395336bdf114dc3ffbf4321d39ae26fce05.tar.gz
libvpx-81a67395336bdf114dc3ffbf4321d39ae26fce05.tar.bz2
libvpx-81a67395336bdf114dc3ffbf4321d39ae26fce05.zip
vp8: apply clang-format
Change-Id: I7605b6678014a5426ceb45c27b54885e0c4e06ed
Diffstat (limited to 'vp8/encoder/boolhuff.h')
-rw-r--r--vp8/encoder/boolhuff.h127
1 files changed, 59 insertions, 68 deletions
diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
index e66a2dbd8..d88d4b37e 100644
--- a/vp8/encoder/boolhuff.h
+++ b/vp8/encoder/boolhuff.h
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
/****************************************************************************
*
* Module Title : boolhuff.h
@@ -26,103 +25,95 @@
extern "C" {
#endif
-typedef struct
-{
- unsigned int lowvalue;
- unsigned int range;
- int count;
- unsigned int pos;
- unsigned char *buffer;
- unsigned char *buffer_end;
- struct vpx_internal_error_info *error;
+typedef struct {
+ unsigned int lowvalue;
+ unsigned int range;
+ int count;
+ unsigned int pos;
+ unsigned char *buffer;
+ unsigned char *buffer_end;
+ struct vpx_internal_error_info *error;
} BOOL_CODER;
-extern void vp8_start_encode(BOOL_CODER *bc, unsigned char *buffer, unsigned char *buffer_end);
+extern void vp8_start_encode(BOOL_CODER *bc, unsigned char *buffer,
+ unsigned char *buffer_end);
extern void vp8_encode_value(BOOL_CODER *br, int data, int bits);
extern 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]);
-static int validate_buffer(const unsigned char *start,
- size_t len,
+static int validate_buffer(const unsigned char *start, size_t len,
const unsigned char *end,
- struct vpx_internal_error_info *error)
-{
- if (start + len > start && start + len < end)
- return 1;
- else
- vpx_internal_error(error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt partition ");
-
- return 0;
+ struct vpx_internal_error_info *error) {
+ if (start + len > start && start + len < end)
+ return 1;
+ else
+ vpx_internal_error(error, VPX_CODEC_CORRUPT_FRAME,
+ "Truncated packet or corrupt partition ");
+
+ return 0;
}
-static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability)
-{
- unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
- register int shift;
+static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
+ unsigned int split;
+ int count = br->count;
+ unsigned int range = br->range;
+ unsigned int lowvalue = br->lowvalue;
+ register int shift;
#ifdef VP8_ENTROPY_STATS
#if defined(SECTIONBITS_OUTPUT)
- if (bit)
- Sectionbits[active_section] += vp8_prob_cost[255-probability];
- else
- Sectionbits[active_section] += vp8_prob_cost[probability];
+ if (bit)
+ Sectionbits[active_section] += vp8_prob_cost[255 - probability];
+ else
+ Sectionbits[active_section] += vp8_prob_cost[probability];
#endif
#endif
- split = 1 + (((range - 1) * probability) >> 8);
+ split = 1 + (((range - 1) * probability) >> 8);
- range = split;
+ range = split;
- if (bit)
- {
- lowvalue += split;
- range = br->range - split;
- }
+ if (bit) {
+ lowvalue += split;
+ range = br->range - split;
+ }
- shift = vp8_norm[range];
+ shift = vp8_norm[range];
- range <<= shift;
- count += shift;
+ range <<= shift;
+ count += shift;
- if (count >= 0)
- {
- int offset = shift - count;
+ if (count >= 0) {
+ int offset = shift - count;
- if ((lowvalue << (offset - 1)) & 0x80000000)
- {
- int x = br->pos - 1;
+ if ((lowvalue << (offset - 1)) & 0x80000000) {
+ int x = br->pos - 1;
- while (x >= 0 && br->buffer[x] == 0xff)
- {
- br->buffer[x] = (unsigned char)0;
- x--;
- }
+ while (x >= 0 && br->buffer[x] == 0xff) {
+ br->buffer[x] = (unsigned char)0;
+ x--;
+ }
- br->buffer[x] += 1;
- }
+ br->buffer[x] += 1;
+ }
- validate_buffer(br->buffer + br->pos, 1, br->buffer_end, br->error);
- br->buffer[br->pos++] = (lowvalue >> (24 - offset));
+ validate_buffer(br->buffer + br->pos, 1, br->buffer_end, br->error);
+ br->buffer[br->pos++] = (lowvalue >> (24 - offset));
- lowvalue <<= offset;
- shift = count;
- lowvalue &= 0xffffff;
- count -= 8 ;
- }
+ lowvalue <<= offset;
+ shift = count;
+ lowvalue &= 0xffffff;
+ count -= 8;
+ }
- lowvalue <<= shift;
- br->count = count;
- br->lowvalue = lowvalue;
- br->range = range;
+ lowvalue <<= shift;
+ br->count = count;
+ br->lowvalue = lowvalue;
+ br->range = range;
}
#ifdef __cplusplus