Commit d5b89d0d authored by Timothy B. Terriberry's avatar Timothy B. Terriberry Committed by Tim Terriberry
Browse files

ec_smallmul: Simplify binary read/write.

This should be the same number of operations as the non-ec_smallmul
version (though ideally we'd use the real 15-bit probability
natively).

Encoder output should not change, and all streams should remain
decodable without decoder changes.

Change-Id: I2998a77a02f566cd0c82c415395637acf49b5a97
parent ead52876
......@@ -45,7 +45,11 @@ uint32_t aom_daala_reader_tell_frac(const daala_reader *r);
static INLINE int aom_daala_read(daala_reader *r, int prob) {
int bit;
int p = ((prob << 15) + (256 - prob)) >> 8;
#if CONFIG_EC_SMALLMUL
int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
#else
int p = ((prob << 15) + 256 - prob) >> 8;
#endif
#if CONFIG_BITSTREAM_DEBUG
/*{
const int queue_r = bitstream_queue_get_read();
......@@ -57,7 +61,7 @@ static INLINE int aom_daala_read(daala_reader *r, int prob) {
}*/
#endif
bit = od_ec_decode_bool_q15(&r->ec, OD_ICDF(p));
bit = od_ec_decode_bool_q15(&r->ec, p);
#if CONFIG_BITSTREAM_DEBUG
{
......
......@@ -36,7 +36,11 @@ void aom_daala_start_encode(daala_writer *w, uint8_t *buffer);
void aom_daala_stop_encode(daala_writer *w);
static INLINE void aom_daala_write(daala_writer *w, int bit, int prob) {
int p = ((prob << 15) + (256 - prob)) >> 8;
#if CONFIG_EC_SMALLMUL
int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
#else
int p = ((prob << 15) + 256 - prob) >> 8;
#endif
#if CONFIG_BITSTREAM_DEBUG
aom_cdf_prob cdf[2] = { (aom_cdf_prob)p, 32767 };
/*int queue_r = 0;
......@@ -50,7 +54,7 @@ static INLINE void aom_daala_write(daala_writer *w, int bit, int prob) {
bitstream_queue_push(bit, cdf, 2);
#endif
od_ec_encode_bool_q15(&w->ec, bit, OD_ICDF(p));
od_ec_encode_bool_q15(&w->ec, bit, p);
}
#if CONFIG_RAWBITS
......
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