RTCD: add motion search functions This commit continues the process of converting to the new RTCD system. Change-Id: Ia5828b7ecc80db55b21916704aa3d54cbb98f625
diff --git a/vp8/common/mv.h b/vp8/common/mv.h index 35c4fe9..b3f919d 100644 --- a/vp8/common/mv.h +++ b/vp8/common/mv.h
@@ -19,7 +19,7 @@ short col; } MV; -typedef union +typedef union int_mv { uint32_t as_int; MV as_mv;
diff --git a/vp8/common/rtcd_defs.sh b/vp8/common/rtcd_defs.sh index 1bdddc1..e18ca97 100644 --- a/vp8/common/rtcd_defs.sh +++ b/vp8/common/rtcd_defs.sh
@@ -7,6 +7,8 @@ /* Encoder forward decls */ struct block; struct macroblock; +struct variance_vtable; +union int_mv; EOF } forward_decls common_forward_decls @@ -464,5 +466,21 @@ specialize vp8_subtract_mbuv mmx sse2 media neon vp8_subtract_mbuv_media=vp8_subtract_mbuv_armv6 +# +# Motion search +# +prototype int vp8_full_search_sad "struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv" +specialize vp8_full_search_sad sse3 sse4_1 +vp8_full_search_sad_sse3=vp8_full_search_sadx3 +vp8_full_search_sad_sse4_1=vp8_full_search_sadx8 + +prototype int vp8_refining_search_sad "struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv" +specialize vp8_refining_search_sad sse3 +vp8_refining_search_sad_sse3=vp8_refining_search_sadx4 + +prototype int vp8_diamond_search_sad "struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv" +vp8_diamond_search_sad_sse3=vp8_diamond_search_sadx4 + + # End of encoder only functions fi
diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c index 7425dc2..1d6acca 100644 --- a/vp8/encoder/generic/csystemdependent.c +++ b/vp8/encoder/generic/csystemdependent.c
@@ -25,9 +25,6 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi) { #if CONFIG_RUNTIME_CPU_DETECT - 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; #if !(CONFIG_REALTIME_ONLY) cpi->rtcd.temporal.apply = vp8_temporal_filter_apply_c; #endif
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c index 735af95..dad89c3 100644 --- a/vp8/encoder/mcomp.c +++ b/vp8/encoder/mcomp.c
@@ -1009,7 +1009,7 @@ #undef CHECK_POINT #undef CHECK_BETTER -int vp8_diamond_search_sad +int vp8_diamond_search_sad_c ( MACROBLOCK *x, BLOCK *b, @@ -1292,7 +1292,7 @@ + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit); } -int vp8_full_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, +int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int sad_per_bit, int distance, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], int_mv *center_mv) @@ -1674,7 +1674,7 @@ return INT_MAX; } -int vp8_refining_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, +int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int error_per_bit, int search_range, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], int_mv *center_mv)
diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h index 416c4d5..e6ab164 100644 --- a/vp8/encoder/mcomp.h +++ b/vp8/encoder/mcomp.h
@@ -50,98 +50,51 @@ (MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv, int_mv *ref_mv, int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2], int *distortion, unsigned int *sse); + extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively; extern fractional_mv_step_fp vp8_find_best_sub_pixel_step; extern fractional_mv_step_fp vp8_find_best_half_pixel_step; extern fractional_mv_step_fp vp8_skip_fractional_mv_step; -#define prototype_full_search_sad(sym)\ - int (sym)\ - (\ - MACROBLOCK *x, \ - BLOCK *b, \ - BLOCKD *d, \ - int_mv *ref_mv, \ - int sad_per_bit, \ - int distance, \ - vp8_variance_fn_ptr_t *fn_ptr, \ - int *mvcost[2], \ - int_mv *center_mv \ - ) +typedef int (*vp8_full_search_fn_t) + ( + MACROBLOCK *x, + BLOCK *b, + BLOCKD *d, + int_mv *ref_mv, + int sad_per_bit, + int distance, + vp8_variance_fn_ptr_t *fn_ptr, + int *mvcost[2], + int_mv *center_mv + ); -#define prototype_refining_search_sad(sym)\ - int (sym)\ - (\ - MACROBLOCK *x, \ - BLOCK *b, \ - BLOCKD *d, \ - int_mv *ref_mv, \ - int sad_per_bit, \ - int distance, \ - vp8_variance_fn_ptr_t *fn_ptr, \ - int *mvcost[2], \ - int_mv *center_mv \ - ) +typedef int (*vp8_refining_search_fn_t) + ( + MACROBLOCK *x, + BLOCK *b, + BLOCKD *d, + int_mv *ref_mv, + int sad_per_bit, + int distance, + vp8_variance_fn_ptr_t *fn_ptr, + int *mvcost[2], + int_mv *center_mv + ); -#define prototype_diamond_search_sad(sym)\ - int (sym)\ - (\ - MACROBLOCK *x, \ - BLOCK *b, \ - BLOCKD *d, \ - int_mv *ref_mv, \ - int_mv *best_mv, \ - int search_param, \ - int sad_per_bit, \ - int *num00, \ - vp8_variance_fn_ptr_t *fn_ptr, \ - int *mvcost[2], \ - int_mv *center_mv \ - ) - -#if ARCH_X86 || ARCH_X86_64 -#include "x86/mcomp_x86.h" -#endif - -typedef prototype_full_search_sad(*vp8_full_search_fn_t); -extern prototype_full_search_sad(vp8_full_search_sad); -extern prototype_full_search_sad(vp8_full_search_sadx3); -extern prototype_full_search_sad(vp8_full_search_sadx8); - -typedef prototype_refining_search_sad(*vp8_refining_search_fn_t); -extern prototype_refining_search_sad(vp8_refining_search_sad); -extern prototype_refining_search_sad(vp8_refining_search_sadx4); - -typedef prototype_diamond_search_sad(*vp8_diamond_search_fn_t); -extern prototype_diamond_search_sad(vp8_diamond_search_sad); -extern prototype_diamond_search_sad(vp8_diamond_search_sadx4); - -#ifndef vp8_search_full_search -#define vp8_search_full_search vp8_full_search_sad -#endif -extern prototype_full_search_sad(vp8_search_full_search); - -#ifndef vp8_search_refining_search -#define vp8_search_refining_search vp8_refining_search_sad -#endif -extern prototype_refining_search_sad(vp8_search_refining_search); - -#ifndef vp8_search_diamond_search -#define vp8_search_diamond_search vp8_diamond_search_sad -#endif -extern prototype_diamond_search_sad(vp8_search_diamond_search); - -typedef struct -{ - prototype_full_search_sad(*full_search); - prototype_refining_search_sad(*refining_search); - prototype_diamond_search_sad(*diamond_search); -} vp8_search_rtcd_vtable_t; - -#if CONFIG_RUNTIME_CPU_DETECT -#define SEARCH_INVOKE(ctx,fn) (ctx)->fn -#else -#define SEARCH_INVOKE(ctx,fn) vp8_search_##fn -#endif +typedef int (*vp8_diamond_search_fn_t) + ( + MACROBLOCK *x, + BLOCK *b, + BLOCKD *d, + int_mv *ref_mv, + int_mv *best_mv, + int search_param, + int sad_per_bit, + int *num00, + vp8_variance_fn_ptr_t *fn_ptr, + int *mvcost[2], + int_mv *center_mv + ); #endif
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 5e6b57b..b02d378 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c
@@ -1997,9 +1997,9 @@ cpi->fn_ptr[BLOCK_4X4].copymem = vp8_copy32xn; #endif - cpi->full_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, full_search); - cpi->diamond_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, diamond_search); - cpi->refining_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, refining_search); + cpi->full_search_sad = vp8_full_search_sad; + cpi->diamond_search_sad = vp8_diamond_search_sad; + cpi->refining_search_sad = vp8_refining_search_sad; // make sure frame 1 is okay cpi->error_bins[0] = cpi->common.MBs;
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index d514d75..f91e6df 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h
@@ -223,7 +223,6 @@ typedef struct VP8_ENCODER_RTCD { - vp8_search_rtcd_vtable_t search; vp8_temporal_rtcd_vtable_t temporal; } VP8_ENCODER_RTCD;
diff --git a/vp8/encoder/variance.h b/vp8/encoder/variance.h index e216a22..b77aa28 100644 --- a/vp8/encoder/variance.h +++ b/vp8/encoder/variance.h
@@ -96,7 +96,7 @@ int ref_stride ); -typedef struct +typedef struct variance_vtable { vp8_sad_fn_t sdf; vp8_variance_fn_t vf;
diff --git a/vp8/encoder/x86/mcomp_x86.h b/vp8/encoder/x86/mcomp_x86.h deleted file mode 100644 index efe7241..0000000 --- a/vp8/encoder/x86/mcomp_x86.h +++ /dev/null
@@ -1,40 +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 MCOMP_X86_H -#define MCOMP_X86_H - -#if HAVE_SSE3 -#if !CONFIG_RUNTIME_CPU_DETECT - -#undef vp8_search_full_search -#define vp8_search_full_search vp8_full_search_sadx3 - -#undef vp8_search_refining_search -#define vp8_search_refining_search vp8_refining_search_sadx4 - -#undef vp8_search_diamond_search -#define vp8_search_diamond_search vp8_diamond_search_sadx4 - -#endif -#endif - -#if HAVE_SSE4_1 -#if !CONFIG_RUNTIME_CPU_DETECT - -#undef vp8_search_full_search -#define vp8_search_full_search vp8_full_search_sadx8 - -#endif -#endif - -#endif -
diff --git a/vp8/encoder/x86/x86_csystemdependent.c b/vp8/encoder/x86/x86_csystemdependent.c index fa628fa..4d27d5c 100644 --- a/vp8/encoder/x86/x86_csystemdependent.c +++ b/vp8/encoder/x86/x86_csystemdependent.c
@@ -135,21 +135,5 @@ } #endif -#if HAVE_SSE3 - if (flags & HAS_SSE3) - { - cpi->rtcd.search.full_search = vp8_full_search_sadx3; - cpi->rtcd.search.diamond_search = vp8_diamond_search_sadx4; - cpi->rtcd.search.refining_search = vp8_refining_search_sadx4; - } -#endif - -#if HAVE_SSE4_1 - if (flags & HAS_SSE4_1) - { - cpi->rtcd.search.full_search = vp8_full_search_sadx8; - } -#endif - #endif }
diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk index febb7ef..8de4066 100644 --- a/vp8/vp8cx.mk +++ b/vp8/vp8cx.mk
@@ -93,7 +93,6 @@ VP8_CX_SRCS_REMOVE-yes += encoder/temporal_filter.c endif -VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/mcomp_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