Commit e787144c authored by fbarchard@google.com's avatar fbarchard@google.com

adjust dimensions for scale factor tests to ensure the scale factor tested is actually used.

BUG=none
TESTED=set LIBYUV_WIDTH=1918 libyuvTest.ScaleDownBy3by4_None
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1416 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent bd2d903e
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1417
Version: 1418
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1417
#define LIBYUV_VERSION 1418
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -132,7 +132,7 @@ static int ARGBClipTestFilter(int src_width, int src_height,
int dst_width, int dst_height,
FilterMode f, int benchmark_iterations) {
const int b = 128;
int src_argb_plane_size = (Abs(src_width) + b * 2) *
int64 src_argb_plane_size = (Abs(src_width) + b * 2) *
(Abs(src_height) + b * 2) * 4;
int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
......@@ -196,41 +196,48 @@ static int ARGBClipTestFilter(int src_width, int src_height,
return max_diff;
}
#define TEST_FACTOR1(name, filter, factor, max_diff) \
// The following adjustments in dimensions ensure the scale factor will be
// exactly achieved.
#define DX(x, nom, denom) ((int)(Abs(x) / nom) * nom)
#define SX(x, nom, denom) ((int)(x / nom) * denom)
#define TEST_FACTOR1(name, filter, nom, denom, max_diff) \
TEST_F(libyuvTest, ARGBScaleDownBy##name##_##filter) { \
int diff = ARGBTestFilter(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
int diff = ARGBTestFilter(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
DX(benchmark_height_, nom, denom), \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, ARGBScaleDownClipBy##name##_##filter) { \
int diff = ARGBClipTestFilter(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
int diff = ARGBClipTestFilter(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
DX(benchmark_height_, nom, denom), \
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, 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, 2)
TEST_FACTOR(4, 4)
TEST_FACTOR(8, 8)
TEST_FACTOR(3by4, 4 / 3)
TEST_FACTOR(3by8, 8 / 3)
TEST_FACTOR(3, 3)
#define TEST_FACTOR(name, nom, denom) \
TEST_FACTOR1(name, None, nom, denom, 0) \
TEST_FACTOR1(name, Linear, nom, denom, 3) \
TEST_FACTOR1(name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(name, Box, nom, denom, 3)
TEST_FACTOR(2, 1, 2)
TEST_FACTOR(4, 1, 4)
TEST_FACTOR(8, 1, 8)
TEST_FACTOR(3by4, 3, 4)
TEST_FACTOR(3by8, 3, 8)
TEST_FACTOR(3, 1, 3)
#undef TEST_FACTOR1
#undef TEST_FACTOR
#undef SX
#undef DX
#define TEST_SCALETO1(name, width, height, filter, max_diff) \
TEST_F(libyuvTest, name##To##width##x##height##_##filter) { \
......
......@@ -27,8 +27,8 @@ static int TestFilter(int src_width, int src_height,
int src_width_uv = (Abs(src_width) + 1) >> 1;
int src_height_uv = (Abs(src_height) + 1) >> 1;
int src_y_plane_size = (Abs(src_width) + b * 2) * (Abs(src_height) + b * 2);
int src_uv_plane_size = (src_width_uv + b * 2) * (src_height_uv + b * 2);
int64 src_y_plane_size = (Abs(src_width) + b * 2) * (Abs(src_height) + b * 2);
int64 src_uv_plane_size = (src_width_uv + b * 2) * (src_height_uv + b * 2);
int src_stride_y = b * 2 + Abs(src_width);
int src_stride_uv = b * 2 + src_width_uv;
......@@ -142,8 +142,9 @@ static int TestFilter_16(int src_width, int src_height,
int src_width_uv = (Abs(src_width) + 1) >> 1;
int src_height_uv = (Abs(src_height) + 1) >> 1;
int src_y_plane_size = (Abs(src_width) + b * 2) * (Abs(src_height) + b * 2);
int src_uv_plane_size = (src_width_uv + b * 2) * (src_height_uv + b * 2);
int64 src_y_plane_size = (Abs(src_width) + b * 2) *
(Abs(src_height) + b * 2);
int64 src_uv_plane_size = (src_width_uv + b * 2) * (src_height_uv + b * 2);
int src_stride_y = b * 2 + Abs(src_width);
int src_stride_uv = b * 2 + src_width_uv;
......@@ -260,41 +261,49 @@ static int TestFilter_16(int src_width, int src_height,
return max_diff;
}
#define TEST_FACTOR1(name, filter, factor, max_diff) \
// The following adjustments in dimensions ensure the scale factor will be
// exactly achieved.
// 2 is chroma subsample
#define DX(x, nom, denom) ((int)(Abs(x) / nom / 2) * nom * 2)
#define SX(x, nom, denom) ((int)(x / nom / 2) * denom * 2)
#define TEST_FACTOR1(name, filter, nom, denom, max_diff) \
TEST_F(libyuvTest, ScaleDownBy##name##_##filter) { \
int diff = TestFilter(benchmark_width_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
int diff = TestFilter(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
DX(benchmark_height_, nom, denom), \
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_ * factor, \
benchmark_height_ * factor, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
int diff = TestFilter_16(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
DX(benchmark_height_, nom, denom), \
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, 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, 2)
TEST_FACTOR(4, 4)
TEST_FACTOR(8, 8)
TEST_FACTOR(3by4, 4 / 3)
TEST_FACTOR(3by8, 8 / 3)
TEST_FACTOR(3, 3)
#define TEST_FACTOR(name, nom, denom) \
TEST_FACTOR1(name, None, nom, denom, 0) \
TEST_FACTOR1(name, Linear, nom, denom, 3) \
TEST_FACTOR1(name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(name, Box, nom, denom, 3)
TEST_FACTOR(2, 1, 2)
TEST_FACTOR(4, 1, 4)
TEST_FACTOR(8, 1, 8)
TEST_FACTOR(3by4, 3, 4)
TEST_FACTOR(3by8, 3, 8)
TEST_FACTOR(3, 1, 3)
#undef TEST_FACTOR1
#undef TEST_FACTOR
#undef SX
#undef DX
#define TEST_SCALETO1(name, width, height, filter, max_diff) \
TEST_F(libyuvTest, name##To##width##x##height##_##filter) { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment