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 #include "vpx_config.h" | 10 #include "vpx_config.h" |
11 #include "test/encode_test_driver.h" | 11 #include "test/encode_test_driver.h" |
12 #if CONFIG_VP8_DECODER | 12 #if CONFIG_VP8_DECODER |
13 #include "test/decode_test_driver.h" | 13 #include "test/decode_test_driver.h" |
14 #endif | 14 #endif |
| 15 #include "test/register_state_check.h" |
15 #include "test/video_source.h" | 16 #include "test/video_source.h" |
16 #include "third_party/googletest/src/include/gtest/gtest.h" | 17 #include "third_party/googletest/src/include/gtest/gtest.h" |
17 | 18 |
18 namespace libvpx_test { | 19 namespace libvpx_test { |
19 void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { | 20 void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { |
20 if (video->img()) | 21 if (video->img()) |
21 EncodeFrameInternal(*video, frame_flags); | 22 EncodeFrameInternal(*video, frame_flags); |
22 else | 23 else |
23 Flush(); | 24 Flush(); |
24 | 25 |
(...skipping 26 matching lines...) Expand all Loading... |
51 | 52 |
52 // Handle frame resizing | 53 // Handle frame resizing |
53 if (cfg_.g_w != img->d_w || cfg_.g_h != img->d_h) { | 54 if (cfg_.g_w != img->d_w || cfg_.g_h != img->d_h) { |
54 cfg_.g_w = img->d_w; | 55 cfg_.g_w = img->d_w; |
55 cfg_.g_h = img->d_h; | 56 cfg_.g_h = img->d_h; |
56 res = vpx_codec_enc_config_set(&encoder_, &cfg_); | 57 res = vpx_codec_enc_config_set(&encoder_, &cfg_); |
57 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 58 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
58 } | 59 } |
59 | 60 |
60 // Encode the frame | 61 // Encode the frame |
61 res = vpx_codec_encode(&encoder_, | 62 REGISTER_STATE_CHECK( |
62 video.img(), video.pts(), video.duration(), | 63 res = vpx_codec_encode(&encoder_, |
63 frame_flags, deadline_); | 64 video.img(), video.pts(), video.duration(), |
| 65 frame_flags, deadline_)); |
64 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 66 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
65 } | 67 } |
66 | 68 |
67 void Encoder::Flush() { | 69 void Encoder::Flush() { |
68 const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0, | 70 const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0, |
69 deadline_); | 71 deadline_); |
70 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 72 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
71 } | 73 } |
72 | 74 |
73 void EncoderTest::SetMode(TestMode mode) { | 75 void EncoderTest::SetMode(TestMode mode) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 break; | 197 break; |
196 } | 198 } |
197 | 199 |
198 EndPassHook(); | 200 EndPassHook(); |
199 | 201 |
200 if (!Continue()) | 202 if (!Continue()) |
201 break; | 203 break; |
202 } | 204 } |
203 } | 205 } |
204 } // namespace libvpx_test | 206 } // namespace libvpx_test |
OLD | NEW |