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

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

Issue 554673004: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 3 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/libs.mk ('k') | source/libvpx/test/datarate_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <climits> 10 #include <climits>
(...skipping 20 matching lines...) Expand all
31 InitializeConfig(); 31 InitializeConfig();
32 SetMode(GET_PARAM(1)); 32 SetMode(GET_PARAM(1));
33 cpu_used_ = GET_PARAM(2); 33 cpu_used_ = GET_PARAM(2);
34 } 34 }
35 35
36 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, 36 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
37 ::libvpx_test::Encoder *encoder) { 37 ::libvpx_test::Encoder *encoder) {
38 if (video->frame() == 1) { 38 if (video->frame() == 1) {
39 encoder->Control(VP8E_SET_CPUUSED, cpu_used_); 39 encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
40 } else if (video->frame() == 3) { 40 } else if (video->frame() == 3) {
41 vpx_active_map_t map = {0}; 41 vpx_active_map_t map = vpx_active_map_t();
42 uint8_t active_map[9 * 13] = { 42 uint8_t active_map[9 * 13] = {
43 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 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, 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, 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, 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, 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, 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, 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, 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, 51 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
52 }; 52 };
53 map.cols = (kWidth + 15) / 16; 53 map.cols = (kWidth + 15) / 16;
54 map.rows = (kHeight + 15) / 16; 54 map.rows = (kHeight + 15) / 16;
55 ASSERT_EQ(map.cols, 13u); 55 ASSERT_EQ(map.cols, 13u);
56 ASSERT_EQ(map.rows, 9u); 56 ASSERT_EQ(map.rows, 9u);
57 map.active_map = active_map; 57 map.active_map = active_map;
58 encoder->Control(VP8E_SET_ACTIVEMAP, &map); 58 encoder->Control(VP8E_SET_ACTIVEMAP, &map);
59 } else if (video->frame() == 15) { 59 } else if (video->frame() == 15) {
60 vpx_active_map_t map = {0}; 60 vpx_active_map_t map = vpx_active_map_t();
61 map.cols = (kWidth + 15) / 16; 61 map.cols = (kWidth + 15) / 16;
62 map.rows = (kHeight + 15) / 16; 62 map.rows = (kHeight + 15) / 16;
63 map.active_map = NULL; 63 map.active_map = NULL;
64 encoder->Control(VP8E_SET_ACTIVEMAP, &map); 64 encoder->Control(VP8E_SET_ACTIVEMAP, &map);
65 } 65 }
66 } 66 }
67 67
68 int cpu_used_; 68 int cpu_used_;
69 }; 69 };
70 70
71 TEST_P(ActiveMapTest, Test) { 71 TEST_P(ActiveMapTest, Test) {
72 // Validate that this non multiple of 64 wide clip encodes 72 // Validate that this non multiple of 64 wide clip encodes
73 cfg_.g_lag_in_frames = 0; 73 cfg_.g_lag_in_frames = 0;
74 cfg_.rc_target_bitrate = 400; 74 cfg_.rc_target_bitrate = 400;
75 cfg_.rc_resize_allowed = 0; 75 cfg_.rc_resize_allowed = 0;
76 cfg_.g_pass = VPX_RC_ONE_PASS; 76 cfg_.g_pass = VPX_RC_ONE_PASS;
77 cfg_.rc_end_usage = VPX_CBR; 77 cfg_.rc_end_usage = VPX_CBR;
78 cfg_.kf_max_dist = 90000; 78 cfg_.kf_max_dist = 90000;
79 79
80 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30, 80 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,
81 1, 0, 20); 81 1, 0, 20);
82 82
83 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 83 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
84 } 84 }
85 85
86 VP9_INSTANTIATE_TEST_CASE(ActiveMapTest, 86 VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
87 ::testing::Values(::libvpx_test::kRealTime), 87 ::testing::Values(::libvpx_test::kRealTime),
88 ::testing::Range(0, 6)); 88 ::testing::Range(0, 6));
89 } // namespace 89 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/libs.mk ('k') | source/libvpx/test/datarate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698