History

vp9: Add nonref frame buffer test.

The new test will run a SVC bitstream which has non ref frames. It checks the number of buffer acquired and released to make sure all external frame buffers are released. Add a new test bitstream: vp90-2-22-svc_1280x720_1.webm which has 400 frames in total, and 1 spatial layer and 2 temporal layers. There is one non ref frame every other frame. Disabled for now. Will be enabled with the fix. BUG=b/68819248

Jerome Jiang committed 9 years ago

Commit a68bbcf1 parent eb7d4314 files · +47 −2Browse files

Unified · Split

4 files
  1. test/external_frame_buffer_test.cc +42 −2
  2. test/test-data.mk +2 −0
  3. test/test-data.sha1 +2 −0
  4. test/test_vectors.cc +1 −0
test/external_frame_buffer_test.cc+42−2
@@ -34,7 +34,8 @@ struct ExternalFrameBuffer { · 33 unmodified lines
3434 // Class to manipulate a list of external frame buffers.
3535 class ExternalFrameBufferList {
3636 public:
37− ExternalFrameBufferList() : num_buffers_(0), ext_fb_list_(NULL) {}
37+ ExternalFrameBufferList()
38+ : num_buffers_(0), num_used_buffers_(0), ext_fb_list_(NULL) {}
3839
3940 virtual ~ExternalFrameBufferList() {
4041 for (int i = 0; i < num_buffers_; ++i) {
@@ -71,6 +72,8 @@ class ExternalFrameBufferList { · 30 unmodified lines
7172 }
7273
7374 SetFrameBuffer(idx, fb);
75+
76+ num_used_buffers_++;
7477 return 0;
7578 }
7679
@@ -106,6 +109,7 @@ class ExternalFrameBufferList { · 29 unmodified lines
106109 }
107110 EXPECT_EQ(1, ext_fb->in_use);
108111 ext_fb->in_use = 0;
112+ num_used_buffers_--;
109113 return 0;
110114 }
111115
@@ -121,6 +125,8 @@ class ExternalFrameBufferList { · 9 unmodified lines
121125 }
122126 }
123127
128+ int num_used_buffers() const { return num_used_buffers_; }
129+
124130 private:
125131 // Returns the index of the first free frame buffer. Returns |num_buffers_|
126132 // if there are no free frame buffers.
@@ -145,6 +151,7 @@ class ExternalFrameBufferList { · 18 unmodified lines
145151 }
146152
147153 int num_buffers_;
154+ int num_used_buffers_;
148155 ExternalFrameBuffer *ext_fb_list_;
149156 };
150157
@@ -273,6 +280,7 @@ class ExternalFrameBufferMD5Test · 122 unmodified lines
273280
274281 #if CONFIG_WEBM_IO
275282 const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
283+const char kVP9NonRefTestFile[] = "vp90-2-22-svc_1280x720_1.webm";
276284
277285 // Class for testing passing in external frame buffers to libvpx.
278286 class ExternalFrameBufferTest : public ::testing::Test {
@@ -292,7 +300,9 @@ class ExternalFrameBufferTest : public ::testing::Test { · 13 unmodified lines
292300
293301 virtual void TearDown() {
294302 delete decoder_;
303+ decoder_ = NULL;
295304 delete video_;
305+ video_ = NULL;
296306 }
297307
298308 // Passes the external frame buffer information to libvpx.
@@ -325,7 +335,7 @@ class ExternalFrameBufferTest : public ::testing::Test { · 26 unmodified lines
325335 return VPX_CODEC_OK;
326336 }
327337
328− private:
338+ protected:
329339 void CheckDecodedFrames() {
330340 libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
331341 const vpx_image_t *img = NULL;
@@ -341,6 +351,25 @@ class ExternalFrameBufferTest : public ::testing::Test { · 9 unmodified lines
341351 int num_buffers_;
342352 ExternalFrameBufferList fb_list_;
343353 };
354+
355+class ExternalFrameBufferNonRefTest : public ExternalFrameBufferTest {
356+ protected:
357+ virtual void SetUp() {
358+ video_ = new libvpx_test::WebMVideoSource(kVP9NonRefTestFile);
359+ ASSERT_TRUE(video_ != NULL);
360+ video_->Init();
361+ video_->Begin();
362+
363+ vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
364+ decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
365+ ASSERT_TRUE(decoder_ != NULL);
366+ }
367+
368+ virtual void CheckFrameBufferRelease() {
369+ TearDown();
370+ ASSERT_EQ(0, fb_list_.num_used_buffers());
371+ }
372+};
344373 #endif // CONFIG_WEBM_IO
345374
346375 // This test runs through the set of test vectors, and decodes them.
@@ -419,6 +448,8 @@ TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) { · 72 unmodified lines
419448 SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
420449 release_vp9_frame_buffer));
421450 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
451+ // Only run this on long clips. Decoding a very short clip will return
452+ // VPX_CODEC_OK even with only 2 buffers.
422453 ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
423454 }
424455
@@ -467,6 +498,15 @@ TEST_F(ExternalFrameBufferTest, SetAfterDecode) { · 42 unmodified lines
467498 SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
468499 release_vp9_frame_buffer));
469500 }
501+
502+TEST_F(ExternalFrameBufferNonRefTest, DISABLED_ReleaseNonRefFrameBuffer) {
503+ const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
504+ ASSERT_EQ(VPX_CODEC_OK,
505+ SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
506+ release_vp9_frame_buffer));
507+ ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
508+ CheckFrameBufferRelease();
509+}
470510 #endif // CONFIG_WEBM_IO
471511
472512 VP9_INSTANTIATE_TEST_CASE(
test/test-data.mk+2−0
@@ -878,3 +878,5 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-21-resize_inter_1920x1080_7_3-4 · 877 unmodified lines
878878 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-21-resize_inter_1920x1080_7_3-4.webm.md5
879879 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-22-svc_1280x720_3.ivf
880880 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-22-svc_1280x720_3.ivf.md5
881+LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-22-svc_1280x720_1.webm
882+LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-22-svc_1280x720_1.webm.md5
test/test-data.sha1+2−0
@@ -852,3 +852,5 @@ e402cbbf9e550ae017a1e9f1f73931c1d18474e8 *invalid-crbug-667044.webm · 851 unmodified lines
852852 d3964f9dad9f60363c81b688324d95b4ec7c8038 *invalid-crbug-667044.webm.res
853853 fd9df7f3f6992af1d7a9dde975c9a0d6f28c053d *invalid-bug-1443.ivf
854854 fd3020fa6e9ca5966206738654c97dec313b0a95 *invalid-bug-1443.ivf.res
855+17696cd21e875f1d6e5d418cbf89feab02c8850a *vp90-2-22-svc_1280x720_1.webm
856+e2f9e1e47a791b4e939a9bdc50bf7a25b3761f77 *vp90-2-22-svc_1280x720_1.webm.md5
test/test_vectors.cc+1−0
@@ -371,6 +371,7 @@ const char *const kVP9TestVectors[] = { · 370 unmodified lines
371371 #endif // CONFIG_VP9_HIGHBITDEPTH
372372 "vp90-2-20-big_superframe-01.webm",
373373 "vp90-2-20-big_superframe-02.webm",
374+ "vp90-2-22-svc_1280x720_1.webm",
374375 RESIZE_TEST_VECTORS
375376 };
376377 const char *const kVP9TestVectorsSvc[] = { "vp90-2-22-svc_1280x720_3.ivf" };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t