Improved aom_smooth_predictor_16x 32,16,8
[aom.git] / test / decode_api_test.cc
blob67f5a917f318ea8364759fee407463efa41bf14d
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
14 #include "./aom_config.h"
15 #include "test/ivf_video_source.h"
16 #include "test/util.h"
17 #include "aom/aomdx.h"
18 #include "aom/aom_decoder.h"
20 namespace {
22 TEST(DecodeAPI, InvalidParams) {
23 static const aom_codec_iface_t *kCodecs[] = {
24 #if CONFIG_AV1_DECODER
25 &aom_codec_av1_dx_algo,
26 #endif
28 uint8_t buf[1] = { 0 };
29 aom_codec_ctx_t dec;
31 EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_dec_init(NULL, NULL, NULL, 0));
32 EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_dec_init(&dec, NULL, NULL, 0));
33 EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(NULL, NULL, 0, NULL));
34 EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(NULL, buf, 0, NULL));
35 EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
36 aom_codec_decode(NULL, buf, NELEMENTS(buf), NULL));
37 EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
38 aom_codec_decode(NULL, NULL, NELEMENTS(buf), NULL));
39 EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_destroy(NULL));
40 EXPECT_TRUE(aom_codec_error(NULL) != NULL);
42 for (int i = 0; i < NELEMENTS(kCodecs); ++i) {
43 EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
44 aom_codec_dec_init(NULL, kCodecs[i], NULL, 0));
46 EXPECT_EQ(AOM_CODEC_OK, aom_codec_dec_init(&dec, kCodecs[i], NULL, 0));
47 EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
48 aom_codec_decode(&dec, NULL, NELEMENTS(buf), NULL));
49 EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(&dec, buf, 0, NULL));
51 EXPECT_EQ(AOM_CODEC_OK, aom_codec_destroy(&dec));
55 } // namespace