2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #include "third_party/googletest/src/include/gtest/gtest.h"
13 #include "./vpx_config.h"
14 #include "./vpx_scale_rtcd.h"
15 #include "test/clear_system_state.h"
16 #include "test/register_state_check.h"
17 #include "test/vpx_scale_test.h"
18 #include "vpx_mem/vpx_mem.h"
19 #include "vpx_ports/vpx_timer.h"
20 #include "vpx_scale/yv12config.h"
22 namespace libvpx_test {
25 #if VPX_ARCH_ARM || (VPX_ARCH_MIPS && !HAVE_MIPS64) || VPX_ARCH_X86
26 // Avoid OOM failures on 32-bit platforms.
27 const int kNumSizesToTest = 7;
29 const int kNumSizesToTest = 8;
31 const int kSizesToTest[] = { 1, 15, 33, 145, 512, 1025, 3840, 16383 };
33 typedef void (*ExtendFrameBorderFunc)(YV12_BUFFER_CONFIG *ybf);
34 typedef void (*CopyFrameFunc)(const YV12_BUFFER_CONFIG *src_ybf,
35 YV12_BUFFER_CONFIG *dst_ybf);
37 class ExtendBorderTest
38 : public VpxScaleBase,
39 public ::testing::TestWithParam<ExtendFrameBorderFunc> {
41 virtual ~ExtendBorderTest() {}
44 virtual void SetUp() { extend_fn_ = GetParam(); }
46 void ExtendBorder() { ASM_REGISTER_STATE_CHECK(extend_fn_(&img_)); }
49 for (int h = 0; h < kNumSizesToTest; ++h) {
50 for (int w = 0; w < kNumSizesToTest; ++w) {
51 ASSERT_NO_FATAL_FAILURE(ResetImages(kSizesToTest[w], kSizesToTest[h]));
60 ExtendFrameBorderFunc extend_fn_;
63 TEST_P(ExtendBorderTest, ExtendBorder) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
65 INSTANTIATE_TEST_SUITE_P(C, ExtendBorderTest,
66 ::testing::Values(vp8_yv12_extend_frame_borders_c));
68 class CopyFrameTest : public VpxScaleBase,
69 public ::testing::TestWithParam<CopyFrameFunc> {
71 virtual ~CopyFrameTest() {}
74 virtual void SetUp() { copy_frame_fn_ = GetParam(); }
77 ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &dst_img_));
81 for (int h = 0; h < kNumSizesToTest; ++h) {
82 for (int w = 0; w < kNumSizesToTest; ++w) {
83 ASSERT_NO_FATAL_FAILURE(ResetImages(kSizesToTest[w], kSizesToTest[h]));
86 CompareImages(dst_img_);
92 CopyFrameFunc copy_frame_fn_;
95 TEST_P(CopyFrameTest, CopyFrame) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
97 INSTANTIATE_TEST_SUITE_P(C, CopyFrameTest,
98 ::testing::Values(vp8_yv12_copy_frame_c));
101 } // namespace libvpx_test