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 "test/decode_test_driver.h" | 10 #include "test/decode_test_driver.h" |
11 #include "third_party/googletest/src/include/gtest/gtest.h" | 11 #include "third_party/googletest/src/include/gtest/gtest.h" |
| 12 #include "test/register_state_check.h" |
12 #include "test/video_source.h" | 13 #include "test/video_source.h" |
13 | 14 |
14 namespace libvpx_test { | 15 namespace libvpx_test { |
15 #if CONFIG_VP8_DECODER | 16 #if CONFIG_VP8_DECODER |
16 void Decoder::DecodeFrame(const uint8_t *cxdata, int size) { | 17 void Decoder::DecodeFrame(const uint8_t *cxdata, int size) { |
17 if (!decoder_.priv) { | 18 if (!decoder_.priv) { |
18 const vpx_codec_err_t res_init = vpx_codec_dec_init(&decoder_, | 19 const vpx_codec_err_t res_init = vpx_codec_dec_init(&decoder_, |
19 &vpx_codec_vp8_dx_algo, | 20 &vpx_codec_vp8_dx_algo, |
20 &cfg_, 0); | 21 &cfg_, 0); |
21 ASSERT_EQ(VPX_CODEC_OK, res_init) << DecodeError(); | 22 ASSERT_EQ(VPX_CODEC_OK, res_init) << DecodeError(); |
22 } | 23 } |
23 | 24 |
24 const vpx_codec_err_t res_dec = vpx_codec_decode(&decoder_, | 25 vpx_codec_err_t res_dec; |
25 cxdata, size, NULL, 0); | 26 REGISTER_STATE_CHECK(res_dec = vpx_codec_decode(&decoder_, |
| 27 cxdata, size, NULL, 0)); |
26 ASSERT_EQ(VPX_CODEC_OK, res_dec) << DecodeError(); | 28 ASSERT_EQ(VPX_CODEC_OK, res_dec) << DecodeError(); |
27 } | 29 } |
28 | 30 |
29 void DecoderTest::RunLoop(CompressedVideoSource *video) { | 31 void DecoderTest::RunLoop(CompressedVideoSource *video) { |
30 vpx_codec_dec_cfg_t dec_cfg = {0}; | 32 vpx_codec_dec_cfg_t dec_cfg = {0}; |
31 Decoder decoder(dec_cfg, 0); | 33 Decoder decoder(dec_cfg, 0); |
32 | 34 |
33 // Decode frames. | 35 // Decode frames. |
34 for (video->Begin(); video->cxdata(); video->Next()) { | 36 for (video->Begin(); video->cxdata(); video->Next()) { |
35 decoder.DecodeFrame(video->cxdata(), video->frame_size()); | 37 decoder.DecodeFrame(video->cxdata(), video->frame_size()); |
36 | 38 |
37 DxDataIterator dec_iter = decoder.GetDxData(); | 39 DxDataIterator dec_iter = decoder.GetDxData(); |
38 const vpx_image_t *img = NULL; | 40 const vpx_image_t *img = NULL; |
39 | 41 |
40 // Get decompressed data | 42 // Get decompressed data |
41 while ((img = dec_iter.Next())) | 43 while ((img = dec_iter.Next())) |
42 DecompressedFrameHook(*img, video->frame_number()); | 44 DecompressedFrameHook(*img, video->frame_number()); |
43 } | 45 } |
44 } | 46 } |
45 #endif | 47 #endif |
46 } // namespace libvpx_test | 48 } // namespace libvpx_test |
OLD | NEW |