Commit 0b0bc8d0 authored by John Koleszar's avatar John Koleszar

RTCD: add motion search functions

This commit continues the process of converting to the new RTCD
system.

Change-Id: Ia5828b7ecc80db55b21916704aa3d54cbb98f625
parent be8af188
......@@ -19,7 +19,7 @@ typedef struct
short col;
} MV;
typedef union
typedef union int_mv
{
uint32_t as_int;
MV as_mv;
......
......@@ -7,6 +7,8 @@ struct loop_filter_info;
/* Encoder forward decls */
struct block;
struct macroblock;
struct variance_vtable;
union int_mv;
EOF
}
forward_decls common_forward_decls
......@@ -464,5 +466,21 @@ prototype void vp8_subtract_mbuv "short *diff, unsigned char *usrc, unsigned cha
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
......@@ -25,9 +25,6 @@ extern void vp8_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc,
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
......
......@@ -1009,7 +1009,7 @@ cal_neighbors:
#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 @@ int vp8_diamond_search_sadx4
+ 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 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
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)
......
......@@ -50,98 +50,51 @@ typedef int (fractional_mv_step_fp)
(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 \
)
#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 \
)
#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_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
);
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
);
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
......@@ -1997,9 +1997,9 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
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;
......
......@@ -223,7 +223,6 @@ typedef struct
typedef struct VP8_ENCODER_RTCD
{
vp8_search_rtcd_vtable_t search;
vp8_temporal_rtcd_vtable_t temporal;
} VP8_ENCODER_RTCD;
......
......@@ -96,7 +96,7 @@ typedef unsigned int (*vp8_get16x16prederror_fn_t)
int ref_stride
);
typedef struct
typedef struct variance_vtable
{
vp8_sad_fn_t sdf;
vp8_variance_fn_t vf;
......
/*
* 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
......@@ -135,21 +135,5 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
}
#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
}
......@@ -93,7 +93,6 @@ VP8_CX_SRCS_REMOVE-yes += encoder/firstpass.c
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment