]> granicus.if.org Git - libvpx/commitdiff
RTCD: add motion search functions
authorJohn Koleszar <jkoleszar@google.com>
Fri, 13 Jan 2012 00:55:44 +0000 (16:55 -0800)
committerJohn Koleszar <jkoleszar@google.com>
Mon, 30 Jan 2012 20:10:47 +0000 (12:10 -0800)
This commit continues the process of converting to the new RTCD
system.

Change-Id: Ia5828b7ecc80db55b21916704aa3d54cbb98f625

vp8/common/mv.h
vp8/common/rtcd_defs.sh
vp8/encoder/generic/csystemdependent.c
vp8/encoder/mcomp.c
vp8/encoder/mcomp.h
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/encoder/variance.h
vp8/encoder/x86/mcomp_x86.h [deleted file]
vp8/encoder/x86/x86_csystemdependent.c
vp8/vp8cx.mk

index 35c4fe9474803cb7fb463b7aa36f286a7dc78480..b3f919db2bd6d62611c49a89a8159d3a9e724dd4 100644 (file)
@@ -19,7 +19,7 @@ typedef struct
     short col;
 } MV;
 
-typedef union
+typedef union int_mv
 {
     uint32_t  as_int;
     MV        as_mv;
index 1bdddc14d9189b14bfd1eb1b364a08fe68c49040..e18ca97da6c4f2fac4a6f9ae38fc0bccd0f3e67f 100644 (file)
@@ -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
index 7425dc2462405451976648608033ab42a8559127..1d6acca149786c36805185029588c59cd7cd4191 100644 (file)
@@ -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
index 735af95ca32b11e4529a21d6a04214d5f1a6bbc9..dad89c311a646ffb7fac857493a32e91bde9dfaf 100644 (file)
@@ -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)
index 416c4d5eb6a19b78c5424730d508728e75b40308..e6ab1648c1297c7f0b8bcb7e841cc93ff977cc24 100644 (file)
@@ -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
index 5e6b57b90a98660a0a07de54fa4744b7c89354bf..b02d378e03d5153e6ff54875172edfb02d8d5ed1 100644 (file)
@@ -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;
index d514d75aa0e9c3518cc92ad71c9f5f17c48c9740..f91e6df14d2da2633dbb61c5cce7b7933a10cbd9 100644 (file)
@@ -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;
 
index e216a22222599c45cbb4ff666159683e68be37ab..b77aa28f493c2a4443d0b2951d2cb81d9c306c43 100644 (file)
@@ -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;
diff --git a/vp8/encoder/x86/mcomp_x86.h b/vp8/encoder/x86/mcomp_x86.h
deleted file mode 100644 (file)
index efe7241..0000000
+++ /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
-
index fa628fa816a836618f9a8721b567f26b37af30e5..4d27d5cf79e1a4f17e93bc70fc88264480ea6a78 100644 (file)
@@ -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
 }
index febb7eff39e6a5431368949147f88df0db9bdabd..8de4066e319869fbf13c0eebb0445001713a0f72 100644 (file)
@@ -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