tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

itx.h (5102B)


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