Commit 3a826f1d authored by clang-format's avatar clang-format Committed by James Zern

test/: apply clang-format

Change-Id: I1138fbeff5f63beb5c0de2c357793da12502d453
parent 712e66da
...@@ -23,9 +23,7 @@ class ACMRandom { ...@@ -23,9 +23,7 @@ class ACMRandom {
explicit ACMRandom(int seed) : random_(seed) {} explicit ACMRandom(int seed) : random_(seed) {}
void Reset(int seed) { void Reset(int seed) { random_.Reseed(seed); }
random_.Reseed(seed);
}
uint16_t Rand16(void) { uint16_t Rand16(void) {
const uint32_t value = const uint32_t value =
random_.Generate(testing::internal::Random::kMaxRange); random_.Generate(testing::internal::Random::kMaxRange);
...@@ -52,17 +50,11 @@ class ACMRandom { ...@@ -52,17 +50,11 @@ class ACMRandom {
return r < 128 ? r << 4 : r >> 4; return r < 128 ? r << 4 : r >> 4;
} }
int PseudoUniform(int range) { int PseudoUniform(int range) { return random_.Generate(range); }
return random_.Generate(range);
}
int operator()(int n) { int operator()(int n) { return PseudoUniform(n); }
return PseudoUniform(n);
}
static int DeterministicSeed(void) { static int DeterministicSeed(void) { return 0xbaba; }
return 0xbaba;
}
private: private:
testing::internal::Random random_; testing::internal::Random random_;
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
namespace { namespace {
// Check if any pixel in a 16x16 macroblock varies between frames. // Check if any pixel in a 16x16 macroblock varies between frames.
int CheckMb(const vpx_image_t &current, const vpx_image_t &previous, int CheckMb(const vpx_image_t &current, const vpx_image_t &previous, int mb_r,
int mb_r, int mb_c) { int mb_c) {
for (int plane = 0; plane < 3; plane++) { for (int plane = 0; plane < 3; plane++) {
int r = 16 * mb_r; int r = 16 * mb_r;
int c0 = 16 * mb_c; int c0 = 16 * mb_c;
......
...@@ -39,6 +39,7 @@ class ActiveMapTest ...@@ -39,6 +39,7 @@ class ActiveMapTest
encoder->Control(VP8E_SET_CPUUSED, cpu_used_); encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
} else if (video->frame() == 3) { } else if (video->frame() == 3) {
vpx_active_map_t map = vpx_active_map_t(); vpx_active_map_t map = vpx_active_map_t();
/* clang-format off */
uint8_t active_map[9 * 13] = { uint8_t active_map[9 * 13] = {
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
...@@ -50,6 +51,7 @@ class ActiveMapTest ...@@ -50,6 +51,7 @@ class ActiveMapTest
0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
}; };
/* clang-format on */
map.cols = (kWidth + 15) / 16; map.cols = (kWidth + 15) / 16;
map.rows = (kHeight + 15) / 16; map.rows = (kHeight + 15) / 16;
ASSERT_EQ(map.cols, 13u); ASSERT_EQ(map.cols, 13u);
...@@ -82,15 +84,11 @@ class ActiveMapTest ...@@ -82,15 +84,11 @@ class ActiveMapTest
int cpu_used_; int cpu_used_;
}; };
TEST_P(ActiveMapTest, Test) { TEST_P(ActiveMapTest, Test) { DoTest(); }
DoTest();
}
class ActiveMapTestLarge : public ActiveMapTest {}; class ActiveMapTestLarge : public ActiveMapTest {};
TEST_P(ActiveMapTestLarge, Test) { TEST_P(ActiveMapTestLarge, Test) { DoTest(); }
DoTest();
}
VP10_INSTANTIATE_TEST_CASE(ActiveMapTestLarge, VP10_INSTANTIATE_TEST_CASE(ActiveMapTestLarge,
::testing::Values(::libvpx_test::kRealTime), ::testing::Values(::libvpx_test::kRealTime),
......
...@@ -24,12 +24,9 @@ typedef void (*AddNoiseFunc)(unsigned char *start, char *noise, ...@@ -24,12 +24,9 @@ typedef void (*AddNoiseFunc)(unsigned char *start, char *noise,
char bothclamp[16], unsigned int width, char bothclamp[16], unsigned int width,
unsigned int height, int pitch); unsigned int height, int pitch);
class AddNoiseTest class AddNoiseTest : public ::testing::TestWithParam<AddNoiseFunc> {
: public ::testing::TestWithParam<AddNoiseFunc> {
public: public:
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
virtual ~AddNoiseTest() {} virtual ~AddNoiseTest() {}
}; };
...@@ -45,7 +42,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) { ...@@ -45,7 +42,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
DECLARE_ALIGNED(16, char, blackclamp[16]); DECLARE_ALIGNED(16, char, blackclamp[16]);
DECLARE_ALIGNED(16, char, whiteclamp[16]); DECLARE_ALIGNED(16, char, whiteclamp[16]);
DECLARE_ALIGNED(16, char, bothclamp[16]); DECLARE_ALIGNED(16, char, bothclamp[16]);
const int width = 64; const int width = 64;
const int height = 64; const int height = 64;
const int image_size = width * height; const int image_size = width * height;
char noise[3072]; char noise[3072];
...@@ -105,7 +102,7 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) { ...@@ -105,7 +102,7 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
DECLARE_ALIGNED(16, char, blackclamp[16]); DECLARE_ALIGNED(16, char, blackclamp[16]);
DECLARE_ALIGNED(16, char, whiteclamp[16]); DECLARE_ALIGNED(16, char, whiteclamp[16]);
DECLARE_ALIGNED(16, char, bothclamp[16]); DECLARE_ALIGNED(16, char, bothclamp[16]);
const int width = 64; const int width = 64;
const int height = 64; const int height = 64;
const int image_size = width * height; const int image_size = width * height;
char noise[3072]; char noise[3072];
...@@ -128,9 +125,8 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) { ...@@ -128,9 +125,8 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, blackclamp, whiteclamp, ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, blackclamp, whiteclamp,
bothclamp, width, height, width)); bothclamp, width, height, width));
srand(0); srand(0);
ASM_REGISTER_STATE_CHECK(vpx_plane_add_noise_c(d, noise, blackclamp, ASM_REGISTER_STATE_CHECK(vpx_plane_add_noise_c(
whiteclamp, bothclamp, d, noise, blackclamp, whiteclamp, bothclamp, width, height, width));
width, height, width));
for (int i = 0; i < image_size; ++i) { for (int i = 0; i < image_size; ++i) {
EXPECT_EQ(static_cast<int>(s[i]), static_cast<int>(d[i])) << "i = " << i; EXPECT_EQ(static_cast<int>(s[i]), static_cast<int>(d[i])) << "i = " << i;
......
...@@ -19,11 +19,8 @@ class AltRefForcedKeyTestLarge ...@@ -19,11 +19,8 @@ class AltRefForcedKeyTestLarge
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected: protected:
AltRefForcedKeyTestLarge() AltRefForcedKeyTestLarge()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
encoding_mode_(GET_PARAM(1)), cpu_used_(GET_PARAM(2)), forced_kf_frame_num_(1), frame_num_(0) {}
cpu_used_(GET_PARAM(2)),
forced_kf_frame_num_(1),
frame_num_(0) {}
virtual ~AltRefForcedKeyTestLarge() {} virtual ~AltRefForcedKeyTestLarge() {}
virtual void SetUp() { virtual void SetUp() {
...@@ -38,8 +35,8 @@ class AltRefForcedKeyTestLarge ...@@ -38,8 +35,8 @@ class AltRefForcedKeyTestLarge
if (video->frame() == 0) { if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_); encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
// override test default for tile columns if necessary.
#if CONFIG_VP10_ENCODER #if CONFIG_VP10_ENCODER
// override test default for tile columns if necessary.
if (GET_PARAM(0) == &libvpx_test::kVP10) { if (GET_PARAM(0) == &libvpx_test::kVP10) {
encoder->Control(VP9E_SET_TILE_COLUMNS, 6); encoder->Control(VP9E_SET_TILE_COLUMNS, 6);
} }
...@@ -91,9 +88,8 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) { ...@@ -91,9 +88,8 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
} }
} }
VP10_INSTANTIATE_TEST_CASE( VP10_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
AltRefForcedKeyTestLarge, ::testing::Values(::libvpx_test::kOnePassGood),
::testing::Values(::libvpx_test::kOnePassGood), ::testing::Range(0, 9));
::testing::Range(0, 9));
} // namespace } // namespace
...@@ -49,8 +49,8 @@ class AqSegmentTest ...@@ -49,8 +49,8 @@ class AqSegmentTest
cfg_.rc_buf_optimal_sz = 500; cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000; cfg_.rc_buf_sz = 1000;
cfg_.rc_target_bitrate = 300; cfg_.rc_target_bitrate = 300;
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
352, 288, 30, 1, 0, 15); 288, 30, 1, 0, 15);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
...@@ -60,36 +60,23 @@ class AqSegmentTest ...@@ -60,36 +60,23 @@ class AqSegmentTest
// Validate that this AQ segmentation mode (AQ=1, variance_ap) // Validate that this AQ segmentation mode (AQ=1, variance_ap)
// encodes and decodes without a mismatch. // encodes and decodes without a mismatch.
TEST_P(AqSegmentTest, TestNoMisMatchAQ1) { TEST_P(AqSegmentTest, TestNoMisMatchAQ1) { DoTest(1); }
DoTest(1);
}
// Validate that this AQ segmentation mode (AQ=2, complexity_aq) // Validate that this AQ segmentation mode (AQ=2, complexity_aq)
// encodes and decodes without a mismatch. // encodes and decodes without a mismatch.
TEST_P(AqSegmentTest, TestNoMisMatchAQ2) { TEST_P(AqSegmentTest, TestNoMisMatchAQ2) { DoTest(2); }
DoTest(2);
}
// Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq) // Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq)
// encodes and decodes without a mismatch. // encodes and decodes without a mismatch.
TEST_P(AqSegmentTest, TestNoMisMatchAQ3) { TEST_P(AqSegmentTest, TestNoMisMatchAQ3) { DoTest(3); }
DoTest(3);
}
class AqSegmentTestLarge : public AqSegmentTest {}; class AqSegmentTestLarge : public AqSegmentTest {};
TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ1) { TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ1) { DoTest(1); }
DoTest(1);
}
TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ2) { TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ2) { DoTest(2); }
DoTest(2);
}
TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ3) {
DoTest(3);
}
TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ3) { DoTest(3); }
VP10_INSTANTIATE_TEST_CASE(AqSegmentTest, VP10_INSTANTIATE_TEST_CASE(AqSegmentTest,
::testing::Values(::libvpx_test::kRealTime, ::testing::Values(::libvpx_test::kRealTime,
......
...@@ -22,8 +22,8 @@ namespace { ...@@ -22,8 +22,8 @@ namespace {
const unsigned int kFrames = 100; const unsigned int kFrames = 100;
const int kBitrate = 500; const int kBitrate = 500;
#define ARF_NOT_SEEN 1000001 #define ARF_NOT_SEEN 1000001
#define ARF_SEEN_ONCE 1000000 #define ARF_SEEN_ONCE 1000000
typedef struct { typedef struct {
const char *filename; const char *filename;
...@@ -44,24 +44,20 @@ typedef struct { ...@@ -44,24 +44,20 @@ typedef struct {
const TestVideoParam kTestVectors[] = { const TestVideoParam kTestVectors[] = {
// artificially increase framerate to trigger default check // artificially increase framerate to trigger default check
{"hantro_collage_w352h288.yuv", 352, 288, 5000, 1, { "hantro_collage_w352h288.yuv", 352, 288, 5000, 1, 8, VPX_IMG_FMT_I420,
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0}, VPX_BITS_8, 0 },
{"hantro_collage_w352h288.yuv", 352, 288, 30, 1, { "hantro_collage_w352h288.yuv", 352, 288, 30, 1, 8, VPX_IMG_FMT_I420,
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0}, VPX_BITS_8, 0 },
{"rush_hour_444.y4m", 352, 288, 30, 1, { "rush_hour_444.y4m", 352, 288, 30, 1, 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1 },
8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
// Add list of profile 2/3 test videos here ... // Add list of profile 2/3 test videos here ...
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
}; };
const TestEncodeParam kEncodeVectors[] = { const TestEncodeParam kEncodeVectors[] = {
{::libvpx_test::kOnePassGood, 2}, { ::libvpx_test::kOnePassGood, 2 }, { ::libvpx_test::kOnePassGood, 5 },
{::libvpx_test::kOnePassGood, 5}, { ::libvpx_test::kTwoPassGood, 1 }, { ::libvpx_test::kTwoPassGood, 2 },
{::libvpx_test::kTwoPassGood, 1}, { ::libvpx_test::kTwoPassGood, 5 }, { ::libvpx_test::kRealTime, 5 },
{::libvpx_test::kTwoPassGood, 2},
{::libvpx_test::kTwoPassGood, 5},
{::libvpx_test::kRealTime, 5},
}; };
const int kMinArfVectors[] = { const int kMinArfVectors[] = {
...@@ -80,15 +76,12 @@ int is_extension_y4m(const char *filename) { ...@@ -80,15 +76,12 @@ int is_extension_y4m(const char *filename) {
class ArfFreqTestLarge class ArfFreqTestLarge
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith3Params<TestVideoParam, \ public ::libvpx_test::CodecTestWith3Params<TestVideoParam,
TestEncodeParam, int> { TestEncodeParam, int> {
protected: protected:
ArfFreqTestLarge() ArfFreqTestLarge()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(1)),
test_video_param_(GET_PARAM(1)), test_encode_param_(GET_PARAM(2)), min_arf_requested_(GET_PARAM(3)) {}
test_encode_param_(GET_PARAM(2)),
min_arf_requested_(GET_PARAM(3)) {
}
virtual ~ArfFreqTestLarge() {} virtual ~ArfFreqTestLarge() {}
...@@ -114,17 +107,16 @@ class ArfFreqTestLarge ...@@ -114,17 +107,16 @@ class ArfFreqTestLarge
} }
int GetNumFramesInPkt(const vpx_codec_cx_pkt_t *pkt) { int GetNumFramesInPkt(const vpx_codec_cx_pkt_t *pkt) {
const uint8_t *buffer = reinterpret_cast<uint8_t*>(pkt->data.frame.buf); const uint8_t *buffer = reinterpret_cast<uint8_t *>(pkt->data.frame.buf);
const uint8_t marker = buffer[pkt->data.frame.sz - 1]; const uint8_t marker = buffer[pkt->data.frame.sz - 1];
const int mag = ((marker >> 3) & 3) + 1; const int mag = ((marker >> 3) & 3) + 1;
int frames = (marker & 0x7) + 1; int frames = (marker & 0x7) + 1;
const unsigned int index_sz = 2 + mag * frames; const unsigned int index_sz = 2 + mag * frames;
// Check for superframe or not. // Check for superframe or not.
// Assume superframe has only one visible frame, the rest being // Assume superframe has only one visible frame, the rest being
// invisible. If superframe index is not found, then there is only // invisible. If superframe index is not found, then there is only
// one frame. // one frame.
if (!((marker & 0xe0) == 0xc0 && if (!((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
pkt->data.frame.sz >= index_sz &&
buffer[pkt->data.frame.sz - index_sz] == marker)) { buffer[pkt->data.frame.sz - index_sz] == marker)) {
frames = 1; frames = 1;
} }
...@@ -132,8 +124,7 @@ class ArfFreqTestLarge ...@@ -132,8 +124,7 @@ class ArfFreqTestLarge
} }
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
return;
const int frames = GetNumFramesInPkt(pkt); const int frames = GetNumFramesInPkt(pkt);
if (frames == 1) { if (frames == 1) {
run_of_visible_frames_++; run_of_visible_frames_++;
...@@ -167,9 +158,7 @@ class ArfFreqTestLarge ...@@ -167,9 +158,7 @@ class ArfFreqTestLarge
} }
} }
int GetMinVisibleRun() const { int GetMinVisibleRun() const { return min_run_; }
return min_run_;
}
int GetMinArfDistanceRequested() const { int GetMinArfDistanceRequested() const {
if (min_arf_requested_) if (min_arf_requested_)
...@@ -178,7 +167,7 @@ class ArfFreqTestLarge ...@@ -178,7 +167,7 @@ class ArfFreqTestLarge
return vp10_rc_get_default_min_gf_interval( return vp10_rc_get_default_min_gf_interval(
test_video_param_.width, test_video_param_.height, test_video_param_.width, test_video_param_.height,
(double)test_video_param_.framerate_num / (double)test_video_param_.framerate_num /
test_video_param_.framerate_den); test_video_param_.framerate_den);
} }
TestVideoParam test_video_param_; TestVideoParam test_video_param_;
...@@ -197,21 +186,18 @@ TEST_P(ArfFreqTestLarge, MinArfFreqTest) { ...@@ -197,21 +186,18 @@ TEST_P(ArfFreqTestLarge, MinArfFreqTest) {
cfg_.g_input_bit_depth = test_video_param_.input_bit_depth; cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
cfg_.g_bit_depth = test_video_param_.bit_depth; cfg_.g_bit_depth = test_video_param_.bit_depth;
init_flags_ = VPX_CODEC_USE_PSNR; init_flags_ = VPX_CODEC_USE_PSNR;
if (cfg_.g_bit_depth > 8) if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
testing::internal::scoped_ptr<libvpx_test::VideoSource> video; testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
if (is_extension_y4m(test_video_param_.filename)) { if (is_extension_y4m(test_video_param_.filename)) {
video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
0, kFrames)); kFrames));
} else { } else {
video.reset(new libvpx_test::YUVVideoSource(test_video_param_.filename, video.reset(new libvpx_test::YUVVideoSource(
test_video_param_.fmt, test_video_param_.filename, test_video_param_.fmt,
test_video_param_.width, test_video_param_.width, test_video_param_.height,
test_video_param_.height, test_video_param_.framerate_num, test_video_param_.framerate_den, 0,
test_video_param_.framerate_num, kFrames));
test_video_param_.framerate_den,
0, kFrames));
} }
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get())); ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
...@@ -235,15 +221,12 @@ INSTANTIATE_TEST_CASE_P( ...@@ -235,15 +221,12 @@ INSTANTIATE_TEST_CASE_P(
::testing::Combine( ::testing::Combine(
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( ::testing::Values(static_cast<const libvpx_test::CodecFactory *>(
&libvpx_test::kVP10)), &libvpx_test::kVP10)),
::testing::ValuesIn(kTestVectors), ::testing::ValuesIn(kTestVectors), ::testing::ValuesIn(kEncodeVectors),
::testing::ValuesIn(kEncodeVectors),
::testing::ValuesIn(kMinArfVectors))); ::testing::ValuesIn(kMinArfVectors)));
#endif // CONFIG_VP10_ENCODER #endif // CONFIG_VP10_ENCODER
#else #else
VP10_INSTANTIATE_TEST_CASE( VP10_INSTANTIATE_TEST_CASE(ArfFreqTestLarge, ::testing::ValuesIn(kTestVectors),
ArfFreqTestLarge, ::testing::ValuesIn(kEncodeVectors),
::testing::ValuesIn(kTestVectors), ::testing::ValuesIn(kMinArfVectors));
::testing::ValuesIn(kEncodeVectors),
::testing::ValuesIn(kMinArfVectors));
#endif // CONFIG_VP9_HIGHBITDEPTH || CONFIG_EXT_REFS #endif // CONFIG_VP9_HIGHBITDEPTH || CONFIG_EXT_REFS
} // namespace } // namespace
This diff is collapsed.
This diff is collapsed.
...@@ -31,7 +31,7 @@ using libvpx_test::FunctionEquivalenceTest; ...@@ -31,7 +31,7 @@ using libvpx_test::FunctionEquivalenceTest;
namespace { namespace {
template<typename F, typename T> template <typename F, typename T>
class BlendA64MaskTest : public FunctionEquivalenceTest<F> { class BlendA64MaskTest : public FunctionEquivalenceTest<F> {
protected: protected:
static const int kIterations = 10000; static const int kIterations = 10000;
...@@ -61,37 +61,36 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<F> { ...@@ -61,37 +61,36 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<F> {
src1_offset_ = this->rng_(33); src1_offset_ = this->rng_(33);
src1_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_; src1_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
mask_stride_ = this->rng_(kMaxWidth + 1 - w_ * (subx_ ? 2 : 1)) + mask_stride_ =
w_ * (subx_ ? 2 : 1); this->rng_(kMaxWidth + 1 - w_ * (subx_ ? 2 : 1)) + w_ * (subx_ ? 2 : 1);
T *p_src0; T *p_src0;
T *p_src1; T *p_src1;
switch (this->rng_(3)) { switch (this->rng_(3)) {
case 0: // Separate sources case 0: // Separate sources
p_src0 = src0_; p_src0 = src0_;
p_src1 = src1_; p_src1 = src1_;
break; break;
case 1: // src0 == dst case 1: // src0 == dst
p_src0 = dst_tst_; p_src0 = dst_tst_;
src0_stride_ = dst_stride_; src0_stride_ = dst_stride_;
src0_offset_ = dst_offset_; src0_offset_ = dst_offset_;
p_src1 = src1_; p_src1 = src1_;
break; break;
case 2: // src1 == dst case 2: // src1 == dst
p_src0 = src0_; p_src0 = src0_;
p_src1 = dst_tst_; p_src1 = dst_tst_;
src1_stride_ = dst_stride_; src1_stride_ = dst_stride_;
src1_offset_ = dst_offset_; src1_offset_ = dst_offset_;
break; break;
default: default: FAIL();
FAIL();
} }
Execute(p_src0, p_src1); Execute(p_src0, p_src1);
for (int r = 0 ; r < h_ ; ++r) { for (int r = 0; r < h_; ++r) {
for (int c = 0 ; c < w_ ; ++c) { for (int c = 0; c < w_; ++c) {
ASSERT_EQ(dst_ref_[dst_offset_ + r * dst_stride_ + c], ASSERT_EQ(dst_ref_[dst_offset_ + r * dst_stride_ + c],
dst_tst_[dst_offset_ + r * dst_stride_ + c]); dst_tst_[dst_offset_ + r * dst_stride_ + c]);
} }
...@@ -125,31 +124,28 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<F> { ...@@ -125,31 +124,28 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<F> {
// 8 bit version // 8 bit version
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
typedef void (*F8B)(uint8_t *dst, uint32_t dst_stride, typedef void (*F8B)(uint8_t *dst, uint32_t dst_stride, const uint8_t *src0,
const uint8_t *src0, uint32_t src0_stride, uint32_t src0_stride, const uint8_t *src1,
const uint8_t *src1, uint32_t src1_stride, uint32_t src1_stride, const uint8_t *mask,
const uint8_t *mask, uint32_t mask_stride, uint32_t mask_stride, int h, int w, int suby, int subx);
int h, int w, int suby, int subx);
typedef libvpx_test::FuncParam<F8B> TestFuncs; typedef libvpx_test::FuncParam<F8B> TestFuncs;
class BlendA64MaskTest8B : public BlendA64MaskTest<F8B, uint8_t> { class BlendA64MaskTest8B : public BlendA64MaskTest<F8B, uint8_t> {
protected: protected:
void Execute(const uint8_t *p_src0, const uint8_t *p_src1) { void Execute(const uint8_t *p_src0, const uint8_t *p_src1) {
params_.ref_func(dst_ref_ + dst_offset_, dst_stride_, params_.ref_func(dst_ref_ + dst_offset_, dst_stride_, p_src0 + src0_offset_,
p_src0 + src0_offset_, src0_stride_, src0_stride_, p_src1 + src1_offset_, src1_stride_, mask_,
p_src1 + src1_offset_, src1_stride_, kMaxMaskWidth, h_, w_, suby_, subx_);
mask_, kMaxMaskWidth, h_, w_, suby_, subx_); ASM_REGISTER_STATE_CHECK(params_.tst_func(
ASM_REGISTER_STATE_CHECK( dst_tst_ + dst_offset_, dst_stride_, p_src0 + src0_offset_,
params_.tst_func(dst_tst_ + dst_offset_, dst_stride_, src0_stride_, p_src1 + src1_offset_, src1_stride_, mask_, kMaxMaskWidth,
p_src0 + src0_offset_, src0_stride_, h_, w_, suby_, subx_));
p_src1 + src1_offset_, src1_stride_,
mask_, kMaxMaskWidth, h_, w_, suby_, subx_));
} }
}; };
TEST_P(BlendA64MaskTest8B, RandomValues) { TEST_P(BlendA64MaskTest8B, RandomValues) {
for (int iter = 0 ; iter < kIterations &&