diff --git a/vp8/common/reconintra4x4.h b/vp8/common/reconintra4x4.h index 6ac2b71376dc21a1e96f81ba3c32882c2d9f55c9..b528df6d59bc017e748e15dab3f7030ee62379fe 100644 --- a/vp8/common/reconintra4x4.h +++ b/vp8/common/reconintra4x4.h @@ -12,6 +12,8 @@ #ifndef __INC_RECONINTRA4x4_H #define __INC_RECONINTRA4x4_H -extern void vp8_intra_prediction_down_copy(MACROBLOCKD *x); +struct macroblockd; + +extern void vp8_intra_prediction_down_copy(struct macroblockd *x); #endif diff --git a/vp8/common/rtcd_defs.sh b/vp8/common/rtcd_defs.sh index 24be8e1bff6f21c44fc0e0605beff9a7b6466c1d..952f3b58a4b1db46db2394ed391a3d04cc25af59 100644 --- a/vp8/common/rtcd_defs.sh +++ b/vp8/common/rtcd_defs.sh @@ -3,6 +3,10 @@ cat <<EOF struct blockd; struct macroblockd; struct loop_filter_info; + +/* Encoder forward decls */ +struct block; +struct macroblock; EOF } forward_decls common_forward_decls @@ -407,5 +411,31 @@ prototype void vp8_short_walsh4x4 "short *input, short *output, int pitch" specialize vp8_short_walsh4x4 mmx sse2 media neon vp8_short_walsh4x4_media=vp8_short_walsh4x4_armv6 +# +# Quantizer +# +prototype void vp8_regular_quantize_b "struct block *, struct blockd *" +specialize vp8_regular_quantize_b sse2 sse4_1 +vp8_regular_quantize_b_sse4_1=vp8_regular_quantize_b_sse4 + +prototype void vp8_fast_quantize_b "struct block *, struct blockd *" +specialize vp8_fast_quantize_b sse2 ssse3 media neon +vp8_fast_quantize_b_media=vp8_fast_quantize_b_armv6 + +prototype void vp8_regular_quantize_b_pair "struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2" +# no asm yet + +prototype void vp8_fast_quantize_b_pair "struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2" +specialize vp8_fast_quantize_b_pair neon + +prototype void vp8_quantize_mb "struct macroblock *" +specialize vp8_quantize_mb neon + +prototype void vp8_quantize_mby "struct macroblock *" +specialize vp8_quantize_mby neon + +prototype void vp8_quantize_mbuv "struct macroblock *" +specialize vp8_quantize_mbuv neon + # End of encoder only functions fi diff --git a/vp8/encoder/arm/arm_csystemdependent.c b/vp8/encoder/arm/arm_csystemdependent.c index 6968e13dbfbde814c6376b14bc48d309c82ef602..2d7c959a677b6232184aa27b09d102a6cb2b9068 100644 --- a/vp8/encoder/arm/arm_csystemdependent.c +++ b/vp8/encoder/arm/arm_csystemdependent.c @@ -38,9 +38,6 @@ void vp8_arch_arm_encoder_init(VP8_COMP *cpi) cpi->rtcd.encodemb.subb = vp8_subtract_b_armv6; cpi->rtcd.encodemb.submby = vp8_subtract_mby_armv6; cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_armv6; - - /*cpi->rtcd.quantize.quantb = vp8_regular_quantize_b;*/ - cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_armv6; } #endif /* HAVE_MEDIA */ @@ -53,11 +50,6 @@ void vp8_arch_arm_encoder_init(VP8_COMP *cpi) cpi->rtcd.encodemb.subb = vp8_subtract_b_neon; cpi->rtcd.encodemb.submby = vp8_subtract_mby_neon; cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_neon; - - /*cpi->rtcd.quantize.quantb = vp8_regular_quantize_b; - cpi->rtcd.quantize.quantb_pair = vp8_regular_quantize_b_pair;*/ - cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_neon; - cpi->rtcd.quantize.fastquantb_pair = vp8_fast_quantize_b_pair_neon; } #endif /* HAVE_NEON */ #endif /* CONFIG_RUNTIME_CPU_DETECT */ diff --git a/vp8/encoder/arm/quantize_arm.c b/vp8/encoder/arm/quantize_arm.c index 6f3f70a0a6f905e4a6f747f12f8b2417497ea507..8999e347fc69fb93c6ea7e8521c44385b7296118 100644 --- a/vp8/encoder/arm/quantize_arm.c +++ b/vp8/encoder/arm/quantize_arm.c @@ -9,9 +9,11 @@ */ +#include "vpx_config.h" +#include "vpx_rtcd.h" +#include "vp8/encoder/block.h" #include <math.h> #include "vpx_mem/vpx_mem.h" - #include "vp8/encoder/quantize.h" #include "vp8/common/entropy.h" diff --git a/vp8/encoder/arm/quantize_arm.h b/vp8/encoder/arm/quantize_arm.h deleted file mode 100644 index ef6517bd88fc59a6716f324e201a1044636edac6..0000000000000000000000000000000000000000 --- a/vp8/encoder/arm/quantize_arm.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef QUANTIZE_ARM_H -#define QUANTIZE_ARM_H - -#if HAVE_MEDIA - -extern prototype_quantize_block(vp8_fast_quantize_b_armv6); - -#if !CONFIG_RUNTIME_CPU_DETECT -#undef vp8_quantize_fastquantb -#define vp8_quantize_fastquantb vp8_fast_quantize_b_armv6 -#endif - -#endif /* HAVE_MEDIA */ - - -#if HAVE_NEON - -extern prototype_quantize_block(vp8_fast_quantize_b_neon); -extern prototype_quantize_block_pair(vp8_fast_quantize_b_pair_neon); - -#if !CONFIG_RUNTIME_CPU_DETECT -#undef vp8_quantize_fastquantb -#define vp8_quantize_fastquantb vp8_fast_quantize_b_neon - -#undef vp8_quantize_fastquantb_pair -#define vp8_quantize_fastquantb_pair vp8_fast_quantize_b_pair_neon - -#undef vp8_quantize_mb -#define vp8_quantize_mb vp8_quantize_mb_neon - -#undef vp8_quantize_mbuv -#define vp8_quantize_mbuv vp8_quantize_mbuv_neon - -#undef vp8_quantize_mby -#define vp8_quantize_mby vp8_quantize_mby_neon -#endif - -#endif /* HAVE_NEON */ - -#endif - diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index 30dad8263eef3912e92cae72e8fb700857965675..a43cff065d145c5287fff69787f00220ed741bda 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -25,7 +25,7 @@ typedef struct int offset; } search_site; -typedef struct +typedef struct block { // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries short *src_diff; @@ -57,7 +57,7 @@ typedef struct } bmi[16]; } PARTITION_INFO; -typedef struct +typedef struct macroblock { DECLARE_ALIGNED(16, short, src_diff[400]); // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y DECLARE_ALIGNED(16, short, coeff[400]); // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 41da9abf5ccb2e163071f65834192f85012c6a85..2392f0220801b13d3c561ead1204ab18983ff833 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -1147,10 +1147,8 @@ int vp8cx_encode_inter_macroblock /* Are we using the fast quantizer for the mode selection? */ if(cpi->sf.use_fastquant_for_pick) { - cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - fastquantb); - cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - fastquantb_pair); + cpi->mb.quantize_b = vp8_fast_quantize_b; + cpi->mb.quantize_b_pair = vp8_fast_quantize_b_pair; /* the fast quantizer does not use zbin_extra, so * do not recalculate */ @@ -1162,10 +1160,8 @@ int vp8cx_encode_inter_macroblock /* switch back to the regular quantizer for the encode */ if (cpi->sf.improved_quant) { - cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - quantb); - cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - quantb_pair); + cpi->mb.quantize_b = vp8_regular_quantize_b; + cpi->mb.quantize_b_pair = vp8_regular_quantize_b_pair; } /* restore cpi->zbin_mode_boost_enabled */ diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c index 279f87ddc27d4cc57d9f15210c1e9857d1c2190a..749bcc32b9c972ab784cb05f36ee93fea87c95f4 100644 --- a/vp8/encoder/generic/csystemdependent.c +++ b/vp8/encoder/generic/csystemdependent.c @@ -32,10 +32,6 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi) cpi->rtcd.encodemb.submby = vp8_subtract_mby_c; cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_c; - cpi->rtcd.quantize.quantb = vp8_regular_quantize_b; - cpi->rtcd.quantize.quantb_pair = vp8_regular_quantize_b_pair; - cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_c; - cpi->rtcd.quantize.fastquantb_pair = vp8_fast_quantize_b_pair_c; cpi->rtcd.search.full_search = vp8_full_search_sad; cpi->rtcd.search.refining_search = vp8_refining_search_sad; cpi->rtcd.search.diamond_search = vp8_diamond_search_sad; diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 5a13a625ec0b288f08b113964b692f48deb077b4..5e6b57b90a98660a0a07de54fa4744b7c89354bf 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -990,17 +990,13 @@ void vp8_set_speed_features(VP8_COMP *cpi) if (cpi->sf.improved_quant) { - cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - quantb); - cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - quantb_pair); + cpi->mb.quantize_b = vp8_regular_quantize_b; + cpi->mb.quantize_b_pair = vp8_regular_quantize_b_pair; } else { - cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - fastquantb); - cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize, - fastquantb_pair); + cpi->mb.quantize_b = vp8_fast_quantize_b; + cpi->mb.quantize_b_pair = vp8_fast_quantize_b_pair; } if (cpi->sf.improved_quant != last_improved_quant) vp8cx_init_quantizer(cpi); diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index ad25897a9938d86ac78732bb5d24aabb6cd8c8a1..8e7f99bda9b385d510149eca0edd4dcccb56a438 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -224,7 +224,6 @@ typedef struct typedef struct VP8_ENCODER_RTCD { vp8_encodemb_rtcd_vtable_t encodemb; - vp8_quantize_rtcd_vtable_t quantize; vp8_search_rtcd_vtable_t search; vp8_temporal_rtcd_vtable_t temporal; } VP8_ENCODER_RTCD; diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index d2aa7fe7244ecdc7be7078c8f4730b86d264c8a7..766d2b2579bd23947d47e15d5557f9c904644d39 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -103,7 +103,7 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) #endif #ifdef EXACT_QUANT -void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) +void vp8_regular_quantize_b_c(BLOCK *b, BLOCKD *d) { int i, rc, eob; int zbin; @@ -156,7 +156,7 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) } /* Perform regular quantization, with unbiased rounding and no zero bin. */ -void vp8_strict_quantize_b(BLOCK *b, BLOCKD *d) +void vp8_strict_quantize_b_c(BLOCK *b, BLOCKD *d) { int i; int rc; @@ -215,7 +215,7 @@ void vp8_strict_quantize_b(BLOCK *b, BLOCKD *d) #else -void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) +void vp8_regular_quantize_b_c(BLOCK *b, BLOCKD *d) { int i, rc, eob; int zbin; diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h index 07b8813d1a7c4e07d1ee29add97ff9ea9fbdc4d8..d55496c5ffe5ff0ebb24634e6a825af4e0ec7e94 100644 --- a/vp8/encoder/quantize.h +++ b/vp8/encoder/quantize.h @@ -12,81 +12,12 @@ #ifndef __INC_QUANTIZE_H #define __INC_QUANTIZE_H -#include "block.h" - -#define prototype_quantize_block(sym) \ - void (sym)(BLOCK *b,BLOCKD *d) - -#define prototype_quantize_block_pair(sym) \ - void (sym)(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2) - -#define prototype_quantize_mb(sym) \ - void (sym)(MACROBLOCK *x) - -#if ARCH_X86 || ARCH_X86_64 -#include "x86/quantize_x86.h" -#endif - -#if ARCH_ARM -#include "arm/quantize_arm.h" -#endif - -#ifndef vp8_quantize_quantb -#define vp8_quantize_quantb vp8_regular_quantize_b -#endif -extern prototype_quantize_block(vp8_quantize_quantb); - -#ifndef vp8_quantize_quantb_pair -#define vp8_quantize_quantb_pair vp8_regular_quantize_b_pair -#endif -extern prototype_quantize_block_pair(vp8_quantize_quantb_pair); - -#ifndef vp8_quantize_fastquantb -#define vp8_quantize_fastquantb vp8_fast_quantize_b_c -#endif -extern prototype_quantize_block(vp8_quantize_fastquantb); - -#ifndef vp8_quantize_fastquantb_pair -#define vp8_quantize_fastquantb_pair vp8_fast_quantize_b_pair_c -#endif -extern prototype_quantize_block_pair(vp8_quantize_fastquantb_pair); - -typedef struct -{ - prototype_quantize_block(*quantb); - prototype_quantize_block_pair(*quantb_pair); - prototype_quantize_block(*fastquantb); - prototype_quantize_block_pair(*fastquantb_pair); -} vp8_quantize_rtcd_vtable_t; - -#ifndef vp8_quantize_mb -#define vp8_quantize_mb vp8_quantize_mb_c -#endif -extern prototype_quantize_mb(vp8_quantize_mb); - -#ifndef vp8_quantize_mbuv -#define vp8_quantize_mbuv vp8_quantize_mbuv_c -#endif -extern prototype_quantize_mb(vp8_quantize_mbuv); - -#ifndef vp8_quantize_mby -#define vp8_quantize_mby vp8_quantize_mby_c -#endif -extern prototype_quantize_mb(vp8_quantize_mby); - -#if CONFIG_RUNTIME_CPU_DETECT -#define QUANTIZE_INVOKE(ctx,fn) (ctx)->fn -#else -#define QUANTIZE_INVOKE(ctx,fn) vp8_quantize_##fn -#endif - -extern void vp8_strict_quantize_b(BLOCK *b,BLOCKD *d); - struct VP8_COMP; +struct macroblock; extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q); extern void vp8cx_frame_init_quantizer(struct VP8_COMP *cpi); -extern void vp8_update_zbin_extra(struct VP8_COMP *cpi, MACROBLOCK *x); -extern void vp8cx_mb_init_quantizer(struct VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip); +extern void vp8_update_zbin_extra(struct VP8_COMP *cpi, struct macroblock *x); +extern void vp8cx_mb_init_quantizer(struct VP8_COMP *cpi, struct macroblock *x, int ok_to_skip); extern void vp8cx_init_quantizer(struct VP8_COMP *cpi); #endif diff --git a/vp8/encoder/x86/quantize_x86.h b/vp8/encoder/x86/quantize_x86.h deleted file mode 100644 index bbe475f8cc79065cc19566051bca5e2f67ee6be8..0000000000000000000000000000000000000000 --- a/vp8/encoder/x86/quantize_x86.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license and patent - * grant that can be found in the LICENSE file in the root of the source - * tree. All contributing project authors may be found in the AUTHORS - * file in the root of the source tree. - */ - -#ifndef QUANTIZE_X86_H -#define QUANTIZE_X86_H - - -/* Note: - * - * This platform is commonly built for runtime CPU detection. If you modify - * any of the function mappings present in this file, be sure to also update - * them in the function pointer initialization code - */ -#if HAVE_MMX - -#endif /* HAVE_MMX */ - - -#if HAVE_SSE2 -extern prototype_quantize_block(vp8_regular_quantize_b_sse2); -extern prototype_quantize_block(vp8_fast_quantize_b_sse2); - -#if !CONFIG_RUNTIME_CPU_DETECT - -#undef vp8_quantize_quantb -#define vp8_quantize_quantb vp8_regular_quantize_b_sse2 - -#undef vp8_quantize_fastquantb -#define vp8_quantize_fastquantb vp8_fast_quantize_b_sse2 - -#endif /* !CONFIG_RUNTIME_CPU_DETECT */ - -#endif /* HAVE_SSE2 */ - - -#if HAVE_SSSE3 -extern prototype_quantize_block(vp8_fast_quantize_b_ssse3); - -#if !CONFIG_RUNTIME_CPU_DETECT - -#undef vp8_quantize_fastquantb -#define vp8_quantize_fastquantb vp8_fast_quantize_b_ssse3 - -#endif /* !CONFIG_RUNTIME_CPU_DETECT */ - -#endif /* HAVE_SSSE3 */ - - -#if HAVE_SSE4_1 -extern prototype_quantize_block(vp8_regular_quantize_b_sse4); - -#if !CONFIG_RUNTIME_CPU_DETECT - -#undef vp8_quantize_quantb -#define vp8_quantize_quantb vp8_regular_quantize_b_sse4 - -#endif /* !CONFIG_RUNTIME_CPU_DETECT */ - -#endif /* HAVE_SSE4_1 */ - -#endif /* QUANTIZE_X86_H */ diff --git a/vp8/encoder/x86/x86_csystemdependent.c b/vp8/encoder/x86/x86_csystemdependent.c index b8205a3a4ac6e3619601a9790fd28d4a3ca881ea..9011ddfa3f3869c460e8b8703c4368e670b04575 100644 --- a/vp8/encoder/x86/x86_csystemdependent.c +++ b/vp8/encoder/x86/x86_csystemdependent.c @@ -10,6 +10,7 @@ #include "vpx_config.h" +#include "vpx_rtcd.h" #include "vpx_ports/x86.h" #include "vp8/encoder/variance.h" #include "vp8/encoder/onyx_int.h" @@ -147,10 +148,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi) cpi->rtcd.encodemb.subb = vp8_subtract_b_sse2; cpi->rtcd.encodemb.submby = vp8_subtract_mby_sse2; cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_sse2; - - cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse2; - cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_sse2; - #if !(CONFIG_REALTIME_ONLY) cpi->rtcd.temporal.apply = vp8_temporal_filter_apply_sse2; #endif @@ -167,21 +164,10 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi) } #endif -#if HAVE_SSSE3 - if (flags & HAS_SSSE3) - { - cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_ssse3; - } -#endif - - - #if HAVE_SSE4_1 if (flags & HAS_SSE4_1) { cpi->rtcd.search.full_search = vp8_full_search_sadx8; - - cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse4; } #endif diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk index c736a8cb19b9f9f28f8f5c09f9a1c4bf904aa354..1760e4b8849e62589a4831337877c689f58f96e3 100644 --- a/vp8/vp8cx.mk +++ b/vp8/vp8cx.mk @@ -95,7 +95,6 @@ endif VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/encodemb_x86.h VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/mcomp_x86.h -VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/quantize_x86.h VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/temporal_filter_x86.h VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/x86_csystemdependent.c VP8_CX_SRCS-$(HAVE_MMX) += encoder/x86/variance_mmx.c diff --git a/vp8/vp8cx_arm.mk b/vp8/vp8cx_arm.mk index 6b43b4b2422f6eb205a6522161bc3baa35bc3af6..1fdb493774dbe8b921bb88f95cea2d738cffea75 100644 --- a/vp8/vp8cx_arm.mk +++ b/vp8/vp8cx_arm.mk @@ -18,7 +18,6 @@ VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/arm_csystemdependent.c VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/dct_arm.c VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/encodemb_arm.h VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/quantize_arm.c -VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/quantize_arm.h VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/variance_arm.c #File list for edsp