Commit 7ab9a958 authored by Deb Mukherjee's avatar Deb Mukherjee

Remove Wextra warnings from vp9_sad.c

As a side-effect, the max_sad check is removed from the
C-implementation of VP8, for consistency with VP9, and to
ensure that the SAD tests common to VP8/VP9 pass.
That will make the VP8 C implementation of sad a little slower
but given that is rarely used in practice, the impact will be
minimal.

Change-Id: I7f43089fdea047fbf1862e40c21e4715c30f07ca
parent 38f3cf12
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr, typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr,
int source_stride, int source_stride,
const unsigned char *reference_ptr, const unsigned char *reference_ptr,
int reference_stride, int reference_stride);
unsigned int max_sad);
typedef std::tr1::tuple<int, int, sad_m_by_n_fn_t> sad_m_by_n_test_param_t; typedef std::tr1::tuple<int, int, sad_m_by_n_fn_t> sad_m_by_n_test_param_t;
typedef void (*sad_n_by_n_by_4_fn_t)(const uint8_t *src_ptr, typedef void (*sad_n_by_n_by_4_fn_t)(const uint8_t *src_ptr,
...@@ -87,7 +86,7 @@ class SADTestBase : public ::testing::Test { ...@@ -87,7 +86,7 @@ class SADTestBase : public ::testing::Test {
// Sum of Absolute Differences. Given two blocks, calculate the absolute // Sum of Absolute Differences. Given two blocks, calculate the absolute
// difference between two pixels in the same relative location; accumulate. // difference between two pixels in the same relative location; accumulate.
unsigned int ReferenceSAD(unsigned int max_sad, int block_idx = 0) { unsigned int ReferenceSAD(int block_idx = 0) {
unsigned int sad = 0; unsigned int sad = 0;
const uint8_t* const reference = GetReference(block_idx); const uint8_t* const reference = GetReference(block_idx);
...@@ -96,9 +95,6 @@ class SADTestBase : public ::testing::Test { ...@@ -96,9 +95,6 @@ class SADTestBase : public ::testing::Test {
sad += abs(source_data_[h * source_stride_ + w] sad += abs(source_data_[h * source_stride_ + w]
- reference[h * reference_stride_ + w]); - reference[h * reference_stride_ + w]);
} }
if (sad > max_sad) {
break;
}
} }
return sad; return sad;
} }
...@@ -134,21 +130,20 @@ class SADTest : public SADTestBase, ...@@ -134,21 +130,20 @@ class SADTest : public SADTestBase,
SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
protected: protected:
unsigned int SAD(unsigned int max_sad, int block_idx = 0) { unsigned int SAD(int block_idx = 0) {
unsigned int ret; unsigned int ret;
const uint8_t* const reference = GetReference(block_idx); const uint8_t* const reference = GetReference(block_idx);
REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_, REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
reference, reference_stride_, reference, reference_stride_));
max_sad));
return ret; return ret;
} }
void CheckSad(unsigned int max_sad) { void CheckSad(unsigned int max_sad) {
unsigned int reference_sad, exp_sad; unsigned int reference_sad, exp_sad;
reference_sad = ReferenceSAD(max_sad); reference_sad = ReferenceSAD();
exp_sad = SAD(max_sad); exp_sad = SAD();
if (reference_sad <= max_sad) { if (reference_sad <= max_sad) {
ASSERT_EQ(exp_sad, reference_sad); ASSERT_EQ(exp_sad, reference_sad);
...@@ -179,7 +174,7 @@ class SADx4Test : public SADTestBase, ...@@ -179,7 +174,7 @@ class SADx4Test : public SADTestBase,
SADs(exp_sad); SADs(exp_sad);
for (int block = 0; block < 4; block++) { for (int block = 0; block < 4; block++) {
reference_sad = ReferenceSAD(UINT_MAX, block); reference_sad = ReferenceSAD(block);
EXPECT_EQ(exp_sad[block], reference_sad) << "block " << block; EXPECT_EQ(exp_sad[block], reference_sad) << "block " << block;
} }
......
...@@ -316,23 +316,23 @@ $vp8_variance_halfpixvar16x16_hv_neon_asm=vp8_variance_halfpixvar16x16_hv_neon; ...@@ -316,23 +316,23 @@ $vp8_variance_halfpixvar16x16_hv_neon_asm=vp8_variance_halfpixvar16x16_hv_neon;
# #
# Single block SAD # Single block SAD
# #
add_proto qw/unsigned int vp8_sad4x4/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp8_sad4x4/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride";
specialize qw/vp8_sad4x4 mmx sse2 neon/; specialize qw/vp8_sad4x4 mmx sse2 neon/;
$vp8_sad4x4_sse2=vp8_sad4x4_wmt; $vp8_sad4x4_sse2=vp8_sad4x4_wmt;
add_proto qw/unsigned int vp8_sad8x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp8_sad8x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride";
specialize qw/vp8_sad8x8 mmx sse2 neon/; specialize qw/vp8_sad8x8 mmx sse2 neon/;
$vp8_sad8x8_sse2=vp8_sad8x8_wmt; $vp8_sad8x8_sse2=vp8_sad8x8_wmt;
add_proto qw/unsigned int vp8_sad8x16/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp8_sad8x16/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride";
specialize qw/vp8_sad8x16 mmx sse2 neon/; specialize qw/vp8_sad8x16 mmx sse2 neon/;
$vp8_sad8x16_sse2=vp8_sad8x16_wmt; $vp8_sad8x16_sse2=vp8_sad8x16_wmt;
add_proto qw/unsigned int vp8_sad16x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp8_sad16x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride";
specialize qw/vp8_sad16x8 mmx sse2 neon/; specialize qw/vp8_sad16x8 mmx sse2 neon/;
$vp8_sad16x8_sse2=vp8_sad16x8_wmt; $vp8_sad16x8_sse2=vp8_sad16x8_wmt;
add_proto qw/unsigned int vp8_sad16x16/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp8_sad16x16/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride";
specialize qw/vp8_sad16x16 mmx sse2 sse3 media neon/; specialize qw/vp8_sad16x16 mmx sse2 sse3 media neon/;
$vp8_sad16x16_sse2=vp8_sad16x16_wmt; $vp8_sad16x16_sse2=vp8_sad16x16_wmt;
$vp8_sad16x16_media=vp8_sad16x16_armv6; $vp8_sad16x16_media=vp8_sad16x16_armv6;
......
This diff is collapsed.
...@@ -22,8 +22,7 @@ typedef unsigned int(*vp8_sad_fn_t)( ...@@ -22,8 +22,7 @@ typedef unsigned int(*vp8_sad_fn_t)(
const unsigned char *src_ptr, const unsigned char *src_ptr,
int source_stride, int source_stride,
const unsigned char *ref_ptr, const unsigned char *ref_ptr,
int ref_stride, int ref_stride);
unsigned int max_sad);
typedef void (*vp8_copy32xn_fn_t)( typedef void (*vp8_copy32xn_fn_t)(
const unsigned char *src_ptr, const unsigned char *src_ptr,
......
...@@ -898,7 +898,7 @@ int vp8_hex_search ...@@ -898,7 +898,7 @@ int vp8_hex_search
this_offset = base_offset + (br * (pre_stride)) + bc; this_offset = base_offset + (br * (pre_stride)) + bc;
this_mv.as_mv.row = br; this_mv.as_mv.row = br;
this_mv.as_mv.col = bc; this_mv.as_mv.col = bc;
bestsad = vfp->sdf(what, what_stride, this_offset, in_what_stride, UINT_MAX) bestsad = vfp->sdf(what, what_stride, this_offset, in_what_stride)
+ mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, sad_per_bit); + mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, sad_per_bit);
#if CONFIG_MULTI_RES_ENCODING #if CONFIG_MULTI_RES_ENCODING
...@@ -923,7 +923,7 @@ int vp8_hex_search ...@@ -923,7 +923,7 @@ int vp8_hex_search
this_mv.as_mv.row = br + hex[i].row; this_mv.as_mv.row = br + hex[i].row;
this_mv.as_mv.col = bc + hex[i].col; this_mv.as_mv.col = bc + hex[i].col;
this_offset = base_offset + (this_mv.as_mv.row * in_what_stride) + this_mv.as_mv.col; this_offset = base_offset + (this_mv.as_mv.row * in_what_stride) + this_mv.as_mv.col;
thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad); thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride);
CHECK_BETTER CHECK_BETTER
} }
}else }else
...@@ -934,7 +934,7 @@ int vp8_hex_search ...@@ -934,7 +934,7 @@ int vp8_hex_search
this_mv.as_mv.col = bc + hex[i].col; this_mv.as_mv.col = bc + hex[i].col;
CHECK_POINT CHECK_POINT
this_offset = base_offset + (this_mv.as_mv.row * in_what_stride) + this_mv.as_mv.col; this_offset = base_offset + (this_mv.as_mv.row * in_what_stride) + this_mv.as_mv.col;
thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad); thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride);
CHECK_BETTER CHECK_BETTER
} }
} }
...@@ -960,7 +960,8 @@ int vp8_hex_search ...@@ -960,7 +960,8 @@ int vp8_hex_search
this_mv.as_mv.row = br + next_chkpts[k][i].row; this_mv.as_mv.row = br + next_chkpts[k][i].row;
this_mv.as_mv.col = bc + next_chkpts[k][i].col; this_mv.as_mv.col = bc + next_chkpts[k][i].col;
this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col; this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad); thissad = vfp->sdf(what, what_stride, this_offset,
in_what_stride);
CHECK_BETTER CHECK_BETTER
} }
}else }else
...@@ -971,7 +972,8 @@ int vp8_hex_search ...@@ -971,7 +972,8 @@ int vp8_hex_search
this_mv.as_mv.col = bc + next_chkpts[k][i].col; this_mv.as_mv.col = bc + next_chkpts[k][i].col;
CHECK_POINT CHECK_POINT
this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col; this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad); thissad = vfp->sdf(what, what_stride, this_offset,
in_what_stride);
CHECK_BETTER CHECK_BETTER
} }
} }
...@@ -1002,7 +1004,8 @@ cal_neighbors: ...@@ -1002,7 +1004,8 @@ cal_neighbors:
this_mv.as_mv.row = br + neighbors[i].row; this_mv.as_mv.row = br + neighbors[i].row;
this_mv.as_mv.col = bc + neighbors[i].col; this_mv.as_mv.col = bc + neighbors[i].col;
this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col; this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad); thissad = vfp->sdf(what, what_stride, this_offset,
in_what_stride);
CHECK_BETTER CHECK_BETTER
} }
}else }else
...@@ -1013,7 +1016,8 @@ cal_neighbors: ...@@ -1013,7 +1016,8 @@ cal_neighbors:
this_mv.as_mv.col = bc + neighbors[i].col; this_mv.as_mv.col = bc + neighbors[i].col;
CHECK_POINT CHECK_POINT
this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col; this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad); thissad = vfp->sdf(what, what_stride, this_offset,
in_what_stride);
CHECK_BETTER CHECK_BETTER
} }
} }
...@@ -1097,7 +1101,7 @@ int vp8_diamond_search_sad_c ...@@ -1097,7 +1101,7 @@ int vp8_diamond_search_sad_c
best_address = in_what; best_address = in_what;
/* Check the starting position */ /* Check the starting position */
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, UINT_MAX) bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride)
+ mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
/* search_param determines the length of the initial step and hence /* search_param determines the length of the initial step and hence
...@@ -1122,7 +1126,8 @@ int vp8_diamond_search_sad_c ...@@ -1122,7 +1126,8 @@ int vp8_diamond_search_sad_c
{ {
check_here = ss[i].offset + best_address; check_here = ss[i].offset + best_address;
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
if (thissad < bestsad) if (thissad < bestsad)
{ {
...@@ -1221,7 +1226,7 @@ int vp8_diamond_search_sadx4 ...@@ -1221,7 +1226,7 @@ int vp8_diamond_search_sadx4
best_address = in_what; best_address = in_what;
/* Check the starting position */ /* Check the starting position */
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, UINT_MAX) bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride)
+ mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
/* search_param determines the length of the initial step and hence the /* search_param determines the length of the initial step and hence the
...@@ -1289,7 +1294,8 @@ int vp8_diamond_search_sadx4 ...@@ -1289,7 +1294,8 @@ int vp8_diamond_search_sadx4
(this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max)) (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
{ {
check_here = ss[i].offset + best_address; check_here = ss[i].offset + best_address;
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
if (thissad < bestsad) if (thissad < bestsad)
{ {
...@@ -1373,7 +1379,7 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, ...@@ -1373,7 +1379,7 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
/* Baseline value at the centre */ /* Baseline value at the centre */
bestsad = fn_ptr->sdf(what, what_stride, bestaddress, bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
in_what_stride, UINT_MAX) in_what_stride)
+ mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
/* Apply further limits to prevent us looking using vectors that /* Apply further limits to prevent us looking using vectors that
...@@ -1398,7 +1404,8 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, ...@@ -1398,7 +1404,8 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
for (c = col_min; c < col_max; c++) for (c = col_min; c < col_max; c++)
{ {
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
this_mv.as_mv.col = c; this_mv.as_mv.col = c;
thissad += mvsad_err_cost(&this_mv, &fcenter_mv, thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
...@@ -1471,7 +1478,7 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, ...@@ -1471,7 +1478,7 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
/* Baseline value at the centre */ /* Baseline value at the centre */
bestsad = fn_ptr->sdf(what, what_stride, bestaddress, bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
in_what_stride, UINT_MAX) in_what_stride)
+ mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
/* Apply further limits to prevent us looking using vectors that stretch /* Apply further limits to prevent us looking using vectors that stretch
...@@ -1527,7 +1534,8 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, ...@@ -1527,7 +1534,8 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
while (c < col_max) while (c < col_max)
{ {
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
if (thissad < bestsad) if (thissad < bestsad)
{ {
...@@ -1606,7 +1614,7 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, ...@@ -1606,7 +1614,7 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
/* Baseline value at the centre */ /* Baseline value at the centre */
bestsad = fn_ptr->sdf(what, what_stride, bestsad = fn_ptr->sdf(what, what_stride,
bestaddress, in_what_stride, UINT_MAX) bestaddress, in_what_stride)
+ mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
/* Apply further limits to prevent us looking using vectors that stretch /* Apply further limits to prevent us looking using vectors that stretch
...@@ -1692,7 +1700,8 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, ...@@ -1692,7 +1700,8 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
while (c < col_max) while (c < col_max)
{ {
thissad = fn_ptr->sdf(what, what_stride, check_here , in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
if (thissad < bestsad) if (thissad < bestsad)
{ {
...@@ -1751,7 +1760,7 @@ int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv ...@@ -1751,7 +1760,7 @@ int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
bestsad = fn_ptr->sdf(what, what_stride, best_address, bestsad = fn_ptr->sdf(what, what_stride, best_address,
in_what_stride, UINT_MAX) in_what_stride)
+ mvsad_err_cost(ref_mv, &fcenter_mv, mvsadcost, error_per_bit); + mvsad_err_cost(ref_mv, &fcenter_mv, mvsadcost, error_per_bit);
for (i=0; i<search_range; i++) for (i=0; i<search_range; i++)
...@@ -1767,7 +1776,8 @@ int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv ...@@ -1767,7 +1776,8 @@ int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv
(this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max)) (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
{ {
check_here = (neighbors[j].row)*in_what_stride + neighbors[j].col + best_address; check_here = (neighbors[j].row)*in_what_stride + neighbors[j].col + best_address;
thissad = fn_ptr->sdf(what, what_stride, check_here , in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
if (thissad < bestsad) if (thissad < bestsad)
{ {
...@@ -1831,7 +1841,7 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d, ...@@ -1831,7 +1841,7 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
bestsad = fn_ptr->sdf(what, what_stride, best_address, bestsad = fn_ptr->sdf(what, what_stride, best_address,
in_what_stride, UINT_MAX) in_what_stride)
+ mvsad_err_cost(ref_mv, &fcenter_mv, mvsadcost, error_per_bit); + mvsad_err_cost(ref_mv, &fcenter_mv, mvsadcost, error_per_bit);
for (i=0; i<search_range; i++) for (i=0; i<search_range; i++)
...@@ -1882,7 +1892,8 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d, ...@@ -1882,7 +1892,8 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
(this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max)) (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
{ {
check_here = (neighbors[j].row)*in_what_stride + neighbors[j].col + best_address; check_here = (neighbors[j].row)*in_what_stride + neighbors[j].col + best_address;
thissad = fn_ptr->sdf(what, what_stride, check_here , in_what_stride, bestsad); thissad = fn_ptr->sdf(what, what_stride, check_here,
in_what_stride);
if (thissad < bestsad) if (thissad < bestsad)
{ {
......
...@@ -1686,16 +1686,25 @@ void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse ...@@ -1686,16 +1686,25 @@ void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse
}else if(xd->mb_to_top_edge==0) }else if(xd->mb_to_top_edge==0)
{ /* only has left MB for sad calculation. */ { /* only has left MB for sad calculation. */
near_sad[0] = near_sad[2] = INT_MAX; near_sad[0] = near_sad[2] = INT_MAX;
near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - 16,xd->dst.y_stride, UINT_MAX); near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, xd->dst.y_buffer - 16, xd->dst.y_stride);
}else if(xd->mb_to_left_edge ==0) }else if(xd->mb_to_left_edge ==0)
{ /* only has left MB for sad calculation. */ { /* only has left MB for sad calculation. */
near_sad[1] = near_sad[2] = INT_MAX; near_sad[1] = near_sad[2] = INT_MAX;
near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,xd->dst.y_stride, UINT_MAX); near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,
xd->dst.y_stride);
}else }else
{ {
near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,xd->dst.y_stride, UINT_MAX); near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(
near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - 16,xd->dst.y_stride, UINT_MAX); src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,
near_sad[2] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16 -16,xd->dst.y_stride, UINT_MAX); xd->dst.y_stride);
near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, xd->dst.y_buffer - 16, xd->dst.y_stride);
near_sad[2] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr,
b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16 -16,
xd->dst.y_stride);
} }
if(cpi->common.last_frame_type != KEY_FRAME) if(cpi->common.last_frame_type != KEY_FRAME)
...@@ -1710,14 +1719,21 @@ void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse ...@@ -1710,14 +1719,21 @@ void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse
if(xd->mb_to_bottom_edge==0) near_sad[7] = INT_MAX; if(xd->mb_to_bottom_edge==0) near_sad[7] = INT_MAX;
if(near_sad[4] != INT_MAX) if(near_sad[4] != INT_MAX)
near_sad[4] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer - pre_y_stride *16, pre_y_stride, UINT_MAX); near_sad[4] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, pre_y_buffer - pre_y_stride *16,
pre_y_stride);
if(near_sad[5] != INT_MAX) if(near_sad[5] != INT_MAX)
near_sad[5] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer - 16, pre_y_stride, UINT_MAX); near_sad[5] = cpi->fn_ptr[BLOCK_16X16].sdf(
near_sad[3] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer, pre_y_stride, UINT_MAX); src_y_ptr, b->src_stride, pre_y_buffer - 16, pre_y_stride);
near_sad[3] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, pre_y_buffer, pre_y_stride);
if(near_sad[6] != INT_MAX) if(near_sad[6] != INT_MAX)
near_sad[6] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer + 16, pre_y_stride, UINT_MAX); near_sad[6] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, pre_y_buffer + 16, pre_y_stride);
if(near_sad[7] != INT_MAX) if(near_sad[7] != INT_MAX)
near_sad[7] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer + pre_y_stride *16, pre_y_stride, UINT_MAX); near_sad[7] = cpi->fn_ptr[BLOCK_16X16].sdf(
src_y_ptr, b->src_stride, pre_y_buffer + pre_y_stride *16,
pre_y_stride);
} }
if(cpi->common.last_frame_type != KEY_FRAME) if(cpi->common.last_frame_type != KEY_FRAME)
......
...@@ -520,82 +520,82 @@ specialize qw/vp9_sub_pixel_variance4x4/, "$sse_x86inc", "$ssse3_x86inc"; ...@@ -520,82 +520,82 @@ specialize qw/vp9_sub_pixel_variance4x4/, "$sse_x86inc", "$ssse3_x86inc";
add_proto qw/unsigned int vp9_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred"; add_proto qw/unsigned int vp9_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
specialize qw/vp9_sub_pixel_avg_variance4x4/, "$sse_x86inc", "$ssse3_x86inc"; specialize qw/vp9_sub_pixel_avg_variance4x4/, "$sse_x86inc", "$ssse3_x86inc";
add_proto qw/unsigned int vp9_sad64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad64x64/, "$sse2_x86inc"; specialize qw/vp9_sad64x64/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad32x64/, "$sse2_x86inc"; specialize qw/vp9_sad32x64/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad64x32/, "$sse2_x86inc"; specialize qw/vp9_sad64x32/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad32x16/, "$sse2_x86inc"; specialize qw/vp9_sad32x16/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad16x32/, "$sse2_x86inc"; specialize qw/vp9_sad16x32/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad32x32/, "$sse2_x86inc"; specialize qw/vp9_sad32x32/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad16x16 mmx/, "$sse2_x86inc"; specialize qw/vp9_sad16x16 mmx/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad16x8 mmx/, "$sse2_x86inc"; specialize qw/vp9_sad16x8 mmx/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad8x16 mmx/, "$sse2_x86inc"; specialize qw/vp9_sad8x16 mmx/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad8x8 mmx/, "$sse2_x86inc"; specialize qw/vp9_sad8x8 mmx/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad8x4/, "$sse2_x86inc"; specialize qw/vp9_sad8x4/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad4x8/, "$sse_x86inc"; specialize qw/vp9_sad4x8/, "$sse_x86inc";
add_proto qw/unsigned int vp9_sad4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vp9_sad4x4 mmx/, "$sse_x86inc"; specialize qw/vp9_sad4x4 mmx/, "$sse_x86inc";
add_proto qw/unsigned int vp9_sad64x64_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad64x64_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vp9_sad64x64_avg/, "$sse2_x86inc"; specialize qw/vp9_sad64x64_avg/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad32x64_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad32x64_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vp9_sad32x64_avg/, "$sse2_x86inc"; specialize qw/vp9_sad32x64_avg/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad64x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad64x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vp9_sad64x32_avg/, "$sse2_x86inc"; specialize qw/vp9_sad64x32_avg/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad32x16_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad32x16_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vp9_sad32x16_avg/, "$sse2_x86inc"; specialize qw/vp9_sad32x16_avg/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_sad16x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad"; add_proto qw/unsigned int vp9_sad16x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vp9_sad16x32_avg/, "$sse2_x86inc";