ref: 0b0bc8d098a6c009b27357a68275ec25af18e7a4
parent: be8af188d025eb24426757952ca8756a9b6353ea
author: John Koleszar <jkoleszar@google.com>
date: Thu Jan 12 11:55:44 EST 2012
RTCD: add motion search functions This commit continues the process of converting to the new RTCD system. Change-Id: Ia5828b7ecc80db55b21916704aa3d54cbb98f625
--- 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;
--- 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
@@ -463,6 +465,22 @@
prototype void vp8_subtract_mbuv "short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride"
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
--- 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
--- 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)
--- 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
--- 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;
--- 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;
--- 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;
--- a/vp8/encoder/x86/mcomp_x86.h
+++ /dev/null
@@ -1,40 +1,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
-
--- 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
}
--- 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