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