Commit 3b93e8eb authored by Thomas Davies's avatar Thomas Davies Committed by Sebastien Alaiwan

Fix redundancy in delta_q signalling.

rem_bits-1 not rem_bits should be transmitted so that
2 cannot be coded in two ways.

 BUG=aomedia:811

Change-Id: Iaa0203214bbe6fc6775e05fe4b6e976d568f54b3
parent 5589d71c
......@@ -63,7 +63,7 @@ static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
}
if (!smallval) {
rem_bits = aom_read_literal(r, 3, ACCT_STR);
rem_bits = aom_read_literal(r, 3, ACCT_STR) + 1;
thr = (1 << rem_bits) + 1;
abs = aom_read_literal(r, rem_bits, ACCT_STR) + thr;
}
......@@ -102,7 +102,7 @@ static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
if (smallval) counts->delta_lf[abs][0]++;
}
if (!smallval) {
rem_bits = aom_read_literal(r, 3, ACCT_STR);
rem_bits = aom_read_literal(r, 3, ACCT_STR) + 1;
thr = (1 << rem_bits) + 1;
abs = aom_read_literal(r, rem_bits, ACCT_STR) + thr;
}
......
......@@ -533,7 +533,7 @@ static void write_delta_qindex(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if (!smallval) {
rem_bits = OD_ILOG_NZ(abs - 1) - 1;
thr = (1 << rem_bits) + 1;
aom_write_literal(w, rem_bits, 3);
aom_write_literal(w, rem_bits - 1, 3);
aom_write_literal(w, abs - thr, rem_bits);
}
if (abs > 0) {
......@@ -557,7 +557,7 @@ static void write_delta_lflevel(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if (!smallval) {
rem_bits = OD_ILOG_NZ(abs - 1) - 1;
thr = (1 << rem_bits) + 1;
aom_write_literal(w, rem_bits, 3);
aom_write_literal(w, rem_bits - 1, 3);
aom_write_literal(w, abs - thr, rem_bits);
}
if (abs > 0) {
......
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