/work/svt-av1/Source/Lib/Codec/transforms.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright(c) 2019 Intel Corporation |
3 | | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
4 | | * |
5 | | * This source code is subject to the terms of the BSD 2 Clause License and |
6 | | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
7 | | * was not distributed with this source code in the LICENSE file, you can |
8 | | * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open |
9 | | * Media Patent License 1.0 was not distributed with this source code in the |
10 | | * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license. |
11 | | */ |
12 | | |
13 | | #ifndef EbTransforms_h |
14 | | #define EbTransforms_h |
15 | | |
16 | | #include "definitions.h" |
17 | | #include "coefficients.h" |
18 | | #include "inv_transforms.h" |
19 | | |
20 | | #ifdef __cplusplus |
21 | | extern "C" { |
22 | | #endif |
23 | | |
24 | | #include "enc_dec_process.h" |
25 | 19.1M | #define UNIT_QUANT_SHIFT 2 |
26 | 19.1M | #define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT) |
27 | | |
28 | | extern const int8_t fwd_cos_bit_col[MAX_TXWH_IDX /*txw_idx*/][MAX_TXWH_IDX /*txh_idx*/]; |
29 | | extern const int8_t fwd_cos_bit_row[MAX_TXWH_IDX /*txw_idx*/][MAX_TXWH_IDX /*txh_idx*/]; |
30 | | |
31 | | extern const int8_t* fwd_txfm_shift_ls[TX_SIZES_ALL]; |
32 | | |
33 | | extern const uint8_t tx_blocks_per_depth[BLOCK_SIZES_ALL][MAX_VARTX_DEPTH + 1]; |
34 | | |
35 | | typedef struct Position { |
36 | | int x; |
37 | | int y; |
38 | | } Position; |
39 | | |
40 | | // origin is block - separate tables for INTRA (idx 0) and INTER (idx 1) needed b/c of tx depth 2 |
41 | | extern const Position tx_org[BLOCK_SIZES_ALL][2 /*is_inter*/][MAX_VARTX_DEPTH + 1][MAX_TXB_COUNT]; |
42 | | |
43 | 0 | static INLINE int is_rect_tx(TxSize tx_size) { |
44 | 0 | return tx_size >= TX_SIZES; |
45 | 0 | } Unexecuted instantiation: av1me.c:is_rect_tx Unexecuted instantiation: enc_cdef.c:is_rect_tx Unexecuted instantiation: enc_dec_process.c:is_rect_tx Unexecuted instantiation: enc_inter_prediction.c:is_rect_tx Unexecuted instantiation: enc_intra_prediction.c:is_rect_tx Unexecuted instantiation: enc_mode_config.c:is_rect_tx Unexecuted instantiation: entropy_coding.c:is_rect_tx Unexecuted instantiation: full_loop.c:is_rect_tx Unexecuted instantiation: md_rate_estimation.c:is_rect_tx Unexecuted instantiation: mode_decision.c:is_rect_tx Unexecuted instantiation: motion_estimation.c:is_rect_tx Unexecuted instantiation: product_coding_loop.c:is_rect_tx Unexecuted instantiation: rc_process.c:is_rect_tx Unexecuted instantiation: rd_cost.c:is_rect_tx Unexecuted instantiation: resource_coordination_process.c:is_rect_tx Unexecuted instantiation: src_ops_process.c:is_rect_tx Unexecuted instantiation: transforms.c:is_rect_tx Unexecuted instantiation: encode_txb_ref_c.c:is_rect_tx Unexecuted instantiation: coding_loop.c:is_rect_tx |
46 | | |
47 | 0 | static INLINE int is_rect_tx_allowed_bsize(BlockSize bsize) { |
48 | 0 | static const char lut[BLOCK_SIZES_ALL] = { |
49 | 0 | 0, // BLOCK_4X4 |
50 | 0 | 1, // BLOCK_4X8 |
51 | 0 | 1, // BLOCK_8X4 |
52 | 0 | 0, // BLOCK_8X8 |
53 | 0 | 1, // BLOCK_8X16 |
54 | 0 | 1, // BLOCK_16X8 |
55 | 0 | 0, // BLOCK_16X16 |
56 | 0 | 1, // BLOCK_16X32 |
57 | 0 | 1, // BLOCK_32X16 |
58 | 0 | 0, // BLOCK_32X32 |
59 | 0 | 1, // BLOCK_32X64 |
60 | 0 | 1, // BLOCK_64X32 |
61 | 0 | 0, // BLOCK_64X64 |
62 | 0 | 0, // BLOCK_64X128 |
63 | 0 | 0, // BLOCK_128X64 |
64 | 0 | 0, // BLOCK_128X128 |
65 | 0 | 1, // BLOCK_4X16 |
66 | 0 | 1, // BLOCK_16X4 |
67 | 0 | 1, // BLOCK_8X32 |
68 | 0 | 1, // BLOCK_32X8 |
69 | 0 | 1, // BLOCK_16X64 |
70 | 0 | 1, // BLOCK_64X16 |
71 | 0 | }; |
72 | 0 |
|
73 | 0 | return lut[bsize]; |
74 | 0 | } Unexecuted instantiation: av1me.c:is_rect_tx_allowed_bsize Unexecuted instantiation: enc_cdef.c:is_rect_tx_allowed_bsize Unexecuted instantiation: enc_dec_process.c:is_rect_tx_allowed_bsize Unexecuted instantiation: enc_inter_prediction.c:is_rect_tx_allowed_bsize Unexecuted instantiation: enc_intra_prediction.c:is_rect_tx_allowed_bsize Unexecuted instantiation: enc_mode_config.c:is_rect_tx_allowed_bsize Unexecuted instantiation: entropy_coding.c:is_rect_tx_allowed_bsize Unexecuted instantiation: full_loop.c:is_rect_tx_allowed_bsize Unexecuted instantiation: md_rate_estimation.c:is_rect_tx_allowed_bsize Unexecuted instantiation: mode_decision.c:is_rect_tx_allowed_bsize Unexecuted instantiation: motion_estimation.c:is_rect_tx_allowed_bsize Unexecuted instantiation: product_coding_loop.c:is_rect_tx_allowed_bsize Unexecuted instantiation: rc_process.c:is_rect_tx_allowed_bsize Unexecuted instantiation: rd_cost.c:is_rect_tx_allowed_bsize Unexecuted instantiation: resource_coordination_process.c:is_rect_tx_allowed_bsize Unexecuted instantiation: src_ops_process.c:is_rect_tx_allowed_bsize Unexecuted instantiation: transforms.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encode_txb_ref_c.c:is_rect_tx_allowed_bsize Unexecuted instantiation: coding_loop.c:is_rect_tx_allowed_bsize |
75 | | |
76 | | static INLINE int is_rect_tx_allowed(/*const MacroBlockD *xd,*/ |
77 | 0 | const MbModeInfo* mbmi) { |
78 | 0 | return is_rect_tx_allowed_bsize(mbmi->bsize) /*&& |
79 | 0 | !xd->lossless[mbmi->segment_id]*/ |
80 | 0 | ; |
81 | 0 | } Unexecuted instantiation: av1me.c:is_rect_tx_allowed Unexecuted instantiation: enc_cdef.c:is_rect_tx_allowed Unexecuted instantiation: enc_dec_process.c:is_rect_tx_allowed Unexecuted instantiation: enc_inter_prediction.c:is_rect_tx_allowed Unexecuted instantiation: enc_intra_prediction.c:is_rect_tx_allowed Unexecuted instantiation: enc_mode_config.c:is_rect_tx_allowed Unexecuted instantiation: entropy_coding.c:is_rect_tx_allowed Unexecuted instantiation: full_loop.c:is_rect_tx_allowed Unexecuted instantiation: md_rate_estimation.c:is_rect_tx_allowed Unexecuted instantiation: mode_decision.c:is_rect_tx_allowed Unexecuted instantiation: motion_estimation.c:is_rect_tx_allowed Unexecuted instantiation: product_coding_loop.c:is_rect_tx_allowed Unexecuted instantiation: rc_process.c:is_rect_tx_allowed Unexecuted instantiation: rd_cost.c:is_rect_tx_allowed Unexecuted instantiation: resource_coordination_process.c:is_rect_tx_allowed Unexecuted instantiation: src_ops_process.c:is_rect_tx_allowed Unexecuted instantiation: transforms.c:is_rect_tx_allowed Unexecuted instantiation: encode_txb_ref_c.c:is_rect_tx_allowed Unexecuted instantiation: coding_loop.c:is_rect_tx_allowed |
82 | | |
83 | | ////////////////////// QUANTIZATION////////////// |
84 | | typedef struct QuantParam { |
85 | | int32_t log_scale; |
86 | | TxSize tx_size; |
87 | | const QmVal* qmatrix; |
88 | | const QmVal* iqmatrix; |
89 | | } QuantParam; |
90 | | |
91 | | static const uint32_t q_func[] = {26214, 23302, 20560, 18396, 16384, 14564}; |
92 | | EbErrorType svt_aom_estimate_transform(PictureControlSet* pcs, ModeDecisionContext* ctx, int16_t* residual_buffer, |
93 | | uint32_t residual_stride, int32_t* coeff_buffer, uint32_t coeff_stride, |
94 | | TxSize transform_size, uint64_t* three_quad_energy, uint32_t bit_depth, |
95 | | TxType transform_type, PlaneType component_type, TxCoeffShape trans_coeff_shape); |
96 | | |
97 | | uint8_t svt_aom_quantize_inv_quantize(PictureControlSet* pcs, ModeDecisionContext* ctx, int32_t* coeff, |
98 | | int32_t* quant_coeff, int32_t* recon_coeff, uint32_t qindex, |
99 | | int32_t segmentation_qp_offset, TxSize txsize, uint16_t* eob, |
100 | | uint32_t component_type, uint32_t bit_depth, TxType tx_type, |
101 | | int16_t txb_skip_context, int16_t dc_sign_context, PredictionMode pred_mode, |
102 | | uint32_t lambda, bool is_encode_pass); |
103 | | |
104 | | void svt_aom_quantize_inv_quantize_light(PictureControlSet* pcs, int32_t* coeff, int32_t* quant_coeff, |
105 | | int32_t* recon_coeff, uint32_t qindex, TxSize txsize, uint16_t* eob, |
106 | | uint32_t bit_depth, TxType tx_type); |
107 | | void svt_av1_wht_fwd_txfm(int16_t* src_diff, int bw, int32_t* coeff, TxSize tx_size, TxCoeffShape pf_shape, |
108 | | int bit_depth, int is_hbd); |
109 | | |
110 | | TxfmFunc svt_aom_fwd_txfm_type_to_func(TxfmType txfmtype); |
111 | | |
112 | | void av1_fwht4x4_c(int16_t* input, int32_t* output, uint32_t stride); |
113 | | #ifdef __cplusplus |
114 | | } |
115 | | #endif |
116 | | |
117 | | #endif // EbTransforms_h |