Move ANS to aom_dsp.
That's where it lives in aom/master. Change-Id: I38f405827d9c2d0b06ef5f3bfd7cadc35d5991ef
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef AV1_COMMON_ANS_H_
|
||||
#define AV1_COMMON_ANS_H_
|
||||
#ifndef AOM_DSP_ANS_H_
|
||||
#define AOM_DSP_ANS_H_
|
||||
// An implementation of Asymmetric Numeral Systems
|
||||
// http://arxiv.org/abs/1311.2540v2
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#define ANS_DIVIDE_BY_MULTIPLY 1
|
||||
#if ANS_DIVIDE_BY_MULTIPLY
|
||||
#include "av1/common/divide.h"
|
||||
#include "aom_dsp/divide.h"
|
||||
#define ANS_DIVREM(quotient, remainder, dividend, divisor) \
|
||||
do { \
|
||||
quotient = fastdiv(dividend, divisor); \
|
||||
@@ -411,4 +411,4 @@ static INLINE int ans_reader_has_error(const struct AnsDecoder *const ans) {
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
#endif // AV1_COMMON_ANS_H_
|
||||
#endif // AOM_DSP_ANS_H_
|
@@ -19,6 +19,7 @@ DSP_SRCS-$(ARCH_X86)$(ARCH_X86_64) += x86/synonyms.h
|
||||
# bit reader
|
||||
DSP_SRCS-yes += prob.h
|
||||
DSP_SRCS-yes += prob.c
|
||||
DSP_SRCS-$(CONFIG_ANS) += ans.h
|
||||
|
||||
ifeq ($(CONFIG_ENCODERS),yes)
|
||||
DSP_SRCS-yes += bitwriter.h
|
||||
@@ -26,6 +27,10 @@ DSP_SRCS-yes += dkboolwriter.h
|
||||
DSP_SRCS-yes += dkboolwriter.c
|
||||
DSP_SRCS-yes += bitwriter_buffer.c
|
||||
DSP_SRCS-yes += bitwriter_buffer.h
|
||||
DSP_SRCS-$(CONFIG_ANS) += buf_ans.h
|
||||
DSP_SRCS-$(CONFIG_ANS) += buf_ans.c
|
||||
DSP_SRCS-$(CONFIG_ANS) += divide.h
|
||||
DSP_SRCS-$(CONFIG_ANS) += divide.c
|
||||
DSP_SRCS-yes += psnr.c
|
||||
DSP_SRCS-yes += psnr.h
|
||||
DSP_SRCS-$(CONFIG_INTERNAL_STATS) += ssim.c
|
||||
|
@@ -10,30 +10,30 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/encoder/buf_ans.h"
|
||||
#include "av1/encoder/encoder.h"
|
||||
#include "aom_dsp/buf_ans.h"
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom/internal/aom_codec_internal.h"
|
||||
|
||||
void av1_buf_ans_alloc(struct BufAnsCoder *c, struct AV1Common *cm,
|
||||
int size_hint) {
|
||||
c->cm = cm;
|
||||
void aom_buf_ans_alloc(struct BufAnsCoder *c,
|
||||
struct aom_internal_error_info *error, int size_hint) {
|
||||
c->error = error;
|
||||
c->size = size_hint;
|
||||
CHECK_MEM_ERROR(cm, c->buf, aom_malloc(c->size * sizeof(*c->buf)));
|
||||
AOM_CHECK_MEM_ERROR(error, c->buf, aom_malloc(c->size * sizeof(*c->buf)));
|
||||
// Initialize to overfull to trigger the assert in write.
|
||||
c->offset = c->size + 1;
|
||||
}
|
||||
|
||||
void av1_buf_ans_free(struct BufAnsCoder *c) {
|
||||
void aom_buf_ans_free(struct BufAnsCoder *c) {
|
||||
aom_free(c->buf);
|
||||
c->buf = NULL;
|
||||
c->size = 0;
|
||||
}
|
||||
|
||||
void av1_buf_ans_grow(struct BufAnsCoder *c) {
|
||||
void aom_buf_ans_grow(struct BufAnsCoder *c) {
|
||||
struct buffered_ans_symbol *new_buf = NULL;
|
||||
int new_size = c->size * 2;
|
||||
CHECK_MEM_ERROR(c->cm, new_buf, aom_malloc(new_size * sizeof(*new_buf)));
|
||||
AOM_CHECK_MEM_ERROR(c->error, new_buf,
|
||||
aom_malloc(new_size * sizeof(*new_buf)));
|
||||
memcpy(new_buf, c->buf, c->size * sizeof(*c->buf));
|
||||
aom_free(c->buf);
|
||||
c->buf = new_buf;
|
@@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef AV1_ENCODER_BUF_ANS_H_
|
||||
#define AV1_ENCODER_BUF_ANS_H_
|
||||
#ifndef AOM_DSP_BUF_ANS_H_
|
||||
#define AOM_DSP_BUF_ANS_H_
|
||||
// Buffered forward ANS writer.
|
||||
// Symbols are written to the writer in forward (decode) order and serialzed
|
||||
// backwards due to ANS's stack like behavior.
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <assert.h>
|
||||
#include "./aom_config.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -34,18 +34,18 @@ struct buffered_ans_symbol {
|
||||
};
|
||||
|
||||
struct BufAnsCoder {
|
||||
struct AV1Common *cm;
|
||||
struct aom_internal_error_info *error;
|
||||
struct buffered_ans_symbol *buf;
|
||||
int size;
|
||||
int offset;
|
||||
};
|
||||
|
||||
void av1_buf_ans_alloc(struct BufAnsCoder *c, struct AV1Common *cm,
|
||||
int size_hint);
|
||||
void aom_buf_ans_alloc(struct BufAnsCoder *c,
|
||||
struct aom_internal_error_info *error, int size_hint);
|
||||
|
||||
void av1_buf_ans_free(struct BufAnsCoder *c);
|
||||
void aom_buf_ans_free(struct BufAnsCoder *c);
|
||||
|
||||
void av1_buf_ans_grow(struct BufAnsCoder *c);
|
||||
void aom_buf_ans_grow(struct BufAnsCoder *c);
|
||||
|
||||
static INLINE void buf_ans_write_reset(struct BufAnsCoder *const c) {
|
||||
c->offset = 0;
|
||||
@@ -55,7 +55,7 @@ static INLINE void buf_uabs_write(struct BufAnsCoder *const c, uint8_t val,
|
||||
AnsP8 prob) {
|
||||
assert(c->offset <= c->size);
|
||||
if (c->offset == c->size) {
|
||||
av1_buf_ans_grow(c);
|
||||
aom_buf_ans_grow(c);
|
||||
}
|
||||
c->buf[c->offset].method = ANS_METHOD_UABS;
|
||||
c->buf[c->offset].val_start = val;
|
||||
@@ -67,7 +67,7 @@ static INLINE void buf_rans_write(struct BufAnsCoder *const c,
|
||||
const struct rans_sym *const sym) {
|
||||
assert(c->offset <= c->size);
|
||||
if (c->offset == c->size) {
|
||||
av1_buf_ans_grow(c);
|
||||
aom_buf_ans_grow(c);
|
||||
}
|
||||
c->buf[c->offset].method = ANS_METHOD_RANS;
|
||||
c->buf[c->offset].val_start = sym->cum_prob;
|
||||
@@ -106,4 +106,4 @@ static INLINE void buf_uabs_write_literal(struct BufAnsCoder *c, int literal,
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
#endif // AV1_ENCODER_BUF_ANS_H_
|
||||
#endif // AOM_DSP_BUF_ANS_H_
|
@@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "av1/common/divide.h"
|
||||
#include "aom_dsp/divide.h"
|
||||
|
||||
/* Constants for divide by multiply for small divisors generated with:
|
||||
void init_fastdiv() {
|
@@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef AV1_COMMON_DIVIDE_H_
|
||||
#define AV1_COMMON_DIVIDE_H_
|
||||
#ifndef AOM_DSP_DIVIDE_H_
|
||||
#define AOM_DSP_DIVIDE_H_
|
||||
// An implemntation of the divide by multiply alogrithm
|
||||
// https://gmplib.org/~tege/divcnst-pldi94.pdf
|
||||
|
||||
@@ -37,4 +37,4 @@ static INLINE unsigned fastdiv(unsigned x, int y) {
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
#endif // AV1_COMMON_DIVIDE_H_
|
||||
#endif // AOM_DSP_DIVIDE_H_
|
@@ -11,11 +11,9 @@
|
||||
|
||||
AV1_COMMON_SRCS-yes += av1_common.mk
|
||||
AV1_COMMON_SRCS-yes += av1_iface_common.h
|
||||
AV1_COMMON_SRCS-yes += common/ans.h
|
||||
AV1_COMMON_SRCS-yes += common/alloccommon.c
|
||||
AV1_COMMON_SRCS-yes += common/blockd.c
|
||||
AV1_COMMON_SRCS-yes += common/debugmodes.c
|
||||
AV1_COMMON_SRCS-yes += common/divide.h
|
||||
AV1_COMMON_SRCS-yes += common/entropy.c
|
||||
AV1_COMMON_SRCS-yes += common/entropymode.c
|
||||
AV1_COMMON_SRCS-yes += common/entropymv.c
|
||||
@@ -82,9 +80,6 @@ AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_highbd_convolve_filters_sse4.c
|
||||
endif
|
||||
AV1_COMMON_SRCS-yes += common/av1_convolve.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_convolve.h
|
||||
AV1_COMMON_SRCS-$(CONFIG_ANS) += common/ans.h
|
||||
AV1_COMMON_SRCS-$(CONFIG_ANS) += common/divide.h
|
||||
AV1_COMMON_SRCS-$(CONFIG_ANS) += common/divide.c
|
||||
AV1_COMMON_SRCS-$(CONFIG_LOOP_RESTORATION) += common/restoration.h
|
||||
AV1_COMMON_SRCS-$(CONFIG_LOOP_RESTORATION) += common/restoration.c
|
||||
ifeq (yes,$(filter yes,$(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION)))
|
||||
|
@@ -86,8 +86,6 @@ AV1_CX_SRCS-yes += encoder/subexp.h
|
||||
AV1_CX_SRCS-yes += encoder/resize.c
|
||||
AV1_CX_SRCS-yes += encoder/resize.h
|
||||
AV1_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/blockiness.c
|
||||
AV1_CX_SRCS-$(CONFIG_ANS) += encoder/buf_ans.h
|
||||
AV1_CX_SRCS-$(CONFIG_ANS) += encoder/buf_ans.c
|
||||
|
||||
AV1_CX_SRCS-yes += encoder/tokenize.c
|
||||
AV1_CX_SRCS-yes += encoder/treewriter.c
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include "aom_dsp/prob.h"
|
||||
|
||||
#if CONFIG_ANS
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/enums.h"
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "./aom_config.h"
|
||||
|
||||
#if CONFIG_ANS
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
#include "aom/aomdx.h" // for av1_decrypt_cb
|
||||
#define aom_reader struct AnsDecoder
|
||||
#define aom_reader_has_error ans_reader_has_error
|
||||
|
@@ -12,7 +12,9 @@
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#include "av1/common/ans.h"
|
||||
#if CONFIG_ANS
|
||||
#include "aom_dsp/ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/entropy.h"
|
||||
|
@@ -13,7 +13,9 @@
|
||||
#define AV1_DECODER_DETOKENIZE_H_
|
||||
|
||||
#include "av1/decoder/decoder.h"
|
||||
#include "av1/common/ans.h"
|
||||
#if CONFIG_ANS
|
||||
#include "aom_dsp/ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
#include "av1/common/scan.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include "av1/common/tile_common.h"
|
||||
|
||||
#if CONFIG_ANS
|
||||
#include "av1/encoder/buf_ans.h"
|
||||
#include "aom_dsp/buf_ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
#include "av1/encoder/bitstream.h"
|
||||
#include "av1/encoder/cost.h"
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
#if CONFIG_ANS
|
||||
typedef struct BufAnsCoder BufAnsCoder;
|
||||
#include "av1/encoder/buf_ans.h"
|
||||
#include "aom_dsp/buf_ans.h"
|
||||
#define aom_writer BufAnsCoder
|
||||
#define aom_write buf_uabs_write
|
||||
#define aom_write_bit buf_uabs_write_bit
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "av1/encoder/cost.h"
|
||||
#if CONFIG_ANS
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
#include "av1/common/entropy.h"
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include "aom_dsp/prob.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#if CONFIG_ANS
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "av1/encoder/aq_variance.h"
|
||||
#include "av1/encoder/bitstream.h"
|
||||
#if CONFIG_ANS
|
||||
#include "av1/encoder/buf_ans.h"
|
||||
#include "aom_dsp/buf_ans.h"
|
||||
#endif
|
||||
#include "av1/encoder/context_tree.h"
|
||||
#include "av1/encoder/encodeframe.h"
|
||||
@@ -485,7 +485,7 @@ static void dealloc_compressor_data(AV1_COMP *cpi) {
|
||||
cpi->source_diff_var = NULL;
|
||||
}
|
||||
#if CONFIG_ANS
|
||||
av1_buf_ans_free(&cpi->buf_ans);
|
||||
aom_buf_ans_free(&cpi->buf_ans);
|
||||
#endif // CONFIG_ANS
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ void av1_alloc_compressor_data(AV1_COMP *cpi) {
|
||||
CHECK_MEM_ERROR(cm, cpi->tile_tok[0][0],
|
||||
aom_calloc(tokens, sizeof(*cpi->tile_tok[0][0])));
|
||||
#if CONFIG_ANS
|
||||
av1_buf_ans_alloc(&cpi->buf_ans, cm, tokens);
|
||||
aom_buf_ans_alloc(&cpi->buf_ans, &cm->error, tokens);
|
||||
#endif // CONFIG_ANS
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/encoder/aq_cyclicrefresh.h"
|
||||
#if CONFIG_ANS
|
||||
#include "av1/encoder/buf_ans.h"
|
||||
#include "aom_dsp/buf_ans.h"
|
||||
#endif
|
||||
#include "av1/encoder/context_tree.h"
|
||||
#include "av1/encoder/encodemb.h"
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
#if CONFIG_ANS
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
#endif // CONFIG_ANS
|
||||
#include "av1/common/blockd.h"
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "av1/common/ans.h"
|
||||
#include "aom_dsp/ans.h"
|
||||
#include "av1/encoder/treewriter.h"
|
||||
#include "aom_dsp/bitreader.h"
|
||||
#include "aom_dsp/bitwriter.h"
|
||||
|
Reference in New Issue
Block a user