From: Scott LaVarnway Date: Mon, 22 Oct 2012 20:45:42 +0000 (-0700) Subject: Added rtcd support vp8_sad16x3 and vp8_sad3x16 X-Git-Tag: v1.3.0~1217^2~199^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d36ecb42da89cf6956fef855c61cb84296e8caa8;p=platform%2Fupstream%2Flibvpx.git Added rtcd support vp8_sad16x3 and vp8_sad3x16 Change-Id: I5bca7b7a4b230082d36ac6fb84db84137ad177d7 --- diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c index 285aabd..be495ff 100644 --- a/vp8/common/findnearmv.c +++ b/vp8/common/findnearmv.c @@ -10,7 +10,7 @@ #include "findnearmv.h" -#include "vp8/encoder/variance.h" +#include "vp8/common/sadmxn.h" #include const unsigned char vp8_mbsplit_offset[4][16] = { @@ -199,6 +199,23 @@ vp8_prob *vp8_mv_ref_probs(VP8_COMMON *pc, } #if CONFIG_NEWBESTREFMV +unsigned int vp8_sad3x16_c( + const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int max_sad) { + return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 3, 16); +} +unsigned int vp8_sad16x3_c( + const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int max_sad) { + return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 3); +} + /* check a list of motion vectors by sad score using a number rows of pixels * above and a number cols of pixels in the left to select the one with best * score to use as ref motion vector @@ -261,10 +278,10 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd, sad = 0; if (xd->up_available) - sad += vp8_sad16x3_c(above_src, xd->dst.y_stride, + sad += vp8_sad16x3(above_src, xd->dst.y_stride, above_ref + offset, ref_y_stride, INT_MAX); if (xd->left_available) - sad += vp8_sad3x16_c(left_src, xd->dst.y_stride, + sad += vp8_sad3x16(left_src, xd->dst.y_stride, left_ref + offset, ref_y_stride, INT_MAX); // Add the entry to our list and then resort the list on score. sad_scores[i] = sad; diff --git a/vp8/common/rtcd_defs.sh b/vp8/common/rtcd_defs.sh index 1236eed..ea64c96 100644 --- a/vp8/common/rtcd_defs.sh +++ b/vp8/common/rtcd_defs.sh @@ -175,6 +175,15 @@ vp8_loop_filter_simple_bh_media=vp8_loop_filter_bhs_armv6 vp8_loop_filter_simple_bh_neon=vp8_loop_filter_bhs_neon # +# sad 16x3, 3x16 +# +prototype unsigned int vp8_sad16x3 "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad" +specialize vp8_sad16x3 + +prototype unsigned int vp8_sad3x16 "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad" +specialize vp8_sad3x16 + +# # Encoder functions below this point. # if [ "$CONFIG_VP8_ENCODER" = "yes" ]; then diff --git a/vp8/common/sadmxn.h b/vp8/common/sadmxn.h new file mode 100644 index 0000000..47b8dfc --- /dev/null +++ b/vp8/common/sadmxn.h @@ -0,0 +1,37 @@ +/* + * 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 __INC_SAD_H +#define __INC_SAD_H + +static __inline +unsigned int sad_mx_n_c( + const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int m, + int n) { + int r, c; + unsigned int sad = 0; + + for (r = 0; r < n; r++) { + for (c = 0; c < m; c++) { + sad += abs(src_ptr[c] - ref_ptr[c]); + } + + src_ptr += src_stride; + ref_ptr += ref_stride; + } + + return sad; +} + +#endif diff --git a/vp8/encoder/sad_c.c b/vp8/encoder/sad_c.c index 2e86a16..f15e687 100644 --- a/vp8/encoder/sad_c.c +++ b/vp8/encoder/sad_c.c @@ -10,33 +10,10 @@ #include +#include "vp8/common/sadmxn.h" #include "vpx_ports/config.h" #include "vpx/vpx_integer.h" -static __inline -unsigned int sad_mx_n_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int m, - int n) { - - int r, c; - unsigned int sad = 0; - - for (r = 0; r < n; r++) { - for (c = 0; c < m; c++) { - sad += abs(src_ptr[c] - ref_ptr[c]); - } - - src_ptr += src_stride; - ref_ptr += ref_stride; - } - - return sad; -} - unsigned int vp8_sad32x32_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, @@ -97,25 +74,6 @@ unsigned int vp8_sad4x4_c( return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 4, 4); } -#if CONFIG_NEWBESTREFMV -unsigned int vp8_sad3x16_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int max_sad){ - return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 3, 16); -} -unsigned int vp8_sad16x3_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int max_sad){ - return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 3); -} -#endif - void vp8_sad32x32x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index 69df04c..fbbdec1 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -53,6 +53,7 @@ VP8_COMMON_SRCS-yes += common/reconintra.h VP8_COMMON_SRCS-yes += common/reconintra4x4.h VP8_COMMON_SRCS-yes += common/rtcd.c VP8_COMMON_SRCS-yes += common/rtcd_defs.sh +VP8_COMMON_SRCS-yes += common/sadmxn.h VP8_COMMON_SRCS-yes += common/seg_common.h VP8_COMMON_SRCS-yes += common/seg_common.c VP8_COMMON_SRCS-yes += common/setupintrarecon.h