aboutsummaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorAlex Converse <aconverse@google.com>2017-03-03 15:02:56 -0800
committerAlex Converse <aconverse@google.com>2017-03-03 23:09:12 +0000
commitbcd12de6c3a785473085fa9a9c2534e0ecb93062 (patch)
tree228c8ffb957115df180376e2dfa1d50372d2b77a /vp9
parent3e7025022ef7732aa5aa41533715d7a249fd0ab4 (diff)
downloadlibvpx-bcd12de6c3a785473085fa9a9c2534e0ecb93062.tar.gz
Narrow cat6_high_cost tables to uint16_t
Saves 2688 bytes of rodata. Change-Id: I46633b6e50c2845181c70fff6273a8e58fdd1e56
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_encodemb.c4
-rw-r--r--vp9/encoder/vp9_rdopt.c4
-rw-r--r--vp9/encoder/vp9_tokenize.c6
-rw-r--r--vp9/encoder/vp9_tokenize.h14
4 files changed, 14 insertions, 14 deletions
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 0c025ad43..ded502d06 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -113,9 +113,9 @@ int vp9_optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size,
mb->token_costs[tx_size][type][ref];
int best, band, pt, i, final_eob;
#if CONFIG_VP9_HIGHBITDEPTH
- const int *cat6_high_cost = vp9_get_high_cost_table(xd->bd);
+ const uint16_t *cat6_high_cost = vp9_get_high_cost_table(xd->bd);
#else
- const int *cat6_high_cost = vp9_get_high_cost_table(8);
+ const uint16_t *cat6_high_cost = vp9_get_high_cost_table(8);
#endif
assert((!type && !plane) || (type && plane));
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 0500e6025..17a4d6632 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -360,9 +360,9 @@ static int cost_coeffs(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size,
uint8_t token_cache[32 * 32];
int cost;
#if CONFIG_VP9_HIGHBITDEPTH
- const int *cat6_high_cost = vp9_get_high_cost_table(xd->bd);
+ const uint16_t *cat6_high_cost = vp9_get_high_cost_table(xd->bd);
#else
- const int *cat6_high_cost = vp9_get_high_cost_table(8);
+ const uint16_t *cat6_high_cost = vp9_get_high_cost_table(8);
#endif
// Check for consistency of tx_size with mode info
diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c
index dc2616dbe..814d769be 100644
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -123,7 +123,7 @@ const int16_t vp9_cat6_low_cost[256] = {
6620, 6632, 6654, 6666, 6677, 6689, 6751, 6763, 6774, 6786, 6808, 6820, 6831,
6843, 6890, 6902, 6913, 6925, 6947, 6959, 6970, 6982
};
-const int vp9_cat6_high_cost[64] = {
+const uint16_t vp9_cat6_high_cost[64] = {
88, 2251, 2727, 4890, 3148, 5311, 5787, 7950, 3666, 5829, 6305,
8468, 6726, 8889, 9365, 11528, 3666, 5829, 6305, 8468, 6726, 8889,
9365, 11528, 7244, 9407, 9883, 12046, 10304, 12467, 12943, 15106, 3666,
@@ -133,7 +133,7 @@ const int vp9_cat6_high_cost[64] = {
};
#if CONFIG_VP9_HIGHBITDEPTH
-const int vp9_cat6_high10_high_cost[256] = {
+const uint16_t vp9_cat6_high10_high_cost[256] = {
94, 2257, 2733, 4896, 3154, 5317, 5793, 7956, 3672, 5835, 6311,
8474, 6732, 8895, 9371, 11534, 3672, 5835, 6311, 8474, 6732, 8895,
9371, 11534, 7250, 9413, 9889, 12052, 10310, 12473, 12949, 15112, 3672,
@@ -159,7 +159,7 @@ const int vp9_cat6_high10_high_cost[256] = {
18075, 20238, 18496, 20659, 21135, 23298, 19014, 21177, 21653, 23816, 22074,
24237, 24713, 26876
};
-const int vp9_cat6_high12_high_cost[1024] = {
+const uint16_t vp9_cat6_high12_high_cost[1024] = {
100, 2263, 2739, 4902, 3160, 5323, 5799, 7962, 3678, 5841, 6317,
8480, 6738, 8901, 9377, 11540, 3678, 5841, 6317, 8480, 6738, 8901,
9377, 11540, 7256, 9419, 9895, 12058, 10316, 12479, 12955, 15118, 3678,
diff --git a/vp9/encoder/vp9_tokenize.h b/vp9/encoder/vp9_tokenize.h
index c905715d7..c7694afed 100644
--- a/vp9/encoder/vp9_tokenize.h
+++ b/vp9/encoder/vp9_tokenize.h
@@ -76,11 +76,11 @@ 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];
-extern const int vp9_cat6_high12_high_cost[1024];
+extern const uint16_t vp9_cat6_high_cost[64];
+extern const uint16_t vp9_cat6_high10_high_cost[256];
+extern const uint16_t vp9_cat6_high12_high_cost[1024];
static INLINE int vp9_get_cost(int16_t token, EXTRABIT extrabits,
- const int *cat6_high_table) {
+ const uint16_t *cat6_high_table) {
if (token != CATEGORY6_TOKEN)
return vp9_extra_bits[token].cost[extrabits >> 1];
return vp9_cat6_low_cost[(extrabits >> 1) & 0xff] +
@@ -88,13 +88,13 @@ static INLINE int vp9_get_cost(int16_t token, EXTRABIT extrabits,
}
#if CONFIG_VP9_HIGHBITDEPTH
-static INLINE const int *vp9_get_high_cost_table(int bit_depth) {
+static INLINE const uint16_t *vp9_get_high_cost_table(int bit_depth) {
return bit_depth == 8 ? vp9_cat6_high_cost
: (bit_depth == 10 ? vp9_cat6_high10_high_cost
: vp9_cat6_high12_high_cost);
}
#else
-static INLINE const int *vp9_get_high_cost_table(int bit_depth) {
+static INLINE const uint16_t *vp9_get_high_cost_table(int bit_depth) {
(void)bit_depth;
return vp9_cat6_high_cost;
}
@@ -118,7 +118,7 @@ static INLINE int16_t vp9_get_token(int v) {
}
static INLINE int vp9_get_token_cost(int v, int16_t *token,
- const int *cat6_high_table) {
+ const uint16_t *cat6_high_table) {
if (v >= CAT6_MIN_VAL || v <= -CAT6_MIN_VAL) {
EXTRABIT extrabits;
*token = CATEGORY6_TOKEN;