summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_tokenize.h
diff options
context:
space:
mode:
authorJulia Robson <juliamrobson@gmail.com>2016-02-26 14:42:25 -0800
committerAlex Converse <aconverse@google.com>2016-02-26 14:47:18 -0800
commit74a679de6f66b6a30d7399ae427ce2b85a967824 (patch)
tree555959d6c6753bee001fb9a58cc4505a58f67497 /vp9/encoder/vp9_tokenize.h
parent1ff2935ebf6c537340861bd590329ba5a49b96e3 (diff)
downloadlibvpx-74a679de6f66b6a30d7399ae427ce2b85a967824.tar
libvpx-74a679de6f66b6a30d7399ae427ce2b85a967824.tar.gz
libvpx-74a679de6f66b6a30d7399ae427ce2b85a967824.tar.bz2
libvpx-74a679de6f66b6a30d7399ae427ce2b85a967824.zip
Port "cost_coeff speed improvements" to vp9.
About a 5% faster overall encode (perf cycles) at speed zero! Change-Id: Iaf013ba75884415cd824e98349f654ffb1c3ef33
Diffstat (limited to 'vp9/encoder/vp9_tokenize.h')
-rw-r--r--vp9/encoder/vp9_tokenize.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_tokenize.h b/vp9/encoder/vp9_tokenize.h
index df979b25d..fad798886 100644
--- a/vp9/encoder/vp9_tokenize.h
+++ b/vp9/encoder/vp9_tokenize.h
@@ -74,6 +74,7 @@ extern const int16_t *vp9_dct_value_cost_ptr;
*/
extern const TOKENVALUE *vp9_dct_value_tokens_ptr;
extern const TOKENVALUE *vp9_dct_cat_lt_10_value_tokens;
+extern const int *vp9_dct_cat_lt_10_value_cost;
extern const int16_t vp9_cat6_low_cost[256];
extern const int vp9_cat6_high_cost[64];
extern const int vp9_cat6_high10_high_cost[256];
@@ -117,6 +118,18 @@ static INLINE int16_t vp9_get_token(int v) {
return vp9_dct_cat_lt_10_value_tokens[v].token;
}
+static INLINE int vp9_get_token_cost(int v, int16_t *token,
+ const int *cat6_high_table) {
+ if (v >= CAT6_MIN_VAL || v <= -CAT6_MIN_VAL) {
+ EXTRABIT extrabits;
+ *token = CATEGORY6_TOKEN;
+ extrabits = abs(v) - CAT6_MIN_VAL;
+ return vp9_cat6_low_cost[extrabits & 0xff] +
+ cat6_high_table[extrabits >> 8];
+ }
+ *token = vp9_dct_cat_lt_10_value_tokens[v].token;
+ return vp9_dct_cat_lt_10_value_cost[v];
+}
#ifdef __cplusplus
} // extern "C"