Coverage Report

Created: 2025-06-22 08:04

/src/aom/aom_dsp/txfm_common.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2016, 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
#ifndef AOM_AOM_DSP_TXFM_COMMON_H_
13
#define AOM_AOM_DSP_TXFM_COMMON_H_
14
15
#include "aom_dsp/aom_dsp_common.h"
16
17
// Constants and Macros used by all idct/dct functions
18
#define DCT_CONST_BITS 14
19
#define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1))
20
21
20.7M
#define UNIT_QUANT_SHIFT 2
22
0
#define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT)
23
24
// block transform size
25
enum {
26
  TX_4X4,             // 4x4 transform
27
  TX_8X8,             // 8x8 transform
28
  TX_16X16,           // 16x16 transform
29
  TX_32X32,           // 32x32 transform
30
  TX_64X64,           // 64x64 transform
31
  TX_4X8,             // 4x8 transform
32
  TX_8X4,             // 8x4 transform
33
  TX_8X16,            // 8x16 transform
34
  TX_16X8,            // 16x8 transform
35
  TX_16X32,           // 16x32 transform
36
  TX_32X16,           // 32x16 transform
37
  TX_32X64,           // 32x64 transform
38
  TX_64X32,           // 64x32 transform
39
  TX_4X16,            // 4x16 transform
40
  TX_16X4,            // 16x4 transform
41
  TX_8X32,            // 8x32 transform
42
  TX_32X8,            // 32x8 transform
43
  TX_16X64,           // 16x64 transform
44
  TX_64X16,           // 64x16 transform
45
  TX_SIZES_ALL,       // Includes rectangular transforms
46
  TX_SIZES = TX_4X8,  // Does NOT include rectangular transforms
47
  TX_SIZES_LARGEST = TX_64X64,
48
  TX_INVALID = 255  // Invalid transform size
49
} UENUM1BYTE(TX_SIZE);
50
51
enum {
52
  DCT_DCT,            // DCT in both horizontal and vertical
53
  ADST_DCT,           // ADST in vertical, DCT in horizontal
54
  DCT_ADST,           // DCT in vertical, ADST in horizontal
55
  ADST_ADST,          // ADST in both directions
56
  FLIPADST_DCT,       // FLIPADST in vertical, DCT in horizontal
57
  DCT_FLIPADST,       // DCT in vertical, FLIPADST in horizontal
58
  FLIPADST_FLIPADST,  // FLIPADST in both directions
59
  ADST_FLIPADST,      // ADST in vertical, FLIPADST in horizontal
60
  FLIPADST_ADST,      // FLIPADST in vertical, ADST in horizontal
61
  IDTX,               // Identity in both directions
62
  V_DCT,              // DCT in vertical, identity in horizontal
63
  H_DCT,              // Identity in vertical, DCT in horizontal
64
  V_ADST,             // ADST in vertical, identity in horizontal
65
  H_ADST,             // Identity in vertical, ADST in horizontal
66
  V_FLIPADST,         // FLIPADST in vertical, identity in horizontal
67
  H_FLIPADST,         // Identity in vertical, FLIPADST in horizontal
68
  TX_TYPES,
69
  DCT_ADST_TX_MASK = 0x000F,  // Either DCT or ADST in each direction
70
  TX_TYPE_INVALID = 255,      // Invalid transform type
71
} UENUM1BYTE(TX_TYPE);
72
73
enum {
74
  // DCT only
75
  EXT_TX_SET_DCTONLY,
76
  // DCT + Identity only
77
  EXT_TX_SET_DCT_IDTX,
78
  // Discrete Trig transforms w/o flip (4) + Identity (1)
79
  EXT_TX_SET_DTT4_IDTX,
80
  // Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2)
81
  EXT_TX_SET_DTT4_IDTX_1DDCT,
82
  // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver DCT (2)
83
  EXT_TX_SET_DTT9_IDTX_1DDCT,
84
  // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6)
85
  EXT_TX_SET_ALL16,
86
  EXT_TX_SET_TYPES
87
} UENUM1BYTE(TxSetType);
88
89
typedef struct txfm_param {
90
  // for both forward and inverse transforms
91
  TX_TYPE tx_type;
92
  TX_SIZE tx_size;
93
  int lossless;
94
  int bd;
95
  // are the pixel buffers octets or shorts?  This should collapse to
96
  // bd==8 implies !is_hbd, but that's not certain right now.
97
  int is_hbd;
98
  TxSetType tx_set_type;
99
  // for inverse transforms only
100
  int eob;
101
} TxfmParam;
102
103
// Constants:
104
//  for (int i = 1; i< 32; ++i)
105
//    printf("static const int cospi_%d_64 = %.0f;\n", i,
106
//           round(16384 * cos(i*PI/64)));
107
// Note: sin(k*Pi/64) = cos((32-k)*Pi/64)
108
static const tran_high_t cospi_1_64 = 16364;
109
static const tran_high_t cospi_2_64 = 16305;
110
static const tran_high_t cospi_3_64 = 16207;
111
static const tran_high_t cospi_4_64 = 16069;
112
static const tran_high_t cospi_5_64 = 15893;
113
static const tran_high_t cospi_6_64 = 15679;
114
static const tran_high_t cospi_7_64 = 15426;
115
static const tran_high_t cospi_8_64 = 15137;
116
static const tran_high_t cospi_9_64 = 14811;
117
static const tran_high_t cospi_10_64 = 14449;
118
static const tran_high_t cospi_11_64 = 14053;
119
static const tran_high_t cospi_12_64 = 13623;
120
static const tran_high_t cospi_13_64 = 13160;
121
static const tran_high_t cospi_14_64 = 12665;
122
static const tran_high_t cospi_15_64 = 12140;
123
static const tran_high_t cospi_16_64 = 11585;
124
static const tran_high_t cospi_17_64 = 11003;
125
static const tran_high_t cospi_18_64 = 10394;
126
static const tran_high_t cospi_19_64 = 9760;
127
static const tran_high_t cospi_20_64 = 9102;
128
static const tran_high_t cospi_21_64 = 8423;
129
static const tran_high_t cospi_22_64 = 7723;
130
static const tran_high_t cospi_23_64 = 7005;
131
static const tran_high_t cospi_24_64 = 6270;
132
static const tran_high_t cospi_25_64 = 5520;
133
static const tran_high_t cospi_26_64 = 4756;
134
static const tran_high_t cospi_27_64 = 3981;
135
static const tran_high_t cospi_28_64 = 3196;
136
static const tran_high_t cospi_29_64 = 2404;
137
static const tran_high_t cospi_30_64 = 1606;
138
static const tran_high_t cospi_31_64 = 804;
139
140
//  16384 * sqrt(2) * sin(kPi/9) * 2 / 3
141
static const tran_high_t sinpi_1_9 = 5283;
142
static const tran_high_t sinpi_2_9 = 9929;
143
static const tran_high_t sinpi_3_9 = 13377;
144
static const tran_high_t sinpi_4_9 = 15212;
145
146
// 16384 * sqrt(2)
147
static const tran_high_t Sqrt2 = 23170;
148
static const tran_high_t InvSqrt2 = 11585;
149
150
0
static inline tran_high_t fdct_round_shift(tran_high_t input) {
151
0
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
152
0
  return rv;
153
0
}
Unexecuted instantiation: av1_dx_iface.c:fdct_round_shift
Unexecuted instantiation: decodeframe.c:fdct_round_shift
Unexecuted instantiation: decodemv.c:fdct_round_shift
Unexecuted instantiation: decoder.c:fdct_round_shift
Unexecuted instantiation: decodetxb.c:fdct_round_shift
Unexecuted instantiation: detokenize.c:fdct_round_shift
Unexecuted instantiation: obu.c:fdct_round_shift
Unexecuted instantiation: av1_cx_iface.c:fdct_round_shift
Unexecuted instantiation: allintra_vis.c:fdct_round_shift
Unexecuted instantiation: av1_quantize.c:fdct_round_shift
Unexecuted instantiation: bitstream.c:fdct_round_shift
Unexecuted instantiation: context_tree.c:fdct_round_shift
Unexecuted instantiation: encodeframe.c:fdct_round_shift
Unexecuted instantiation: encodeframe_utils.c:fdct_round_shift
Unexecuted instantiation: encodemb.c:fdct_round_shift
Unexecuted instantiation: encodemv.c:fdct_round_shift
Unexecuted instantiation: encoder.c:fdct_round_shift
Unexecuted instantiation: encoder_utils.c:fdct_round_shift
Unexecuted instantiation: encodetxb.c:fdct_round_shift
Unexecuted instantiation: ethread.c:fdct_round_shift
Unexecuted instantiation: firstpass.c:fdct_round_shift
Unexecuted instantiation: global_motion_facade.c:fdct_round_shift
Unexecuted instantiation: hash.c:fdct_round_shift
Unexecuted instantiation: hash_motion.c:fdct_round_shift
Unexecuted instantiation: hybrid_fwd_txfm.c:fdct_round_shift
Unexecuted instantiation: level.c:fdct_round_shift
Unexecuted instantiation: lookahead.c:fdct_round_shift
Unexecuted instantiation: mcomp.c:fdct_round_shift
Unexecuted instantiation: mv_prec.c:fdct_round_shift
Unexecuted instantiation: palette.c:fdct_round_shift
Unexecuted instantiation: partition_search.c:fdct_round_shift
Unexecuted instantiation: partition_strategy.c:fdct_round_shift
Unexecuted instantiation: pass2_strategy.c:fdct_round_shift
Unexecuted instantiation: pickcdef.c:fdct_round_shift
Unexecuted instantiation: picklpf.c:fdct_round_shift
Unexecuted instantiation: pickrst.c:fdct_round_shift
Unexecuted instantiation: ratectrl.c:fdct_round_shift
Unexecuted instantiation: rd.c:fdct_round_shift
Unexecuted instantiation: rdopt.c:fdct_round_shift
Unexecuted instantiation: nonrd_pickmode.c:fdct_round_shift
Unexecuted instantiation: nonrd_opt.c:fdct_round_shift
Unexecuted instantiation: reconinter_enc.c:fdct_round_shift
Unexecuted instantiation: segmentation.c:fdct_round_shift
Unexecuted instantiation: speed_features.c:fdct_round_shift
Unexecuted instantiation: superres_scale.c:fdct_round_shift
Unexecuted instantiation: svc_layercontext.c:fdct_round_shift
Unexecuted instantiation: temporal_filter.c:fdct_round_shift
Unexecuted instantiation: tokenize.c:fdct_round_shift
Unexecuted instantiation: tpl_model.c:fdct_round_shift
Unexecuted instantiation: tx_search.c:fdct_round_shift
Unexecuted instantiation: txb_rdopt.c:fdct_round_shift
Unexecuted instantiation: intra_mode_search.c:fdct_round_shift
Unexecuted instantiation: var_based_part.c:fdct_round_shift
Unexecuted instantiation: av1_noise_estimate.c:fdct_round_shift
Unexecuted instantiation: dwt.c:fdct_round_shift
Unexecuted instantiation: aom_dsp_rtcd.c:fdct_round_shift
Unexecuted instantiation: av1_rtcd.c:fdct_round_shift
Unexecuted instantiation: aom_convolve.c:fdct_round_shift
Unexecuted instantiation: blend_a64_mask.c:fdct_round_shift
Unexecuted instantiation: avg.c:fdct_round_shift
Unexecuted instantiation: blk_sse_sum.c:fdct_round_shift
Unexecuted instantiation: fwd_txfm.c:fdct_round_shift
Unexecuted instantiation: psnr.c:fdct_round_shift
Unexecuted instantiation: quantize.c:fdct_round_shift
Unexecuted instantiation: sad.c:fdct_round_shift
Unexecuted instantiation: sad_av1.c:fdct_round_shift
Unexecuted instantiation: subtract.c:fdct_round_shift
Unexecuted instantiation: sse.c:fdct_round_shift
Unexecuted instantiation: sum_squares.c:fdct_round_shift
Unexecuted instantiation: variance.c:fdct_round_shift
Unexecuted instantiation: pyramid.c:fdct_round_shift
Unexecuted instantiation: noise_util.c:fdct_round_shift
Unexecuted instantiation: yv12config.c:fdct_round_shift
Unexecuted instantiation: alloccommon.c:fdct_round_shift
Unexecuted instantiation: av1_loopfilter.c:fdct_round_shift
Unexecuted instantiation: blockd.c:fdct_round_shift
Unexecuted instantiation: cdef.c:fdct_round_shift
Unexecuted instantiation: cdef_block.c:fdct_round_shift
Unexecuted instantiation: cfl.c:fdct_round_shift
Unexecuted instantiation: common_data.c:fdct_round_shift
Unexecuted instantiation: debugmodes.c:fdct_round_shift
Unexecuted instantiation: entropy.c:fdct_round_shift
Unexecuted instantiation: entropymode.c:fdct_round_shift
Unexecuted instantiation: entropymv.c:fdct_round_shift
Unexecuted instantiation: idct.c:fdct_round_shift
Unexecuted instantiation: mvref_common.c:fdct_round_shift
Unexecuted instantiation: pred_common.c:fdct_round_shift
Unexecuted instantiation: quant_common.c:fdct_round_shift
Unexecuted instantiation: reconinter.c:fdct_round_shift
Unexecuted instantiation: reconintra.c:fdct_round_shift
Unexecuted instantiation: resize.c:fdct_round_shift
Unexecuted instantiation: restoration.c:fdct_round_shift
Unexecuted instantiation: scale.c:fdct_round_shift
Unexecuted instantiation: scan.c:fdct_round_shift
Unexecuted instantiation: seg_common.c:fdct_round_shift
Unexecuted instantiation: thread_common.c:fdct_round_shift
Unexecuted instantiation: tile_common.c:fdct_round_shift
Unexecuted instantiation: timing.c:fdct_round_shift
Unexecuted instantiation: txb_common.c:fdct_round_shift
Unexecuted instantiation: warped_motion.c:fdct_round_shift
Unexecuted instantiation: aq_complexity.c:fdct_round_shift
Unexecuted instantiation: aq_cyclicrefresh.c:fdct_round_shift
Unexecuted instantiation: aq_variance.c:fdct_round_shift
Unexecuted instantiation: av1_fwd_txfm2d.c:fdct_round_shift
Unexecuted instantiation: cnn.c:fdct_round_shift
Unexecuted instantiation: compound_type.c:fdct_round_shift
Unexecuted instantiation: cost.c:fdct_round_shift
Unexecuted instantiation: encode_strategy.c:fdct_round_shift
Unexecuted instantiation: global_motion.c:fdct_round_shift
Unexecuted instantiation: gop_structure.c:fdct_round_shift
Unexecuted instantiation: interp_search.c:fdct_round_shift
Unexecuted instantiation: ml.c:fdct_round_shift
Unexecuted instantiation: motion_search_facade.c:fdct_round_shift
Unexecuted instantiation: wedge_utils.c:fdct_round_shift
Unexecuted instantiation: blend_a64_hmask.c:fdct_round_shift
Unexecuted instantiation: blend_a64_vmask.c:fdct_round_shift
Unexecuted instantiation: intrapred.c:fdct_round_shift
Unexecuted instantiation: loopfilter.c:fdct_round_shift
Unexecuted instantiation: fft.c:fdct_round_shift
Unexecuted instantiation: corner_match.c:fdct_round_shift
Unexecuted instantiation: disflow.c:fdct_round_shift
Unexecuted instantiation: av1_inv_txfm2d.c:fdct_round_shift
Unexecuted instantiation: av1_txfm.c:fdct_round_shift
Unexecuted instantiation: convolve.c:fdct_round_shift
Unexecuted instantiation: av1_fwd_txfm1d.c:fdct_round_shift
Unexecuted instantiation: av1_inv_txfm1d.c:fdct_round_shift
154
155
#endif  // AOM_AOM_DSP_TXFM_COMMON_H_