Remove the DAALA_EC experiment. This patch forces DAALA_EC on by default and removes the dkbool coder. Change-Id: Icd2ff08efd7bf467adf554344111473cb357adf8
diff --git a/aom_dsp/aom_dsp.mk b/aom_dsp/aom_dsp.mk index b7943a1..87504c2 100644 --- a/aom_dsp/aom_dsp.mk +++ b/aom_dsp/aom_dsp.mk
@@ -27,14 +27,11 @@ DSP_SRCS-yes += answriter.h DSP_SRCS-yes += buf_ans.h DSP_SRCS-yes += buf_ans.c -else ifeq ($(CONFIG_DAALA_EC),yes) +else DSP_SRCS-yes += entenc.c DSP_SRCS-yes += entenc.h DSP_SRCS-yes += daalaboolwriter.c DSP_SRCS-yes += daalaboolwriter.h -else -DSP_SRCS-yes += dkboolwriter.h -DSP_SRCS-yes += dkboolwriter.c endif DSP_SRCS-yes += bitwriter.h DSP_SRCS-yes += bitwriter_buffer.c @@ -52,14 +49,11 @@ ifeq ($(CONFIG_AV1_DECODER),yes) ifeq ($(CONFIG_ANS),yes) DSP_SRCS-yes += ansreader.h -else ifeq ($(CONFIG_DAALA_EC),yes) +else DSP_SRCS-yes += entdec.c DSP_SRCS-yes += entdec.h DSP_SRCS-yes += daalaboolreader.c DSP_SRCS-yes += daalaboolreader.h -else -DSP_SRCS-yes += dkboolreader.h -DSP_SRCS-yes += dkboolreader.c endif DSP_SRCS-yes += bitreader.h DSP_SRCS-yes += bitreader_buffer.c @@ -71,7 +65,7 @@ # intra predictions DSP_SRCS-yes += intrapred.c -ifeq ($(CONFIG_DAALA_EC),yes) +ifneq ($(CONFIG_ANS),yes) DSP_SRCS-yes += entcode.c DSP_SRCS-yes += entcode.h endif
diff --git a/aom_dsp/bitreader.h b/aom_dsp/bitreader.h index 67e723d..5bad70c 100644 --- a/aom_dsp/bitreader.h +++ b/aom_dsp/bitreader.h
@@ -16,19 +16,13 @@ #include <limits.h> #include "./aom_config.h" -#if CONFIG_EC_ADAPT && !(CONFIG_DAALA_EC || CONFIG_ANS) -#error \ - "CONFIG_EC_ADAPT is enabled without either CONFIG_DAALA_EC or CONFIG_ANS." -#endif #include "aom/aomdx.h" #include "aom/aom_integer.h" #if CONFIG_ANS #include "aom_dsp/ansreader.h" -#elif CONFIG_DAALA_EC -#include "aom_dsp/daalaboolreader.h" #else -#include "aom_dsp/dkboolreader.h" +#include "aom_dsp/daalaboolreader.h" #endif #include "aom_dsp/prob.h" #include "av1/common/odintrin.h" @@ -62,26 +56,20 @@ #if CONFIG_ANS typedef struct AnsDecoder aom_reader; -#elif CONFIG_DAALA_EC -typedef struct daala_reader aom_reader; #else -typedef struct aom_dk_reader aom_reader; +typedef struct daala_reader aom_reader; #endif static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer, size_t size, aom_decrypt_cb decrypt_cb, void *decrypt_state) { -#if CONFIG_ANS (void)decrypt_cb; (void)decrypt_state; +#if CONFIG_ANS if (size > INT_MAX) return 1; return ans_read_init(r, buffer, (int)size); -#elif CONFIG_DAALA_EC - (void)decrypt_cb; - (void)decrypt_state; - return aom_daala_reader_init(r, buffer, (int)size); #else - return aom_dk_reader_init(r, buffer, size, decrypt_cb, decrypt_state); + return aom_daala_reader_init(r, buffer, (int)size); #endif } @@ -90,20 +78,16 @@ (void)r; assert(0 && "Use the raw buffer size with ANS"); return NULL; -#elif CONFIG_DAALA_EC - return aom_daala_reader_find_end(r); #else - return aom_dk_reader_find_end(r); + return aom_daala_reader_find_end(r); #endif } static INLINE int aom_reader_has_error(aom_reader *r) { #if CONFIG_ANS return ans_reader_has_error(r); -#elif CONFIG_DAALA_EC - return aom_daala_reader_has_error(r); #else - return aom_dk_reader_has_error(r); + return aom_daala_reader_has_error(r); #endif } @@ -113,10 +97,8 @@ (void)r; assert(0 && "aom_reader_tell() is unimplemented for ANS"); return 0; -#elif CONFIG_DAALA_EC - return aom_daala_reader_tell(r); #else - return aom_dk_reader_tell(r); + return aom_daala_reader_tell(r); #endif } @@ -126,10 +108,8 @@ (void)r; assert(0 && "aom_reader_tell_frac() is unimplemented for ANS"); return 0; -#elif CONFIG_DAALA_EC - return aom_daala_reader_tell_frac(r); #else - return aom_dk_reader_tell_frac(r); + return aom_daala_reader_tell_frac(r); #endif } @@ -156,10 +136,8 @@ int ret; #if CONFIG_ANS ret = rabs_read(r, prob); -#elif CONFIG_DAALA_EC - ret = aom_daala_read(r, prob); #else - ret = aom_dk_read(r, prob); + ret = aom_daala_read(r, prob); #endif #if CONFIG_ACCOUNTING if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME); @@ -172,7 +150,7 @@ int ret; #if CONFIG_ANS ret = rabs_read_bit(r); // Non trivial optimization at half probability -#elif CONFIG_DAALA_EC && CONFIG_RAWBITS +#elif CONFIG_RAWBITS // Note this uses raw bits and is not the same as aom_daala_read(r, 128); // Calls to this function are omitted from raw symbol accounting. ret = aom_daala_read_bit(r); @@ -195,16 +173,6 @@ return literal; } -static INLINE int aom_read_tree_as_bits(aom_reader *r, - const aom_tree_index *tree, - const aom_prob *probs) { - aom_tree_index i = 0; - - while ((i = tree[i + aom_read(r, probs[i >> 1], NULL)]) > 0) continue; - return -i; -} - -#if CONFIG_DAALA_EC || CONFIG_ANS static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf, int nsymbs ACCT_STR_PARAM) { int ret; @@ -250,16 +218,11 @@ } while (i > 0); return -i; } -#endif // CONFIG_DAALA_EC || CONFIG_ANS static INLINE int aom_read_tree_(aom_reader *r, const aom_tree_index *tree, const aom_prob *probs ACCT_STR_PARAM) { int ret; -#if CONFIG_DAALA_EC || CONFIG_ANS ret = aom_read_tree_as_cdf(r, tree, probs); -#else - ret = aom_read_tree_as_bits(r, tree, probs); -#endif #if CONFIG_ACCOUNTING if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME); #endif
diff --git a/aom_dsp/bitwriter.h b/aom_dsp/bitwriter.h index af34615..588e47b 100644 --- a/aom_dsp/bitwriter.h +++ b/aom_dsp/bitwriter.h
@@ -14,17 +14,11 @@ #include <assert.h> #include "./aom_config.h" -#if CONFIG_EC_ADAPT && !(CONFIG_DAALA_EC || CONFIG_ANS) -#error \ - "CONFIG_EC_ADAPT is enabled without either CONFIG_DAALA_EC of CONFIG_ANS." -#endif #if CONFIG_ANS #include "aom_dsp/buf_ans.h" -#elif CONFIG_DAALA_EC -#include "aom_dsp/daalaboolwriter.h" #else -#include "aom_dsp/dkboolwriter.h" +#include "aom_dsp/daalaboolwriter.h" #endif #include "aom_dsp/prob.h" @@ -39,10 +33,8 @@ #if CONFIG_ANS typedef struct BufAnsCoder aom_writer; -#elif CONFIG_DAALA_EC -typedef struct daala_writer aom_writer; #else -typedef struct aom_dk_writer aom_writer; +typedef struct daala_writer aom_writer; #endif typedef struct TOKEN_STATS { @@ -73,10 +65,8 @@ (void)bc; (void)buffer; assert(0 && "buf_ans requires a more complicated startup procedure"); -#elif CONFIG_DAALA_EC - aom_daala_start_encode(bc, buffer); #else - aom_dk_start_encode(bc, buffer); + aom_daala_start_encode(bc, buffer); #endif } @@ -84,20 +74,16 @@ #if CONFIG_ANS (void)bc; assert(0 && "buf_ans requires a more complicated shutdown procedure"); -#elif CONFIG_DAALA_EC - aom_daala_stop_encode(bc); #else - aom_dk_stop_encode(bc); + aom_daala_stop_encode(bc); #endif } static INLINE void aom_write(aom_writer *br, int bit, int probability) { #if CONFIG_ANS buf_rabs_write(br, bit, probability); -#elif CONFIG_DAALA_EC - aom_daala_write(br, bit, probability); #else - aom_dk_write(br, bit, probability); + aom_daala_write(br, bit, probability); #endif } @@ -114,7 +100,7 @@ static INLINE void aom_write_bit(aom_writer *w, int bit) { #if CONFIG_ANS buf_rabs_write_bit(w, bit); -#elif CONFIG_DAALA_EC && CONFIG_RAWBITS +#elif CONFIG_RAWBITS // Note this uses raw bits and is not the same as aom_daala_write(r, 128); aom_daala_write_bit(w, bit); #else @@ -138,28 +124,6 @@ for (bit = bits - 1; bit >= 0; bit--) aom_write_bit(w, 1 & (data >> bit)); } -static INLINE void aom_write_tree_as_bits(aom_writer *w, - const aom_tree_index *tr, - const aom_prob *probs, int bits, - int len, aom_tree_index i) { - do { - const int bit = (bits >> --len) & 1; - aom_write(w, bit, probs[i >> 1]); - i = tr[i + bit]; - } while (len); -} - -static INLINE void aom_write_tree_as_bits_record( - aom_writer *w, const aom_tree_index *tr, const aom_prob *probs, int bits, - int len, aom_tree_index i, TOKEN_STATS *token_stats) { - do { - const int bit = (bits >> --len) & 1; - aom_write_record(w, bit, probs[i >> 1], token_stats); - i = tr[i + bit]; - } while (len); -} - -#if CONFIG_DAALA_EC || CONFIG_ANS static INLINE void aom_write_cdf(aom_writer *w, int symb, const aom_cdf_prob *cdf, int nsymbs) { #if CONFIG_ANS @@ -220,16 +184,10 @@ } while (len); } -#endif // CONFIG_DAALA_EC || CONFIG_ANS - static INLINE void aom_write_tree(aom_writer *w, const aom_tree_index *tree, const aom_prob *probs, int bits, int len, aom_tree_index i) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_tree_as_cdf(w, tree, probs, bits, len, i); -#else - aom_write_tree_as_bits(w, tree, probs, bits, len, i); -#endif } static INLINE void aom_write_tree_record(aom_writer *w, @@ -237,12 +195,8 @@ const aom_prob *probs, int bits, int len, aom_tree_index i, TOKEN_STATS *token_stats) { -#if CONFIG_DAALA_EC || CONFIG_ANS (void)token_stats; aom_write_tree_as_cdf(w, tree, probs, bits, len, i); -#else - aom_write_tree_as_bits_record(w, tree, probs, bits, len, i, token_stats); -#endif } #ifdef __cplusplus
diff --git a/aom_dsp/dkboolreader.c b/aom_dsp/dkboolreader.c deleted file mode 100644 index 288d5f1..0000000 --- a/aom_dsp/dkboolreader.c +++ /dev/null
@@ -1,110 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include <stdlib.h> - -#include "./aom_config.h" - -#include "aom_dsp/dkboolreader.h" -#include "aom_dsp/prob.h" -#include "aom_dsp/aom_dsp_common.h" -#include "aom_ports/mem.h" -#include "aom_mem/aom_mem.h" -#include "aom_util/endian_inl.h" - -static INLINE int aom_dk_read_bit(struct aom_dk_reader *r) { - return aom_dk_read(r, 128); // aom_prob_half -} - -int aom_dk_reader_init(struct aom_dk_reader *r, const uint8_t *buffer, - size_t size, aom_decrypt_cb decrypt_cb, - void *decrypt_state) { - if (size && !buffer) { - return 1; - } else { - r->buffer_end = buffer + size; - r->buffer_start = r->buffer = buffer; - r->value = 0; - r->count = -8; - r->range = 255; - r->decrypt_cb = decrypt_cb; - r->decrypt_state = decrypt_state; - aom_dk_reader_fill(r); -#if CONFIG_ACCOUNTING - r->accounting = NULL; -#endif - return aom_dk_read_bit(r) != 0; // marker bit - } -} - -void aom_dk_reader_fill(struct aom_dk_reader *r) { - const uint8_t *const buffer_end = r->buffer_end; - const uint8_t *buffer = r->buffer; - const uint8_t *buffer_start = buffer; - BD_VALUE value = r->value; - int count = r->count; - const size_t bytes_left = buffer_end - buffer; - const size_t bits_left = bytes_left * CHAR_BIT; - int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT); - - if (r->decrypt_cb) { - size_t n = AOMMIN(sizeof(r->clear_buffer), bytes_left); - r->decrypt_cb(r->decrypt_state, buffer, r->clear_buffer, (int)n); - buffer = r->clear_buffer; - buffer_start = r->clear_buffer; - } - if (bits_left > BD_VALUE_SIZE) { - const int bits = (shift & 0xfffffff8) + CHAR_BIT; - BD_VALUE nv; - BD_VALUE big_endian_values; - memcpy(&big_endian_values, buffer, sizeof(BD_VALUE)); -#if SIZE_MAX == 0xffffffffffffffffULL - big_endian_values = HToBE64(big_endian_values); -#else - big_endian_values = HToBE32(big_endian_values); -#endif - nv = big_endian_values >> (BD_VALUE_SIZE - bits); - count += bits; - buffer += (bits >> 3); - value = r->value | (nv << (shift & 0x7)); - } else { - const int bits_over = (int)(shift + CHAR_BIT - (int)bits_left); - int loop_end = 0; - if (bits_over >= 0) { - count += LOTS_OF_BITS; - loop_end = bits_over; - } - - if (bits_over < 0 || bits_left) { - while (shift >= loop_end) { - count += CHAR_BIT; - value |= (BD_VALUE)*buffer++ << shift; - shift -= CHAR_BIT; - } - } - } - - // NOTE: Variable 'buffer' may not relate to 'r->buffer' after decryption, - // so we increase 'r->buffer' by the amount that 'buffer' moved, rather than - // assign 'buffer' to 'r->buffer'. - r->buffer += buffer - buffer_start; - r->value = value; - r->count = count; -} - -const uint8_t *aom_dk_reader_find_end(struct aom_dk_reader *r) { - // Find the end of the coded buffer - while (r->count > CHAR_BIT && r->count < BD_VALUE_SIZE) { - r->count -= CHAR_BIT; - r->buffer--; - } - return r->buffer; -}
diff --git a/aom_dsp/dkboolreader.h b/aom_dsp/dkboolreader.h deleted file mode 100644 index f0bc843..0000000 --- a/aom_dsp/dkboolreader.h +++ /dev/null
@@ -1,181 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#ifndef AOM_DSP_DKBOOLREADER_H_ -#define AOM_DSP_DKBOOLREADER_H_ - -#include <assert.h> -#include <stddef.h> -#include <limits.h> - -#include "./aom_config.h" -#if CONFIG_BITSTREAM_DEBUG -#include <assert.h> -#include <stdio.h> -#include "aom_util/debug_util.h" -#endif // CONFIG_BITSTREAM_DEBUG - -#include "aom_ports/mem.h" -#include "aom/aomdx.h" -#include "aom/aom_integer.h" -#include "aom_dsp/prob.h" -#if CONFIG_ACCOUNTING -#include "av1/decoder/accounting.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef size_t BD_VALUE; - -#define BD_VALUE_SIZE ((int)sizeof(BD_VALUE) * CHAR_BIT) - -// This is meant to be a large, positive constant that can still be efficiently -// loaded as an immediate (on platforms like ARM, for example). -// Even relatively modest values like 100 would work fine. -#define LOTS_OF_BITS 0x40000000 - -struct aom_dk_reader { - // Be careful when reordering this struct, it may impact the cache negatively. - BD_VALUE value; - unsigned int range; - int count; - const uint8_t *buffer_start; - const uint8_t *buffer_end; - const uint8_t *buffer; - aom_decrypt_cb decrypt_cb; - void *decrypt_state; - uint8_t clear_buffer[sizeof(BD_VALUE) + 1]; -#if CONFIG_ACCOUNTING - Accounting *accounting; -#endif -}; - -int aom_dk_reader_init(struct aom_dk_reader *r, const uint8_t *buffer, - size_t size, aom_decrypt_cb decrypt_cb, - void *decrypt_state); - -void aom_dk_reader_fill(struct aom_dk_reader *r); - -const uint8_t *aom_dk_reader_find_end(struct aom_dk_reader *r); - -static INLINE uint32_t aom_dk_reader_tell(const struct aom_dk_reader *r) { - const uint32_t bits_read = - (uint32_t)((r->buffer - r->buffer_start) * CHAR_BIT); - const int count = - (r->count < LOTS_OF_BITS) ? r->count : r->count - LOTS_OF_BITS; - assert(r->buffer >= r->buffer_start); - return bits_read - (count + CHAR_BIT); -} - -/*The resolution of fractional-precision bit usage measurements, i.e., - 3 => 1/8th bits.*/ -#define DK_BITRES (3) - -static INLINE uint32_t aom_dk_reader_tell_frac(const struct aom_dk_reader *r) { - uint32_t num_bits; - uint32_t range; - int l; - int i; - num_bits = aom_dk_reader_tell(r) << DK_BITRES; - range = r->range; - l = 0; - for (i = DK_BITRES; i-- > 0;) { - int b; - range = range * range >> 7; - b = (int)(range >> 8); - l = l << 1 | b; - range >>= b; - } - return num_bits - l; -} - -static INLINE int aom_dk_reader_has_error(struct aom_dk_reader *r) { - // Check if we have reached the end of the buffer. - // - // Variable 'count' stores the number of bits in the 'value' buffer, minus - // 8. The top byte is part of the algorithm, and the remainder is buffered - // to be shifted into it. So if count == 8, the top 16 bits of 'value' are - // occupied, 8 for the algorithm and 8 in the buffer. - // - // When reading a byte from the user's buffer, count is filled with 8 and - // one byte is filled into the value buffer. When we reach the end of the - // data, count is additionally filled with LOTS_OF_BITS. So when - // count == LOTS_OF_BITS - 1, the user's data has been exhausted. - // - // 1 if we have tried to decode bits after the end of stream was encountered. - // 0 No error. - return r->count > BD_VALUE_SIZE && r->count < LOTS_OF_BITS; -} - -static INLINE int aom_dk_read(struct aom_dk_reader *r, int prob) { - unsigned int bit = 0; - BD_VALUE value; - BD_VALUE bigsplit; - int count; - unsigned int range; - unsigned int split = (r->range * prob + (256 - prob)) >> CHAR_BIT; - - if (r->count < 0) aom_dk_reader_fill(r); - - value = r->value; - count = r->count; - - bigsplit = (BD_VALUE)split << (BD_VALUE_SIZE - CHAR_BIT); - - range = split; - - if (value >= bigsplit) { - range = r->range - split; - value = value - bigsplit; - bit = 1; - } - - { - register int shift = aom_norm[range]; - range <<= shift; - value <<= shift; - count -= shift; - } - r->value = value; - r->count = count; - r->range = range; - -#if CONFIG_BITSTREAM_DEBUG - { - int ref_bit, ref_prob; - const int queue_r = bitstream_queue_get_read(); - const int frame_idx = bitstream_queue_get_frame_read(); - bitstream_queue_pop(&ref_bit, &ref_prob); - if (prob != ref_prob) { - fprintf( - stderr, - "\n *** prob error, frame_idx_r %d prob %d ref_prob %d queue_r %d\n", - frame_idx, prob, ref_prob, queue_r); - assert(0); - } - if ((int)bit != ref_bit) { - fprintf(stderr, "\n *** bit error, frame_idx_r %d bit %d ref_bit %d\n", - frame_idx, bit, ref_bit); - assert(0); - } - } -#endif // CONFIG_BITSTREAM_DEBUG - - return bit; -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // AOM_DSP_DKBOOLREADER_H_
diff --git a/aom_dsp/dkboolwriter.c b/aom_dsp/dkboolwriter.c deleted file mode 100644 index fc98e7c..0000000 --- a/aom_dsp/dkboolwriter.c +++ /dev/null
@@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include <assert.h> - -#include "./dkboolwriter.h" - -static INLINE void aom_dk_write_bit(aom_dk_writer *w, int bit) { - aom_dk_write(w, bit, 128); // aom_prob_half -} - -void aom_dk_start_encode(aom_dk_writer *br, uint8_t *source) { - br->lowvalue = 0; - br->range = 255; - br->count = -24; - br->buffer = source; - br->pos = 0; - aom_dk_write_bit(br, 0); -} - -void aom_dk_stop_encode(aom_dk_writer *br) { - int i; - -#if CONFIG_BITSTREAM_DEBUG - bitstream_queue_set_skip_write(1); -#endif // CONFIG_BITSTREAM_DEBUG - - for (i = 0; i < 32; i++) aom_dk_write_bit(br, 0); - -#if CONFIG_BITSTREAM_DEBUG - bitstream_queue_set_skip_write(0); -#endif // CONFIG_BITSTREAM_DEBUG - - // Ensure there's no ambigous collision with any index marker bytes - if ((br->buffer[br->pos - 1] & 0xe0) == 0xc0) br->buffer[br->pos++] = 0; -}
diff --git a/aom_dsp/dkboolwriter.h b/aom_dsp/dkboolwriter.h deleted file mode 100644 index 8354368..0000000 --- a/aom_dsp/dkboolwriter.h +++ /dev/null
@@ -1,104 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#ifndef AOM_DSP_DKBOOLWRITER_H_ -#define AOM_DSP_DKBOOLWRITER_H_ - -#include "./aom_config.h" - -#if CONFIG_BITSTREAM_DEBUG -#include <stdio.h> -#include "aom_util/debug_util.h" -#endif // CONFIG_BITSTREAM_DEBUG - -#include "aom_dsp/prob.h" -#include "aom_ports/mem.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct aom_dk_writer { - unsigned int lowvalue; - unsigned int range; - int count; - unsigned int pos; - uint8_t *buffer; -} aom_dk_writer; - -void aom_dk_start_encode(aom_dk_writer *bc, uint8_t *buffer); -void aom_dk_stop_encode(aom_dk_writer *bc); - -static INLINE void aom_dk_write(aom_dk_writer *br, int bit, int probability) { - unsigned int split; - int count = br->count; - unsigned int range = br->range; - unsigned int lowvalue = br->lowvalue; - register int shift; - -#if CONFIG_BITSTREAM_DEBUG - // int queue_r = 0; - // int frame_idx_r = 0; - // int queue_w = bitstream_queue_get_write(); - // int frame_idx_w = bitstream_queue_get_frame_write(); - // 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, probability); -#endif // CONFIG_BITSTREAM_DEBUG - - split = 1 + (((range - 1) * probability) >> 8); - - range = split; - - if (bit) { - lowvalue += split; - range = br->range - split; - } - - shift = aom_norm[range]; - - range <<= shift; - count += shift; - - if (count >= 0) { - int offset = shift - count; - - if ((lowvalue << (offset - 1)) & 0x80000000) { - int x = br->pos - 1; - - while (x >= 0 && br->buffer[x] == 0xff) { - br->buffer[x] = 0; - x--; - } - - br->buffer[x] += 1; - } - - br->buffer[br->pos++] = (lowvalue >> (24 - offset)); - lowvalue <<= offset; - shift = count; - lowvalue &= 0xffffff; - count -= 8; - } - - lowvalue <<= shift; - br->count = count; - br->lowvalue = lowvalue; - br->range = range; -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // AOM_DSP_DKBOOLWRITER_H_
diff --git a/aom_dsp/prob.c b/aom_dsp/prob.c index 913742a..eefe752 100644 --- a/aom_dsp/prob.c +++ b/aom_dsp/prob.c
@@ -11,25 +11,10 @@ #include "./aom_config.h" -#if CONFIG_DAALA_EC || CONFIG_ANS #include <string.h> -#endif // CONFIG_DAALA_EC || CONFIG_ANS #include "aom_dsp/prob.h" -const uint8_t aom_norm[256] = { - 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - static unsigned int tree_merge_probs_impl(unsigned int i, const aom_tree_index *tree, const aom_prob *pre_probs, @@ -53,7 +38,6 @@ tree_merge_probs_impl(0, tree, pre_probs, counts, probs); } -#if CONFIG_DAALA_EC || CONFIG_ANS typedef struct tree_node tree_node; struct tree_node { @@ -233,4 +217,3 @@ int stack_index = 0; tree_to_index(&stack_index, ind, inv, tree, 0, 0); } -#endif // CONFIG_DAALA_EC || CONFIG_ANS
diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h index 8201e42..ec6654a 100644 --- a/aom_dsp/prob.h +++ b/aom_dsp/prob.h
@@ -20,7 +20,7 @@ #include "aom_ports/bitops.h" #include "aom_ports/mem.h" -#if CONFIG_DAALA_EC +#if !CONFIG_ANS #include "aom_dsp/entcode.h" #endif @@ -33,14 +33,12 @@ // TODO(negge): Rename this aom_prob once we remove vpxbool. typedef uint16_t aom_cdf_prob; -#if CONFIG_DAALA_EC || CONFIG_ANS #define CDF_SIZE(x) ((x) + 1) -#endif // CONFIG_DAALA_EC || CONFIG_ANS #define CDF_PROB_BITS 15 #define CDF_PROB_TOP (1 << CDF_PROB_BITS) -#if CONFIG_DAALA_EC +#if !CONFIG_ANS #define AOM_ICDF OD_ICDF #else #define AOM_ICDF(x) (x) @@ -117,7 +115,6 @@ void aom_tree_merge_probs(const aom_tree_index *tree, const aom_prob *pre_probs, const unsigned int *counts, aom_prob *probs); -#if CONFIG_DAALA_EC || CONFIG_ANS int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs, aom_tree_index root, aom_cdf_prob *cdf, aom_tree_index *ind, int *pth, int *len); @@ -150,9 +147,6 @@ } while (0) void av1_indices_from_tree(int *ind, int *inv, const aom_tree_index *tree); -#endif // CONFIG_DAALA_EC || CONFIG_ANS - -DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]); #if CONFIG_EC_ADAPT static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) { @@ -165,7 +159,7 @@ tmp = AOM_ICDF(tmp0); diff = ((CDF_PROB_TOP - (nsymbs << rate2)) >> rate) << rate; // Single loop (faster) -#if CONFIG_DAALA_EC && CONFIG_EC_SMALLMUL +#if !CONFIG_ANS && CONFIG_EC_SMALLMUL for (i = 0; i < nsymbs - 1; ++i, tmp -= tmp0) { tmp -= (i == val ? diff : 0); cdf[i] += ((tmp - cdf[i]) >> rate);
diff --git a/aom_util/debug_util.c b/aom_util/debug_util.c index 071d669..ea73df8 100644 --- a/aom_util/debug_util.c +++ b/aom_util/debug_util.c
@@ -16,12 +16,8 @@ #define QUEUE_MAX_SIZE 2000000 static int result_queue[QUEUE_MAX_SIZE]; -#if CONFIG_DAALA_EC static int nsymbs_queue[QUEUE_MAX_SIZE]; static aom_cdf_prob cdf_queue[QUEUE_MAX_SIZE][16]; -#else -static int prob_queue[QUEUE_MAX_SIZE]; -#endif static int queue_r = 0; static int queue_w = 0; @@ -53,42 +49,24 @@ int bitstream_queue_get_read(void) { return queue_r; } -void bitstream_queue_pop(int *result, -#if CONFIG_DAALA_EC - aom_cdf_prob *cdf, int *nsymbs) { -#else - int *prob) { -#endif // CONFIG_DAALA_EC +void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs) { if (!skip_r) { if (queue_w == queue_r) { printf("buffer underflow queue_w %d queue_r %d\n", queue_w, queue_r); assert(0); } *result = result_queue[queue_r]; -#if CONFIG_DAALA_EC *nsymbs = nsymbs_queue[queue_r]; memcpy(cdf, cdf_queue[queue_r], *nsymbs * sizeof(*cdf)); -#else - *prob = prob_queue[queue_r]; -#endif // CONFIG_DAALA_EC queue_r = (queue_r + 1) % QUEUE_MAX_SIZE; } } -void bitstream_queue_push(int result, -#if CONFIG_DAALA_EC - const aom_cdf_prob *cdf, int nsymbs) { -#else - int prob) { -#endif // CONFIG_DAALA_EC +void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs) { if (!skip_w) { result_queue[queue_w] = result; -#if CONFIG_DAALA_EC nsymbs_queue[queue_w] = nsymbs; memcpy(cdf_queue[queue_w], cdf, nsymbs * sizeof(*cdf)); -#else - prob_queue[queue_w] = prob; -#endif // CONFIG_DAALA_EC queue_w = (queue_w + 1) % QUEUE_MAX_SIZE; if (queue_w == queue_r) { printf("buffer overflow queue_w %d queue_r %d\n", queue_w, queue_r);
diff --git a/aom_util/debug_util.h b/aom_util/debug_util.h index 2ed56ea..3740620 100644 --- a/aom_util/debug_util.h +++ b/aom_util/debug_util.h
@@ -13,9 +13,7 @@ #define AOM_UTIL_DEBUG_UTIL_H_ #include "./aom_config.h" -#if CONFIG_DAALA_EC #include "aom_dsp/prob.h" -#endif #ifdef __cplusplus extern "C" { @@ -33,13 +31,8 @@ int bitstream_queue_get_read(void); void bitstream_queue_record_write(void); void bitstream_queue_reset_write(void); -#if CONFIG_DAALA_EC void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs); void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs); -#else -void bitstream_queue_pop(int *result, int *prob); -void bitstream_queue_push(int result, int prob); -#endif void bitstream_queue_set_skip_write(int skip); void bitstream_queue_set_skip_read(int skip); void bitstream_queue_set_frame_write(int frame_idx);
diff --git a/av1/common/entropy.c b/av1/common/entropy.c index 0f2c396..0f03634 100644 --- a/av1/common/entropy.c +++ b/av1/common/entropy.c
@@ -627,7 +627,6 @@ // The full source code of the generating program is available in: // tools/gen_constrained_tokenset.py // -#if CONFIG_DAALA_EC || CONFIG_ANS // Values for tokens TWO_TOKEN through CATEGORY6_TOKEN included // in the table here : the ONE_TOKEN probability is // removed and the probabilities rescaled. @@ -891,7 +890,6 @@ { 31131, 1448, 152, 31, 2, 1, 1, 1, 1 }, { 31486, 1150, 107, 20, 1, 1, 1, 1, 1 }, }; -#endif // CONFIG_DAALA_EC || CONFIG_ANS /* clang-format off */ #if CONFIG_Q_ADAPT_PROBS @@ -3563,7 +3561,6 @@ }, }; #else -#if CONFIG_DAALA_EC || CONFIG_ANS static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = { { // Y plane { // Intra @@ -3988,343 +3985,6 @@ } } }; -#else // CONFIG_DAALA_EC || CONFIG_ANS -static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - { 195, 29, 183 }, { 84, 49, 136 }, { 8, 42, 71 } - }, { // Band 1 - { 31, 107, 169 }, { 35, 99, 159 }, { 17, 82, 140 }, - { 8, 66, 114 }, { 2, 44, 76 }, { 1, 19, 32 } - }, { // Band 2 - { 40, 132, 201 }, { 29, 114, 187 }, { 13, 91, 157 }, - { 7, 75, 127 }, { 3, 58, 95 }, { 1, 28, 47 } - }, { // Band 3 - { 69, 142, 221 }, { 42, 122, 201 }, { 15, 91, 159 }, - { 6, 67, 121 }, { 1, 42, 77 }, { 1, 17, 31 } - }, { // Band 4 - { 102, 148, 228 }, { 67, 117, 204 }, { 17, 82, 154 }, - { 6, 59, 114 }, { 2, 39, 75 }, { 1, 15, 29 } - }, { // Band 5 - { 156, 57, 233 }, { 119, 57, 212 }, { 58, 48, 163 }, - { 29, 40, 124 }, { 12, 30, 81 }, { 3, 12, 31 } - } - }, { // Inter - { // Band 0 - { 191, 107, 226 }, { 124, 117, 204 }, { 25, 99, 155 } - }, { // Band 1 - { 29, 148, 210 }, { 37, 126, 194 }, { 8, 93, 157 }, - { 2, 68, 118 }, { 1, 39, 69 }, { 1, 17, 33 } - }, { // Band 2 - { 41, 151, 213 }, { 27, 123, 193 }, { 3, 82, 144 }, - { 1, 58, 105 }, { 1, 32, 60 }, { 1, 13, 26 } - }, { // Band 3 - { 59, 159, 220 }, { 23, 126, 198 }, { 4, 88, 151 }, - { 1, 66, 114 }, { 1, 38, 71 }, { 1, 18, 34 } - }, { // Band 4 - { 114, 136, 232 }, { 51, 114, 207 }, { 11, 83, 155 }, - { 3, 56, 105 }, { 1, 33, 65 }, { 1, 17, 34 } - }, { // Band 5 - { 149, 65, 234 }, { 121, 57, 215 }, { 61, 49, 166 }, - { 28, 36, 114 }, { 12, 25, 76 }, { 3, 16, 42 } - } - } - }, { // UV plane - { // Intra - { // Band 0 - { 214, 49, 220 }, { 132, 63, 188 }, { 42, 65, 137 } - }, { // Band 1 - { 85, 137, 221 }, { 104, 131, 216 }, { 49, 111, 192 }, - { 21, 87, 155 }, { 2, 49, 87 }, { 1, 16, 28 } - }, { // Band 2 - { 89, 163, 230 }, { 90, 137, 220 }, { 29, 100, 183 }, - { 10, 70, 135 }, { 2, 42, 81 }, { 1, 17, 33 } - }, { // Band 3 - { 108, 167, 237 }, { 55, 133, 222 }, { 15, 97, 179 }, - { 4, 72, 135 }, { 1, 45, 85 }, { 1, 19, 38 } - }, { // Band 4 - { 124, 146, 240 }, { 66, 124, 224 }, { 17, 88, 175 }, - { 4, 58, 122 }, { 1, 36, 75 }, { 1, 18, 37 } - }, { // Band 5 - { 141, 79, 241 }, { 126, 70, 227 }, { 66, 58, 182 }, - { 30, 44, 136 }, { 12, 34, 96 }, { 2, 20, 47 } - } - }, { // Inter - { // Band 0 - { 229, 99, 249 }, { 143, 111, 235 }, { 46, 109, 192 } - }, { // Band 1 - { 82, 158, 236 }, { 94, 146, 224 }, { 25, 117, 191 }, - { 9, 87, 149 }, { 3, 56, 99 }, { 1, 33, 57 } - }, { // Band 2 - { 83, 167, 237 }, { 68, 145, 222 }, { 10, 103, 177 }, - { 2, 72, 131 }, { 1, 41, 79 }, { 1, 20, 39 } - }, { // Band 3 - { 99, 167, 239 }, { 47, 141, 224 }, { 10, 104, 178 }, - { 2, 73, 133 }, { 1, 44, 85 }, { 1, 22, 47 } - }, { // Band 4 - { 127, 145, 243 }, { 71, 129, 228 }, { 17, 93, 177 }, - { 3, 61, 124 }, { 1, 41, 84 }, { 1, 21, 52 } - }, { // Band 5 - { 157, 78, 244 }, { 140, 72, 231 }, { 69, 58, 184 }, - { 31, 44, 137 }, { 14, 38, 105 }, { 8, 23, 61 } - } - } - } -}; - -static const av1_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - { 125, 34, 187 }, { 52, 41, 133 }, { 6, 31, 56 } - }, { // Band 1 - { 37, 109, 153 }, { 51, 102, 147 }, { 23, 87, 128 }, - { 8, 67, 101 }, { 1, 41, 63 }, { 1, 19, 29 } - }, { // Band 2 - { 31, 154, 185 }, { 17, 127, 175 }, { 6, 96, 145 }, - { 2, 73, 114 }, { 1, 51, 82 }, { 1, 28, 45 } - }, { // Band 3 - { 23, 163, 200 }, { 10, 131, 185 }, { 2, 93, 148 }, - { 1, 67, 111 }, { 1, 41, 69 }, { 1, 14, 24 } - }, { // Band 4 - { 29, 176, 217 }, { 12, 145, 201 }, { 3, 101, 156 }, - { 1, 69, 111 }, { 1, 39, 63 }, { 1, 14, 23 } - }, { // Band 5 - { 57, 192, 233 }, { 25, 154, 215 }, { 6, 109, 167 }, - { 3, 78, 118 }, { 1, 48, 69 }, { 1, 21, 29 } - } - }, { // Inter - { // Band 0 - { 202, 105, 245 }, { 108, 106, 216 }, { 18, 90, 144 } - }, { // Band 1 - { 33, 172, 219 }, { 64, 149, 206 }, { 14, 117, 177 }, - { 5, 90, 141 }, { 2, 61, 95 }, { 1, 37, 57 } - }, { // Band 2 - { 33, 179, 220 }, { 11, 140, 198 }, { 1, 89, 148 }, - { 1, 60, 104 }, { 1, 33, 57 }, { 1, 12, 21 } - }, { // Band 3 - { 30, 181, 221 }, { 8, 141, 198 }, { 1, 87, 145 }, - { 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 20 } - }, { // Band 4 - { 32, 186, 224 }, { 7, 142, 198 }, { 1, 86, 143 }, - { 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 22 } - }, { // Band 5 - { 57, 192, 227 }, { 20, 143, 204 }, { 3, 96, 154 }, - { 1, 68, 112 }, { 1, 42, 69 }, { 1, 19, 32 } - } - } - }, { // UV plane - { // Intra - { // Band 0 - { 212, 35, 215 }, { 113, 47, 169 }, { 29, 48, 105 } - }, { // Band 1 - { 74, 129, 203 }, { 106, 120, 203 }, { 49, 107, 178 }, - { 19, 84, 144 }, { 4, 50, 84 }, { 1, 15, 25 } - }, { // Band 2 - { 71, 172, 217 }, { 44, 141, 209 }, { 15, 102, 173 }, - { 6, 76, 133 }, { 2, 51, 89 }, { 1, 24, 42 } - }, { // Band 3 - { 64, 185, 231 }, { 31, 148, 216 }, { 8, 103, 175 }, - { 3, 74, 131 }, { 1, 46, 81 }, { 1, 18, 30 } - }, { // Band 4 - { 65, 196, 235 }, { 25, 157, 221 }, { 5, 105, 174 }, - { 1, 67, 120 }, { 1, 38, 69 }, { 1, 15, 30 } - }, { // Band 5 - { 65, 204, 238 }, { 30, 156, 224 }, { 7, 107, 177 }, - { 2, 70, 124 }, { 1, 42, 73 }, { 1, 18, 34 } - } - }, { // Inter - { // Band 0 - { 225, 86, 251 }, { 144, 104, 235 }, { 42, 99, 181 } - }, { // Band 1 - { 85, 175, 239 }, { 112, 165, 229 }, { 29, 136, 200 }, - { 12, 103, 162 }, { 6, 77, 123 }, { 2, 53, 84 } - }, { // Band 2 - { 75, 183, 239 }, { 30, 155, 221 }, { 3, 106, 171 }, - { 1, 74, 128 }, { 1, 44, 76 }, { 1, 17, 28 } - }, { // Band 3 - { 73, 185, 240 }, { 27, 159, 222 }, { 2, 107, 172 }, - { 1, 75, 127 }, { 1, 42, 73 }, { 1, 17, 29 } - }, { // Band 4 - { 62, 190, 238 }, { 21, 159, 222 }, { 2, 107, 172 }, - { 1, 72, 122 }, { 1, 40, 71 }, { 1, 18, 32 } - }, { // Band 5 - { 61, 199, 240 }, { 27, 161, 226 }, { 4, 113, 180 }, - { 1, 76, 129 }, { 1, 46, 80 }, { 1, 23, 41 } - } - } - } -}; - -static const av1_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - { 7, 27, 153 }, { 5, 30, 95 }, { 1, 16, 30 } - }, { // Band 1 - { 50, 75, 127 }, { 57, 75, 124 }, { 27, 67, 108 }, - { 10, 54, 86 }, { 1, 33, 52 }, { 1, 12, 18 } - }, { // Band 2 - { 43, 125, 151 }, { 26, 108, 148 }, { 7, 83, 122 }, - { 2, 59, 89 }, { 1, 38, 60 }, { 1, 17, 27 } - }, { // Band 3 - { 23, 144, 163 }, { 13, 112, 154 }, { 2, 75, 117 }, - { 1, 50, 81 }, { 1, 31, 51 }, { 1, 14, 23 } - }, { // Band 4 - { 18, 162, 185 }, { 6, 123, 171 }, { 1, 78, 125 }, - { 1, 51, 86 }, { 1, 31, 54 }, { 1, 14, 23 } - }, { // Band 5 - { 15, 199, 227 }, { 3, 150, 204 }, { 1, 91, 146 }, - { 1, 55, 95 }, { 1, 30, 53 }, { 1, 11, 20 } - } - }, { // Inter - { // Band 0 - { 19, 55, 240 }, { 19, 59, 196 }, { 3, 52, 105 } - }, { // Band 1 - { 41, 166, 207 }, { 104, 153, 199 }, { 31, 123, 181 }, - { 14, 101, 152 }, { 5, 72, 106 }, { 1, 36, 52 } - }, { // Band 2 - { 35, 176, 211 }, { 12, 131, 190 }, { 2, 88, 144 }, - { 1, 60, 101 }, { 1, 36, 60 }, { 1, 16, 28 } - }, { // Band 3 - { 28, 183, 213 }, { 8, 134, 191 }, { 1, 86, 142 }, - { 1, 56, 96 }, { 1, 30, 53 }, { 1, 12, 20 } - }, { // Band 4 - { 20, 190, 215 }, { 4, 135, 192 }, { 1, 84, 139 }, - { 1, 53, 91 }, { 1, 28, 49 }, { 1, 11, 20 } - }, { // Band 5 - { 13, 196, 216 }, { 2, 137, 192 }, { 1, 86, 143 }, - { 1, 57, 99 }, { 1, 32, 56 }, { 1, 13, 24 } - } - } - }, { // UV plane - { // Intra - { // Band 0 - { 211, 29, 217 }, { 96, 47, 156 }, { 22, 43, 87 } - }, { // Band 1 - { 78, 120, 193 }, { 111, 116, 186 }, { 46, 102, 164 }, - { 15, 80, 128 }, { 2, 49, 76 }, { 1, 18, 28 } - }, { // Band 2 - { 71, 161, 203 }, { 42, 132, 192 }, { 10, 98, 150 }, - { 3, 69, 109 }, { 1, 44, 70 }, { 1, 18, 29 } - }, { // Band 3 - { 57, 186, 211 }, { 30, 140, 196 }, { 4, 93, 146 }, - { 1, 62, 102 }, { 1, 38, 65 }, { 1, 16, 27 } - }, { // Band 4 - { 47, 199, 217 }, { 14, 145, 196 }, { 1, 88, 142 }, - { 1, 57, 98 }, { 1, 36, 62 }, { 1, 15, 26 } - }, { // Band 5 - { 26, 219, 229 }, { 5, 155, 207 }, { 1, 94, 151 }, - { 1, 60, 104 }, { 1, 36, 62 }, { 1, 16, 28 } - } - }, { // Inter - { // Band 0 - { 233, 29, 248 }, { 146, 47, 220 }, { 43, 52, 140 } - }, { // Band 1 - { 100, 163, 232 }, { 179, 161, 222 }, { 63, 142, 204 }, - { 37, 113, 174 }, { 26, 89, 137 }, { 18, 68, 97 } - }, { // Band 2 - { 85, 181, 230 }, { 32, 146, 209 }, { 7, 100, 164 }, - { 3, 71, 121 }, { 1, 45, 77 }, { 1, 18, 30 } - }, { // Band 3 - { 65, 187, 230 }, { 20, 148, 207 }, { 2, 97, 159 }, - { 1, 68, 116 }, { 1, 40, 70 }, { 1, 14, 29 } - }, { // Band 4 - { 40, 194, 227 }, { 8, 147, 204 }, { 1, 94, 155 }, - { 1, 65, 112 }, { 1, 39, 66 }, { 1, 14, 26 } - }, { // Band 5 - { 16, 208, 228 }, { 3, 151, 207 }, { 1, 98, 160 }, - { 1, 67, 117 }, { 1, 41, 74 }, { 1, 17, 31 } - } - } - } -}; - -static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - { 17, 38, 140 }, { 7, 34, 80 }, { 1, 17, 29 } - }, { // Band 1 - { 37, 75, 128 }, { 41, 76, 128 }, { 26, 66, 116 }, - { 12, 52, 94 }, { 2, 32, 55 }, { 1, 10, 16 } - }, { // Band 2 - { 50, 127, 154 }, { 37, 109, 152 }, { 16, 82, 121 }, - { 5, 59, 85 }, { 1, 35, 54 }, { 1, 13, 20 } - }, { // Band 3 - { 40, 142, 167 }, { 17, 110, 157 }, { 2, 71, 112 }, - { 1, 44, 72 }, { 1, 27, 45 }, { 1, 11, 17 } - }, { // Band 4 - { 30, 175, 188 }, { 9, 124, 169 }, { 1, 74, 116 }, - { 1, 48, 78 }, { 1, 30, 49 }, { 1, 11, 18 } - }, { // Band 5 - { 10, 222, 223 }, { 2, 150, 194 }, { 1, 83, 128 }, - { 1, 48, 79 }, { 1, 27, 45 }, { 1, 11, 17 } - } - }, { // Inter - { // Band 0 - { 36, 41, 235 }, { 29, 36, 193 }, { 10, 27, 111 } - }, { // Band 1 - { 85, 165, 222 }, { 177, 162, 215 }, { 110, 135, 195 }, - { 57, 113, 168 }, { 23, 83, 120 }, { 10, 49, 61 } - }, { // Band 2 - { 85, 190, 223 }, { 36, 139, 200 }, { 5, 90, 146 }, - { 1, 60, 103 }, { 1, 38, 65 }, { 1, 18, 30 } - }, { // Band 3 - { 72, 202, 223 }, { 23, 141, 199 }, { 2, 86, 140 }, - { 1, 56, 97 }, { 1, 36, 61 }, { 1, 16, 27 } - }, { // Band 4 - { 55, 218, 225 }, { 13, 145, 200 }, { 1, 86, 141 }, - { 1, 57, 99 }, { 1, 35, 61 }, { 1, 13, 22 } - }, { // Band 5 - { 15, 235, 212 }, { 1, 132, 184 }, { 1, 84, 139 }, - { 1, 57, 97 }, { 1, 34, 56 }, { 1, 14, 23 } - } - } - }, { // UV plane - { // Intra - { // Band 0 - { 181, 21, 201 }, { 61, 37, 123 }, { 10, 38, 71 } - }, { // Band 1 - { 47, 106, 172 }, { 95, 104, 173 }, { 42, 93, 159 }, - { 18, 77, 131 }, { 4, 50, 81 }, { 1, 17, 23 } - }, { // Band 2 - { 62, 147, 199 }, { 44, 130, 189 }, { 28, 102, 154 }, - { 18, 75, 115 }, { 2, 44, 65 }, { 1, 12, 19 } - }, { // Band 3 - { 55, 153, 210 }, { 24, 130, 194 }, { 3, 93, 146 }, - { 1, 61, 97 }, { 1, 31, 50 }, { 1, 10, 16 } - }, { // Band 4 - { 49, 186, 223 }, { 17, 148, 204 }, { 1, 96, 142 }, - { 1, 53, 83 }, { 1, 26, 44 }, { 1, 11, 17 } - }, { // Band 5 - { 13, 217, 212 }, { 2, 136, 180 }, { 1, 78, 124 }, - { 1, 50, 83 }, { 1, 29, 49 }, { 1, 14, 23 } - } - }, { // Inter - { // Band 0 - { 197, 13, 247 }, { 82, 17, 222 }, { 25, 17, 162 } - }, { // Band 1 - { 126, 186, 247 }, { 234, 191, 243 }, { 176, 177, 234 }, - { 104, 158, 220 }, { 66, 128, 186 }, { 55, 90, 137 } - }, { // Band 2 - { 111, 197, 242 }, { 46, 158, 219 }, { 9, 104, 171 }, - { 2, 65, 125 }, { 1, 44, 80 }, { 1, 17, 91 } - }, { // Band 3 - { 104, 208, 245 }, { 39, 168, 224 }, { 3, 109, 162 }, - { 1, 79, 124 }, { 1, 50, 102 }, { 1, 43, 102 } - }, { // Band 4 - { 84, 220, 246 }, { 31, 177, 231 }, { 2, 115, 180 }, - { 1, 79, 134 }, { 1, 55, 77 }, { 1, 60, 79 } - }, { // Band 5 - { 43, 243, 240 }, { 8, 180, 217 }, { 1, 115, 166 }, - { 1, 84, 121 }, { 1, 51, 67 }, { 1, 16, 6 } - } - } - } -}; -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_TX64X64 // FIXME. Optimize for EC_MULTISYMBOL @@ -4413,7 +4073,6 @@ }; #endif // CONFIG_TX64X64 #endif // CONFIG_Q_ADAPT_PROBS -#if CONFIG_DAALA_EC || CONFIG_ANS static const aom_prob av1_default_blockzero_probs[TX_SIZES][PLANE_TYPES] [REF_TYPES][BLOCKZ_CONTEXTS] = { #if CONFIG_CB4X4 @@ -5666,7 +5325,6 @@ {AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), AOM_ICDF(32768) } } } } }; -#endif // CONFIG_DAALA_EC || CONFIG_ANS /* clang-format on */ @@ -5681,8 +5339,6 @@ extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]); } -#if CONFIG_DAALA_EC || CONFIG_ANS - static void build_tail_cdfs(aom_cdf_prob cdf_tail[CDF_SIZE(ENTROPY_TOKENS)], aom_cdf_prob cdf_head[CDF_SIZE(ENTROPY_TOKENS)], int band_zero) { @@ -5837,7 +5493,6 @@ build_tail_cdfs(fc->coef_tail_cdfs[t][i][j][k][l], fc->coef_head_cdfs[t][i][j][k][l], k == 0); } -#endif // CONFIG_DAALA_EC || CONFIG_ANS void av1_default_coef_probs(AV1_COMMON *cm) { #if CONFIG_Q_ADAPT_PROBS @@ -5856,12 +5511,10 @@ av1_copy(cm->fc->coef_probs[TX_64X64], default_coef_probs_64x64); #endif // CONFIG_TX64X64 #endif // CONFIG_Q_ADAPT_PROBS -#if CONFIG_DAALA_EC || CONFIG_ANS av1_copy(cm->fc->blockzero_probs, av1_default_blockzero_probs); /* Load the head tokens */ av1_default_coef_cdfs(cm->fc); av1_coef_pareto_cdfs(cm->fc); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #if !CONFIG_LV_MAP @@ -5876,13 +5529,11 @@ const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] = (const unsigned int(*)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]) cm->counts.eob_branch[tx_size]; -#if CONFIG_DAALA_EC || CONFIG_ANS const av1_blockz_probs_model *const pre_blockz_probs = pre_fc->blockzero_probs[tx_size]; av1_blockz_probs_model *const blockz_probs = cm->fc->blockzero_probs[tx_size]; const av1_blockz_count_model *const blockz_counts = (const av1_blockz_count_model *)&cm->counts.blockz_count[tx_size][0]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS int i, j, k, l, m; #if CONFIG_RECT_TX assert(!is_rect_tx(tx_size)); @@ -5905,7 +5556,6 @@ count_sat, update_factor); } -#if CONFIG_DAALA_EC || CONFIG_ANS for (i = 0; i < PLANE_TYPES; ++i) { for (j = 0; j < REF_TYPES; ++j) { for (k = 0; k < BLOCKZ_CONTEXTS; ++k) { @@ -5917,7 +5567,6 @@ } } } -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #endif // !CONFIG_LV_MAP @@ -5975,10 +5624,8 @@ aom_cdf_prob *fc_cdf_ptr; -#if CONFIG_DAALA_EC || CONFIG_ANS AVERAGE_TILE_CDFS(coef_head_cdfs) AVERAGE_TILE_CDFS(coef_tail_cdfs) -#endif // CONFIG_DAALA_EC || CONFIG_ANS } void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
diff --git a/av1/common/entropy.h b/av1/common/entropy.h index 30fd5a5..dac4003 100644 --- a/av1/common/entropy.h +++ b/av1/common/entropy.h
@@ -45,18 +45,16 @@ #define CATEGORY5_TOKEN 9 // 35-66 Extra Bits 5+1 #define CATEGORY6_TOKEN 10 // 67+ Extra Bits 14+1 #define EOB_TOKEN 11 // EOB Extra Bits 0+0 -#if CONFIG_DAALA_EC || CONFIG_ANS -#define NO_EOB 0 // Not an end-of-block -#define EARLY_EOB 1 // End of block before the last position -#define LAST_EOB 2 // End of block in the last position (implicit) -#define BLOCK_Z_TOKEN 255 // block zero +#define NO_EOB 0 // Not an end-of-block +#define EARLY_EOB 1 // End of block before the last position +#define LAST_EOB 2 // End of block in the last position (implicit) +#define BLOCK_Z_TOKEN 255 // block zero #define HEAD_TOKENS 5 #define TAIL_TOKENS 9 #define ONE_TOKEN_EOB 1 #define ONE_TOKEN_NEOB 2 #define TWO_TOKEN_PLUS_EOB 3 #define TWO_TOKEN_PLUS_NEOB 4 -#endif // CONFIG_DAALA_EC || CONFIG_ANS #define ENTROPY_TOKENS 12 #define ENTROPY_NODES 11 @@ -171,9 +169,7 @@ distinct bands). */ #define COEFF_CONTEXTS 6 -#if CONFIG_DAALA_EC || CONFIG_ANS #define BLOCKZ_CONTEXTS 3 -#endif // CONFIG_DAALA_EC || CONFIG_ANS #define COEFF_CONTEXTS0 3 // for band 0 #define BAND_COEFF_CONTEXTS(band) \ ((band) == 0 ? COEFF_CONTEXTS0 : COEFF_CONTEXTS) @@ -243,7 +239,6 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full); -#if CONFIG_DAALA_EC || CONFIG_ANS typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] [CDF_SIZE(ENTROPY_TOKENS)]; typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS]; @@ -256,7 +251,6 @@ void av1_coef_head_cdfs(struct frame_contexts *fc); void av1_coef_pareto_cdfs(struct frame_contexts *fc); -#endif // CONFIG_DAALA_EC || CONFIG_ANS typedef char ENTROPY_CONTEXT;
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 199c954..f703bc6 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -1173,22 +1173,17 @@ #if CONFIG_DELTA_Q static const aom_prob default_delta_q_probs[DELTA_Q_PROBS] = { 220, 220, 220 }; -#if CONFIG_DAALA_EC || CONFIG_ANS static const aom_cdf_prob default_delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)] = { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }; -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_EXT_DELTA_Q static const aom_prob default_delta_lf_probs[DELTA_LF_PROBS] = { 220, 220, 220 }; -#if CONFIG_DAALA_EC || CONFIG_ANS static const aom_cdf_prob default_delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)] = { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }; -#endif // CONFIG_DAALA_EC || CONFIG_ANS #endif #endif -#if CONFIG_DAALA_EC || CONFIG_ANS int av1_intra_mode_ind[INTRA_MODES]; int av1_intra_mode_inv[INTRA_MODES]; int av1_inter_mode_ind[INTER_MODES]; @@ -1199,7 +1194,6 @@ int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES]; int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES]; #endif -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_ALT_INTRA #if CONFIG_SMOOTH_HV @@ -2198,10 +2192,8 @@ -INTRA_FILTER_LINEAR, 2, -INTRA_FILTER_8TAP, 4, -INTRA_FILTER_8TAP_SHARP, -INTRA_FILTER_8TAP_SMOOTH, }; -#if CONFIG_DAALA_EC || CONFIG_ANS int av1_intra_filter_ind[INTRA_FILTERS]; int av1_intra_filter_inv[INTRA_FILTERS]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP #if CONFIG_FILTER_INTRA @@ -2237,7 +2229,6 @@ }; // clang-format on -#if CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_DUAL_FILTER static const aom_cdf_prob default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE( @@ -4447,7 +4438,6 @@ AOM_ICDF(30393), AOM_ICDF(32768), 0 } }, #endif // CONFIG_ALT_INTRA }; -#endif // CONFIG_DAALA_EC || CONFIG_ANS static void init_mode_probs(FRAME_CONTEXT *fc) { av1_copy(fc->uv_mode_prob, default_uv_probs); @@ -4522,7 +4512,6 @@ #if CONFIG_LOOP_RESTORATION av1_copy(fc->switchable_restore_prob, default_switchable_restore_prob); #endif // CONFIG_LOOP_RESTORATION -#if CONFIG_DAALA_EC || CONFIG_ANS av1_copy(fc->y_mode_cdf, default_if_y_mode_cdf); av1_copy(fc->uv_mode_cdf, default_uv_mode_cdf); av1_copy(fc->switchable_interp_cdf, default_switchable_interp_cdf); @@ -4535,17 +4524,12 @@ #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP av1_copy(fc->seg.tree_cdf, default_seg_tree_cdf); av1_copy(fc->tx_size_cdf, default_tx_size_cdf); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_DELTA_Q av1_copy(fc->delta_q_prob, default_delta_q_probs); -#if CONFIG_DAALA_EC || CONFIG_ANS av1_copy(fc->delta_q_cdf, default_delta_q_cdf); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_EXT_DELTA_Q av1_copy(fc->delta_lf_prob, default_delta_lf_probs); -#if CONFIG_DAALA_EC || CONFIG_ANS av1_copy(fc->delta_lf_cdf, default_delta_lf_cdf); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #endif #endif // CONFIG_DELTA_Q #if CONFIG_CFL @@ -4553,7 +4537,6 @@ #endif } -#if CONFIG_DAALA_EC || CONFIG_ANS int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; @@ -4654,7 +4637,6 @@ #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP } #endif // !CONFIG_EC_ADAPT -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_DUAL_FILTER const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index f65db70..97e0f3b 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -99,11 +99,9 @@ aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; #endif av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES]; -#if CONFIG_DAALA_EC || CONFIG_ANS coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES]; coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES]; aom_prob blockzero_probs[TX_SIZES][PLANE_TYPES][REF_TYPES][BLOCKZ_CONTEXTS]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] [SWITCHABLE_FILTERS - 1]; #if CONFIG_ADAPT_SCAN @@ -260,7 +258,6 @@ #if CONFIG_LOOP_RESTORATION aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1]; #endif // CONFIG_LOOP_RESTORATION -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)]; aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)]; #if CONFIG_EXT_PARTITION_TYPES @@ -294,7 +291,6 @@ #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP aom_cdf_prob intra_filter_cdf[INTRA_FILTERS + 1][CDF_SIZE(INTRA_FILTERS)]; #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_DELTA_Q aom_prob delta_q_prob[DELTA_Q_PROBS]; #if CONFIG_EXT_DELTA_Q @@ -356,9 +352,7 @@ unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2]; #endif // CONFIG_LV_MAP -#if CONFIG_DAALA_EC || CONFIG_ANS av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2]; unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2]; @@ -450,11 +444,9 @@ // Contexts used: Intra mode (Y plane) of 'above' and 'left' blocks. extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES] [INTRA_MODES - 1]; -#if CONFIG_DAALA_EC || CONFIG_ANS // CDF version of 'av1_kf_y_mode_prob'. extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES] [CDF_SIZE(INTRA_MODES)]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_PALETTE extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES] @@ -473,7 +465,6 @@ extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)]; extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)]; -#if CONFIG_DAALA_EC || CONFIG_ANS extern int av1_intra_mode_ind[INTRA_MODES]; extern int av1_intra_mode_inv[INTRA_MODES]; extern int av1_inter_mode_ind[INTER_MODES]; @@ -484,7 +475,6 @@ extern int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES]; extern int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES]; #endif -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_EXT_INTER #if CONFIG_INTERINTRA @@ -535,20 +525,18 @@ extern const aom_tree_index av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)]; #endif // CONFIG_LOOP_RESTORATION -#if CONFIG_DAALA_EC || CONFIG_ANS extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; #if !CONFIG_EC_ADAPT void av1_set_mode_cdfs(struct AV1Common *cm); #endif -#endif // CONFIG_DAALA_EC || CONFIG_ANS void av1_setup_past_independence(struct AV1Common *cm); void av1_adapt_intra_frame_probs(struct AV1Common *cm); void av1_adapt_inter_frame_probs(struct AV1Common *cm); -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EXT_TX +#if !CONFIG_EXT_TX extern int av1_ext_tx_ind[TX_TYPES]; extern int av1_ext_tx_inv[TX_TYPES]; #endif
diff --git a/av1/common/entropymv.c b/av1/common/entropymv.c index 14a58b3..954bfec 100644 --- a/av1/common/entropymv.c +++ b/av1/common/entropymv.c
@@ -43,31 +43,25 @@ static const nmv_context default_nmv_context = { { 32, 64, 96 }, // joints -#if CONFIG_DAALA_EC || CONFIG_ANS { AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768), 0 }, // joint_cdf -#endif // CONFIG_DAALA_EC || CONFIG_ANS { { // Vertical component 128, // sign { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class -#if CONFIG_DAALA_EC || CONFIG_ANS { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf -#endif // CONFIG_DAALA_EC || CONFIG_ANS - { 216 }, // class0 - { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits - { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp - { 64, 96, 64 }, // fp -#if CONFIG_DAALA_EC || CONFIG_ANS + { 216 }, // class0 + { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits + { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp + { 64, 96, 64 }, // fp { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), 0 }, { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), 0 } }, // class0_fp_cdf { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), 0 }, // fp_cdf -#endif // CONFIG_DAALA_EC || CONFIG_ANS 160, // class0_hp bit 128, // hp }, @@ -75,23 +69,19 @@ // Horizontal component 128, // sign { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class -#if CONFIG_DAALA_EC || CONFIG_ANS { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf -#endif // CONFIG_DAALA_EC || CONFIG_ANS - { 208 }, // class0 - { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits - { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp - { 64, 96, 64 }, // fp -#if CONFIG_DAALA_EC || CONFIG_ANS + { 208 }, // class0 + { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits + { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp + { 64, 96, 64 }, // fp { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), 0 }, { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), 0 } }, // class0_fp_cdf { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), 0 }, // fp_cdf -#endif // CONFIG_DAALA_EC || CONFIG_ANS 160, // class0_hp bit 128, // hp } }, @@ -268,7 +258,7 @@ } } -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT +#if !CONFIG_EC_ADAPT void av1_set_mv_cdfs(nmv_context *ctx) { int i; int j;
diff --git a/av1/common/entropymv.h b/av1/common/entropymv.h index 91f16a2..61bbbe3 100644 --- a/av1/common/entropymv.h +++ b/av1/common/entropymv.h
@@ -84,26 +84,20 @@ typedef struct { aom_prob sign; aom_prob classes[MV_CLASSES - 1]; -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS aom_prob class0[CLASS0_SIZE - 1]; aom_prob bits[MV_OFFSET_BITS]; aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1]; aom_prob fp[MV_FP_SIZE - 1]; -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)]; aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS aom_prob class0_hp; aom_prob hp; } nmv_component; typedef struct { aom_prob joints[MV_JOINTS - 1]; -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS nmv_component comps[2]; } nmv_context; @@ -138,7 +132,7 @@ extern const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)]; #endif // CONFIG_GLOBAL_MOTION -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT +#if !CONFIG_EC_ADAPT void av1_set_mv_cdfs(nmv_context *ctx); #endif
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index e55755b..80a3b0a 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h
@@ -674,7 +674,6 @@ return cm->kf_y_prob[above][left]; } -#if CONFIG_DAALA_EC || CONFIG_ANS static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx, const MODE_INFO *mi, const MODE_INFO *above_mi, @@ -684,7 +683,6 @@ const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, block); return tile_ctx->kf_y_cdf[above][left]; } -#endif // CONFIG_DAALA_EC || CONFIG_ANS static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE subsize,
diff --git a/av1/common/seg_common.h b/av1/common/seg_common.h index 4dfdd30..69a6387 100644 --- a/av1/common/seg_common.h +++ b/av1/common/seg_common.h
@@ -48,9 +48,7 @@ struct segmentation_probs { aom_prob tree_probs[SEG_TREE_PROBS]; -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS aom_prob pred_probs[PREDICTION_PROBS]; };
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index e377970..0b39bc7 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -2094,38 +2094,23 @@ #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; (void)cm; -#elif CONFIG_DAALA_EC || CONFIG_ANS +#else FRAME_CONTEXT *ec_ctx = cm->fc; #endif -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob *partition_cdf = (ctx >= 0) ? ec_ctx->partition_cdf[ctx] : NULL; -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (has_rows && has_cols) #if CONFIG_EXT_PARTITION_TYPES if (bsize <= BLOCK_8X8) -#if CONFIG_DAALA_EC || CONFIG_ANS p = (PARTITION_TYPE)aom_read_symbol(r, partition_cdf, PARTITION_TYPES, ACCT_STR); -#else - p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs, ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS else -#if CONFIG_DAALA_EC || CONFIG_ANS p = (PARTITION_TYPE)aom_read_symbol(r, partition_cdf, EXT_PARTITION_TYPES, ACCT_STR); #else - p = (PARTITION_TYPE)aom_read_tree(r, av1_ext_partition_tree, probs, - ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS -#else -#if CONFIG_DAALA_EC || CONFIG_ANS p = (PARTITION_TYPE)aom_read_symbol(r, partition_cdf, PARTITION_TYPES, ACCT_STR); -#else - p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs, ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #endif // CONFIG_EXT_PARTITION_TYPES else if (!has_rows && has_cols) p = aom_read(r, probs[1], ACCT_STR) ? PARTITION_SPLIT : PARTITION_HORZ; @@ -4764,9 +4749,7 @@ if (frame_is_intra_only(cm)) { av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob); -#if CONFIG_DAALA_EC || CONFIG_ANS av1_copy(cm->fc->kf_y_cdf, av1_kf_y_mode_cdf); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if !CONFIG_EC_ADAPT for (k = 0; k < INTRA_MODES; k++) for (j = 0; j < INTRA_MODES; j++) @@ -4846,15 +4829,15 @@ #endif #if CONFIG_GLOBAL_MOTION read_global_motion(cm, &r); -#endif // EC_ADAPT, DAALA_EC +#endif } -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT +#if !CONFIG_EC_ADAPT av1_coef_head_cdfs(fc); /* Make tail distribution from head */ av1_coef_pareto_cdfs(fc); for (i = 0; i < NMV_CONTEXTS; ++i) av1_set_mv_cdfs(&fc->nmvc[i]); av1_set_mode_cdfs(cm); -#endif // (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT +#endif // !CONFIG_EC_ADAPT return aom_reader_has_error(&r); } @@ -4878,10 +4861,8 @@ assert(!memcmp(cm->counts.coef, zero_counts.coef, sizeof(cm->counts.coef))); assert(!memcmp(cm->counts.eob_branch, zero_counts.eob_branch, sizeof(cm->counts.eob_branch))); -#if CONFIG_DAALA_EC || CONFIG_ANS assert(!memcmp(cm->counts.blockz_count, zero_counts.blockz_count, sizeof(cm->counts.blockz_count))); -#endif // CONFIG_DAALA_EC || CONFIG_ANS assert(!memcmp(cm->counts.switchable_interp, zero_counts.switchable_interp, sizeof(cm->counts.switchable_interp))); assert(!memcmp(cm->counts.inter_mode, zero_counts.inter_mode,
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 35ebc6c..e23925f 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -45,16 +45,10 @@ } #endif // CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE -#if CONFIG_DAALA_EC || CONFIG_ANS static PREDICTION_MODE read_intra_mode(aom_reader *r, aom_cdf_prob *cdf) { return (PREDICTION_MODE) av1_intra_mode_inv[aom_read_symbol(r, cdf, INTRA_MODES, ACCT_STR)]; } -#else -static PREDICTION_MODE read_intra_mode(aom_reader *r, const aom_prob *p) { - return (PREDICTION_MODE)aom_read_tree(r, av1_intra_mode_tree, p, ACCT_STR); -} -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_DELTA_Q static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r, @@ -75,16 +69,7 @@ #endif if ((bsize != BLOCK_LARGEST || mbmi->skip == 0) && read_delta_q_flag) { -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - int bit = 1; - abs = 0; - while (abs < DELTA_Q_SMALL && bit) { - bit = aom_read(r, ec_ctx->delta_q_prob[abs], ACCT_STR); - abs += bit; - } -#else abs = aom_read_symbol(r, ec_ctx->delta_q_cdf, DELTA_Q_PROBS + 1, ACCT_STR); -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) smallval = (abs < DELTA_Q_SMALL); if (counts) { for (i = 0; i < abs; ++i) counts->delta_q[i][1]++; @@ -127,17 +112,8 @@ #endif if ((bsize != BLOCK_64X64 || mbmi->skip == 0) && read_delta_lf_flag) { -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - int bit = 1; - abs = 0; - while (abs < DELTA_LF_SMALL && bit) { - bit = aom_read(r, ec_ctx->delta_lf_prob[abs], ACCT_STR); - abs += bit; - } -#else abs = aom_read_symbol(r, ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1, ACCT_STR); -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) smallval = (abs < DELTA_LF_SMALL); if (counts) { for (i = 0; i < abs; ++i) counts->delta_lf[i][1]++; @@ -166,16 +142,12 @@ aom_reader *r, int size_group) { #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; -#elif CONFIG_DAALA_EC || CONFIG_ANS +#else FRAME_CONTEXT *ec_ctx = cm->fc; #endif const PREDICTION_MODE y_mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, ec_ctx->y_mode_cdf[size_group]); -#else - read_intra_mode(r, cm->fc->y_mode_prob[size_group]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS FRAME_COUNTS *counts = xd->counts; #if CONFIG_EC_ADAPT (void)cm; @@ -189,16 +161,12 @@ PREDICTION_MODE y_mode) { #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; -#elif CONFIG_DAALA_EC || CONFIG_ANS +#else FRAME_CONTEXT *ec_ctx = cm->fc; #endif const PREDICTION_MODE uv_mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, ec_ctx->uv_mode_cdf[y_mode]); -#else - read_intra_mode(r, cm->fc->uv_mode_prob[y_mode]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS FRAME_COUNTS *counts = xd->counts; #if CONFIG_EC_ADAPT (void)cm; @@ -382,11 +350,7 @@ #endif // CONFIG_EXT_INTER static int read_segment_id(aom_reader *r, struct segmentation_probs *segp) { -#if CONFIG_DAALA_EC || CONFIG_ANS return aom_read_symbol(r, segp->tree_cdf, MAX_SEGMENTS, ACCT_STR); -#else - return aom_read_tree(r, av1_segment_tree, segp->tree_probs, ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #if CONFIG_VAR_TX @@ -476,14 +440,8 @@ FRAME_CONTEXT *ec_ctx = cm->fc; #endif - const int depth = -#if CONFIG_DAALA_EC || CONFIG_ANS - aom_read_symbol(r, ec_ctx->tx_size_cdf[tx_size_cat][ctx], tx_size_cat + 2, - ACCT_STR); -#else - aom_read_tree(r, av1_tx_size_tree[tx_size_cat], - ec_ctx->tx_size_probs[tx_size_cat][ctx], ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS + const int depth = aom_read_symbol(r, ec_ctx->tx_size_cdf[tx_size_cat][ctx], + tx_size_cat + 2, ACCT_STR); const TX_SIZE tx_size = depth_to_tx_size(depth); #if CONFIG_RECT_TX assert(!is_rect_tx(tx_size)); @@ -879,13 +837,8 @@ p_angle = mode_to_angle_map[mbmi->mode] + mbmi->angle_delta[0] * ANGLE_STEP; if (av1_is_intra_filter_switchable(p_angle)) { FRAME_COUNTS *counts = xd->counts; -#if CONFIG_DAALA_EC || CONFIG_ANS mbmi->intra_filter = aom_read_symbol(r, ec_ctx->intra_filter_cdf[ctx], INTRA_FILTERS, ACCT_STR); -#else - mbmi->intra_filter = aom_read_tree( - r, av1_intra_filter_tree, ec_ctx->intra_filter_probs[ctx], ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->intra_filter[ctx][mbmi->intra_filter]; } else { mbmi->intra_filter = INTRA_FILTER_LINEAR; @@ -947,29 +900,16 @@ if (inter_block) { if (eset > 0) { -#if CONFIG_DAALA_EC || CONFIG_ANS *tx_type = av1_ext_tx_inter_inv[eset][aom_read_symbol( r, ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], ext_tx_cnt_inter[eset], ACCT_STR)]; -#else - *tx_type = aom_read_tree( - r, av1_ext_tx_inter_tree[eset], - ec_ctx->inter_ext_tx_prob[eset][square_tx_size], ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->inter_ext_tx[eset][square_tx_size][*tx_type]; } } else if (ALLOW_INTRA_EXT_TX) { if (eset > 0) { -#if CONFIG_DAALA_EC || CONFIG_ANS *tx_type = av1_ext_tx_intra_inv[eset][aom_read_symbol( r, ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], ext_tx_cnt_intra[eset], ACCT_STR)]; -#else - *tx_type = aom_read_tree( - r, av1_ext_tx_intra_tree[eset], - ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode], - ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode][*tx_type]; } @@ -990,25 +930,14 @@ FRAME_COUNTS *counts = xd->counts; if (inter_block) { -#if CONFIG_DAALA_EC || CONFIG_ANS *tx_type = av1_ext_tx_inv[aom_read_symbol( r, ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES, ACCT_STR)]; -#else - *tx_type = aom_read_tree(r, av1_ext_tx_tree, - ec_ctx->inter_ext_tx_prob[tx_size], ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->inter_ext_tx[tx_size][*tx_type]; } else { const TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode]; -#if CONFIG_DAALA_EC || CONFIG_ANS *tx_type = av1_ext_tx_inv[aom_read_symbol( r, ec_ctx->intra_ext_tx_cdf[tx_size][tx_type_nom], TX_TYPES, ACCT_STR)]; -#else - *tx_type = aom_read_tree( - r, av1_ext_tx_tree, ec_ctx->intra_ext_tx_prob[tx_size][tx_type_nom], - ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->intra_ext_tx[tx_size][tx_type_nom][*tx_type]; } } else { @@ -1061,7 +990,7 @@ const int y_mis = AOMMIN(cm->mi_rows - mi_row, bh); #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; -#elif CONFIG_DAALA_EC || CONFIG_ANS +#else FRAME_CONTEXT *ec_ctx = cm->fc; #endif @@ -1146,59 +1075,30 @@ #if CONFIG_CB4X4 (void)i; mbmi->mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); #else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS -#else switch (bsize) { case BLOCK_4X4: for (i = 0; i < 4; ++i) - mi->bmi[i].as_mode = -#if CONFIG_DAALA_EC || CONFIG_ANS - read_intra_mode(r, - get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, i)); -#else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, i)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS + mi->bmi[i].as_mode = read_intra_mode( + r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, i)); mbmi->mode = mi->bmi[3].as_mode; break; case BLOCK_4X8: mi->bmi[0].as_mode = mi->bmi[2].as_mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); -#else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 1)); -#else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 1)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS break; case BLOCK_8X4: mi->bmi[0].as_mode = mi->bmi[1].as_mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); -#else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 2)); -#else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 2)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS break; default: mbmi->mode = -#if CONFIG_DAALA_EC || CONFIG_ANS read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); -#else - read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #endif @@ -1256,11 +1156,7 @@ int mag, d, fr, hp; const int sign = aom_read(r, mvcomp->sign, ACCT_STR); const int mv_class = -#if CONFIG_DAALA_EC || CONFIG_ANS aom_read_symbol(r, mvcomp->class_cdf, MV_CLASSES, ACCT_STR); -#else - aom_read_tree(r, av1_mv_class_tree, mvcomp->classes, ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS const int class0 = mv_class == MV_CLASS_0; // Integer part @@ -1276,14 +1172,9 @@ mag = CLASS0_SIZE << (mv_class + 2); } -// Fractional part -#if CONFIG_DAALA_EC || CONFIG_ANS + // Fractional part fr = aom_read_symbol(r, class0 ? mvcomp->class0_fp_cdf[d] : mvcomp->fp_cdf, MV_FP_SIZE, ACCT_STR); -#else - fr = aom_read_tree(r, av1_mv_fp_tree, - class0 ? mvcomp->class0_fp[d] : mvcomp->fp, ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS // High precision part (if hp is not used, the default value of the hp is 1) hp = usehp ? aom_read(r, class0 ? mvcomp->class0_hp : mvcomp->hp, ACCT_STR) @@ -1300,11 +1191,7 @@ MV_JOINT_TYPE joint_type; MV diff = { 0, 0 }; joint_type = -#if CONFIG_DAALA_EC || CONFIG_ANS (MV_JOINT_TYPE)aom_read_symbol(r, ctx->joint_cdf, MV_JOINTS, ACCT_STR); -#else - (MV_JOINT_TYPE)aom_read_tree(r, av1_mv_joint_tree, ctx->joints, ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (mv_joint_vertical(joint_type)) diff.row = read_mv_component(r, &ctx->comps[0], allow_hp); @@ -1471,16 +1358,10 @@ if (has_subpel_mv_component(xd->mi[0], xd, dir) || (mbmi->ref_frame[1] > INTRA_FRAME && has_subpel_mv_component(xd->mi[0], xd, dir + 2))) { -#if CONFIG_DAALA_EC || CONFIG_ANS mbmi->interp_filter[dir] = (InterpFilter)av1_switchable_interp_inv[aom_read_symbol( r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS, ACCT_STR)]; -#else - mbmi->interp_filter[dir] = (InterpFilter)aom_read_tree( - r, av1_switchable_interp_tree, ec_ctx->switchable_interp_prob[ctx], - ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->switchable_interp[ctx][mbmi->interp_filter[dir]]; } } @@ -1490,21 +1371,15 @@ mbmi->interp_filter[2] = mbmi->interp_filter[0]; mbmi->interp_filter[3] = mbmi->interp_filter[1]; } -#else // CONFIG_DUAL_FILTER +#else // CONFIG_DUAL_FILTER if (cm->interp_filter != SWITCHABLE) { mbmi->interp_filter = cm->interp_filter; } else { const int ctx = av1_get_pred_context_switchable_interp(xd); -#if CONFIG_DAALA_EC || CONFIG_ANS mbmi->interp_filter = (InterpFilter)av1_switchable_interp_inv[aom_read_symbol( r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS, ACCT_STR)]; -#else - mbmi->interp_filter = (InterpFilter)aom_read_tree( - r, av1_switchable_interp_tree, ec_ctx->switchable_interp_prob[ctx], - ACCT_STR); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (counts) ++counts->switchable_interp[ctx][mbmi->interp_filter]; } #endif // CONFIG_DUAL_FILTER
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c index f347963..b4f37d4 100644 --- a/av1/decoder/decoder.c +++ b/av1/decoder/decoder.c
@@ -50,7 +50,6 @@ av1_init_wedge_masks(); #endif // CONFIG_EXT_INTER init_done = 1; -#if CONFIG_DAALA_EC || CONFIG_ANS av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv, av1_intra_mode_tree); av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv, @@ -68,7 +67,6 @@ #endif av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv, av1_inter_mode_tree); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } }
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c index 522fe5d..2e3309c 100644 --- a/av1/decoder/detokenize.c +++ b/av1/decoder/detokenize.c
@@ -123,7 +123,6 @@ #endif // CONFIG_AOM_QM int band, c = 0; const int tx_size_ctx = txsize_sqr_map[tx_size]; -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob(*coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] = ec_ctx->coef_head_cdfs[tx_size_ctx][type][ref]; aom_cdf_prob(*coef_tail_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] = @@ -135,13 +134,6 @@ unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL; unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL; #endif -#else - aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] = - ec_ctx->coef_probs[tx_size_ctx][type][ref]; - const aom_prob *prob; - unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL; - unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL; -#endif // CONFIG_DAALA_EC || CONFIG_ANS uint8_t token_cache[MAX_TX_SQUARE]; const uint8_t *band_translate = get_band_translate(tx_size); int dq_shift; @@ -153,18 +145,15 @@ (void)tx_type; if (counts) { -#if !(CONFIG_DAALA_EC || CONFIG_ANS) || !CONFIG_EC_ADAPT +#if !CONFIG_EC_ADAPT coef_counts = counts->coef[tx_size_ctx][type][ref]; eob_branch_count = counts->eob_branch[tx_size_ctx][type][ref]; -#endif -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT blockz_count = counts->blockz_count[tx_size_ctx][type][ref][ctx]; #endif } dq_shift = av1_get_tx_scale(tx_size); -#if CONFIG_DAALA_EC || CONFIG_ANS band = *band_translate++; int more_data = 1; @@ -256,71 +245,6 @@ dqv = dq[1]; ctx = get_coef_context(nb, token_cache, c); band = *band_translate++; - -#else // CONFIG_DAALA_EC || CONFIG_ANS - while (c < max_eob) { - int val = -1; - band = *band_translate++; - prob = coef_probs[band][ctx]; - if (counts) ++eob_branch_count[band][ctx]; - if (!aom_read(r, prob[EOB_CONTEXT_NODE], ACCT_STR)) { - INCREMENT_COUNT(EOB_MODEL_TOKEN); - break; - } - -#if CONFIG_NEW_QUANT - dqv_val = &dq_val[band][0]; -#endif // CONFIG_NEW_QUANT - - while (!aom_read(r, prob[ZERO_CONTEXT_NODE], ACCT_STR)) { - INCREMENT_COUNT(ZERO_TOKEN); - dqv = dq[1]; - token_cache[scan[c]] = 0; - ++c; - if (c >= max_eob) return c; // zero tokens at the end (no eob token) - ctx = get_coef_context(nb, token_cache, c); - band = *band_translate++; - prob = coef_probs[band][ctx]; -#if CONFIG_NEW_QUANT - dqv_val = &dq_val[band][0]; -#endif // CONFIG_NEW_QUANT - } - - *max_scan_line = AOMMAX(*max_scan_line, scan[c]); - - if (!aom_read(r, prob[ONE_CONTEXT_NODE], ACCT_STR)) { - INCREMENT_COUNT(ONE_TOKEN); - token = ONE_TOKEN; - val = 1; - } else { - INCREMENT_COUNT(TWO_TOKEN); - token = aom_read_tree(r, av1_coef_con_tree, - av1_pareto8_full[prob[PIVOT_NODE] - 1], ACCT_STR); - assert(token != ZERO_TOKEN && token != ONE_TOKEN); - val = token_to_value(r, token, tx_size, xd->bd); - } -#if CONFIG_NEW_QUANT - v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val); - v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v; -#else -#if CONFIG_AOM_QM - dqv = ((iqmatrix[scan[c]] * (int)dqv) + (1 << (AOM_QM_BITS - 1))) >> - AOM_QM_BITS; -#endif - v = (val * dqv) >> dq_shift; -#endif // CONFIG_NEW_QUANT - -#if CONFIG_COEFFICIENT_RANGE_CHECKING - dqcoeff[scan[c]] = - check_range((aom_read_bit(r, ACCT_STR) ? -v : v), xd->bd); -#else - dqcoeff[scan[c]] = aom_read_bit(r, ACCT_STR) ? -v : v; -#endif // CONFIG_COEFFICIENT_RANGE_CHECKING - token_cache[scan[c]] = av1_pt_energy_class[token]; - ++c; - ctx = get_coef_context(nb, token_cache, c); - dqv = dq[1]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS } return c;
diff --git a/av1/decoder/laplace_decoder.c b/av1/decoder/laplace_decoder.c index b6cf50b..5cc080e 100644 --- a/av1/decoder/laplace_decoder.c +++ b/av1/decoder/laplace_decoder.c
@@ -39,10 +39,10 @@ count += msbs << shift; if (count > sum) { count = sum; -#if CONFIG_DAALA_EC +#if !CONFIG_ANS r->ec.error = 1; #else -# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +# error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif } return count;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index a012cb0..ea0136c 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -63,12 +63,6 @@ static struct av1_token intra_mode_encodings[INTRA_MODES]; static struct av1_token switchable_interp_encodings[SWITCHABLE_FILTERS]; -#if CONFIG_EXT_PARTITION_TYPES && !(CONFIG_DAALA_EC || CONFIG_ANS) -static const struct av1_token ext_partition_encodings[EXT_PARTITION_TYPES] = { - { 0, 1 }, { 4, 3 }, { 12, 4 }, { 7, 3 }, - { 10, 4 }, { 11, 4 }, { 26, 5 }, { 27, 5 } -}; -#endif static struct av1_token partition_encodings[PARTITION_TYPES]; #if CONFIG_EXT_INTER static const struct av1_token @@ -82,16 +76,6 @@ static struct av1_token palette_color_index_encodings[PALETTE_SIZES] [PALETTE_COLORS]; #endif // CONFIG_PALETTE -#if !(CONFIG_DAALA_EC || CONFIG_ANS) -static const struct av1_token tx_size_encodings[MAX_TX_DEPTH][TX_SIZES] = { - { { 0, 1 }, { 1, 1 } }, // Max tx_size is 8X8 - { { 0, 1 }, { 2, 2 }, { 3, 2 } }, // Max tx_size is 16X16 - { { 0, 1 }, { 2, 2 }, { 6, 3 }, { 7, 3 } }, // Max tx_size is 32X32 -#if CONFIG_TX64X64 - { { 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 } }, // Max tx_size 64X64 -#endif // CONFIG_TX64X64 -}; -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) #if CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE static INLINE void write_uniform(aom_writer *w, int n, int v) { @@ -193,7 +177,6 @@ av1_switchable_restore_tree); #endif // CONFIG_LOOP_RESTORATION -#if CONFIG_DAALA_EC || CONFIG_ANS /* This hack is necessary when CONFIG_DUAL_FILTER is enabled because the five SWITCHABLE_FILTERS are not consecutive, e.g., 0, 1, 2, 3, 4, when doing an in-order traversal of the av1_switchable_interp_tree structure. */ @@ -216,7 +199,6 @@ av1_intra_mode_tree); av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv, av1_inter_mode_tree); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } static void write_intra_mode_kf(const AV1_COMMON *cm, FRAME_CONTEXT *frame_ctx, @@ -226,17 +208,10 @@ #if CONFIG_INTRABC assert(!is_intrabc_block(&mi->mbmi)); #endif // CONFIG_INTRABC -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_intra_mode_ind[mode], get_y_mode_cdf(frame_ctx, mi, above_mi, left_mi, block), INTRA_MODES); (void)cm; -#else - av1_write_token(w, av1_intra_mode_tree, - get_y_mode_probs(cm, mi, above_mi, left_mi, block), - &intra_mode_encodings[mode]); - (void)frame_ctx; -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #if CONFIG_EXT_INTER && CONFIG_INTERINTRA @@ -462,14 +437,8 @@ assert(IMPLIES(is_rect_tx(tx_size), is_rect_tx_allowed(xd, mbmi))); #endif // CONFIG_EXT_TX && CONFIG_RECT_TX -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, depth, ec_ctx->tx_size_cdf[tx_size_cat][tx_size_ctx], tx_size_cat + 2); -#else - av1_write_token(w, av1_tx_size_tree[tx_size_cat], - ec_ctx->tx_size_probs[tx_size_cat][tx_size_ctx], - &tx_size_encodings[tx_size_cat][depth]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT if (is_quarter_tx_allowed(xd, mbmi, is_inter) && tx_size != coded_tx_size) aom_write(w, tx_size == quarter_txsize_lookup[bsize], @@ -577,17 +546,8 @@ (void)xd; #endif -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, AOMMIN(abs, DELTA_Q_SMALL), ec_ctx->delta_q_cdf, DELTA_Q_PROBS + 1); -#else - int i = 0; - while (i < DELTA_Q_SMALL && i <= abs) { - int bit = (i < abs); - aom_write(w, bit, ec_ctx->delta_q_prob[i]); - i++; - } -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (!smallval) { rem_bits = OD_ILOG_NZ(abs - 1) - 1; @@ -634,17 +594,8 @@ (void)xd; #endif -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, AOMMIN(abs, DELTA_LF_SMALL), ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1); -#else - int i = 0; - while (i < DELTA_LF_SMALL && i <= abs) { - int bit = (i < abs); - aom_write(w, bit, ec_ctx->delta_lf_prob[i]); - i++; - } -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (!smallval) { rem_bits = OD_ILOG_NZ(abs - 1) - 1; @@ -887,7 +838,7 @@ } #endif -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_LV_MAP +#if !CONFIG_LV_MAP static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp, const TOKENEXTRA *const stop, aom_bit_depth_t bit_depth, const TX_SIZE tx_size, @@ -952,98 +903,7 @@ *tp = p; } -#else // (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_LV_MAP -#if !CONFIG_LV_MAP -static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp, - const TOKENEXTRA *const stop, - aom_bit_depth_t bit_depth, const TX_SIZE tx_size, - TOKEN_STATS *token_stats) { - const TOKENEXTRA *p = *tp; -#if CONFIG_VAR_TX - int count = 0; - const int seg_eob = tx_size_2d[tx_size]; -#endif - - while (p < stop && p->token != EOSB_TOKEN) { - const int token = p->token; -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - const struct av1_token *const coef_encoding = &av1_coef_encodings[token]; - int coef_value = coef_encoding->value; - int coef_length = coef_encoding->len; -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) - const av1_extra_bit *const extra_bits = &av1_extra_bits[token]; - -#if CONFIG_DAALA_EC || CONFIG_ANS - /* skip one or two nodes */ - if (!p->skip_eob_node) - aom_write_record(w, token != EOB_TOKEN, p->context_tree[0], token_stats); - if (token != EOB_TOKEN) { - aom_write_record(w, token != ZERO_TOKEN, p->context_tree[1], token_stats); - if (token != ZERO_TOKEN) { - aom_write_symbol(w, token - ONE_TOKEN, *p->token_cdf, - CATEGORY6_TOKEN - ONE_TOKEN + 1); - } - } -#else - /* skip one or two nodes */ - if (p->skip_eob_node) - coef_length -= p->skip_eob_node; - else - aom_write_record(w, token != EOB_TOKEN, p->context_tree[0], token_stats); - - if (token != EOB_TOKEN) { - aom_write_record(w, token != ZERO_TOKEN, p->context_tree[1], token_stats); - - if (token != ZERO_TOKEN) { - aom_write_record(w, token != ONE_TOKEN, p->context_tree[2], - token_stats); - - if (token != ONE_TOKEN) { - const int unconstrained_len = UNCONSTRAINED_NODES - p->skip_eob_node; - aom_write_tree_record( - w, av1_coef_con_tree, - av1_pareto8_full[p->context_tree[PIVOT_NODE] - 1], coef_value, - coef_length - unconstrained_len, 0, token_stats); - } - } - } -#endif // CONFIG_DAALA_EC || CONFIG_ANS - - if (extra_bits->base_val) { - const int bit_string = p->extra; - const int bit_string_length = extra_bits->len; // Length of extra bits to - // be written excluding - // the sign bit. - int skip_bits = (extra_bits->base_val == CAT6_MIN_VAL) - ? (int)sizeof(av1_cat6_prob) - - av1_get_cat6_extrabits_size(tx_size, bit_depth) - : 0; - - assert(!(bit_string >> (bit_string_length - skip_bits + 1))); - if (bit_string_length > 0) { -#if CONFIG_NEW_MULTISYMBOL - skip_bits &= ~3; - write_coeff_extra(extra_bits->cdf, bit_string >> 1, - bit_string_length - skip_bits, w); -#else - write_coeff_extra(extra_bits->prob, bit_string >> 1, bit_string_length, - skip_bits, w, token_stats); -#endif - } - aom_write_bit_record(w, bit_string & 1, token_stats); - } - ++p; - -#if CONFIG_VAR_TX - ++count; - if (token == EOB_TOKEN || count == seg_eob) break; -#endif - } - - *tp = p; -} #endif // !CONFIG_LV_MAP -#endif // (CONFIG_DAALA_EC || CONFIG_ANS) !CONFIG_LV_MAP #else // !CONFIG_PVQ static PVQ_INFO *get_pvq_block(PVQ_QUEUE *pvq_q) { PVQ_INFO *pvq; @@ -1269,11 +1129,7 @@ static void write_segment_id(aom_writer *w, const struct segmentation *seg, struct segmentation_probs *segp, int segment_id) { if (seg->enabled && seg->update_map) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, segment_id, segp->tree_cdf, MAX_SEGMENTS); -#else - aom_write_tree(w, av1_segment_tree, segp->tree_probs, segment_id, 3, 0); -#endif } } @@ -1413,15 +1269,9 @@ #if CONFIG_INTRA_INTERP p_angle = mode_to_angle_map[mbmi->mode] + mbmi->angle_delta[0] * ANGLE_STEP; if (av1_is_intra_filter_switchable(p_angle)) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, mbmi->intra_filter, ec_ctx->intra_filter_cdf[intra_filter_ctx], INTRA_FILTERS); -#else - av1_write_token(w, av1_intra_filter_tree, - ec_ctx->intra_filter_probs[intra_filter_ctx], - &intra_filter_encodings[mbmi->intra_filter]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #endif // CONFIG_INTRA_INTERP } @@ -1464,15 +1314,9 @@ (mbmi->ref_frame[1] > INTRA_FRAME && has_subpel_mv_component(xd->mi[0], xd, dir + 2))) { const int ctx = av1_get_pred_context_switchable_interp(xd, dir); -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter[dir]], ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS); -#else - av1_write_token(w, av1_switchable_interp_tree, - ec_ctx->switchable_interp_prob[ctx], - &switchable_interp_encodings[mbmi->interp_filter[dir]]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS ++cpi->interp_filter_selected[0][mbmi->interp_filter[dir]]; } else { assert(mbmi->interp_filter[dir] == EIGHTTAP_REGULAR); @@ -1481,14 +1325,8 @@ #else { const int ctx = av1_get_pred_context_switchable_interp(xd); -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter], ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS); -#else - av1_write_token(w, av1_switchable_interp_tree, - ec_ctx->switchable_interp_prob[ctx], - &switchable_interp_encodings[mbmi->interp_filter]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS ++cpi->interp_filter_selected[0][mbmi->interp_filter]; } #endif // CONFIG_DUAL_FILTER @@ -1732,30 +1570,17 @@ if (is_inter) { assert(ext_tx_used_inter[eset][tx_type]); if (eset > 0) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_ext_tx_inter_ind[eset][tx_type], ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], ext_tx_cnt_inter[eset]); -#else - av1_write_token(w, av1_ext_tx_inter_tree[eset], - ec_ctx->inter_ext_tx_prob[eset][square_tx_size], - &ext_tx_inter_encodings[eset][tx_type]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } } else if (ALLOW_INTRA_EXT_TX) { assert(ext_tx_used_intra[eset][tx_type]); if (eset > 0) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol( w, av1_ext_tx_intra_ind[eset][tx_type], ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], ext_tx_cnt_intra[eset]); -#else - av1_write_token( - w, av1_ext_tx_intra_tree[eset], - ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode], - &ext_tx_intra_encodings[eset][tx_type]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } } } @@ -1769,28 +1594,14 @@ #endif // CONFIG_SUPERTX !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { if (is_inter) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_ext_tx_ind[tx_type], ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES); -#else - av1_write_token(w, av1_ext_tx_tree, ec_ctx->inter_ext_tx_prob[tx_size], - &ext_tx_encodings[tx_type]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } else { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol( w, av1_ext_tx_ind[tx_type], ec_ctx->intra_ext_tx_cdf[tx_size] [intra_mode_to_tx_type_context[mbmi->mode]], TX_TYPES); -#else - av1_write_token( - w, av1_ext_tx_tree, - ec_ctx - ->intra_ext_tx_prob[tx_size] - [intra_mode_to_tx_type_context[mbmi->mode]], - &ext_tx_encodings[tx_type]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } } #endif // CONFIG_EXT_TX @@ -1799,27 +1610,16 @@ static void write_intra_mode(FRAME_CONTEXT *frame_ctx, BLOCK_SIZE bsize, PREDICTION_MODE mode, aom_writer *w) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_intra_mode_ind[mode], frame_ctx->y_mode_cdf[size_group_lookup[bsize]], INTRA_MODES); -#else - av1_write_token(w, av1_intra_mode_tree, - frame_ctx->y_mode_prob[size_group_lookup[bsize]], - &intra_mode_encodings[mode]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } static void write_intra_uv_mode(FRAME_CONTEXT *frame_ctx, PREDICTION_MODE uv_mode, PREDICTION_MODE y_mode, aom_writer *w) { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, av1_intra_mode_ind[uv_mode], frame_ctx->uv_mode_cdf[y_mode], INTRA_MODES); -#else - av1_write_token(w, av1_intra_mode_tree, frame_ctx->uv_mode_prob[y_mode], - &intra_mode_encodings[uv_mode]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #if CONFIG_CFL @@ -2875,7 +2675,7 @@ #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; (void)cm; -#elif CONFIG_DAALA_EC || CONFIG_ANS +#else FRAME_CONTEXT *ec_ctx = cm->fc; #endif @@ -2884,24 +2684,11 @@ if (has_rows && has_cols) { #if CONFIG_EXT_PARTITION_TYPES if (bsize <= BLOCK_8X8) -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], PARTITION_TYPES); -#else - av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS else -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], EXT_PARTITION_TYPES); #else - av1_write_token(w, av1_ext_partition_tree, probs, - &ext_partition_encodings[p]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS -#else -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], PARTITION_TYPES); -#else - av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #endif // CONFIG_EXT_PARTITION_TYPES } else if (!has_rows && has_cols) { assert(p == PARTITION_SPLIT || p == PARTITION_HORZ); @@ -3068,7 +2855,6 @@ const int eset = get_ext_tx_set(supertx_size, bsize, 1, cm->reduced_tx_set_used); if (eset > 0) { -#if CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; #else @@ -3077,11 +2863,6 @@ aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type], ec_ctx->inter_ext_tx_cdf[eset][supertx_size], ext_tx_cnt_inter[eset]); -#else - av1_write_token(w, av1_ext_tx_inter_tree[eset], - cm->fc->inter_ext_tx_prob[eset][supertx_size], - &ext_tx_inter_encodings[eset][mbmi->tx_type]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS } } #else @@ -4887,9 +4668,7 @@ if (frame_is_intra_only(cm)) { av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob); -#if CONFIG_DAALA_EC || CONFIG_ANS av1_copy(cm->fc->kf_y_cdf, av1_kf_y_mode_cdf); -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if !CONFIG_EC_ADAPT for (i = 0; i < INTRA_MODES; ++i) @@ -5004,12 +4783,12 @@ write_global_motion(cpi, header_bc); #endif // CONFIG_GLOBAL_MOTION } -#if (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT +#if !CONFIG_EC_ADAPT av1_coef_head_cdfs(fc); av1_coef_pareto_cdfs(fc); for (i = 0; i < NMV_CONTEXTS; ++i) av1_set_mv_cdfs(&fc->nmvc[i]); av1_set_mode_cdfs(cm); -#endif // (CONFIG_DAALA_EC || CONFIG_ANS) && !CONFIG_EC_ADAPT +#endif // !CONFIG_EC_ADAPT #if CONFIG_ANS aom_buf_ans_flush(header_bc); header_size = buf_ans_write_end(header_bc);
diff --git a/av1/encoder/daala_compat_enc.c b/av1/encoder/daala_compat_enc.c index 3df424c..c60e2d3 100644 --- a/av1/encoder/daala_compat_enc.c +++ b/av1/encoder/daala_compat_enc.c
@@ -12,19 +12,19 @@ #include "encint.h" void od_encode_checkpoint(const daala_enc_ctx *enc, od_rollback_buffer *rbuf) { -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_checkpoint(&rbuf->ec, &enc->w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif OD_COPY(&rbuf->adapt, enc->state.adapt, 1); } void od_encode_rollback(daala_enc_ctx *enc, const od_rollback_buffer *rbuf) { -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_rollback(&enc->w.ec, &rbuf->ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif OD_COPY(enc->state.adapt, &rbuf->adapt, 1); }
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index b64365e..fabfa05 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -4988,16 +4988,11 @@ } } -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_init(&td->mb.daala_enc.w.ec, 65025); -#else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." -#endif - -#if CONFIG_DAALA_EC od_ec_enc_reset(&td->mb.daala_enc.w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif #endif // #if CONFIG_PVQ @@ -5026,10 +5021,10 @@ (unsigned int)(tok - cpi->tile_tok[tile_row][tile_col]); assert(cpi->tok_count[tile_row][tile_col] <= allocated_tokens(*tile_info)); #if CONFIG_PVQ -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_clear(&td->mb.daala_enc.w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif td->mb.pvq_q->last_pos = td->mb.pvq_q->curr_pos;
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index b4d19ff..4199906 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c
@@ -128,12 +128,8 @@ static INLINE unsigned int get_token_bit_costs( unsigned int token_costs[2][COEFF_CONTEXTS][ENTROPY_TOKENS], int skip_eob, int ctx, int token) { -#if CONFIG_DAALA_EC || CONFIG_ANS (void)skip_eob; return token_costs[token == ZERO_TOKEN || token == EOB_TOKEN][ctx][token]; -#else - return token_costs[skip_eob][ctx][token]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS } #define USE_GREEDY_OPTIMIZE_B 0 @@ -2039,10 +2035,10 @@ *eob = 0; -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell = od_ec_enc_tell_frac(&daala_enc->w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif // Change coefficient ordering for pvq encoding. @@ -2111,11 +2107,11 @@ *eob = tx_blk_size * tx_blk_size; -#if CONFIG_DAALA_EC +#if !CONFIG_ANS *rate = (od_ec_enc_tell_frac(&daala_enc->w.ec) - tell) << (AV1_PROB_COST_SHIFT - OD_BITRES); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif assert(*rate >= 0);
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c index 3a2ea78..eb0ff88 100644 --- a/av1/encoder/encodemv.c +++ b/av1/encoder/encodemv.c
@@ -45,13 +45,8 @@ // Sign aom_write(w, sign, mvcomp->sign); -// Class -#if CONFIG_DAALA_EC || CONFIG_ANS + // Class aom_write_symbol(w, mv_class, mvcomp->class_cdf, MV_CLASSES); -#else - av1_write_token(w, av1_mv_class_tree, mvcomp->classes, - &mv_class_encodings[mv_class]); -#endif // Integer bits if (mv_class == MV_CLASS_0) { @@ -62,16 +57,10 @@ for (i = 0; i < n; ++i) aom_write(w, (d >> i) & 1, mvcomp->bits[i]); } -// Fractional bits -#if CONFIG_DAALA_EC || CONFIG_ANS + // Fractional bits aom_write_symbol( w, fr, mv_class == MV_CLASS_0 ? mvcomp->class0_fp_cdf[d] : mvcomp->fp_cdf, MV_FP_SIZE); -#else - av1_write_token(w, av1_mv_fp_tree, - mv_class == MV_CLASS_0 ? mvcomp->class0_fp[d] : mvcomp->fp, - &mv_fp_encodings[fr]); -#endif // High precision bit if (usehp) @@ -218,11 +207,7 @@ nmv_context *mvctx, int usehp) { const MV diff = { mv->row - ref->row, mv->col - ref->col }; const MV_JOINT_TYPE j = av1_get_mv_joint(&diff); -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, j, mvctx->joint_cdf, MV_JOINTS); -#else - av1_write_token(w, av1_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (mv_joint_vertical(j)) encode_mv_component(w, diff.row, &mvctx->comps[0], usehp); @@ -243,11 +228,7 @@ const MV diff = { mv->row - ref->row, mv->col - ref->col }; const MV_JOINT_TYPE j = av1_get_mv_joint(&diff); -#if CONFIG_DAALA_EC || CONFIG_ANS aom_write_symbol(w, j, mvctx->joint_cdf, MV_JOINTS); -#else - av1_write_token(w, av1_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]); -#endif // CONFIG_DAALA_EC || CONFIG_ANS if (mv_joint_vertical(j)) encode_mv_component(w, diff.row, &mvctx->comps[0], 0);
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index a5b7863..7a0abba 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c
@@ -568,16 +568,11 @@ od_init_qm(x->daala_enc.state.qm, x->daala_enc.state.qm_inv, x->daala_enc.qm == OD_HVS_QM ? OD_QM8_Q4_HVS : OD_QM8_Q4_FLAT); -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_init(&x->daala_enc.w.ec, 65025); -#else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." -#endif - -#if CONFIG_DAALA_EC od_ec_enc_reset(&x->daala_enc.w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif } #endif @@ -998,10 +993,10 @@ } #if CONFIG_PVQ -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_clear(&x->daala_enc.w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif x->pvq_q->last_pos = x->pvq_q->curr_pos;
diff --git a/av1/encoder/pvq_encoder.c b/av1/encoder/pvq_encoder.c index ab63f1b..0df238a 100644 --- a/av1/encoder/pvq_encoder.c +++ b/av1/encoder/pvq_encoder.c
@@ -247,23 +247,23 @@ aom_writer w; od_pvq_codeword_ctx cd; int tell; -#if CONFIG_DAALA_EC +#if !CONFIG_ANS od_ec_enc_init(&w.ec, 1000); #else -# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +# error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif OD_COPY(&cd, &adapt->pvq.pvq_codeword_ctx, 1); -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell = od_ec_enc_tell_frac(&w.ec); #else -# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +# error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif aom_encode_pvq_codeword(&w, &cd, y0, n - (theta != -1), k); -#if CONFIG_DAALA_EC +#if !CONFIG_ANS rate = (od_ec_enc_tell_frac(&w.ec)-tell)/8.; od_ec_enc_clear(&w.ec); #else -# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +# error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif } if (qg > 0 && theta >= 0) { @@ -851,18 +851,18 @@ (double)(skip_cdf[2] - skip_cdf[1])); dc_rate += 1; -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell2 = od_ec_enc_tell_frac(&enc->w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif od_encode_checkpoint(enc, &dc_buf); generic_encode(&enc->w, &enc->state.adapt->model_dc[pli], n - 1, &enc->state.adapt->ex_dc[pli][bs][0], 2); -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell2 = od_ec_enc_tell_frac(&enc->w.ec) - tell2; #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif dc_rate += tell2/8.0; od_encode_rollback(enc, &dc_buf); @@ -871,10 +871,10 @@ enc->pvq_norm_lambda); } } -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell = od_ec_enc_tell_frac(&enc->w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif /* Code as if we're not skipping. */ aom_write_symbol(&enc->w, 2 + (out[0] != 0), skip_cdf, 4); @@ -921,10 +921,10 @@ } if (encode_flip) cfl_encoded = 1; } -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell = od_ec_enc_tell_frac(&enc->w.ec) - tell; #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif /* Account for the rate of skipping the AC, based on the same DC decision we made when trying to not skip AC. */ @@ -955,18 +955,18 @@ (double)skip_cdf[0]); dc_rate += 1; -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell2 = od_ec_enc_tell_frac(&enc->w.ec); #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif od_encode_checkpoint(enc, &dc_buf); generic_encode(&enc->w, &enc->state.adapt->model_dc[pli], n - 1, &enc->state.adapt->ex_dc[pli][bs][0], 2); -#if CONFIG_DAALA_EC +#if !CONFIG_ANS tell2 = od_ec_enc_tell_frac(&enc->w.ec) - tell2; #else -#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." +#error "CONFIG_PVQ currently requires !CONFIG_ANS." #endif dc_rate += tell2/8.0; od_encode_rollback(enc, &dc_buf);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 9c164eb..993e15c 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -1072,13 +1072,10 @@ int c, cost; const int16_t *scan = scan_order->scan; const int16_t *nb = scan_order->neighbors; -#if CONFIG_DAALA_EC || CONFIG_ANS const int ref = is_inter_block(mbmi); aom_prob *blockz_probs = cm->fc->blockzero_probs[txsize_sqr_map[tx_size]][type][ref]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS - #if CONFIG_HIGHBITDEPTH const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd); #else @@ -1092,12 +1089,8 @@ (void)cm; if (eob == 0) { -#if CONFIG_DAALA_EC || CONFIG_ANS // single eob token cost = av1_cost_bit(blockz_probs[pt], 0); -#else - cost = token_costs[0][0][pt][EOB_TOKEN]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS } else { if (use_fast_coef_costing) { int band_left = *band_count++; @@ -1106,11 +1099,7 @@ int v = qcoeff[0]; int16_t prev_t; cost = av1_get_token_cost(v, &prev_t, cat6_bits); -#if CONFIG_DAALA_EC || CONFIG_ANS cost += (*token_costs)[!prev_t][pt][prev_t]; -#else - cost += (*token_costs)[0][pt][prev_t]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS token_cache[0] = av1_pt_energy_class[prev_t]; ++token_costs; @@ -1122,11 +1111,7 @@ v = qcoeff[rc]; cost += av1_get_token_cost(v, &t, cat6_bits); -#if CONFIG_DAALA_EC || CONFIG_ANS cost += (*token_costs)[!t][!prev_t][t]; -#else - cost += (*token_costs)[!prev_t][!prev_t][t]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS prev_t = t; if (!--band_left) { band_left = *band_count++; @@ -1135,8 +1120,7 @@ } // eob token - if (band_left || (CONFIG_DAALA_EC || CONFIG_ANS)) - cost += (*token_costs)[0][!prev_t][EOB_TOKEN]; + cost += (*token_costs)[0][!prev_t][EOB_TOKEN]; } else { // !use_fast_coef_costing int band_left = *band_count++; @@ -1144,23 +1128,12 @@ // dc token int v = qcoeff[0]; int16_t tok; -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - unsigned int(*tok_cost_ptr)[COEFF_CONTEXTS][ENTROPY_TOKENS]; -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) cost = av1_get_token_cost(v, &tok, cat6_bits); -#if CONFIG_DAALA_EC || CONFIG_ANS cost += (*token_costs)[!tok][pt][tok]; -#else - cost += (*token_costs)[0][pt][tok]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS token_cache[0] = av1_pt_energy_class[tok]; ++token_costs; -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - tok_cost_ptr = &((*token_costs)[!tok]); -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) - // ac tokens for (c = 1; c < eob; c++) { const int rc = scan[c]; @@ -1168,26 +1141,17 @@ v = qcoeff[rc]; cost += av1_get_token_cost(v, &tok, cat6_bits); pt = get_coef_context(nb, token_cache, c); -#if CONFIG_DAALA_EC || CONFIG_ANS cost += (*token_costs)[!tok][pt][tok]; -#else - cost += (*tok_cost_ptr)[pt][tok]; -#endif // CONFIG_DAALA_EC || CONFIG_ANS token_cache[rc] = av1_pt_energy_class[tok]; if (!--band_left) { band_left = *band_count++; ++token_costs; } -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - tok_cost_ptr = &((*token_costs)[!tok]); -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) } // eob token - if (band_left || (CONFIG_DAALA_EC || CONFIG_ANS)) { - pt = get_coef_context(nb, token_cache, c); - cost += (*token_costs)[0][pt][EOB_TOKEN]; - } + pt = get_coef_context(nb, token_cache, c); + cost += (*token_costs)[0][pt][EOB_TOKEN]; } }
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c index a52e2b5..18d2cd9 100644 --- a/av1/encoder/tokenize.c +++ b/av1/encoder/tokenize.c
@@ -264,13 +264,6 @@ }; #endif -#if !(CONFIG_DAALA_EC || CONFIG_ANS) -const struct av1_token av1_coef_encodings[ENTROPY_TOKENS] = { - { 2, 2 }, { 6, 3 }, { 28, 5 }, { 58, 6 }, { 59, 6 }, { 60, 6 }, - { 61, 6 }, { 124, 7 }, { 125, 7 }, { 126, 7 }, { 127, 7 }, { 0, 1 } -}; -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) - #if !CONFIG_PVQ || CONFIG_VAR_TX static void cost_coeffs_b(int plane, int block, int blk_row, int blk_col, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) { @@ -310,7 +303,6 @@ blk_row); } -#if CONFIG_DAALA_EC || CONFIG_ANS static INLINE void add_token(TOKENEXTRA **t, aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)], aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)], @@ -324,19 +316,6 @@ (*t)->first_val = first_val; (*t)++; } - -#else -static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree, - int32_t extra, uint8_t token, - uint8_t skip_eob_node, unsigned int *counts) { - (*t)->token = token; - (*t)->extra = extra; - (*t)->context_tree = context_tree; - (*t)->skip_eob_node = skip_eob_node; - (*t)++; - ++counts[token]; -} -#endif // CONFIG_DAALA_EC || CONFIG_ANS #endif // !CONFIG_PVQ || CONFIG_VAR_TX #if CONFIG_PALETTE @@ -461,16 +440,11 @@ const int ref = is_inter_block(mbmi); unsigned int(*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] = td->rd_counts.coef_counts[txsize_sqr_map[tx_size]][type][ref]; -#if !(CONFIG_DAALA_EC || CONFIG_ANS) - aom_prob(*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] = - cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref]; -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) #if CONFIG_EC_ADAPT FRAME_CONTEXT *ec_ctx = xd->tile_ctx; -#elif CONFIG_DAALA_EC || CONFIG_ANS +#else FRAME_CONTEXT *ec_ctx = cpi->common.fc; #endif -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob( *const coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] = ec_ctx->coef_head_cdfs[txsize_sqr_map[tx_size]][type][ref]; @@ -481,9 +455,6 @@ td->counts->blockz_count[txsize_sqr_map[tx_size]][type][ref]; int eob_val; int first_val = 1; -#else - int skip_eob = 0; -#endif // CONFIG_DAALA_EC || CONFIG_ANS const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size); unsigned int(*const eob_branch)[COEFF_CONTEXTS] = td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref]; @@ -497,7 +468,6 @@ nb = scan_order->neighbors; c = 0; -#if CONFIG_DAALA_EC || CONFIG_ANS if (eob == 0) add_token(&t, &coef_tail_cdfs[band[c]][pt], &coef_head_cdfs[band[c]][pt], 1, 1, 0, BLOCK_Z_TOKEN); @@ -533,27 +503,6 @@ ++c; pt = get_coef_context(nb, token_cache, AOMMIN(c, eob - 1)); } -#else - while (c < eob) { - const int v = qcoeff[scan[c]]; - eob_branch[band[c]][pt] += !skip_eob; - - av1_get_token_extra(v, &token, &extra); - - add_token(&t, coef_probs[band[c]][pt], extra, (uint8_t)token, - (uint8_t)skip_eob, counts[band[c]][pt]); - - token_cache[scan[c]] = av1_pt_energy_class[token]; - ++c; - pt = get_coef_context(nb, token_cache, c); - skip_eob = (token == ZERO_TOKEN); - } - if (c < seg_eob) { - add_token(&t, coef_probs[band[c]][pt], 0, EOB_TOKEN, 0, - counts[band[c]][pt]); - ++eob_branch[band[c]][pt]; - } -#endif // CONFIG_DAALA_EC || CONFIG_ANS #if CONFIG_COEF_INTERLEAVE t->token = EOSB_TOKEN;
diff --git a/av1/encoder/tokenize.h b/av1/encoder/tokenize.h index c3e8cef..cbfa3cd 100644 --- a/av1/encoder/tokenize.h +++ b/av1/encoder/tokenize.h
@@ -35,12 +35,10 @@ } TOKENVALUE; typedef struct { -#if CONFIG_DAALA_EC || CONFIG_ANS aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)]; aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)]; int eob_val; int first_val; -#endif // CONFIG_DAALA_EC || CONFIG_ANS const aom_prob *context_tree; EXTRABIT extra; uint8_t token; @@ -49,9 +47,6 @@ extern const aom_tree_index av1_coef_tree[]; extern const aom_tree_index av1_coef_con_tree[]; -#if !(CONFIG_DAALA_EC || CONFIG_ANS) -extern const struct av1_token av1_coef_encodings[]; -#endif // !(CONFIG_DAALA_EC || CONFIG_ANS) int av1_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
diff --git a/configure b/configure index 562b1be..b77b07d 100755 --- a/configure +++ b/configure
@@ -279,7 +279,6 @@ alt_intra palette palette_delta_encoding - daala_ec rawbits ec_smallmul pvq @@ -498,7 +497,6 @@ # Enable low-bitdepth pixel pipeline by default soft_enable lowbitdepth - ! enabled ans && soft_enable daala_ec soft_enable palette soft_enable alt_intra soft_enable palette_throughput @@ -519,28 +517,16 @@ enabled dpcm_intra && enable_feature ext_tx enabled chroma_sub8x8 && enable_feature cb4x4 - if ! enabled daala_ec && ! enabled ans && enabled cfl; then - log_echo "cfl requires daala_ec or ans, so disabling cfl" - disable_feature cfl - fi - if ! enabled daala_ec && ! enabled ans && enabled ec_adapt; then - log_echo "ec_adapt requires daala_ec or ans, so disabling ec_adapt" - disable_feature ec_adapt - fi - if ! enabled daala_ec && ! enabled ans && enabled new_multisymbol; then - log_echo "new_multisymbol requires daala_ec or ans, so disabling new_multisymbol" - disable_feature new_multisymbol - fi if ! enabled delta_q && enabled ext_delta_q; then log_echo "ext_delta_q requires delta_q, so disabling ext_delta_q" disable_feature ext_delta_q fi - if enabled rawbits && ! enabled daala_ec; then - log_echo "rawbits requires daala_ec, so disabling rawbits" + if enabled rawbits && enabled ans; then + log_echo "rawbits requires not ans, so disabling rawbits" disable_feature rawbits fi - if enabled ec_smallmul && ! enabled daala_ec; then - log_echo "ec_smallmul requires daala_ec, so disabling ec_smallmul" + if enabled ec_smallmul && enabled ans; then + log_echo "ec_smallmul requires not ans, so disabling ec_smallmul" disable_feature ec_smallmul fi if enabled ext_tile; then
diff --git a/test/boolcoder_test.cc b/test/boolcoder_test.cc index e5bd913..7abe1b1 100644 --- a/test/boolcoder_test.cc +++ b/test/boolcoder_test.cc
@@ -68,11 +68,6 @@ aom_stop_encode(&bw); -#if !CONFIG_DAALA_EC - // First bit should be zero - GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0); -#endif - aom_reader br; aom_reader_init(&br, bw_buffer, bw.pos, NULL, NULL); bit_rnd.Reset(random_seed); @@ -91,15 +86,11 @@ } } -#if CONFIG_DAALA_EC #if CONFIG_EC_SMALLMUL #define FRAC_DIFF_TOTAL_ERROR 0.16 #else #define FRAC_DIFF_TOTAL_ERROR 0.07 #endif -#else -#define FRAC_DIFF_TOTAL_ERROR 0.2 -#endif TEST(AV1, TestTell) { const int kBufferSize = 10000;
diff --git a/test/superframe_test.cc b/test/superframe_test.cc index 0f54bae..a28d35d 100644 --- a/test/superframe_test.cc +++ b/test/superframe_test.cc
@@ -119,23 +119,12 @@ // to the decoder starting at the end of the buffer. #if CONFIG_EXT_TILE // Single tile does not work with ANS (see comment above). -#if CONFIG_ANS || CONFIG_DAALA_EC const int tile_col_values[] = { 1, 2 }; -#else -const int tile_col_values[] = { 1, 2, 32 }; -#endif const int tile_row_values[] = { 1, 2, 32 }; AV1_INSTANTIATE_TEST_CASE( SuperframeTest, ::testing::Combine(::testing::Values(::libaom_test::kTwoPassGood), ::testing::ValuesIn(tile_col_values), ::testing::ValuesIn(tile_row_values))); -#else -#if !CONFIG_ANS && !CONFIG_DAALA_EC -AV1_INSTANTIATE_TEST_CASE( - SuperframeTest, - ::testing::Combine(::testing::Values(::libaom_test::kTwoPassGood), - ::testing::Values(0), ::testing::Values(0))); -#endif // !CONFIG_ANS #endif // CONFIG_EXT_TILE } // namespace