1 /*
2 * Copyright (c) 2021, Alliance for Open Media. All rights reserved.
3 *
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.
10 */
11
12 #include "av1/encoder/firstpass.h"
13 #include "av1/encoder/ratectrl.h"
14 #include "av1/encoder/tpl_model.h"
15 #include "gtest/gtest.h"
16
17 namespace {
18
TEST(RatectrlTest,QModeGetQIndexTest)19 TEST(RatectrlTest, QModeGetQIndexTest) {
20 int base_q_index = 36;
21 int gf_update_type = INTNL_ARF_UPDATE;
22 int gf_pyramid_level = 1;
23 int arf_q = 100;
24 int q_index = av1_q_mode_get_q_index(base_q_index, gf_update_type,
25 gf_pyramid_level, arf_q);
26 EXPECT_EQ(q_index, arf_q);
27
28 gf_update_type = INTNL_ARF_UPDATE;
29 gf_pyramid_level = 3;
30 q_index = av1_q_mode_get_q_index(base_q_index, gf_update_type,
31 gf_pyramid_level, arf_q);
32 EXPECT_LT(q_index, arf_q);
33
34 gf_update_type = LF_UPDATE;
35 q_index = av1_q_mode_get_q_index(base_q_index, gf_update_type,
36 gf_pyramid_level, arf_q);
37 EXPECT_EQ(q_index, base_q_index);
38 }
39 } // namespace
40