From 1d7ccd5325ec34244074419f6802640c8afafd31 Mon Sep 17 00:00:00 2001 From: Johann Date: Mon, 11 May 2015 19:09:22 -0700 Subject: [PATCH] Relocate memory operations for common code With the sad functions, and hopefully the variance functions soon, moving to the vpx_dsp location, place the defines used in the reference C code in a common location. Change-Id: I4c8ce7778eb38a0a3ee674d2f1c488eda01cfeca --- test/dct16x16_test.cc | 1 + test/dct32x32_test.cc | 1 + test/fdct4x4_test.cc | 1 + test/fdct8x8_test.cc | 1 + test/sad_test.cc | 17 +---------------- test/variance_test.cc | 1 + vp9/common/arm/neon/vp9_idct16x16_1_add_neon.c | 2 ++ vp9/common/arm/neon/vp9_idct32x32_1_add_neon.c | 4 +++- vp9/common/arm/neon/vp9_idct4x4_1_add_neon.c | 2 ++ vp9/common/arm/neon/vp9_idct8x8_1_add_neon.c | 2 ++ vp9/common/mips/dspr2/vp9_itrans16_dspr2.c | 1 + vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c | 1 + vp9/common/mips/dspr2/vp9_itrans4_dspr2.c | 1 + vp9/common/mips/dspr2/vp9_itrans8_dspr2.c | 1 + vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h | 1 + vp9/common/vp9_common.h | 9 --------- vp9/common/vp9_idct.c | 1 + vp9/common/vp9_idct.h | 1 + vp9/common/vp9_loopfilter.c | 1 + vp9/common/vp9_loopfilter_filters.c | 1 + vp9/common/vp9_postproc.c | 4 +--- vp9/common/vp9_reconintra.c | 1 + vp9/common/x86/vp9_high_loopfilter_intrin_sse2.c | 1 + vp9/common/x86/vp9_idct_intrin_sse2.c | 1 + vp9/decoder/vp9_decodeframe.c | 1 + vp9/encoder/vp9_aq_variance.c | 2 ++ vp9/encoder/vp9_dct.c | 1 + vp9/encoder/vp9_encodeframe.c | 1 + vp9/encoder/vp9_encodemb.c | 1 + vp9/encoder/vp9_encoder.c | 1 + vp9/encoder/vp9_extend.c | 1 + vp9/encoder/vp9_firstpass.c | 1 + vp9/encoder/vp9_mcomp.c | 1 + vp9/encoder/vp9_picklpf.c | 1 + vp9/encoder/vp9_pickmode.c | 1 + vp9/encoder/vp9_quantize.c | 1 + vp9/encoder/vp9_ratectrl.c | 1 + vp9/encoder/vp9_rd.c | 1 + vp9/encoder/vp9_rdopt.c | 1 + vp9/encoder/vp9_resize.c | 1 + vp9/encoder/vp9_ssim.c | 1 + vp9/encoder/vp9_temporal_filter.c | 1 + vp9/encoder/x86/vp9_highbd_quantize_intrin_sse2.c | 1 + vp9/vp9_iface_common.h | 2 ++ vpx_dsp/sad.c | 8 +------- vpx_ports/mem.h | 12 ++++++++++++ vpx_scale/generic/yv12config.c | 4 +--- vpx_scale/generic/yv12extend.c | 1 + 48 files changed, 65 insertions(+), 39 deletions(-) diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc index 587b27a..48a8006 100644 --- a/test/dct16x16_test.cc +++ b/test/dct16x16_test.cc @@ -22,6 +22,7 @@ #include "vp9/common/vp9_entropy.h" #include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" +#include "vpx_ports/mem.h" using libvpx_test::ACMRandom; diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc index a962661..267dfb8 100644 --- a/test/dct32x32_test.cc +++ b/test/dct32x32_test.cc @@ -23,6 +23,7 @@ #include "vp9/common/vp9_entropy.h" #include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" +#include "vpx_ports/mem.h" using libvpx_test::ACMRandom; diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc index 610dbd4..064a5a6 100644 --- a/test/fdct4x4_test.cc +++ b/test/fdct4x4_test.cc @@ -22,6 +22,7 @@ #include "vp9/common/vp9_entropy.h" #include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" +#include "vpx_ports/mem.h" using libvpx_test::ACMRandom; diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc index 795a608..6f78ffc 100644 --- a/test/fdct8x8_test.cc +++ b/test/fdct8x8_test.cc @@ -22,6 +22,7 @@ #include "vp9/common/vp9_entropy.h" #include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" +#include "vpx_ports/mem.h" const int kNumCoeffs = 64; const double kPi = 3.141592653589793238462643383279502884; diff --git a/test/sad_test.cc b/test/sad_test.cc index 6c28edb..001d21d 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -16,22 +16,7 @@ #include "./vpx_config.h" #include "./vpx_dsp_rtcd.h" #include "vpx_mem/vpx_mem.h" - -/* Needed for ROUND_POWER_OF_TWO and CONVERT_TO* macros, both of which should be - * moved to a more generic location. Alternatively the *avg functions could be - * restricted to VP9 builds, but it would be better to avoid that sort of - * specificity. - * TODO(johannkoenig): move these macros to a common location. - */ -#if CONFIG_VP9_HIGHBITDEPTH -#include "vp9/common/vp9_common.h" -#endif // CONFIG_VP9_HIGHBITDEPTH - -#ifndef ROUND_POWER_OF_TWO -#define ROUND_POWER_OF_TWO(value, n) \ - (((value) + (1 << ((n) - 1))) >> (n)) -#endif // ROUND_POWER_OF_TWO - +#include "vpx_ports/mem.h" #include "test/acm_random.h" #include "test/clear_system_state.h" diff --git a/test/variance_test.cc b/test/variance_test.cc index a8dd7de..e4e27af 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc @@ -20,6 +20,7 @@ #include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #if CONFIG_VP8_ENCODER # include "./vp8_rtcd.h" # include "vp8/common/variance.h" diff --git a/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.c b/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.c index 3c8c6a9..0233877 100644 --- a/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.c +++ b/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.c @@ -9,6 +9,8 @@ */ #include + +#include "vpx_ports/mem.h" #include "vp9/common/vp9_idct.h" void vp9_idct16x16_1_add_neon( diff --git a/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.c b/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.c index d0e4b4f..0ce45f2 100644 --- a/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.c +++ b/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.c @@ -9,10 +9,12 @@ */ #include -#include "vp9/common/vp9_idct.h" #include "./vpx_config.h" +#include "vpx_ports/mem.h" +#include "vp9/common/vp9_idct.h" + static INLINE void LD_16x8( uint8_t *d, int d_stride, diff --git a/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.c b/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.c index 7c8a930..f045735 100644 --- a/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.c +++ b/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.c @@ -9,6 +9,8 @@ */ #include + +#include "vpx_ports/mem.h" #include "vp9/common/vp9_idct.h" void vp9_idct4x4_1_add_neon( diff --git a/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.c b/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.c index 24c29fb..5369697 100644 --- a/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.c +++ b/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.c @@ -9,6 +9,8 @@ */ #include + +#include "vpx_ports/mem.h" #include "vp9/common/vp9_idct.h" void vp9_idct8x8_1_add_neon( diff --git a/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c b/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c index 19c582f..202d913 100644 --- a/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c +++ b/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c @@ -13,6 +13,7 @@ #include "./vpx_config.h" #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" diff --git a/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c b/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c index 132d88c..7ceebb6 100644 --- a/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c +++ b/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c @@ -12,6 +12,7 @@ #include "./vpx_config.h" #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" diff --git a/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c b/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c index 1990348..280190a 100644 --- a/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c +++ b/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c @@ -13,6 +13,7 @@ #include "./vpx_config.h" #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" diff --git a/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c b/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c index fc44ffa..04d2266 100644 --- a/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c +++ b/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c @@ -13,6 +13,7 @@ #include "./vpx_config.h" #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" diff --git a/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h b/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h index 008cf8c..675db65 100644 --- a/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h +++ b/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h @@ -14,6 +14,7 @@ #include #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_onyxc_int.h" diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h index d06b8e0..9c2d779 100644 --- a/vp9/common/vp9_common.h +++ b/vp9/common/vp9_common.h @@ -27,12 +27,6 @@ extern "C" { #define MIN(x, y) (((x) < (y)) ? (x) : (y)) #define MAX(x, y) (((x) > (y)) ? (x) : (y)) -#define ROUND_POWER_OF_TWO(value, n) \ - (((value) + (1 << ((n) - 1))) >> (n)) - -#define ALIGN_POWER_OF_TWO(value, n) \ - (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) - // Only need this for fixed-size arrays, for structs just assign. #define vp9_copy(dest, src) { \ assert(sizeof(dest) == sizeof(src)); \ @@ -83,9 +77,6 @@ static INLINE uint16_t clip_pixel_highbd(int val, int bd) { typedef int64_t tran_high_t; typedef int32_t tran_low_t; -#define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) -#define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) - #else // Note: diff --git a/vp9/common/vp9_idct.c b/vp9/common/vp9_idct.c index 3b21437..174b96e 100644 --- a/vp9/common/vp9_idct.c +++ b/vp9/common/vp9_idct.c @@ -11,6 +11,7 @@ #include #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" #include "vp9/common/vp9_systemdependent.h" diff --git a/vp9/common/vp9_idct.h b/vp9/common/vp9_idct.h index 6e2551d..cee1682 100644 --- a/vp9/common/vp9_idct.h +++ b/vp9/common/vp9_idct.h @@ -14,6 +14,7 @@ #include #include "./vpx_config.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_enums.h" diff --git a/vp9/common/vp9_loopfilter.c b/vp9/common/vp9_loopfilter.c index 69d393e..484e457 100644 --- a/vp9/common/vp9_loopfilter.c +++ b/vp9/common/vp9_loopfilter.c @@ -13,6 +13,7 @@ #include "vp9/common/vp9_onyxc_int.h" #include "vp9/common/vp9_reconinter.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_seg_common.h" diff --git a/vp9/common/vp9_loopfilter_filters.c b/vp9/common/vp9_loopfilter_filters.c index 2e32c40..3cf4c32 100644 --- a/vp9/common/vp9_loopfilter_filters.c +++ b/vp9/common/vp9_loopfilter_filters.c @@ -9,6 +9,7 @@ */ #include "./vpx_config.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_loopfilter.h" #include "vp9/common/vp9_onyxc_int.h" diff --git a/vp9/common/vp9_postproc.c b/vp9/common/vp9_postproc.c index 983a474..d26a6eb 100644 --- a/vp9/common/vp9_postproc.c +++ b/vp9/common/vp9_postproc.c @@ -16,12 +16,10 @@ #include "./vpx_scale_rtcd.h" #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vpx_scale/vpx_scale.h" #include "vpx_scale/yv12config.h" -#if CONFIG_VP9_HIGHBITDEPTH -#include "vp9/common/vp9_common.h" -#endif #include "vp9/common/vp9_onyxc_int.h" #include "vp9/common/vp9_postproc.h" #include "vp9/common/vp9_systemdependent.h" diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c index d1a6474..650310d 100644 --- a/vp9/common/vp9_reconintra.c +++ b/vp9/common/vp9_reconintra.c @@ -12,6 +12,7 @@ #include "./vp9_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vpx_ports/vpx_once.h" #include "vp9/common/vp9_reconintra.h" diff --git a/vp9/common/x86/vp9_high_loopfilter_intrin_sse2.c b/vp9/common/x86/vp9_high_loopfilter_intrin_sse2.c index 1637f0e..b40669c 100644 --- a/vp9/common/x86/vp9_high_loopfilter_intrin_sse2.c +++ b/vp9/common/x86/vp9_high_loopfilter_intrin_sse2.c @@ -11,6 +11,7 @@ #include // SSE2 #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_loopfilter.h" #include "vpx_ports/emmintrin_compat.h" diff --git a/vp9/common/x86/vp9_idct_intrin_sse2.c b/vp9/common/x86/vp9_idct_intrin_sse2.c index 0385c79..6ad7c62 100644 --- a/vp9/common/x86/vp9_idct_intrin_sse2.c +++ b/vp9/common/x86/vp9_idct_intrin_sse2.c @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "vpx_ports/mem.h" #include "vp9/common/x86/vp9_idct_intrin_sse2.h" #include "vp9/common/vp9_idct.h" diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index feea459..7391dc1 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -15,6 +15,7 @@ #include "./vpx_scale_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vpx_ports/mem_ops.h" #include "vpx_scale/vpx_scale.h" diff --git a/vp9/encoder/vp9_aq_variance.c b/vp9/encoder/vp9_aq_variance.c index be6f7e4..55c9649 100644 --- a/vp9/encoder/vp9_aq_variance.c +++ b/vp9/encoder/vp9_aq_variance.c @@ -10,6 +10,8 @@ #include +#include "vpx_ports/mem.h" + #include "vp9/encoder/vp9_aq_variance.h" #include "vp9/common/vp9_seg_common.h" diff --git a/vp9/encoder/vp9_dct.c b/vp9/encoder/vp9_dct.c index 9e6ca3d..414d2bb 100644 --- a/vp9/encoder/vp9_dct.c +++ b/vp9/encoder/vp9_dct.c @@ -14,6 +14,7 @@ #include "./vpx_config.h" #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" #include "vp9/common/vp9_systemdependent.h" diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 0e74784..3c490f8 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -15,6 +15,7 @@ #include "./vp9_rtcd.h" #include "./vpx_config.h" +#include "vpx_ports/mem.h" #include "vpx_ports/vpx_timer.h" #include "vp9/common/vp9_common.h" diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 9a4e61e..b115e0e 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -13,6 +13,7 @@ #include "./vpx_config.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_idct.h" #include "vp9/common/vp9_reconinter.h" diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 5d500e9..dff05f5 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -17,6 +17,7 @@ #include "./vpx_dsp_rtcd.h" #include "./vpx_scale_rtcd.h" #include "vpx/internal/vpx_psnr.h" +#include "vpx_ports/mem.h" #include "vpx_ports/vpx_timer.h" #include "vp9/common/vp9_alloccommon.h" diff --git a/vp9/encoder/vp9_extend.c b/vp9/encoder/vp9_extend.c index 96f3598..6e1ed36 100644 --- a/vp9/encoder/vp9_extend.c +++ b/vp9/encoder/vp9_extend.c @@ -9,6 +9,7 @@ */ #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/encoder/vp9_extend.h" diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 9752668..9da4fc4 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -15,6 +15,7 @@ #include "./vpx_scale_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vpx_scale/vpx_scale.h" #include "vpx_scale/yv12config.h" diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 80c509a..8bdd428 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -15,6 +15,7 @@ #include "./vpx_config.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" diff --git a/vp9/encoder/vp9_picklpf.c b/vp9/encoder/vp9_picklpf.c index 5eb5d54..8e19103 100644 --- a/vp9/encoder/vp9_picklpf.c +++ b/vp9/encoder/vp9_picklpf.c @@ -14,6 +14,7 @@ #include "./vpx_scale_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_loopfilter.h" #include "vp9/common/vp9_onyxc_int.h" diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 9fb7cfb..03e0eca 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -16,6 +16,7 @@ #include "./vp9_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_common.h" diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index 3c07e2c..db5460b 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -11,6 +11,7 @@ #include #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_quant_common.h" #include "vp9/common/vp9_seg_common.h" diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 7ddb635..47932db 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -16,6 +16,7 @@ #include #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_alloccommon.h" #include "vp9/encoder/vp9_aq_cyclicrefresh.h" diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c index 194001c..9fa7b9d 100644 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@ -15,6 +15,7 @@ #include "./vp9_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_entropy.h" diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 7382562..6eb8f6c 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -14,6 +14,7 @@ #include "./vp9_rtcd.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_entropy.h" diff --git a/vp9/encoder/vp9_resize.c b/vp9/encoder/vp9_resize.c index 2ebdff2..a3cf954 100644 --- a/vp9/encoder/vp9_resize.c +++ b/vp9/encoder/vp9_resize.c @@ -15,6 +15,7 @@ #include #include +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #include "vp9/encoder/vp9_resize.h" diff --git a/vp9/encoder/vp9_ssim.c b/vp9/encoder/vp9_ssim.c index 88db5dd..172de5d 100644 --- a/vp9/encoder/vp9_ssim.c +++ b/vp9/encoder/vp9_ssim.c @@ -10,6 +10,7 @@ #include #include "./vp9_rtcd.h" +#include "vpx_ports/mem.h" #include "vp9/encoder/vp9_ssim.h" void vp9_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r, diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index d7979ab..0fe5312 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -24,6 +24,7 @@ #include "vp9/encoder/vp9_ratectrl.h" #include "vp9/encoder/vp9_segmentation.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vpx_ports/vpx_timer.h" #include "vpx_scale/vpx_scale.h" diff --git a/vp9/encoder/x86/vp9_highbd_quantize_intrin_sse2.c b/vp9/encoder/x86/vp9_highbd_quantize_intrin_sse2.c index ffa43b6..cbdd1c9 100644 --- a/vp9/encoder/x86/vp9_highbd_quantize_intrin_sse2.c +++ b/vp9/encoder/x86/vp9_highbd_quantize_intrin_sse2.c @@ -10,6 +10,7 @@ #include +#include "vpx_ports/mem.h" #include "vp9/common/vp9_common.h" #if CONFIG_VP9_HIGHBITDEPTH diff --git a/vp9/vp9_iface_common.h b/vp9/vp9_iface_common.h index e585aa1..58bb7d5 100644 --- a/vp9/vp9_iface_common.h +++ b/vp9/vp9_iface_common.h @@ -10,6 +10,8 @@ #ifndef VP9_VP9_IFACE_COMMON_H_ #define VP9_VP9_IFACE_COMMON_H_ +#include "vpx_ports/mem.h" + static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12, void *user_priv) { /** vpx_img_wrap() doesn't allow specifying independent strides for diff --git a/vpx_dsp/sad.c b/vpx_dsp/sad.c index 9db312f..9783e43 100644 --- a/vpx_dsp/sad.c +++ b/vpx_dsp/sad.c @@ -14,13 +14,7 @@ #include "./vpx_dsp_rtcd.h" #include "vpx/vpx_integer.h" - -#if CONFIG_VP9_HIGHBITDEPTH -#include "vp9/common/vp9_common.h" -#endif // CONFIG_VP9_HIGHBITDEPTH -// Temporary ... -#define ROUND_POWER_OF_TWO(value, n) \ - (((value) + (1 << ((n) - 1))) >> (n)) +#include "vpx_ports/mem.h" /* Sum the difference between every corresponding element of the buffers. */ static INLINE unsigned int sad(const uint8_t *a, int a_stride, diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h index 0106a45..7502f90 100644 --- a/vpx_ports/mem.h +++ b/vpx_ports/mem.h @@ -38,4 +38,16 @@ #define __builtin_prefetch(x) #endif +/* Shift down with rounding */ +#define ROUND_POWER_OF_TWO(value, n) \ + (((value) + (1 << ((n) - 1))) >> (n)) + +#define ALIGN_POWER_OF_TWO(value, n) \ + (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) + +#if CONFIG_VP9_HIGHBITDEPTH +#define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) +#define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1)) +#endif // CONFIG_VP9_HIGHBITDEPTH + #endif // VPX_PORTS_MEM_H_ diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c index 169c2ab..7582792 100644 --- a/vpx_scale/generic/yv12config.c +++ b/vpx_scale/generic/yv12config.c @@ -12,9 +12,7 @@ #include "vpx_scale/yv12config.h" #include "vpx_mem/vpx_mem.h" -#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH -#include "vp9/common/vp9_common.h" -#endif +#include "vpx_ports/mem.h" /**************************************************************************** * Exports diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c index 6214a12..13ee3e9 100644 --- a/vpx_scale/generic/yv12extend.c +++ b/vpx_scale/generic/yv12extend.c @@ -12,6 +12,7 @@ #include "./vpx_config.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vpx_scale/yv12config.h" #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH #include "vp9/common/vp9_common.h" -- 2.7.4