Commit 4b038ad2 authored by Alex Converse's avatar Alex Converse Committed by Gerrit Code Review

Merge "Deduplicate some high bit depth tables"

parents b16a164c 246e0eaa
......@@ -36,20 +36,6 @@ const vpx_prob vp9_cat6_prob[] = {
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
};
#if CONFIG_VP9_HIGHBITDEPTH
const vpx_prob vp9_cat1_prob_high10[] = { 159 };
const vpx_prob vp9_cat2_prob_high10[] = { 165, 145 };
const vpx_prob vp9_cat3_prob_high10[] = { 173, 148, 140 };
const vpx_prob vp9_cat4_prob_high10[] = { 176, 155, 140, 135 };
const vpx_prob vp9_cat5_prob_high10[] = { 180, 157, 141, 134, 130 };
const vpx_prob vp9_cat6_prob_high10[] = {
255, 255, 254, 254, 254, 252, 249, 243,
230, 196, 177, 153, 140, 133, 130, 129
};
const vpx_prob vp9_cat1_prob_high12[] = { 159 };
const vpx_prob vp9_cat2_prob_high12[] = { 165, 145 };
const vpx_prob vp9_cat3_prob_high12[] = { 173, 148, 140 };
const vpx_prob vp9_cat4_prob_high12[] = { 176, 155, 140, 135 };
const vpx_prob vp9_cat5_prob_high12[] = { 180, 157, 141, 134, 130 };
const vpx_prob vp9_cat6_prob_high12[] = {
255, 255, 255, 255, 254, 254, 254, 252, 249,
243, 230, 196, 177, 153, 140, 133, 130, 129
......
......@@ -65,52 +65,24 @@ static int decode_coefs(const MACROBLOCKD *xd,
const int dq_shift = (tx_size == TX_32X32);
int v, token;
int16_t dqv = dq[0];
const uint8_t *cat1_prob;
const uint8_t *cat2_prob;
const uint8_t *cat3_prob;
const uint8_t *cat4_prob;
const uint8_t *cat5_prob;
const uint8_t *cat6_prob;
const uint8_t *const cat6_prob =
#if CONFIG_VP9_HIGHBITDEPTH
(xd->bd == VPX_BITS_12) ? vp9_cat6_prob_high12 :
(xd->bd == VPX_BITS_10) ? vp9_cat6_prob_high12 + 2 :
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_cat6_prob;
const int cat6_bits =
#if CONFIG_VP9_HIGHBITDEPTH
(xd->bd == VPX_BITS_12) ? 18 :
(xd->bd == VPX_BITS_10) ? 16 :
#endif // CONFIG_VP9_HIGHBITDEPTH
14;
if (counts) {
coef_counts = counts->coef[tx_size][type][ref];
eob_branch_count = counts->eob_branch[tx_size][type][ref];
}
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->bd > VPX_BITS_8) {
if (xd->bd == VPX_BITS_10) {
cat1_prob = vp9_cat1_prob_high10;
cat2_prob = vp9_cat2_prob_high10;
cat3_prob = vp9_cat3_prob_high10;
cat4_prob = vp9_cat4_prob_high10;
cat5_prob = vp9_cat5_prob_high10;
cat6_prob = vp9_cat6_prob_high10;
} else {
cat1_prob = vp9_cat1_prob_high12;
cat2_prob = vp9_cat2_prob_high12;
cat3_prob = vp9_cat3_prob_high12;
cat4_prob = vp9_cat4_prob_high12;
cat5_prob = vp9_cat5_prob_high12;
cat6_prob = vp9_cat6_prob_high12;
}
} else {
cat1_prob = vp9_cat1_prob;
cat2_prob = vp9_cat2_prob;
cat3_prob = vp9_cat3_prob;
cat4_prob = vp9_cat4_prob;
cat5_prob = vp9_cat5_prob;
cat6_prob = vp9_cat6_prob;
}
#else
cat1_prob = vp9_cat1_prob;
cat2_prob = vp9_cat2_prob;
cat3_prob = vp9_cat3_prob;
cat4_prob = vp9_cat4_prob;
cat5_prob = vp9_cat5_prob;
cat6_prob = vp9_cat6_prob;
#endif
while (c < max_eob) {
int val = -1;
band = *band_translate++;
......@@ -149,39 +121,22 @@ static int decode_coefs(const MACROBLOCKD *xd,
val = token;
break;
case CATEGORY1_TOKEN:
val = CAT1_MIN_VAL + read_coeff(cat1_prob, 1, r);
val = CAT1_MIN_VAL + read_coeff(vp9_cat1_prob, 1, r);
break;
case CATEGORY2_TOKEN:
val = CAT2_MIN_VAL + read_coeff(cat2_prob, 2, r);
val = CAT2_MIN_VAL + read_coeff(vp9_cat2_prob, 2, r);
break;
case CATEGORY3_TOKEN:
val = CAT3_MIN_VAL + read_coeff(cat3_prob, 3, r);
val = CAT3_MIN_VAL + read_coeff(vp9_cat3_prob, 3, r);
break;
case CATEGORY4_TOKEN:
val = CAT4_MIN_VAL + read_coeff(cat4_prob, 4, r);
val = CAT4_MIN_VAL + read_coeff(vp9_cat4_prob, 4, r);
break;
case CATEGORY5_TOKEN:
val = CAT5_MIN_VAL + read_coeff(cat5_prob, 5, r);
val = CAT5_MIN_VAL + read_coeff(vp9_cat5_prob, 5, r);
break;
case CATEGORY6_TOKEN:
#if CONFIG_VP9_HIGHBITDEPTH
switch (xd->bd) {
case VPX_BITS_8:
val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r);
break;
case VPX_BITS_10:
val = CAT6_MIN_VAL + read_coeff(cat6_prob, 16, r);
break;
case VPX_BITS_12:
val = CAT6_MIN_VAL + read_coeff(cat6_prob, 18, r);
break;
default:
assert(0);
return -1;
}
#else
val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r);
#endif
val = CAT6_MIN_VAL + read_coeff(cat6_prob, cat6_bits, r);
break;
}
}
......
......@@ -375,32 +375,32 @@ const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS] = {
#if CONFIG_VP9_HIGHBITDEPTH
const vp9_extra_bit vp9_extra_bits_high10[ENTROPY_TOKENS] = {
{0, 0, 0, zero_cost}, // ZERO
{0, 0, 1, one_cost}, // ONE
{0, 0, 2, two_cost}, // TWO
{0, 0, 3, three_cost}, // THREE
{0, 0, 4, four_cost}, // FOUR
{vp9_cat1_prob_high10, 1, CAT1_MIN_VAL, cat1_cost}, // CAT1
{vp9_cat2_prob_high10, 2, CAT2_MIN_VAL, cat2_cost}, // CAT2
{vp9_cat3_prob_high10, 3, CAT3_MIN_VAL, cat3_cost}, // CAT3
{vp9_cat4_prob_high10, 4, CAT4_MIN_VAL, cat4_cost}, // CAT4
{vp9_cat5_prob_high10, 5, CAT5_MIN_VAL, cat5_cost}, // CAT5
{vp9_cat6_prob_high10, 16, CAT6_MIN_VAL, 0}, // CAT6
{0, 0, 0, zero_cost} // EOB
{0, 0, 0, zero_cost}, // ZERO
{0, 0, 1, one_cost}, // ONE
{0, 0, 2, two_cost}, // TWO
{0, 0, 3, three_cost}, // THREE
{0, 0, 4, four_cost}, // FOUR
{vp9_cat1_prob, 1, CAT1_MIN_VAL, cat1_cost}, // CAT1
{vp9_cat2_prob, 2, CAT2_MIN_VAL, cat2_cost}, // CAT2
{vp9_cat3_prob, 3, CAT3_MIN_VAL, cat3_cost}, // CAT3
{vp9_cat4_prob, 4, CAT4_MIN_VAL, cat4_cost}, // CAT4
{vp9_cat5_prob, 5, CAT5_MIN_VAL, cat5_cost}, // CAT5
{vp9_cat6_prob_high12 + 2, 16, CAT6_MIN_VAL, 0}, // CAT6
{0, 0, 0, zero_cost} // EOB
};
const vp9_extra_bit vp9_extra_bits_high12[ENTROPY_TOKENS] = {
{0, 0, 0, zero_cost}, // ZERO
{0, 0, 1, one_cost}, // ONE
{0, 0, 2, two_cost}, // TWO
{0, 0, 3, three_cost}, // THREE
{0, 0, 4, four_cost}, // FOUR
{vp9_cat1_prob_high12, 1, CAT1_MIN_VAL, cat1_cost}, // CAT1
{vp9_cat2_prob_high12, 2, CAT2_MIN_VAL, cat2_cost}, // CAT2
{vp9_cat3_prob_high12, 3, CAT3_MIN_VAL, cat3_cost}, // CAT3
{vp9_cat4_prob_high12, 4, CAT4_MIN_VAL, cat4_cost}, // CAT4
{vp9_cat5_prob_high12, 5, CAT5_MIN_VAL, cat5_cost}, // CAT5
{vp9_cat6_prob_high12, 18, CAT6_MIN_VAL, 0}, // CAT6
{0, 0, 0, zero_cost} // EOB
{0, 0, 0, zero_cost}, // ZERO
{0, 0, 1, one_cost}, // ONE
{0, 0, 2, two_cost}, // TWO
{0, 0, 3, three_cost}, // THREE
{0, 0, 4, four_cost}, // FOUR
{vp9_cat1_prob, 1, CAT1_MIN_VAL, cat1_cost}, // CAT1
{vp9_cat2_prob, 2, CAT2_MIN_VAL, cat2_cost}, // CAT2
{vp9_cat3_prob, 3, CAT3_MIN_VAL, cat3_cost}, // CAT3
{vp9_cat4_prob, 4, CAT4_MIN_VAL, cat4_cost}, // CAT4
{vp9_cat5_prob, 5, CAT5_MIN_VAL, cat5_cost}, // CAT5
{vp9_cat6_prob_high12, 18, CAT6_MIN_VAL, 0}, // CAT6
{0, 0, 0, zero_cost} // EOB
};
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment