From 61311e61039c300ae872ccba22304e9e60dc0205 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Thu, 12 Jan 2012 16:55:44 -0800 Subject: [PATCH] RTCD: add quantizer functions This commit continues the process of converting to the new RTCD system. Change-Id: Iba9df4c03a508e51c37201c621be43523fae87d9 --- vp8/common/reconintra4x4.h | 4 +- vp8/common/rtcd_defs.sh | 30 +++++++++++ vp8/encoder/arm/arm_csystemdependent.c | 8 --- vp8/encoder/arm/quantize_arm.c | 4 +- vp8/encoder/arm/quantize_arm.h | 52 ------------------ vp8/encoder/block.h | 4 +- vp8/encoder/encodeframe.c | 12 ++--- vp8/encoder/generic/csystemdependent.c | 4 -- vp8/encoder/onyx_if.c | 12 ++--- vp8/encoder/onyx_int.h | 1 - vp8/encoder/quantize.c | 6 +-- vp8/encoder/quantize.h | 75 ++------------------------ vp8/encoder/x86/quantize_x86.h | 67 ----------------------- vp8/encoder/x86/x86_csystemdependent.c | 16 +----- vp8/vp8cx.mk | 1 - vp8/vp8cx_arm.mk | 1 - 16 files changed, 53 insertions(+), 244 deletions(-) delete mode 100644 vp8/encoder/arm/quantize_arm.h delete mode 100644 vp8/encoder/x86/quantize_x86.h diff --git a/vp8/common/reconintra4x4.h b/vp8/common/reconintra4x4.h index 6ac2b7137..b528df6d5 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 24be8e1bf..952f3b58a 100644 --- a/vp8/common/rtcd_defs.sh +++ b/vp8/common/rtcd_defs.sh @@ -3,6 +3,10 @@ cat <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 6f3f70a0a..8999e347f 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 #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 ef6517bd8..000000000 --- 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 30dad8263..a43cff065 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 41da9abf5..2392f0220 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 279f87ddc..749bcc32b 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 5a13a625e..5e6b57b90 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 ad25897a9..8e7f99bda 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 d2aa7fe72..766d2b257 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 07b8813d1..d55496c5f 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 bbe475f8c..000000000 --- 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 b8205a3a4..9011ddfa3 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 c736a8cb1..1760e4b88 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 6b43b4b24..1fdb49377 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 -- 2.40.0