Commit e0644a1f authored by Yaowu Xu's avatar Yaowu Xu

misc-fix: skip non-existing cat6 extrabits

This commit merge the fix that avoids encoding of non-existing extra
bits for cat6 tokens.

Related tracking issue:
https://bugs.chromium.org/p/webm/issues/detail?id=1065
Original llibvpx commit:
3461e8ce

Change-Id: Ia84a14a6a93239b694a104106b6797561893b9d5
parent 23e83574
......@@ -174,11 +174,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
val = CAT5_MIN_VAL + read_coeff(cat5_prob, 5, r);
break;
case CATEGORY6_TOKEN: {
#if CONFIG_MISC_FIXES
const int skip_bits = TX_SIZES - 1 - tx_size;
#else
const int skip_bits = 0;
#endif
const uint8_t *cat6p = cat6_prob + skip_bits;
#if CONFIG_AOM_HIGHBITDEPTH
switch (xd->bd) {
......@@ -228,11 +224,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
val = CAT5_MIN_VAL + read_coeff(cat5_prob, 5, r);
break;
case CATEGORY6_TOKEN: {
#if CONFIG_MISC_FIXES
const int skip_bits = TX_SIZES - 1 - tx_size;
#else
const int skip_bits = 0;
#endif
const uint8_t *cat6p = cat6_prob + skip_bits;
#if CONFIG_AOM_HIGHBITDEPTH
switch (xd->bd) {
......
......@@ -470,9 +470,6 @@ static void pack_mb_tokens(aom_writer *w, TOKENEXTRA **tp,
const av1_extra_bit *const extra_bits_table = av1_extra_bits;
(void)bit_depth;
#endif // CONFIG_AOM_HIGHBITDEPTH
#if !CONFIG_MISC_FIXES
(void)tx;
#endif
while (p < stop && p->token != EOSB_TOKEN) {
const uint8_t token = p->token;
......@@ -532,12 +529,8 @@ static void pack_mb_tokens(aom_writer *w, TOKENEXTRA **tp,
const int bit_string_length = extra_bits->len; // Length of extra bits to
// be written excluding
// the sign bit.
#if CONFIG_MISC_FIXES
int skip_bits =
(extra_bits->base_val == CAT6_MIN_VAL) ? TX_SIZES - 1 - tx : 0;
#else
int skip_bits = 0;
#endif
if (bit_string_length > 0) {
const unsigned char *pb = extra_bits->prob;
......
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