1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2021, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker *
4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker */
11*77c1e3ccSAndroid Build Coastguard Worker
12*77c1e3ccSAndroid Build Coastguard Worker #include <stdint.h>
13*77c1e3ccSAndroid Build Coastguard Worker #include <vector>
14*77c1e3ccSAndroid Build Coastguard Worker
15*77c1e3ccSAndroid Build Coastguard Worker #include "gtest/gtest.h"
16*77c1e3ccSAndroid Build Coastguard Worker
17*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/block.h"
18*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encodemb.h"
19*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/scan.h"
20*77c1e3ccSAndroid Build Coastguard Worker
21*77c1e3ccSAndroid Build Coastguard Worker namespace {
22*77c1e3ccSAndroid Build Coastguard Worker
23*77c1e3ccSAndroid Build Coastguard Worker // Reorders 'qcoeff_lexico', which is in lexicographic order (row by row), into
24*77c1e3ccSAndroid Build Coastguard Worker // scan order (zigzag) in 'qcoeff_scan'.
ToScanOrder(TX_SIZE tx_size,TX_TYPE tx_type,tran_low_t * qcoeff_lexico,tran_low_t * qcoeff_scan)25*77c1e3ccSAndroid Build Coastguard Worker void ToScanOrder(TX_SIZE tx_size, TX_TYPE tx_type, tran_low_t *qcoeff_lexico,
26*77c1e3ccSAndroid Build Coastguard Worker tran_low_t *qcoeff_scan) {
27*77c1e3ccSAndroid Build Coastguard Worker const int max_eob = av1_get_max_eob(tx_size);
28*77c1e3ccSAndroid Build Coastguard Worker const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
29*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < max_eob; ++i) {
30*77c1e3ccSAndroid Build Coastguard Worker qcoeff_scan[i] = qcoeff_lexico[scan_order->scan[i]];
31*77c1e3ccSAndroid Build Coastguard Worker }
32*77c1e3ccSAndroid Build Coastguard Worker }
33*77c1e3ccSAndroid Build Coastguard Worker
34*77c1e3ccSAndroid Build Coastguard Worker // Reorders 'qcoeff_scan', which is in scan order (zigzag), into lexicographic
35*77c1e3ccSAndroid Build Coastguard Worker // order (row by row) in 'qcoeff_lexico'.
ToLexicoOrder(TX_SIZE tx_size,TX_TYPE tx_type,tran_low_t * qcoeff_scan,tran_low_t * qcoeff_lexico)36*77c1e3ccSAndroid Build Coastguard Worker void ToLexicoOrder(TX_SIZE tx_size, TX_TYPE tx_type, tran_low_t *qcoeff_scan,
37*77c1e3ccSAndroid Build Coastguard Worker tran_low_t *qcoeff_lexico) {
38*77c1e3ccSAndroid Build Coastguard Worker const int max_eob = av1_get_max_eob(tx_size);
39*77c1e3ccSAndroid Build Coastguard Worker const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
40*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < max_eob; ++i) {
41*77c1e3ccSAndroid Build Coastguard Worker qcoeff_lexico[scan_order->scan[i]] = qcoeff_scan[i];
42*77c1e3ccSAndroid Build Coastguard Worker }
43*77c1e3ccSAndroid Build Coastguard Worker }
44*77c1e3ccSAndroid Build Coastguard Worker
45*77c1e3ccSAndroid Build Coastguard Worker // Runs coefficient dropout on 'qcoeff_scan'.
Dropout(TX_SIZE tx_size,TX_TYPE tx_type,int dropout_num_before,int dropout_num_after,tran_low_t * qcoeff_scan)46*77c1e3ccSAndroid Build Coastguard Worker void Dropout(TX_SIZE tx_size, TX_TYPE tx_type, int dropout_num_before,
47*77c1e3ccSAndroid Build Coastguard Worker int dropout_num_after, tran_low_t *qcoeff_scan) {
48*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff[MAX_TX_SQUARE];
49*77c1e3ccSAndroid Build Coastguard Worker // qcoeff_scan is assumed to be in scan order, since tests are easier to
50*77c1e3ccSAndroid Build Coastguard Worker // understand this way, but av1_dropout_qcoeff expects coeffs in lexico order
51*77c1e3ccSAndroid Build Coastguard Worker // so we convert to lexico then back to scan afterwards.
52*77c1e3ccSAndroid Build Coastguard Worker ToLexicoOrder(tx_size, tx_type, qcoeff_scan, qcoeff);
53*77c1e3ccSAndroid Build Coastguard Worker
54*77c1e3ccSAndroid Build Coastguard Worker const int max_eob = av1_get_max_eob(tx_size);
55*77c1e3ccSAndroid Build Coastguard Worker const int kDequantFactor = 10;
56*77c1e3ccSAndroid Build Coastguard Worker tran_low_t dqcoeff[MAX_TX_SQUARE];
57*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < max_eob; ++i) {
58*77c1e3ccSAndroid Build Coastguard Worker dqcoeff[i] = qcoeff[i] * kDequantFactor;
59*77c1e3ccSAndroid Build Coastguard Worker }
60*77c1e3ccSAndroid Build Coastguard Worker
61*77c1e3ccSAndroid Build Coastguard Worker uint16_t eob = max_eob;
62*77c1e3ccSAndroid Build Coastguard Worker while (eob > 0 && qcoeff_scan[eob - 1] == 0) --eob;
63*77c1e3ccSAndroid Build Coastguard Worker
64*77c1e3ccSAndroid Build Coastguard Worker MACROBLOCK mb;
65*77c1e3ccSAndroid Build Coastguard Worker const int kPlane = 0;
66*77c1e3ccSAndroid Build Coastguard Worker const int kBlock = 0;
67*77c1e3ccSAndroid Build Coastguard Worker memset(&mb, 0, sizeof(mb));
68*77c1e3ccSAndroid Build Coastguard Worker uint16_t eobs[] = { eob };
69*77c1e3ccSAndroid Build Coastguard Worker mb.plane[kPlane].eobs = eobs;
70*77c1e3ccSAndroid Build Coastguard Worker mb.plane[kPlane].qcoeff = qcoeff;
71*77c1e3ccSAndroid Build Coastguard Worker mb.plane[kPlane].dqcoeff = dqcoeff;
72*77c1e3ccSAndroid Build Coastguard Worker uint8_t txb_entropy_ctx[1];
73*77c1e3ccSAndroid Build Coastguard Worker mb.plane[kPlane].txb_entropy_ctx = txb_entropy_ctx;
74*77c1e3ccSAndroid Build Coastguard Worker
75*77c1e3ccSAndroid Build Coastguard Worker av1_dropout_qcoeff_num(&mb, kPlane, kBlock, tx_size, tx_type,
76*77c1e3ccSAndroid Build Coastguard Worker dropout_num_before, dropout_num_after);
77*77c1e3ccSAndroid Build Coastguard Worker
78*77c1e3ccSAndroid Build Coastguard Worker ToScanOrder(tx_size, tx_type, qcoeff, qcoeff_scan);
79*77c1e3ccSAndroid Build Coastguard Worker
80*77c1e3ccSAndroid Build Coastguard Worker // Check updated eob value is valid.
81*77c1e3ccSAndroid Build Coastguard Worker uint16_t new_eob = max_eob;
82*77c1e3ccSAndroid Build Coastguard Worker while (new_eob > 0 && qcoeff_scan[new_eob - 1] == 0) --new_eob;
83*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(new_eob, mb.plane[kPlane].eobs[0]);
84*77c1e3ccSAndroid Build Coastguard Worker
85*77c1e3ccSAndroid Build Coastguard Worker // Check dqcoeff is still valid.
86*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < max_eob; ++i) {
87*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(qcoeff[i] * kDequantFactor, dqcoeff[i]);
88*77c1e3ccSAndroid Build Coastguard Worker }
89*77c1e3ccSAndroid Build Coastguard Worker }
90*77c1e3ccSAndroid Build Coastguard Worker
ExpectArrayEq(tran_low_t * actual,std::vector<tran_low_t> expected)91*77c1e3ccSAndroid Build Coastguard Worker void ExpectArrayEq(tran_low_t *actual, std::vector<tran_low_t> expected) {
92*77c1e3ccSAndroid Build Coastguard Worker for (size_t i = 0; i < expected.size(); ++i) {
93*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(expected[i], actual[i]) << "Arrays differ at index " << i;
94*77c1e3ccSAndroid Build Coastguard Worker }
95*77c1e3ccSAndroid Build Coastguard Worker }
96*77c1e3ccSAndroid Build Coastguard Worker
97*77c1e3ccSAndroid Build Coastguard Worker static constexpr TX_TYPE kTxType = DCT_DCT;
98*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,KeepsLargeCoeffs)99*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, KeepsLargeCoeffs) {
100*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
101*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
102*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 6;
103*77c1e3ccSAndroid Build Coastguard Worker // Large isolated coeffs should be preserved.
104*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = { 0, 0, 0, 0, 0, 0, 42, 0, // should be kept
105*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
106*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, -30, // should be kept
107*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 };
108*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
109*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 0, 0, 0, 0, 0, 0, 42, 0, //
110*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
111*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, -30, //
112*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 });
113*77c1e3ccSAndroid Build Coastguard Worker }
114*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,RemovesSmallIsolatedCoeffs)115*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, RemovesSmallIsolatedCoeffs) {
116*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
117*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
118*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 6;
119*77c1e3ccSAndroid Build Coastguard Worker // Small isolated coeffs should be removed.
120*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = { 0, 0, 0, 0, 1, 0, 0, 0, // should be removed
121*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
122*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, -2, 0, 0, 0, // should be removed
123*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 };
124*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
125*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 0, 0, 0, 0, 0, 0, 0, 0, //
126*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
127*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
128*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 });
129*77c1e3ccSAndroid Build Coastguard Worker }
130*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,KeepsSmallCoeffsAmongLargeOnes)131*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, KeepsSmallCoeffsAmongLargeOnes) {
132*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
133*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
134*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 6;
135*77c1e3ccSAndroid Build Coastguard Worker // Small coeffs that are not isolated (not enough zeros before/after should be
136*77c1e3ccSAndroid Build Coastguard Worker // kept).
137*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = {
138*77c1e3ccSAndroid Build Coastguard Worker 1, 0, 0, 0, -5, 0, 0, -1, // should be kept
139*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 10, 0, 0, 2, 0, // should be kept
140*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
141*77c1e3ccSAndroid Build Coastguard Worker 0, -2, 0, 0, 0, 0, 0, 0 // should be removed
142*77c1e3ccSAndroid Build Coastguard Worker }; // should be removed
143*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
144*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 1, 0, 0, 0, -5, 0, 0, -1, //
145*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 10, 0, 0, 2, 0, //
146*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
147*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 });
148*77c1e3ccSAndroid Build Coastguard Worker }
149*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,KeepsSmallCoeffsCloseToStartOrEnd)150*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, KeepsSmallCoeffsCloseToStartOrEnd) {
151*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
152*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
153*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 6;
154*77c1e3ccSAndroid Build Coastguard Worker // Small coeffs that are too close to the beginning or end of the block
155*77c1e3ccSAndroid Build Coastguard Worker // should also be kept (not enough zeroes before/after).
156*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = { 0, 0, -1, 0, 0, 0, 0, 0, // should be kept
157*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 10, 0, 0, 0, 0, // should be kept
158*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 2, 0, 0, 0, 0, // should be removed
159*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, -1, 0 }; // should be kept
160*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
161*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 0, 0, -1, 0, 0, 0, 0, 0, //
162*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 10, 0, 0, 0, 0, //
163*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
164*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, -1, 0 });
165*77c1e3ccSAndroid Build Coastguard Worker }
166*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,RemovesSmallClusterOfCoeffs)167*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, RemovesSmallClusterOfCoeffs) {
168*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
169*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
170*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 6;
171*77c1e3ccSAndroid Build Coastguard Worker // Small clusters (<= kDropoutContinuityMax) of small coeffs should be
172*77c1e3ccSAndroid Build Coastguard Worker // removed.
173*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan_two[] = {
174*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 1, 0, 0, -1, // should be removed
175*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
176*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 1, 0, // should be removed
177*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0
178*77c1e3ccSAndroid Build Coastguard Worker };
179*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after,
180*77c1e3ccSAndroid Build Coastguard Worker qcoeff_scan_two);
181*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan_two, { 0, 0, 0, 0, 0, 0, 0, 0, //
182*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
183*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
184*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 });
185*77c1e3ccSAndroid Build Coastguard Worker }
186*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,KeepsLargeClusterOfCoeffs)187*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, KeepsLargeClusterOfCoeffs) {
188*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
189*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
190*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 6;
191*77c1e3ccSAndroid Build Coastguard Worker // Large clusters (> kDropoutContinuityMax) of small coeffs should be kept.
192*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = { 0, 0, 0, 0, 1, 0, 1, -1, // should be kept
193*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
194*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, -2, 0, 0, // should be removed
195*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 };
196*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
197*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 0, 0, 0, 0, 1, 0, 1, -1, //
198*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
199*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
200*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 });
201*77c1e3ccSAndroid Build Coastguard Worker }
202*77c1e3ccSAndroid Build Coastguard Worker
TEST(DropoutTest,NumBeforeLargerThanNumAfter)203*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, NumBeforeLargerThanNumAfter) {
204*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X4;
205*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
206*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 2;
207*77c1e3ccSAndroid Build Coastguard Worker // The second coeff (-2) doesn't seem to meet the dropout_num_before
208*77c1e3ccSAndroid Build Coastguard Worker // criteria. But since the first coeff (1) will be dropped, it will meet
209*77c1e3ccSAndroid Build Coastguard Worker // the criteria and should be dropped too.
210*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = { 0, 0, 0, 0, 1, 0, 0, 0, // should be removed
211*77c1e3ccSAndroid Build Coastguard Worker -2, 0, 0, 0, 0, 0, 0, 0, // should be removed
212*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
213*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 };
214*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
215*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 0, 0, 0, 0, 0, 0, 0, 0, //
216*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
217*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
218*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0 });
219*77c1e3ccSAndroid Build Coastguard Worker }
220*77c1e3ccSAndroid Build Coastguard Worker
221*77c1e3ccSAndroid Build Coastguard Worker // More complex test combining other test cases.
TEST(DropoutTest,ComplexTest)222*77c1e3ccSAndroid Build Coastguard Worker TEST(DropoutTest, ComplexTest) {
223*77c1e3ccSAndroid Build Coastguard Worker const TX_SIZE tx_size = TX_8X8;
224*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_before = 4;
225*77c1e3ccSAndroid Build Coastguard Worker const uint32_t dropout_num_after = 2;
226*77c1e3ccSAndroid Build Coastguard Worker tran_low_t qcoeff_scan[] = { 1, 12, 0, 0, 0, 0, 1, 0, //
227*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, -12, 0, 0, 0, 1, //
228*77c1e3ccSAndroid Build Coastguard Worker 0, 0, -2, 0, 1, 0, 0, 1, //
229*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 5, 0, -1, 0, //
230*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 1, 0, 0, 0, -1, //
231*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 2, 0, 0, 0, //
232*77c1e3ccSAndroid Build Coastguard Worker 0, 1, 0, 0, 0, 5, 0, 0, //
233*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 1, 1, 0, 0, 0, -2 };
234*77c1e3ccSAndroid Build Coastguard Worker Dropout(tx_size, kTxType, dropout_num_before, dropout_num_after, qcoeff_scan);
235*77c1e3ccSAndroid Build Coastguard Worker ExpectArrayEq(qcoeff_scan, { 1, 12, 0, 0, 0, 0, 0, 0, //
236*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, -12, 0, 0, 0, 1, //
237*77c1e3ccSAndroid Build Coastguard Worker 0, 0, -2, 0, 1, 0, 0, 1, //
238*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 5, 0, -1, 0, //
239*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
240*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, 0, //
241*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 5, 0, 0, //
242*77c1e3ccSAndroid Build Coastguard Worker 0, 0, 0, 0, 0, 0, 0, -2 });
243*77c1e3ccSAndroid Build Coastguard Worker }
244*77c1e3ccSAndroid Build Coastguard Worker
245*77c1e3ccSAndroid Build Coastguard Worker } // namespace
246