OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
| 11 #include <string> |
| 12 |
11 #include "./vpx_config.h" | 13 #include "./vpx_config.h" |
12 #include "test/codec_factory.h" | 14 #include "test/codec_factory.h" |
13 #include "test/encode_test_driver.h" | 15 #include "test/encode_test_driver.h" |
14 #include "test/decode_test_driver.h" | 16 #include "test/decode_test_driver.h" |
15 #include "test/register_state_check.h" | 17 #include "test/register_state_check.h" |
16 #include "test/video_source.h" | 18 #include "test/video_source.h" |
17 #include "third_party/googletest/src/include/gtest/gtest.h" | 19 #include "third_party/googletest/src/include/gtest/gtest.h" |
18 | 20 |
19 namespace libvpx_test { | 21 namespace libvpx_test { |
20 void Encoder::InitEncoder(VideoSource *video) { | 22 void Encoder::InitEncoder(VideoSource *video) { |
21 vpx_codec_err_t res; | 23 vpx_codec_err_t res; |
22 const vpx_image_t *img = video->img(); | 24 const vpx_image_t *img = video->img(); |
23 | 25 |
24 if (video->img() && !encoder_.priv) { | 26 if (video->img() && !encoder_.priv) { |
25 cfg_.g_w = img->d_w; | 27 cfg_.g_w = img->d_w; |
26 cfg_.g_h = img->d_h; | 28 cfg_.g_h = img->d_h; |
27 cfg_.g_timebase = video->timebase(); | 29 cfg_.g_timebase = video->timebase(); |
28 cfg_.rc_twopass_stats_in = stats_->buf(); | 30 cfg_.rc_twopass_stats_in = stats_->buf(); |
| 31 |
| 32 // Default to 1 thread and 1 tile column. |
| 33 cfg_.g_threads = 1; |
29 res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, | 34 res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, |
30 init_flags_); | 35 init_flags_); |
31 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 36 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
| 37 |
| 38 std::string codec_name(encoder_.name); |
| 39 if (codec_name.find("WebM Project VP9 Encoder") != std::string::npos) { |
| 40 const int log2_tile_columns = 0; |
| 41 res = vpx_codec_control_(&encoder_, VP9E_SET_TILE_COLUMNS, |
| 42 log2_tile_columns); |
| 43 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
| 44 } |
32 } | 45 } |
33 } | 46 } |
34 | 47 |
35 void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { | 48 void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { |
36 if (video->img()) | 49 if (video->img()) |
37 EncodeFrameInternal(*video, frame_flags); | 50 EncodeFrameInternal(*video, frame_flags); |
38 else | 51 else |
39 Flush(); | 52 Flush(); |
40 | 53 |
41 // Handle twopass stats | 54 // Handle twopass stats |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (decoder) | 256 if (decoder) |
244 delete decoder; | 257 delete decoder; |
245 delete encoder; | 258 delete encoder; |
246 | 259 |
247 if (!Continue()) | 260 if (!Continue()) |
248 break; | 261 break; |
249 } | 262 } |
250 } | 263 } |
251 | 264 |
252 } // namespace libvpx_test | 265 } // namespace libvpx_test |
OLD | NEW |