Explicitly call daala read/write bit functions.
Calling aom_write_bit() and aom_read_bit() with --enable-daala_ec
would call aom_write() and aom_read() with probability 128 which
would ultimately call od_ec_enc_bits() and od_ec_dec_bits().
This refactors that code and makes the call explicit.
objective-1-fast:
master@2016-12-14T18:38:33Z -> daala_ec_bits@2016-12-14T18:36:22Z
PSNR | PSNR Cb | PSNR Cr | PSNR HVS | SSIM | MS SSIM | CIEDE 2000
0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000
Change-Id: Ib69e98734fadcdc8b89936b7b6fbd0574afc7e34
diff --git a/aom_dsp/bitreader.h b/aom_dsp/bitreader.h
index d0c6dc5..4ab8b5b 100644
--- a/aom_dsp/bitreader.h
+++ b/aom_dsp/bitreader.h
@@ -163,6 +163,9 @@
int ret;
#if CONFIG_ANS
ret = uabs_read_bit(r); // Non trivial optimization at half probability
+#elif CONFIG_DAALA_EC
+ // Note this uses raw bits and is not the same as aom_daala_read(r, 128);
+ ret = aom_daala_read_bit(r);
#else
ret = aom_read(r, 128, NULL); // aom_prob_half
#endif
diff --git a/aom_dsp/bitwriter.h b/aom_dsp/bitwriter.h
index 18af099..e1e5cc7 100644
--- a/aom_dsp/bitwriter.h
+++ b/aom_dsp/bitwriter.h
@@ -94,6 +94,7 @@
#if CONFIG_ANS
buf_uabs_write(br, bit, probability);
#elif CONFIG_DAALA_EC
+ // Note this uses raw bits and is not the same as aom_daala_write(r, 128);
aom_daala_write(br, bit, probability);
#else
aom_dk_write(br, bit, probability);
@@ -111,7 +112,11 @@
}
static INLINE void aom_write_bit(aom_writer *w, int bit) {
+#if CONFIG_DAALA_EC
+ aom_daala_write_bit(w, bit);
+#else
aom_write(w, bit, 128); // aom_prob_half
+#endif
}
static INLINE void aom_write_bit_record(aom_writer *w, int bit,
diff --git a/aom_dsp/daalaboolreader.h b/aom_dsp/daalaboolreader.h
index e08c777..6376bad 100644
--- a/aom_dsp/daalaboolreader.h
+++ b/aom_dsp/daalaboolreader.h
@@ -57,11 +57,7 @@
}*/
#endif
- if (prob == 128) {
- bit = od_ec_dec_bits(&r->ec, 1, "aom_bits");
- } else {
- bit = od_ec_decode_bool_q15(&r->ec, p);
- }
+ bit = od_ec_decode_bool_q15(&r->ec, p);
#if CONFIG_BITSTREAM_DEBUG
{
@@ -101,7 +97,7 @@
}
static INLINE int aom_daala_read_bit(daala_reader *r) {
- return aom_daala_read(r, 128);
+ return od_ec_dec_bits(&r->ec, 1, "aom_bits");
}
static INLINE int aom_daala_reader_has_error(daala_reader *r) {
diff --git a/aom_dsp/daalaboolwriter.h b/aom_dsp/daalaboolwriter.h
index 5386c83..e088b5f 100644
--- a/aom_dsp/daalaboolwriter.h
+++ b/aom_dsp/daalaboolwriter.h
@@ -50,11 +50,11 @@
bitstream_queue_push(bit, cdf, 2);
#endif
- if (prob == 128) {
- od_ec_enc_bits(&w->ec, bit, 1);
- } else {
- od_ec_encode_bool_q15(&w->ec, bit, p);
- }
+ od_ec_encode_bool_q15(&w->ec, bit, p);
+}
+
+static INLINE void aom_daala_write_bit(daala_writer *w, int bit) {
+ od_ec_enc_bits(&w->ec, bit, 1);
}
static INLINE void daala_write_symbol(daala_writer *w, int symb,