]> granicus.if.org Git - libvpx/commitdiff
Move ANS to aom_dsp.
authorAlex Converse <aconverse@google.com>
Sat, 17 Sep 2016 22:11:16 +0000 (15:11 -0700)
committerAlex Converse <aconverse@google.com>
Mon, 19 Sep 2016 16:51:27 +0000 (09:51 -0700)
That's where it lives in aom/master.

Change-Id: I38f405827d9c2d0b06ef5f3bfd7cadc35d5991ef

20 files changed:
aom_dsp/ans.h [moved from av1/common/ans.h with 99% similarity]
aom_dsp/aom_dsp.mk
aom_dsp/buf_ans.c [moved from av1/encoder/buf_ans.c with 62% similarity]
aom_dsp/buf_ans.h [moved from av1/encoder/buf_ans.h with 87% similarity]
aom_dsp/divide.c [moved from av1/common/divide.c with 99% similarity]
aom_dsp/divide.h [moved from av1/common/divide.h with 91% similarity]
av1/av1_common.mk
av1/av1_cx.mk
av1/common/entropy.h
av1/decoder/bitreader.h
av1/decoder/detokenize.c
av1/decoder/detokenize.h
av1/encoder/bitstream.c
av1/encoder/bitwriter.h
av1/encoder/cost.c
av1/encoder/cost.h
av1/encoder/encoder.c
av1/encoder/encoder.h
av1/encoder/rd.h
test/av1_ans_test.cc

similarity index 99%
rename from av1/common/ans.h
rename to aom_dsp/ans.h
index 1a632ee6ba73d735e39f2e60bdac5f9d3badecf3..c526e275df724d01b9e74ff6abf08fcf3096e14c 100644 (file)
@@ -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_
index 5bebb26f3712de6fa8409ee5ed8dea855f57c66f..25e7d8f966bc10f8fee33a97403089d146d4c793 100644 (file)
@@ -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
similarity index 62%
rename from av1/encoder/buf_ans.c
rename to aom_dsp/buf_ans.c
index d20edc3ca27b522888af66dfe4a128faff4af321..a62aaba6c329980ebe54ed0c5e7d12500ec695d9 100644 (file)
 
 #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;
similarity index 87%
rename from av1/encoder/buf_ans.h
rename to aom_dsp/buf_ans.h
index 1ba6e6c25f7eb336ede722e4156733649cabfe03..b3fdad9deeada6d20e729d8b5356c9284c28388f 100644 (file)
@@ -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_
similarity index 99%
rename from av1/common/divide.c
rename to aom_dsp/divide.c
index 3c82be8b831dc7348a710413206b663e11683a2b..3e58da5e9e0df8cc2a660b201b89225ffeb528e2 100644 (file)
@@ -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() {
similarity index 91%
rename from av1/common/divide.h
rename to aom_dsp/divide.h
index b96ad4cc809d4337d9ee187b499ebe90af965116..c92a58f39f06230c14a687cb06f5e342bc71331f 100644 (file)
@@ -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_
index cd3e1d13e492091652f894ad80ad937e9f109ad7..9976e7aab3bb0e5a74ee804b22a245a8698f1145 100644 (file)
 
 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)))
index c4df1a56b9290ec0b8c2e15cf1efba971e5c1d4a..ecbe2b32bba95af7c98ad8d6a07e613a731a0b33 100644 (file)
@@ -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
index ac47b3b440c975a1d60689db5ea10cb1375ad86b..4ce502be66ef247b14496f104f14f08f95055215 100644 (file)
@@ -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"
index aaf1bb865d3397e6af347d69539402712921fbd2..4d77664cc77b59b654982a634f3a65a65ab1ff6b 100644 (file)
@@ -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
index 778bf129e4ceda5bf186bd3feb35adf5761a29b2..fbcf8fe05b517006bd14380710c3a5c376b7f633 100644 (file)
@@ -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"
index de9ded99db32315f7089e23cc0b5be3247a84d1a..69d6fabfb83c6e6c28fe591616d8b903c7c67767 100644 (file)
@@ -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
index 0f2daa1691839c941cccc7f7f3128aa5cc4b8644..2cdc82fcb54e4055ee7ed83246242e7e866cc0d8 100644 (file)
@@ -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"
index 2247e30adb4dcf74bc050a5f2cb39017f341fa0b..e4e72502aab58b4d28fe9c91e84ef161835f3d02 100644 (file)
@@ -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
index f6636ecdb66aafe178bda34e42ff3589e411260c..8acb341e306ba8851731131f5146a2fc63428ffe 100644 (file)
@@ -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"
 
index 4e4d9bbcc75699ad274b2f77528ebc45e9132114..87652cd1513724f366fe4ee0e3a78cd5bd8ba3ab 100644 (file)
@@ -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
index b6facfafcda7e76a56fe86330c1f91bd01f706c4..a5dcfc6ffc5632083ddb3d5dcfbf6ae0eb61f743 100644 (file)
@@ -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
   }
 
index 86503d72928ae7681814ac10192240a18c7bee0f..8120e895fb37d991d729939b91192767381b31a5 100644 (file)
@@ -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"
index 42c37e3f64693f7b7f17ae9e468c704610655ca2..54c10b27c39c6dd776288193ad3f3908b0a5061c 100644 (file)
@@ -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"
 
index 20fc223e9084932b108e08e380668a156b265df3..29a1cf5d519988c435800f7498ae84f4d3ab257e 100644 (file)
@@ -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"