Commit b07a2a8e authored by Yaowu Xu's avatar Yaowu Xu

misc-fix: code sign bit before magnitude

This commit merges the fix that changes the coding order between sign
and magnitude to be sign first, magnitude later.

Related tracking issue:
https://bugs.chromium.org/p/webm/issues/detail?id=1039
Original libvpx commit:
a3df343c

Change-Id: Ifde537a1deea9baecba39923256310ee3309829e
parent 103f3000
......@@ -41,11 +41,7 @@ int aom_rb_read_signed_literal(struct aom_read_bit_buffer *rb, int bits) {
}
int aom_rb_read_inv_signed_literal(struct aom_read_bit_buffer *rb, int bits) {
#if CONFIG_MISC_FIXES
const int nbits = sizeof(unsigned) * 8 - bits - 1;
const unsigned value = (unsigned)aom_rb_read_literal(rb, bits + 1) << nbits;
return ((int)value) >> nbits;
#else
return aom_rb_read_signed_literal(rb, bits);
#endif
}
......@@ -39,10 +39,5 @@ void aom_wb_write_literal(struct aom_write_bit_buffer *wb, int data, int bits) {
void aom_wb_write_inv_signed_literal(struct aom_write_bit_buffer *wb, int data,
int bits) {
#if CONFIG_MISC_FIXES
aom_wb_write_literal(wb, data, bits + 1);
#else
aom_wb_write_literal(wb, abs(data), bits);
aom_wb_write_bit(wb, data < 0);
#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