xref: /aosp_15_r20/external/libdav1d/src/itx.h (revision c09093415860a1c2373dacd84c4fde00c507cdfd)
1*c0909341SAndroid Build Coastguard Worker /*
2*c0909341SAndroid Build Coastguard Worker  * Copyright © 2018-2021, VideoLAN and dav1d authors
3*c0909341SAndroid Build Coastguard Worker  * Copyright © 2018, Two Orioles, LLC
4*c0909341SAndroid Build Coastguard Worker  * All rights reserved.
5*c0909341SAndroid Build Coastguard Worker  *
6*c0909341SAndroid Build Coastguard Worker  * Redistribution and use in source and binary forms, with or without
7*c0909341SAndroid Build Coastguard Worker  * modification, are permitted provided that the following conditions are met:
8*c0909341SAndroid Build Coastguard Worker  *
9*c0909341SAndroid Build Coastguard Worker  * 1. Redistributions of source code must retain the above copyright notice, this
10*c0909341SAndroid Build Coastguard Worker  *    list of conditions and the following disclaimer.
11*c0909341SAndroid Build Coastguard Worker  *
12*c0909341SAndroid Build Coastguard Worker  * 2. Redistributions in binary form must reproduce the above copyright notice,
13*c0909341SAndroid Build Coastguard Worker  *    this list of conditions and the following disclaimer in the documentation
14*c0909341SAndroid Build Coastguard Worker  *    and/or other materials provided with the distribution.
15*c0909341SAndroid Build Coastguard Worker  *
16*c0909341SAndroid Build Coastguard Worker  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17*c0909341SAndroid Build Coastguard Worker  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18*c0909341SAndroid Build Coastguard Worker  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19*c0909341SAndroid Build Coastguard Worker  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20*c0909341SAndroid Build Coastguard Worker  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21*c0909341SAndroid Build Coastguard Worker  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22*c0909341SAndroid Build Coastguard Worker  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23*c0909341SAndroid Build Coastguard Worker  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*c0909341SAndroid Build Coastguard Worker  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25*c0909341SAndroid Build Coastguard Worker  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*c0909341SAndroid Build Coastguard Worker  */
27*c0909341SAndroid Build Coastguard Worker 
28*c0909341SAndroid Build Coastguard Worker #ifndef DAV1D_SRC_ITX_H
29*c0909341SAndroid Build Coastguard Worker #define DAV1D_SRC_ITX_H
30*c0909341SAndroid Build Coastguard Worker 
31*c0909341SAndroid Build Coastguard Worker #include <stddef.h>
32*c0909341SAndroid Build Coastguard Worker 
33*c0909341SAndroid Build Coastguard Worker #include "common/bitdepth.h"
34*c0909341SAndroid Build Coastguard Worker 
35*c0909341SAndroid Build Coastguard Worker #include "src/levels.h"
36*c0909341SAndroid Build Coastguard Worker 
37*c0909341SAndroid Build Coastguard Worker #define decl_itx_fn(name) \
38*c0909341SAndroid Build Coastguard Worker void (name)(pixel *dst, ptrdiff_t dst_stride, coef *coeff, int eob \
39*c0909341SAndroid Build Coastguard Worker             HIGHBD_DECL_SUFFIX)
40*c0909341SAndroid Build Coastguard Worker typedef decl_itx_fn(*itxfm_fn);
41*c0909341SAndroid Build Coastguard Worker 
42*c0909341SAndroid Build Coastguard Worker #define decl_itx2_fns(w, h, opt) \
43*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_##w##x##h, opt)); \
44*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_identity_identity_##w##x##h, opt))
45*c0909341SAndroid Build Coastguard Worker 
46*c0909341SAndroid Build Coastguard Worker #define decl_itx12_fns(w, h, opt) \
47*c0909341SAndroid Build Coastguard Worker decl_itx2_fns(w, h, opt); \
48*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_dct_adst_##w##x##h, opt)); \
49*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_dct_flipadst_##w##x##h, opt)); \
50*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_dct_identity_##w##x##h, opt)); \
51*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_##w##x##h, opt)); \
52*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_adst_adst_##w##x##h, opt)); \
53*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_adst_flipadst_##w##x##h, opt)); \
54*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_dct_##w##x##h, opt)); \
55*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_adst_##w##x##h, opt)); \
56*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_flipadst_##w##x##h, opt)); \
57*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_identity_dct_##w##x##h, opt))
58*c0909341SAndroid Build Coastguard Worker 
59*c0909341SAndroid Build Coastguard Worker #define decl_itx16_fns(w, h, opt) \
60*c0909341SAndroid Build Coastguard Worker decl_itx12_fns(w, h, opt); \
61*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_adst_identity_##w##x##h, opt)); \
62*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_identity_##w##x##h, opt)); \
63*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_identity_adst_##w##x##h, opt)); \
64*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_identity_flipadst_##w##x##h, opt))
65*c0909341SAndroid Build Coastguard Worker 
66*c0909341SAndroid Build Coastguard Worker #define decl_itx17_fns(w, h, opt) \
67*c0909341SAndroid Build Coastguard Worker decl_itx16_fns(w, h, opt); \
68*c0909341SAndroid Build Coastguard Worker decl_itx_fn(BF(dav1d_inv_txfm_add_wht_wht_##w##x##h, opt))
69*c0909341SAndroid Build Coastguard Worker 
70*c0909341SAndroid Build Coastguard Worker typedef struct Dav1dInvTxfmDSPContext {
71*c0909341SAndroid Build Coastguard Worker     itxfm_fn itxfm_add[N_RECT_TX_SIZES][N_TX_TYPES_PLUS_LL];
72*c0909341SAndroid Build Coastguard Worker } Dav1dInvTxfmDSPContext;
73*c0909341SAndroid Build Coastguard Worker 
74*c0909341SAndroid Build Coastguard Worker bitfn_decls(void dav1d_itx_dsp_init, Dav1dInvTxfmDSPContext *c, int bpc);
75*c0909341SAndroid Build Coastguard Worker 
76*c0909341SAndroid Build Coastguard Worker #define assign_itx_fn(pfx, w, h, type, type_enum, ext) \
77*c0909341SAndroid Build Coastguard Worker     c->itxfm_add[pfx##TX_##w##X##h][type_enum] = \
78*c0909341SAndroid Build Coastguard Worker         BF(dav1d_inv_txfm_add_##type##_##w##x##h, ext)
79*c0909341SAndroid Build Coastguard Worker 
80*c0909341SAndroid Build Coastguard Worker #define assign_itx1_fn(pfx, w, h, ext) \
81*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, dct_dct,           DCT_DCT,           ext)
82*c0909341SAndroid Build Coastguard Worker 
83*c0909341SAndroid Build Coastguard Worker #define assign_itx2_fn(pfx, w, h, ext) \
84*c0909341SAndroid Build Coastguard Worker     assign_itx1_fn(pfx, w, h, ext); \
85*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, identity_identity, IDTX,              ext)
86*c0909341SAndroid Build Coastguard Worker 
87*c0909341SAndroid Build Coastguard Worker #define assign_itx12_fn(pfx, w, h, ext) \
88*c0909341SAndroid Build Coastguard Worker     assign_itx2_fn(pfx, w, h, ext); \
89*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, dct_adst,          ADST_DCT,          ext); \
90*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, dct_flipadst,      FLIPADST_DCT,      ext); \
91*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, dct_identity,      H_DCT,             ext); \
92*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, adst_dct,          DCT_ADST,          ext); \
93*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, adst_adst,         ADST_ADST,         ext); \
94*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, adst_flipadst,     FLIPADST_ADST,     ext); \
95*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, flipadst_dct,      DCT_FLIPADST,      ext); \
96*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, flipadst_adst,     ADST_FLIPADST,     ext); \
97*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, flipadst_flipadst, FLIPADST_FLIPADST, ext); \
98*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, identity_dct,      V_DCT,             ext)
99*c0909341SAndroid Build Coastguard Worker 
100*c0909341SAndroid Build Coastguard Worker #define assign_itx16_fn(pfx, w, h, ext) \
101*c0909341SAndroid Build Coastguard Worker     assign_itx12_fn(pfx, w, h, ext); \
102*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, adst_identity,     H_ADST,            ext); \
103*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, flipadst_identity, H_FLIPADST,        ext); \
104*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, identity_adst,     V_ADST,            ext); \
105*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, identity_flipadst, V_FLIPADST,        ext)
106*c0909341SAndroid Build Coastguard Worker 
107*c0909341SAndroid Build Coastguard Worker #define assign_itx17_fn(pfx, w, h, ext) \
108*c0909341SAndroid Build Coastguard Worker     assign_itx16_fn(pfx, w, h, ext); \
109*c0909341SAndroid Build Coastguard Worker     assign_itx_fn(pfx, w, h, wht_wht,           WHT_WHT,           ext)
110*c0909341SAndroid Build Coastguard Worker 
111*c0909341SAndroid Build Coastguard Worker #endif /* DAV1D_SRC_ITX_H */
112