summaryrefslogtreecommitdiff
path: root/media/libaom/src/aom_dsp/bitwriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/libaom/src/aom_dsp/bitwriter.h')
-rw-r--r--media/libaom/src/aom_dsp/bitwriter.h53
1 files changed, 41 insertions, 12 deletions
diff --git a/media/libaom/src/aom_dsp/bitwriter.h b/media/libaom/src/aom_dsp/bitwriter.h
index b5ecc2382b..4e77a17944 100644
--- a/media/libaom/src/aom_dsp/bitwriter.h
+++ b/media/libaom/src/aom_dsp/bitwriter.h
@@ -16,7 +16,7 @@
#include "config/aom_config.h"
-#include "aom_dsp/daalaboolwriter.h"
+#include "aom_dsp/entenc.h"
#include "aom_dsp/prob.h"
#if CONFIG_RD_DEBUG
@@ -28,7 +28,14 @@
extern "C" {
#endif
-typedef struct daala_writer aom_writer;
+struct aom_writer {
+ unsigned int pos;
+ uint8_t *buffer;
+ od_ec_enc ec;
+ uint8_t allow_update_cdf;
+};
+
+typedef struct aom_writer aom_writer;
typedef struct TOKEN_STATS {
int cost;
@@ -49,16 +56,26 @@ static INLINE void init_token_stats(TOKEN_STATS *token_stats) {
token_stats->cost = 0;
}
-static INLINE void aom_start_encode(aom_writer *bc, uint8_t *buffer) {
- aom_daala_start_encode(bc, buffer);
-}
-
-static INLINE int aom_stop_encode(aom_writer *bc) {
- return aom_daala_stop_encode(bc);
-}
+void aom_start_encode(aom_writer *w, uint8_t *buffer);
+
+int aom_stop_encode(aom_writer *w);
+
+static INLINE void aom_write(aom_writer *w, int bit, int probability) {
+ int p = (0x7FFFFF - (probability << 15) + probability) >> 8;
+#if CONFIG_BITSTREAM_DEBUG
+ aom_cdf_prob cdf[2] = { (aom_cdf_prob)p, 32767 };
+ /*int queue_r = 0;
+ int frame_idx_r = 0;
+ int queue_w = bitstream_queue_get_write();
+ int frame_idx_w = aom_bitstream_queue_get_frame_writee();
+ if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
+ fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
+ frame_idx_w, queue_w);
+ }*/
+ bitstream_queue_push(bit, cdf, 2);
+#endif
-static INLINE void aom_write(aom_writer *br, int bit, int probability) {
- aom_daala_write(br, bit, probability);
+ od_ec_encode_bool_q15(&w->ec, bit, p);
}
static INLINE void aom_write_bit(aom_writer *w, int bit) {
@@ -73,7 +90,19 @@ static INLINE void aom_write_literal(aom_writer *w, int data, int bits) {
static INLINE void aom_write_cdf(aom_writer *w, int symb,
const aom_cdf_prob *cdf, int nsymbs) {
- daala_write_symbol(w, symb, cdf, nsymbs);
+#if CONFIG_BITSTREAM_DEBUG
+ /*int queue_r = 0;
+ int frame_idx_r = 0;
+ int queue_w = bitstream_queue_get_write();
+ int frame_idx_w = aom_bitstream_queue_get_frame_writee();
+ if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
+ fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
+ frame_idx_w, queue_w);
+ }*/
+ bitstream_queue_push(symb, cdf, nsymbs);
+#endif
+
+ od_ec_encode_cdf_q15(&w->ec, symb, cdf, nsymbs);
}
static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,