Scale Down by factor tests scale down to specified ratio rather than up. This ensures the alignment constrains on the destination dont cause a different factor to be used.

BUG=431
TESTED=libyuvTest.ScaleDownBy3_Bilinear
R=harryjin@google.com

Review URL: https://webrtc-codereview.appspot.com/47309004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1413 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
fbarchard@google.com 2015-05-26 23:22:01 +00:00
parent 7c09264ffc
commit 535a7140f2
4 changed files with 49 additions and 44 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1412
Version: 1415
License: BSD
License File: LICENSE

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1412
#define LIBYUV_VERSION 1415
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT

View File

@ -196,37 +196,39 @@ static int ARGBClipTestFilter(int src_width, int src_height,
return max_diff;
}
#define TEST_FACTOR1(name, filter, hfactor, vfactor, max_diff) \
#define TEST_FACTOR1(name, filter, factor, max_diff) \
TEST_F(libyuvTest, ARGBScaleDownBy##name##_##filter) { \
int diff = ARGBTestFilter(benchmark_width_, benchmark_height_, \
Abs(benchmark_width_) * hfactor, \
Abs(benchmark_height_) * vfactor, \
int diff = ARGBTestFilter(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, ARGBScaleDownClipBy##name##_##filter) { \
int diff = ARGBClipTestFilter(benchmark_width_, benchmark_height_, \
Abs(benchmark_width_) * hfactor, \
Abs(benchmark_height_) * vfactor, \
int diff = ARGBClipTestFilter(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_); \
EXPECT_LE(diff, max_diff); \
}
// Test a scale factor with 2 filters. Expect unfiltered to be exact, but
// Test a scale factor with all 4 filters. Expect unfiltered to be exact, but
// filtering is different fixed point implementations for SSSE3, Neon and C.
#define TEST_FACTOR(name, hfactor, vfactor) \
TEST_FACTOR1(name, None, hfactor, vfactor, 2) \
TEST_FACTOR1(name, Linear, hfactor, vfactor, 2) \
TEST_FACTOR1(name, Bilinear, hfactor, vfactor, 2) \
TEST_FACTOR1(name, Box, hfactor, vfactor, 2)
#define TEST_FACTOR(name, factor) \
TEST_FACTOR1(name, None, factor, 0) \
TEST_FACTOR1(name, Linear, factor, 3) \
TEST_FACTOR1(name, Bilinear, factor, 3) \
TEST_FACTOR1(name, Box, factor, 3) \
TEST_FACTOR(2, 1 / 2, 1 / 2)
TEST_FACTOR(4, 1 / 4, 1 / 4)
TEST_FACTOR(8, 1 / 8, 1 / 8)
TEST_FACTOR(3by4, 3 / 4, 3 / 4)
TEST_FACTOR(3by8, 3 / 8, 3 / 8)
TEST_FACTOR(3, 1 / 3, 1 / 3)
TEST_FACTOR(2, 2)
TEST_FACTOR(4, 4)
TEST_FACTOR(8, 8)
TEST_FACTOR(3by4, 4 / 3)
TEST_FACTOR(3by8, 8 / 3)
TEST_FACTOR(3, 3)
#undef TEST_FACTOR1
#undef TEST_FACTOR
@ -253,7 +255,8 @@ TEST_FACTOR(3, 1 / 3, 1 / 3)
} \
TEST_F(libyuvTest, name##ClipFrom##width##x##height##_##filter) { \
int diff = ARGBClipTestFilter(width, height, \
Abs(benchmark_width_), Abs(benchmark_height_), \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_); \
EXPECT_LE(diff, max_diff); \
}

View File

@ -260,37 +260,39 @@ static int TestFilter_16(int src_width, int src_height,
return max_diff;
}
#define TEST_FACTOR1(name, filter, hfactor, vfactor, max_diff) \
#define TEST_FACTOR1(name, filter, factor, max_diff) \
TEST_F(libyuvTest, ScaleDownBy##name##_##filter) { \
int diff = TestFilter(benchmark_width_, benchmark_height_, \
Abs(benchmark_width_) * hfactor, \
Abs(benchmark_height_) * vfactor, \
int diff = TestFilter(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, DISABLED_ScaleDownBy##name##_##filter##_16) { \
int diff = TestFilter_16(benchmark_width_, benchmark_height_, \
Abs(benchmark_width_) * hfactor, \
Abs(benchmark_height_) * vfactor, \
int diff = TestFilter_16(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_); \
EXPECT_LE(diff, max_diff); \
}
// Test a scale factor with all 4 filters. Expect unfiltered to be exact, but
// filtering is different fixed point implementations for SSSE3, Neon and C.
#define TEST_FACTOR(name, hfactor, vfactor) \
TEST_FACTOR1(name, None, hfactor, vfactor, 0) \
TEST_FACTOR1(name, Linear, hfactor, vfactor, 3) \
TEST_FACTOR1(name, Bilinear, hfactor, vfactor, 3) \
TEST_FACTOR1(name, Box, hfactor, vfactor, 3) \
#define TEST_FACTOR(name, factor) \
TEST_FACTOR1(name, None, factor, 0) \
TEST_FACTOR1(name, Linear, factor, 3) \
TEST_FACTOR1(name, Bilinear, factor, 3) \
TEST_FACTOR1(name, Box, factor, 3) \
TEST_FACTOR(2, 1 / 2, 1 / 2)
TEST_FACTOR(4, 1 / 4, 1 / 4)
TEST_FACTOR(8, 1 / 8, 1 / 8)
TEST_FACTOR(3by4, 3 / 4, 3 / 4)
TEST_FACTOR(3by8, 3 / 8, 3 / 8)
TEST_FACTOR(3, 1 / 3, 1 / 3)
TEST_FACTOR(2, 2)
TEST_FACTOR(4, 4)
TEST_FACTOR(8, 8)
TEST_FACTOR(3by4, 4 / 3)
TEST_FACTOR(3by8, 8 / 3)
TEST_FACTOR(3, 3)
#undef TEST_FACTOR1
#undef TEST_FACTOR