| OLD | NEW |
| 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 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 | 204 |
| 205 virtual void PreDecodeFrameHook( | 205 virtual void PreDecodeFrameHook( |
| 206 const libvpx_test::CompressedVideoSource &video, | 206 const libvpx_test::CompressedVideoSource &video, |
| 207 libvpx_test::Decoder *decoder) { | 207 libvpx_test::Decoder *decoder) { |
| 208 if (num_buffers_ > 0 && video.frame_number() == 0) { | 208 if (num_buffers_ > 0 && video.frame_number() == 0) { |
| 209 // Have libvpx use frame buffers we create. | 209 // Have libvpx use frame buffers we create. |
| 210 ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_)); | 210 ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_)); |
| 211 ASSERT_EQ(VPX_CODEC_OK, | 211 ASSERT_EQ(VPX_CODEC_OK, |
| 212 decoder->SetFrameBufferFunctions( | 212 decoder->SetFrameBufferFunctions( |
| 213 GetVp9FrameBuffer, ReleaseVP9FrameBuffer, this)); | 213 GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this)); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 void OpenMD5File(const std::string &md5_file_name_) { | 217 void OpenMD5File(const std::string &md5_file_name_) { |
| 218 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_); | 218 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_); |
| 219 ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: " | 219 ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: " |
| 220 << md5_file_name_; | 220 << md5_file_name_; |
| 221 } | 221 } |
| 222 | 222 |
| 223 virtual void DecompressedFrameHook(const vpx_image_t &img, | 223 virtual void DecompressedFrameHook(const vpx_image_t &img, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 235 md5_res.Add(&img); | 235 md5_res.Add(&img); |
| 236 const char *const actual_md5 = md5_res.Get(); | 236 const char *const actual_md5 = md5_res.Get(); |
| 237 | 237 |
| 238 // Check md5 match. | 238 // Check md5 match. |
| 239 ASSERT_STREQ(expected_md5, actual_md5) | 239 ASSERT_STREQ(expected_md5, actual_md5) |
| 240 << "Md5 checksums don't match: frame number = " << frame_number; | 240 << "Md5 checksums don't match: frame number = " << frame_number; |
| 241 } | 241 } |
| 242 | 242 |
| 243 // Callback to get a free external frame buffer. Return value < 0 is an | 243 // Callback to get a free external frame buffer. Return value < 0 is an |
| 244 // error. | 244 // error. |
| 245 static int GetVp9FrameBuffer(void *user_priv, size_t min_size, | 245 static int GetVP9FrameBuffer(void *user_priv, size_t min_size, |
| 246 vpx_codec_frame_buffer_t *fb) { | 246 vpx_codec_frame_buffer_t *fb) { |
| 247 ExternalFrameBufferMD5Test *const md5Test = | 247 ExternalFrameBufferMD5Test *const md5Test = |
| 248 reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv); | 248 reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv); |
| 249 return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb); | 249 return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb); |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Callback to release an external frame buffer. Return value < 0 is an | 252 // Callback to release an external frame buffer. Return value < 0 is an |
| 253 // error. | 253 // error. |
| 254 static int ReleaseVP9FrameBuffer(void *user_priv, | 254 static int ReleaseVP9FrameBuffer(void *user_priv, |
| 255 vpx_codec_frame_buffer_t *fb) { | 255 vpx_codec_frame_buffer_t *fb) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 455 |
| 456 TEST_F(ExternalFrameBufferTest, SetAfterDecode) { | 456 TEST_F(ExternalFrameBufferTest, SetAfterDecode) { |
| 457 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; | 457 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; |
| 458 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); | 458 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); |
| 459 ASSERT_EQ(VPX_CODEC_ERROR, | 459 ASSERT_EQ(VPX_CODEC_ERROR, |
| 460 SetFrameBufferFunctions( | 460 SetFrameBufferFunctions( |
| 461 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); | 461 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); |
| 462 } | 462 } |
| 463 | 463 |
| 464 VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, | 464 VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, |
| 465 ::testing::ValuesIn(libvpx_test::kVP9TestVectors)); | 465 ::testing::ValuesIn(libvpx_test::kVP9TestVectors, |
| 466 libvpx_test::kVP9TestVectors + |
| 467 libvpx_test::kNumVP9TestVectors)); |
| 466 } // namespace | 468 } // namespace |
| OLD | NEW |