diff options
author | clang-format <noreply@google.com> | 2016-07-13 22:26:28 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2016-07-15 19:28:44 -0700 |
commit | 81a67395336bdf114dc3ffbf4321d39ae26fce05 (patch) | |
tree | 1afb6aaecb33dedf4e384c05e4a60653f256fdd8 /vp8/encoder/treewriter.h | |
parent | 65daa4137894bd7b8bc6ec3be9fde20093ddf1c5 (diff) | |
download | libvpx-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/treewriter.h')
-rw-r--r-- | vp8/encoder/treewriter.h | 117 |
1 files changed, 43 insertions, 74 deletions
diff --git a/vp8/encoder/treewriter.h b/vp8/encoder/treewriter.h index 2debf9276..dadbbe3f8 100644 --- a/vp8/encoder/treewriter.h +++ b/vp8/encoder/treewriter.h @@ -8,7 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ - #ifndef VP8_ENCODER_TREEWRITER_H_ #define VP8_ENCODER_TREEWRITER_H_ @@ -18,7 +17,7 @@ #include "./vpx_config.h" #include "vp8/common/treecoder.h" -#include "boolhuff.h" /* for now */ +#include "boolhuff.h" /* for now */ #ifdef __cplusplus extern "C" { @@ -28,105 +27,75 @@ typedef BOOL_CODER vp8_writer; #define vp8_write vp8_encode_bool #define vp8_write_literal vp8_encode_value -#define vp8_write_bit( W, V) vp8_write( W, V, vp8_prob_half) +#define vp8_write_bit(W, V) vp8_write(W, V, vp8_prob_half) #define vp8bc_write vp8bc_write_bool #define vp8bc_write_literal vp8bc_write_bits -#define vp8bc_write_bit( W, V) vp8bc_write_bits( W, V, 1) - +#define vp8bc_write_bit(W, V) vp8bc_write_bits(W, V, 1) /* Approximate length of an encoded bool in 256ths of a bit at given prob */ -#define vp8_cost_zero( x) ( vp8_prob_cost[x]) -#define vp8_cost_one( x) vp8_cost_zero( vp8_complement(x)) +#define vp8_cost_zero(x) (vp8_prob_cost[x]) +#define vp8_cost_one(x) vp8_cost_zero(vp8_complement(x)) -#define vp8_cost_bit( x, b) vp8_cost_zero( (b)? vp8_complement(x) : (x) ) +#define vp8_cost_bit(x, b) vp8_cost_zero((b) ? vp8_complement(x) : (x)) /* VP8BC version is scaled by 2^20 rather than 2^8; see bool_coder.h */ - /* Both of these return bits, not scaled bits. */ -static INLINE unsigned int vp8_cost_branch(const unsigned int ct[2], vp8_prob p) -{ - /* Imitate existing calculation */ +static INLINE unsigned int vp8_cost_branch(const unsigned int ct[2], + vp8_prob p) { + /* Imitate existing calculation */ - return ((ct[0] * vp8_cost_zero(p)) - + (ct[1] * vp8_cost_one(p))) >> 8; + return ((ct[0] * vp8_cost_zero(p)) + (ct[1] * vp8_cost_one(p))) >> 8; } /* Small functions to write explicit values and tokens, as well as estimate their lengths. */ -static void vp8_treed_write -( - vp8_writer *const w, - vp8_tree t, - const vp8_prob *const p, - int v, - int n /* number of bits in v, assumed nonzero */ -) -{ - vp8_tree_index i = 0; - - do - { - const int b = (v >> --n) & 1; - vp8_write(w, b, p[i>>1]); - i = t[i+b]; - } - while (n); +static void vp8_treed_write(vp8_writer *const w, vp8_tree t, + const vp8_prob *const p, int v, + int n /* number of bits in v, assumed nonzero */ + ) { + vp8_tree_index i = 0; + + do { + const int b = (v >> --n) & 1; + vp8_write(w, b, p[i >> 1]); + i = t[i + b]; + } while (n); } -static INLINE void vp8_write_token -( - vp8_writer *const w, - vp8_tree t, - const vp8_prob *const p, - vp8_token *const x -) -{ - vp8_treed_write(w, t, p, x->value, x->Len); +static INLINE void vp8_write_token(vp8_writer *const w, vp8_tree t, + const vp8_prob *const p, + vp8_token *const x) { + vp8_treed_write(w, t, p, x->value, x->Len); } -static int vp8_treed_cost( - vp8_tree t, - const vp8_prob *const p, - int v, - int n /* number of bits in v, assumed nonzero */ -) -{ - int c = 0; - vp8_tree_index i = 0; - - do - { - const int b = (v >> --n) & 1; - c += vp8_cost_bit(p[i>>1], b); - i = t[i+b]; - } - while (n); - - return c; +static int vp8_treed_cost(vp8_tree t, const vp8_prob *const p, int v, + int n /* number of bits in v, assumed nonzero */ + ) { + int c = 0; + vp8_tree_index i = 0; + + do { + const int b = (v >> --n) & 1; + c += vp8_cost_bit(p[i >> 1], b); + i = t[i + b]; + } while (n); + + return c; } -static INLINE int vp8_cost_token -( - vp8_tree t, - const vp8_prob *const p, - vp8_token *const x -) -{ - return vp8_treed_cost(t, p, x->value, x->Len); +static INLINE int vp8_cost_token(vp8_tree t, const vp8_prob *const p, + vp8_token *const x) { + return vp8_treed_cost(t, p, x->value, x->Len); } /* Fill array of costs for all possible token values. */ -void vp8_cost_tokens( - int *Costs, const vp8_prob *, vp8_tree -); +void vp8_cost_tokens(int *Costs, const vp8_prob *, vp8_tree); -void vp8_cost_tokens2( - int *Costs, const vp8_prob *, vp8_tree, int -); +void vp8_cost_tokens2(int *Costs, const vp8_prob *, vp8_tree, int); #ifdef __cplusplus } // extern "C" |