Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: source/libvpx/test/decode_api_test.cc

Issue 958693004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/test/datarate_test.cc ('k') | source/libvpx/test/decode_test_driver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "third_party/googletest/src/include/gtest/gtest.h" 10 #include "third_party/googletest/src/include/gtest/gtest.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0)); 50 vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));
51 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, 51 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
52 vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0)); 52 vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));
53 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, 53 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
54 vpx_codec_decode(&dec, buf, 0, NULL, 0)); 54 vpx_codec_decode(&dec, buf, 0, NULL, 0));
55 55
56 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); 56 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
57 } 57 }
58 } 58 }
59 59
60 #if CONFIG_VP8_DECODER
61 TEST(DecodeAPI, OptionalParams) {
62 vpx_codec_ctx_t dec;
63
64 #if CONFIG_ERROR_CONCEALMENT
65 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL,
66 VPX_CODEC_USE_ERROR_CONCEALMENT));
67 #else
68 EXPECT_EQ(VPX_CODEC_INCAPABLE,
69 vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL,
70 VPX_CODEC_USE_ERROR_CONCEALMENT));
71 #endif // CONFIG_ERROR_CONCEALMENT
72 }
73 #endif // CONFIG_VP8_DECODER
74
60 #if CONFIG_VP9_DECODER 75 #if CONFIG_VP9_DECODER
61 // Test VP9 codec controls after a decode error to ensure the code doesn't 76 // Test VP9 codec controls after a decode error to ensure the code doesn't
62 // misbehave. 77 // misbehave.
63 void TestVp9Controls(vpx_codec_ctx_t *dec) { 78 void TestVp9Controls(vpx_codec_ctx_t *dec) {
64 static const int kControls[] = { 79 static const int kControls[] = {
65 VP8D_GET_LAST_REF_UPDATES, 80 VP8D_GET_LAST_REF_UPDATES,
66 VP8D_GET_FRAME_CORRUPTED, 81 VP8D_GET_FRAME_CORRUPTED,
67 VP9D_GET_DISPLAY_SIZE, 82 VP9D_GET_DISPLAY_SIZE,
83 VP9D_GET_FRAME_SIZE
68 }; 84 };
69 int val[2]; 85 int val[2];
70 86
71 for (int i = 0; i < NELEMENTS(kControls); ++i) { 87 for (int i = 0; i < NELEMENTS(kControls); ++i) {
72 const vpx_codec_err_t res = vpx_codec_control_(dec, kControls[i], val); 88 const vpx_codec_err_t res = vpx_codec_control_(dec, kControls[i], val);
73 switch (kControls[i]) { 89 switch (kControls[i]) {
74 case VP8D_GET_FRAME_CORRUPTED: 90 case VP8D_GET_FRAME_CORRUPTED:
75 EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i]; 91 EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i];
76 break; 92 break;
77 default: 93 default:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0)); 133 vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0));
118 vpx_codec_iter_t iter = NULL; 134 vpx_codec_iter_t iter = NULL;
119 EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter)); 135 EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));
120 136
121 TestVp9Controls(&dec); 137 TestVp9Controls(&dec);
122 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); 138 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
123 } 139 }
124 #endif // CONFIG_VP9_DECODER 140 #endif // CONFIG_VP9_DECODER
125 141
126 } // namespace 142 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/datarate_test.cc ('k') | source/libvpx/test/decode_test_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698