Coverage Report

Created: 2026-05-16 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/svt-av1/Source/Lib/Codec/utility.h
Line
Count
Source
1
/*
2
* Copyright(c) 2019 Intel Corporation
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 https://www.aomedia.org/license/software-license. 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 https://www.aomedia.org/license/patent-license.
10
*/
11
12
#ifndef EbUtility_h
13
#define EbUtility_h
14
15
#include "definitions.h"
16
#include "common_dsp_rtcd.h"
17
#ifdef __cplusplus
18
extern "C" {
19
#endif
20
#include <limits.h>
21
22
/****************************
23
     * UTILITY FUNCTIONS
24
     ****************************/
25
typedef struct BlockList {
26
    uint8_t  list_size;
27
    uint16_t blk_mds_table[3]; //stores a max of 3 redundant blocks
28
} BlockList_t;
29
30
typedef enum GeomIndex {
31
    GEOM_0, //64x64  ->16x16  NSQ:OFF
32
    GEOM_1, //64x64  ->16x16  NSQ:ON (only H & V shapes, but not 16x8 and 8x16)
33
    GEOM_2, //64x64  ->8x8    NSQ:OFF
34
    GEOM_3, //64x64  ->8x8    NSQ:ON (only H & V shapes, but not 8x4 and 4x8 and not 16x8 and 8x16)
35
    GEOM_4, //64x64  ->8x8    NSQ:ON (only H & V shapes, but not 8x4 and 4x8)
36
    GEOM_5, //64x64  ->8x8    NSQ:ON (only H & V shapes)
37
    GEOM_6, //64x64  ->4x4    NSQ:ON (only H & V shapes)
38
    GEOM_7, //64x64  ->4x4    NSQ:ON (only H, V, H4, V4 shapes)
39
    GEOM_8, //64x64  ->4x4    NSQ:ON (all shapes)
40
    GEOM_9, //128x128->4x4    NSQ:ON (all shapes)
41
    GEOM_10, //128x128->8x8    NSQ:ON (only H, V, H4, V4 shapes)
42
    GEOM_TOT
43
} GeomIndex;
44
45
typedef struct BlockGeom {
46
    uint8_t sq_size; // size of parent square
47
48
    uint8_t   bwidth; // block width
49
    uint8_t   bheight; // block height
50
    uint8_t   bwidth_uv; // block width for Chroma 4:2:0
51
    uint8_t   bheight_uv; // block height for Chroma 4:2:0
52
    BlockSize bsize; // bloc size
53
    BlockSize bsize_uv; // bloc size for Chroma 4:2:0
54
55
    uint16_t d1_depth_offset; // offset to the next d1 sq block
56
    uint16_t ns_depth_offset; // offset to the next nsq block (skip remaining d2 blocks)
57
#if _DEBUG
58
    // when debugging, track the mds_idx for each block so can confirm we are using the
59
    // correct MDS when we get the BlkGeom. Should not be used in the code though.
60
    uint32_t mds_idx;
61
#endif
62
} BlockGeom;
63
64
void svt_aom_build_blk_geom(GeomIndex geom, BlockGeom* blk_geom_table);
65
66
635k
static INLINE const BlockGeom* get_blk_geom_mds(const BlockGeom* blk_geom_table, uint32_t bidx_mds) {
67
635k
    return &blk_geom_table[bidx_mds];
68
635k
}
Unexecuted instantiation: enc_handle.c:get_blk_geom_mds
Unexecuted instantiation: enc_settings.c:get_blk_geom_mds
Unexecuted instantiation: aom_dsp_rtcd.c:get_blk_geom_mds
Unexecuted instantiation: av1me.c:get_blk_geom_mds
Unexecuted instantiation: bitstream_unit.c:get_blk_geom_mds
Unexecuted instantiation: cdef_process.c:get_blk_geom_mds
Unexecuted instantiation: common_dsp_rtcd.c:get_blk_geom_mds
Unexecuted instantiation: dlf_process.c:get_blk_geom_mds
Unexecuted instantiation: enc_cdef.c:get_blk_geom_mds
Unexecuted instantiation: enc_dec_process.c:get_blk_geom_mds
Unexecuted instantiation: enc_inter_prediction.c:get_blk_geom_mds
Unexecuted instantiation: enc_intra_prediction.c:get_blk_geom_mds
Unexecuted instantiation: enc_mode_config.c:get_blk_geom_mds
Unexecuted instantiation: entropy_coding.c:get_blk_geom_mds
Unexecuted instantiation: ec_process.c:get_blk_geom_mds
Unexecuted instantiation: full_loop.c:get_blk_geom_mds
Unexecuted instantiation: initial_rc_process.c:get_blk_geom_mds
Unexecuted instantiation: inter_prediction.c:get_blk_geom_mds
Unexecuted instantiation: intra_prediction.c:get_blk_geom_mds
Unexecuted instantiation: md_rate_estimation.c:get_blk_geom_mds
Unexecuted instantiation: mode_decision.c:get_blk_geom_mds
Unexecuted instantiation: md_config_process.c:get_blk_geom_mds
md_process.c:get_blk_geom_mds
Line
Count
Source
66
252k
static INLINE const BlockGeom* get_blk_geom_mds(const BlockGeom* blk_geom_table, uint32_t bidx_mds) {
67
252k
    return &blk_geom_table[bidx_mds];
68
252k
}
Unexecuted instantiation: motion_estimation.c:get_blk_geom_mds
Unexecuted instantiation: me_process.c:get_blk_geom_mds
Unexecuted instantiation: neighbor_arrays.c:get_blk_geom_mds
Unexecuted instantiation: packetization_process.c:get_blk_geom_mds
Unexecuted instantiation: palette.c:get_blk_geom_mds
Unexecuted instantiation: pic_analysis_process.c:get_blk_geom_mds
Unexecuted instantiation: pcs.c:get_blk_geom_mds
Unexecuted instantiation: pd_process.c:get_blk_geom_mds
Unexecuted instantiation: pic_manager_process.c:get_blk_geom_mds
Unexecuted instantiation: pic_operators.c:get_blk_geom_mds
Unexecuted instantiation: pred_structure.c:get_blk_geom_mds
product_coding_loop.c:get_blk_geom_mds
Line
Count
Source
66
254k
static INLINE const BlockGeom* get_blk_geom_mds(const BlockGeom* blk_geom_table, uint32_t bidx_mds) {
67
254k
    return &blk_geom_table[bidx_mds];
68
254k
}
Unexecuted instantiation: rc_aq.c:get_blk_geom_mds
Unexecuted instantiation: rc_process.c:get_blk_geom_mds
Unexecuted instantiation: rc_rtc_cbr.c:get_blk_geom_mds
Unexecuted instantiation: rc_vbr_cbr.c:get_blk_geom_mds
Unexecuted instantiation: rd_cost.c:get_blk_geom_mds
Unexecuted instantiation: reference_object.c:get_blk_geom_mds
Unexecuted instantiation: resize.c:get_blk_geom_mds
Unexecuted instantiation: resource_coordination_process.c:get_blk_geom_mds
Unexecuted instantiation: rest_process.c:get_blk_geom_mds
Unexecuted instantiation: restoration.c:get_blk_geom_mds
Unexecuted instantiation: restoration_pick.c:get_blk_geom_mds
Unexecuted instantiation: segmentation.c:get_blk_geom_mds
Unexecuted instantiation: sequence_control_set.c:get_blk_geom_mds
Unexecuted instantiation: src_ops_process.c:get_blk_geom_mds
Unexecuted instantiation: super_res.c:get_blk_geom_mds
Unexecuted instantiation: svt_psnr.c:get_blk_geom_mds
Unexecuted instantiation: temporal_filtering.c:get_blk_geom_mds
Unexecuted instantiation: transforms.c:get_blk_geom_mds
Unexecuted instantiation: utility.c:get_blk_geom_mds
Unexecuted instantiation: compute_sad_c.c:get_blk_geom_mds
Unexecuted instantiation: encode_txb_ref_c.c:get_blk_geom_mds
Unexecuted instantiation: picture_operators_c.c:get_blk_geom_mds
Unexecuted instantiation: adaptive_mv_pred.c:get_blk_geom_mds
coding_loop.c:get_blk_geom_mds
Line
Count
Source
66
128k
static INLINE const BlockGeom* get_blk_geom_mds(const BlockGeom* blk_geom_table, uint32_t bidx_mds) {
67
128k
    return &blk_geom_table[bidx_mds];
68
128k
}
Unexecuted instantiation: coding_unit.c:get_blk_geom_mds
Unexecuted instantiation: deblocking_filter.c:get_blk_geom_mds
Unexecuted instantiation: firstpass.c:get_blk_geom_mds
Unexecuted instantiation: global_me.c:get_blk_geom_mds
Unexecuted instantiation: global_me_cost.c:get_blk_geom_mds
Unexecuted instantiation: mcomp.c:get_blk_geom_mds
Unexecuted instantiation: me_context.c:get_blk_geom_mds
Unexecuted instantiation: pass2_strategy.c:get_blk_geom_mds
Unexecuted instantiation: rc_crf_cqp.c:get_blk_geom_mds
Unexecuted instantiation: global_motion.c:get_blk_geom_mds
Unexecuted instantiation: ransac.c:get_blk_geom_mds
69
70
// CU Stats Helper Functions
71
typedef struct CodedBlockStats {
72
    uint8_t depth;
73
    uint8_t size;
74
    uint8_t size_log2;
75
    uint8_t org_x;
76
    uint8_t org_y;
77
    uint8_t cu_num_in_depth;
78
    uint8_t parent32x32_index;
79
} CodedBlockStats;
80
81
const CodedBlockStats* svt_aom_get_coded_blk_stats(const uint32_t cu_idx);
82
83
/****************************
84
     * MACROS
85
     ****************************/
86
87
253k
#define MULTI_LINE_MACRO_BEGIN do {
88
#define MULTI_LINE_MACRO_END \
89
253k
    }                        \
90
253k
    while (0)
91
92
//**************************************************
93
// MACROS
94
//**************************************************
95
1.21M
#define NOT_USED_VALUE 0
96
36.9k
#define DIVIDE_AND_ROUND(x, y) (((x) + ((y) >> 1)) / (y))
97
11.3k
#define DIVIDE_AND_CEIL(x, y) (((x) + ((y) - 1)) / (y))
98
18.5M
#define MAX(x, y) ((x) > (y) ? (x) : (y))
99
7.29M
#define MIN(x, y) ((x) < (y) ? (x) : (y))
100
#define MEDIAN(a, b, c)                   ((a)>(b)?(a)>?(b)>?(b)::(a):(b)>?(a)>?(a)::(b))
101
269k
#define CLIP3(min_val, max_val, a) (((a) < (min_val)) ? (min_val) : (((a) > (max_val)) ? (max_val) : (a)))
102
#define CLIP3EQ(min_val, max_val, a) (((a) <= (min_val)) ? (min_val) : (((a) >= (max_val)) ? (max_val) : (a)))
103
#define BITDEPTH_MIDRANGE_VALUE(precision) (1 << ((precision) - 1))
104
26.5k
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
105
9.50M
#define EB_ABS_DIFF(a, b) ((a) > (b) ? ((a) - (b)) : ((b) - (a)))
106
#define EB_DIFF_SQR(a, b) (((a) - (b)) * ((a) - (b)))
107
90.1M
#define SQR(x) ((x) * (x))
108
0
#define POW2(x) (1 << (x))
109
#define SIGN(a, b) (((a - b) < 0) ? (-1) : ((a - b) > 0) ? (1) : 0)
110
0
#define ROUND(a) (a >= 0) ? (a + 1 / 2) : (a - 1 / 2);
111
#define UNSIGNED_DEC(x)                                      \
112
    MULTI_LINE_MACRO_BEGIN(x) = (((x) > 0) ? ((x) - 1) : 0); \
113
    MULTI_LINE_MACRO_END
114
#define CIRCULAR_ADD(x, max) (((x) >= (max)) ? ((x) - (max)) : ((x) < 0) ? ((max) + (x)) : (x))
115
#define CIRCULAR_ADD_UNSIGNED(x, max) (((x) >= (max)) ? ((x) - (max)) : (x))
116
#define CEILING(x, base) ((((x) + (base) - 1) / (base)) * (base))
117
#define POW2_CHECK(x) ((x) == ((x) & (-((int32_t)(x)))))
118
#define ROUND_UP_MUL_8(x) ((x) + ((8 - ((x) & 0x7)) & 0x7))
119
#define ROUND_UP_MULT(x, mult) ((x) + (((mult) - ((x) & ((mult) - 1))) & ((mult) - 1)))
120
121
// rounds down to the next power of two
122
#define FLOOR_POW2(x)                        \
123
    MULTI_LINE_MACRO_BEGIN(x) |= ((x) >> 1); \
124
    (x) |= ((x) >> 2);                       \
125
    (x) |= ((x) >> 4);                       \
126
    (x) |= ((x) >> 8);                       \
127
    (x) |= ((x) >> 16);                      \
128
    (x) -= ((x) >> 1);                       \
129
    MULTI_LINE_MACRO_END
130
131
// rounds up to the next power of two
132
#define CEIL_POW2(x)                \
133
    MULTI_LINE_MACRO_BEGIN(x) -= 1; \
134
    (x) |= ((x) >> 1);              \
135
    (x) |= ((x) >> 2);              \
136
    (x) |= ((x) >> 4);              \
137
    (x) |= ((x) >> 8);              \
138
    (x) |= ((x) >> 16);             \
139
    (x) += 1;                       \
140
    MULTI_LINE_MACRO_END
141
#define LOG2F_8(x)              \
142
    (((x) < 0x0002u)       ? 0u \
143
         : ((x) < 0x0004u) ? 1u \
144
         : ((x) < 0x0008u) ? 2u \
145
         : ((x) < 0x0010u) ? 3u \
146
         : ((x) < 0x0020u) ? 4u \
147
         : ((x) < 0x0040u) ? 5u \
148
                           : 6u)
149
150
#define TWO_D_INDEX(x, y, stride) (((y) * (stride)) + (x))
151
152
// MAX_CU_COUNT is used to find the total number of partitions for the max partition depth and for
153
// each parent partition up to the root partition level (i.e. SB level).
154
155
// MAX_CU_COUNT is given by SUM from k=1 to n (4^(k-1)), reduces by using the following finite sum
156
// SUM from k=1 to n (q^(k-1)) = (q^n - 1)/(q-1) => (4^n - 1) / 3
157
#define MAX_CU_COUNT(max_depth_count) ((((1 << (max_depth_count)) * (1 << (max_depth_count))) - 1) / 3)
158
159
//**************************************************
160
// CONSTANTS
161
//**************************************************
162
0
#define MIN_UNSIGNED_VALUE 0
163
#define MAX_UNSIGNED_VALUE ~0u
164
0
#define MIN_SIGNED_VALUE ~0 - ((signed)(~0u >> 1))
165
0
#define MAX_SIGNED_VALUE ((signed)(~0u >> 1))
166
0
#define CONST_SQRT2 (1.4142135623730950488016887242097) /*sqrt(2)*/
167
168
0
#define MINI_GOP_MAX_COUNT 31
169
#define MINI_GOP_WINDOW_MAX_COUNT 16 // window subdivision: 16 x 2L
170
171
0
#define MIN_HIERARCHICAL_LEVEL 1
172
static const uint8_t mini_gop_offset[MAX_HIERARCHICAL_LEVEL - MIN_HIERARCHICAL_LEVEL] = {1, 3, 7, 15, 31};
173
174
typedef struct MiniGopStats {
175
    uint8_t hierarchical_levels;
176
    uint8_t start_index;
177
    uint8_t end_index;
178
    uint8_t length;
179
} MiniGopStats;
180
181
const MiniGopStats* svt_aom_get_mini_gop_stats(const uint32_t mini_gop_index);
182
183
typedef enum MinigopIndex {
184
    L6_INDEX    = 0,
185
    L5_0_INDEX  = 1,
186
    L4_0_INDEX  = 2,
187
    L3_0_INDEX  = 3,
188
    L2_0_INDEX  = 4,
189
    L2_1_INDEX  = 5,
190
    L3_1_INDEX  = 6,
191
    L2_2_INDEX  = 7,
192
    L2_3_INDEX  = 8,
193
    L4_1_INDEX  = 9,
194
    L3_2_INDEX  = 10,
195
    L2_4_INDEX  = 11,
196
    L2_5_INDEX  = 12,
197
    L3_3_INDEX  = 13,
198
    L2_6_INDEX  = 14,
199
    L2_7_INDEX  = 15,
200
    L5_1_INDEX  = 16,
201
    L4_2_INDEX  = 17,
202
    L3_4_INDEX  = 18,
203
    L2_8_INDEX  = 19,
204
    L2_9_INDEX  = 20,
205
    L3_5_INDEX  = 21,
206
    L2_10_INDEX = 22,
207
    L2_11_INDEX = 23,
208
    L4_3_INDEX  = 24,
209
    L3_6_INDEX  = 25,
210
    L2_12_INDEX = 26,
211
    L2_13_INDEX = 27,
212
    L3_7_INDEX  = 28,
213
    L2_14_INDEX = 29,
214
    L2_15_INDEX = 30
215
} MinigopIndex;
216
217
// Right shift that replicates gcc's implementation
218
219
0
static inline int gcc_right_shift(int a, unsigned shift) {
220
0
    if (!a) {
221
0
        return 0;
222
0
    }
223
0
    if (a > 0) {
224
0
        return a >> shift;
225
0
    }
226
0
    static const unsigned sbit = 1u << (sizeof(sbit) * CHAR_BIT - 1);
227
0
    a                          = (unsigned)a >> shift;
228
0
    while (shift) {
229
0
        a |= sbit >> shift--;
230
0
    }
231
0
    return a ^ sbit;
232
0
}
Unexecuted instantiation: enc_handle.c:gcc_right_shift
Unexecuted instantiation: enc_settings.c:gcc_right_shift
Unexecuted instantiation: aom_dsp_rtcd.c:gcc_right_shift
Unexecuted instantiation: av1me.c:gcc_right_shift
Unexecuted instantiation: bitstream_unit.c:gcc_right_shift
Unexecuted instantiation: cdef_process.c:gcc_right_shift
Unexecuted instantiation: common_dsp_rtcd.c:gcc_right_shift
Unexecuted instantiation: dlf_process.c:gcc_right_shift
Unexecuted instantiation: enc_cdef.c:gcc_right_shift
Unexecuted instantiation: enc_dec_process.c:gcc_right_shift
Unexecuted instantiation: enc_inter_prediction.c:gcc_right_shift
Unexecuted instantiation: enc_intra_prediction.c:gcc_right_shift
Unexecuted instantiation: enc_mode_config.c:gcc_right_shift
Unexecuted instantiation: entropy_coding.c:gcc_right_shift
Unexecuted instantiation: ec_process.c:gcc_right_shift
Unexecuted instantiation: full_loop.c:gcc_right_shift
Unexecuted instantiation: initial_rc_process.c:gcc_right_shift
Unexecuted instantiation: inter_prediction.c:gcc_right_shift
Unexecuted instantiation: intra_prediction.c:gcc_right_shift
Unexecuted instantiation: md_rate_estimation.c:gcc_right_shift
Unexecuted instantiation: mode_decision.c:gcc_right_shift
Unexecuted instantiation: md_config_process.c:gcc_right_shift
Unexecuted instantiation: md_process.c:gcc_right_shift
Unexecuted instantiation: motion_estimation.c:gcc_right_shift
Unexecuted instantiation: me_process.c:gcc_right_shift
Unexecuted instantiation: neighbor_arrays.c:gcc_right_shift
Unexecuted instantiation: packetization_process.c:gcc_right_shift
Unexecuted instantiation: palette.c:gcc_right_shift
Unexecuted instantiation: pic_analysis_process.c:gcc_right_shift
Unexecuted instantiation: pcs.c:gcc_right_shift
Unexecuted instantiation: pd_process.c:gcc_right_shift
Unexecuted instantiation: pic_manager_process.c:gcc_right_shift
Unexecuted instantiation: pic_operators.c:gcc_right_shift
Unexecuted instantiation: pred_structure.c:gcc_right_shift
Unexecuted instantiation: product_coding_loop.c:gcc_right_shift
Unexecuted instantiation: rc_aq.c:gcc_right_shift
Unexecuted instantiation: rc_process.c:gcc_right_shift
Unexecuted instantiation: rc_rtc_cbr.c:gcc_right_shift
Unexecuted instantiation: rc_vbr_cbr.c:gcc_right_shift
Unexecuted instantiation: rd_cost.c:gcc_right_shift
Unexecuted instantiation: reference_object.c:gcc_right_shift
Unexecuted instantiation: resize.c:gcc_right_shift
Unexecuted instantiation: resource_coordination_process.c:gcc_right_shift
Unexecuted instantiation: rest_process.c:gcc_right_shift
Unexecuted instantiation: restoration.c:gcc_right_shift
Unexecuted instantiation: restoration_pick.c:gcc_right_shift
Unexecuted instantiation: segmentation.c:gcc_right_shift
Unexecuted instantiation: sequence_control_set.c:gcc_right_shift
Unexecuted instantiation: src_ops_process.c:gcc_right_shift
Unexecuted instantiation: super_res.c:gcc_right_shift
Unexecuted instantiation: svt_psnr.c:gcc_right_shift
Unexecuted instantiation: temporal_filtering.c:gcc_right_shift
Unexecuted instantiation: transforms.c:gcc_right_shift
Unexecuted instantiation: utility.c:gcc_right_shift
Unexecuted instantiation: compute_sad_c.c:gcc_right_shift
Unexecuted instantiation: encode_txb_ref_c.c:gcc_right_shift
Unexecuted instantiation: picture_operators_c.c:gcc_right_shift
Unexecuted instantiation: adaptive_mv_pred.c:gcc_right_shift
Unexecuted instantiation: coding_loop.c:gcc_right_shift
Unexecuted instantiation: coding_unit.c:gcc_right_shift
Unexecuted instantiation: deblocking_filter.c:gcc_right_shift
Unexecuted instantiation: firstpass.c:gcc_right_shift
Unexecuted instantiation: global_me.c:gcc_right_shift
Unexecuted instantiation: global_me_cost.c:gcc_right_shift
Unexecuted instantiation: mcomp.c:gcc_right_shift
Unexecuted instantiation: me_context.c:gcc_right_shift
Unexecuted instantiation: pass2_strategy.c:gcc_right_shift
Unexecuted instantiation: rc_crf_cqp.c:gcc_right_shift
Unexecuted instantiation: global_motion.c:gcc_right_shift
Unexecuted instantiation: ransac.c:gcc_right_shift
233
234
0
static INLINE int convert_to_trans_prec(int allow_hp, int coor) {
235
0
    if (allow_hp) {
236
0
        return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 3);
237
0
    } else {
238
0
        return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 2) * 2;
239
0
    }
240
0
}
Unexecuted instantiation: enc_handle.c:convert_to_trans_prec
Unexecuted instantiation: enc_settings.c:convert_to_trans_prec
Unexecuted instantiation: av1me.c:convert_to_trans_prec
Unexecuted instantiation: bitstream_unit.c:convert_to_trans_prec
Unexecuted instantiation: cdef_process.c:convert_to_trans_prec
Unexecuted instantiation: common_dsp_rtcd.c:convert_to_trans_prec
Unexecuted instantiation: dlf_process.c:convert_to_trans_prec
Unexecuted instantiation: enc_cdef.c:convert_to_trans_prec
Unexecuted instantiation: enc_dec_process.c:convert_to_trans_prec
Unexecuted instantiation: enc_inter_prediction.c:convert_to_trans_prec
Unexecuted instantiation: enc_intra_prediction.c:convert_to_trans_prec
Unexecuted instantiation: enc_mode_config.c:convert_to_trans_prec
Unexecuted instantiation: entropy_coding.c:convert_to_trans_prec
Unexecuted instantiation: ec_process.c:convert_to_trans_prec
Unexecuted instantiation: full_loop.c:convert_to_trans_prec
Unexecuted instantiation: initial_rc_process.c:convert_to_trans_prec
Unexecuted instantiation: inter_prediction.c:convert_to_trans_prec
Unexecuted instantiation: intra_prediction.c:convert_to_trans_prec
Unexecuted instantiation: md_rate_estimation.c:convert_to_trans_prec
Unexecuted instantiation: mode_decision.c:convert_to_trans_prec
Unexecuted instantiation: md_config_process.c:convert_to_trans_prec
Unexecuted instantiation: md_process.c:convert_to_trans_prec
Unexecuted instantiation: motion_estimation.c:convert_to_trans_prec
Unexecuted instantiation: me_process.c:convert_to_trans_prec
Unexecuted instantiation: neighbor_arrays.c:convert_to_trans_prec
Unexecuted instantiation: packetization_process.c:convert_to_trans_prec
Unexecuted instantiation: pic_analysis_process.c:convert_to_trans_prec
Unexecuted instantiation: pcs.c:convert_to_trans_prec
Unexecuted instantiation: pd_process.c:convert_to_trans_prec
Unexecuted instantiation: pic_manager_process.c:convert_to_trans_prec
Unexecuted instantiation: pic_operators.c:convert_to_trans_prec
Unexecuted instantiation: pred_structure.c:convert_to_trans_prec
Unexecuted instantiation: product_coding_loop.c:convert_to_trans_prec
Unexecuted instantiation: rc_aq.c:convert_to_trans_prec
Unexecuted instantiation: rc_process.c:convert_to_trans_prec
Unexecuted instantiation: rc_rtc_cbr.c:convert_to_trans_prec
Unexecuted instantiation: rc_vbr_cbr.c:convert_to_trans_prec
Unexecuted instantiation: rd_cost.c:convert_to_trans_prec
Unexecuted instantiation: reference_object.c:convert_to_trans_prec
Unexecuted instantiation: resource_coordination_process.c:convert_to_trans_prec
Unexecuted instantiation: rest_process.c:convert_to_trans_prec
Unexecuted instantiation: restoration_pick.c:convert_to_trans_prec
Unexecuted instantiation: sequence_control_set.c:convert_to_trans_prec
Unexecuted instantiation: src_ops_process.c:convert_to_trans_prec
Unexecuted instantiation: super_res.c:convert_to_trans_prec
Unexecuted instantiation: svt_psnr.c:convert_to_trans_prec
Unexecuted instantiation: temporal_filtering.c:convert_to_trans_prec
Unexecuted instantiation: transforms.c:convert_to_trans_prec
Unexecuted instantiation: utility.c:convert_to_trans_prec
Unexecuted instantiation: compute_sad_c.c:convert_to_trans_prec
Unexecuted instantiation: encode_txb_ref_c.c:convert_to_trans_prec
Unexecuted instantiation: picture_operators_c.c:convert_to_trans_prec
Unexecuted instantiation: adaptive_mv_pred.c:convert_to_trans_prec
Unexecuted instantiation: coding_loop.c:convert_to_trans_prec
Unexecuted instantiation: coding_unit.c:convert_to_trans_prec
Unexecuted instantiation: deblocking_filter.c:convert_to_trans_prec
Unexecuted instantiation: global_me.c:convert_to_trans_prec
Unexecuted instantiation: global_me_cost.c:convert_to_trans_prec
Unexecuted instantiation: me_context.c:convert_to_trans_prec
Unexecuted instantiation: rc_crf_cqp.c:convert_to_trans_prec
241
242
/* Convert Floating Point to Fixed Point example: int32_t val_fp8 = FLOAT2FP(val_float, 8, int32_t) */
243
#define FLOAT2FP(x_float, base_move, fp_type) ((fp_type)((x_float) * (((fp_type)(1)) << (base_move))))
244
245
/* Convert Fixed Point to Floating Point example: double val = FP2FLOAT(val_fp8, 8, int32_t, double) */
246
#define FP2FLOAT(x_fp, base_move, fp_type, float_type) \
247
    ((((float_type)((fp_type)(x_fp))) / ((float_type)(((fp_type)1) << (base_move)))))
248
249
#ifndef FIXED_POINT_ASSERT_TEST
250
#if NDEBUG
251
#define FIXED_POINT_ASSERT_TEST 0
252
#else
253
#define FIXED_POINT_ASSERT_TEST 1
254
#endif
255
#endif
256
257
#if FIXED_POINT_ASSERT_TEST
258
void svt_fixed_point_test_breakpoint(char* file, unsigned line);
259
#define FP_ASSERT(expression)                                                                             \
260
    if (!(expression)) {                                                                                  \
261
        fprintf(stderr, "ERROR: FP_ASSERT Fixed Point overload %s:%u\n", __FILE__, (unsigned)(__LINE__)); \
262
        svt_fixed_point_test_breakpoint(__FILE__, (unsigned)(__LINE__));                                  \
263
        assert(0);                                                                                        \
264
        abort();                                                                                          \
265
    }
266
#else /*FIXED_POINT_ASSERT_TEST*/
267
#define FP_ASSERT(expression)
268
#endif
269
270
#ifdef __cplusplus
271
}
272
#endif
273
274
#endif // EbUtility_h