Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: source/libvpx/test/active_map_test.cc

Issue 232133009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/resize_util.c ('k') | source/libvpx/test/android/scrape_gtest_log.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 *
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.
9 */
10 #include <climits>
11 #include <vector>
12 #include "third_party/googletest/src/include/gtest/gtest.h"
13 #include "test/codec_factory.h"
14 #include "test/encode_test_driver.h"
15 #include "test/i420_video_source.h"
16 #include "test/util.h"
17
18 namespace {
19
20 class ActiveMapTest
21 : public ::libvpx_test::EncoderTest,
22 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
23 protected:
24 static const int kWidth = 208;
25 static const int kHeight = 144;
26
27 ActiveMapTest() : EncoderTest(GET_PARAM(0)) {}
28 virtual ~ActiveMapTest() {}
29
30 virtual void SetUp() {
31 InitializeConfig();
32 SetMode(GET_PARAM(1));
33 cpu_used_ = GET_PARAM(2);
34 }
35
36 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
37 ::libvpx_test::Encoder *encoder) {
38 if (video->frame() == 1) {
39 encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
40 } else if (video->frame() == 3) {
41 vpx_active_map_t map = {0};
42 uint8_t active_map[9 * 13] = {
43 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
44 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
45 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
46 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
47 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1,
48 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1,
49 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1,
50 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
51 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
52 };
53 map.cols = (kWidth + 15) / 16;
54 map.rows = (kHeight + 15) / 16;
55 ASSERT_EQ(map.cols, 13u);
56 ASSERT_EQ(map.rows, 9u);
57 map.active_map = active_map;
58 encoder->Control(VP8E_SET_ACTIVEMAP, &map);
59 } else if (video->frame() == 15) {
60 vpx_active_map_t map = {0};
61 map.cols = (kWidth + 15) / 16;
62 map.rows = (kHeight + 15) / 16;
63 map.active_map = NULL;
64 encoder->Control(VP8E_SET_ACTIVEMAP, &map);
65 }
66 }
67
68 int cpu_used_;
69 };
70
71 TEST_P(ActiveMapTest, Test) {
72 // Validate that this non multiple of 64 wide clip encodes
73 cfg_.g_lag_in_frames = 0;
74 cfg_.rc_target_bitrate = 400;
75 cfg_.rc_resize_allowed = 0;
76 cfg_.g_pass = VPX_RC_ONE_PASS;
77 cfg_.rc_end_usage = VPX_CBR;
78 cfg_.kf_max_dist = 90000;
79
80 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,
81 1, 0, 20);
82
83 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
84 }
85
86 #define VP9_FACTORY \
87 static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)
88
89 VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
90 ::testing::Values(::libvpx_test::kRealTime),
91 ::testing::Range(0, 6));
92 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/resize_util.c ('k') | source/libvpx/test/android/scrape_gtest_log.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698