diff options
Diffstat (limited to 'vp8/common')
-rw-r--r-- | vp8/common/findnearmv.c | 23 | ||||
-rw-r--r-- | vp8/common/rtcd_defs.sh | 9 | ||||
-rw-r--r-- | vp8/common/sadmxn.h | 37 |
3 files changed, 66 insertions, 3 deletions
diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c index 285aabdb6..be495ff81 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 <limits.h> 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 1236eedc2..ea64c9682 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 000000000..47b8dfc58 --- /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 |