]> granicus.if.org Git - libvpx/commitdiff
Correctly report "Unsupported bitstream profile"
authorYaowu Xu <yaowu@google.com>
Thu, 16 Jul 2015 22:40:22 +0000 (15:40 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 17 Jul 2015 17:51:02 +0000 (10:51 -0700)
For vp9 decoder build without profile 2 and profile 3 support, this
commit changes to report error "Unsupported bitstream profile" for
input streams in profile 2 or 3, rather than other misleading error
information.

In addition, one of the invalid files in unit tests is actually coded
profile 2, this commit makes it tested only when the decoder is built
with vp9-highbitdepth.

This fixes issue #1028.

Change-Id: I8b6c1210787c8f89c703a546687dcf973ac20fc0

test/decode_api_test.cc
test/invalid_file_test.cc
vp9/decoder/vp9_decodeframe.c

index 42ac13f310215cf4848928c5b5db072d98ae3cc2..32be1f4112d4beaeb0368309e9fc7e4a2e8c9e88 100644 (file)
@@ -129,8 +129,13 @@ TEST(DecodeAPI, Vp9InvalidDecode) {
   vpx_codec_ctx_t dec;
   EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
   const uint32_t frame_size = static_cast<uint32_t>(video.frame_size());
+#if CONFIG_VP9_HIGHBITDEPTH
   EXPECT_EQ(VPX_CODEC_MEM_ERROR,
             vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0));
+#else
+  EXPECT_EQ(VPX_CODEC_UNSUP_BITSTREAM,
+            vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0));
+#endif
   vpx_codec_iter_t iter = NULL;
   EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));
 
index 2cbbc6b0eaf50ff3a826ef69fd5c62ee199943c3..1b5ef5c875eb75b91c30309dc9f9ddca960dcf6c 100644 (file)
@@ -112,7 +112,9 @@ TEST_P(InvalidFileTest, ReturnCode) {
 
 const DecodeParam kVP9InvalidFileTests[] = {
   {1, "invalid-vp90-02-v2.webm"},
+#if CONFIG_VP9_HIGHBITDEPTH
   {1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf"},
+#endif
   {1, "invalid-vp90-03-v3.webm"},
   {1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf"},
   {1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf"},
index 8f7457e2f2ca21c64a18637e8944b7689944d13e..b9983f410b02a6d59da14244b7f4a4bb4d0b1673 100644 (file)
@@ -1816,10 +1816,15 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
                          "Invalid frame marker");
 
   cm->profile = vp9_read_profile(rb);
-
+#if CONFIG_VP9_HIGHBITDEPTH
   if (cm->profile >= MAX_PROFILES)
     vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
                        "Unsupported bitstream profile");
+#else
+  if (cm->profile >= PROFILE_2)
+    vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
+                       "Unsupported bitstream profile");
+#endif
 
   cm->show_existing_frame = vp9_rb_read_bit(rb);
   if (cm->show_existing_frame) {