/work/svt-av1/Source/Lib/Codec/restoration.h
Line | Count | Source |
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 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 AV1_COMMON_RESTORATION_H_ |
13 | | #define AV1_COMMON_RESTORATION_H_ |
14 | | |
15 | | #include <math.h> |
16 | | #include "definitions.h" |
17 | | #include "pic_buffer_desc.h" |
18 | | #include "av1_structs.h" |
19 | | |
20 | | #ifdef __cplusplus |
21 | | extern "C" { |
22 | | #endif |
23 | | |
24 | | void svt_apply_selfguided_restoration_c(const uint8_t* dat8, int32_t width, int32_t height, int32_t stride, int32_t eps, |
25 | | const int32_t* xqd, uint8_t* dst8, int32_t dst_stride, int32_t* tmpbuf, |
26 | | int32_t bit_depth, int32_t highbd); |
27 | | |
28 | | // Border for Loop restoration buffer |
29 | 0 | #define AOM_RESTORATION_FRAME_BORDER 32 |
30 | | |
31 | 491k | #define CLIP(x, lo, hi) ((x) < (lo) ? (lo) : (x) > (hi) ? (hi) : (x)) |
32 | | #define RINT(x) ((x) < 0 ? (int32_t)((x) - 0.5) : (int32_t)((x) + 0.5)) |
33 | | |
34 | 0 | #define REAL_PTR(hbd, d) ((hbd) ? (uint8_t*)CONVERT_TO_SHORTPTR(d) : (d)) |
35 | | |
36 | 0 | #define RESTORATION_PROC_UNIT_SIZE 64 |
37 | | |
38 | | // Filter tile grid offset upwards compared to the superblock grid |
39 | 0 | #define RESTORATION_UNIT_OFFSET 8 |
40 | | |
41 | 0 | #define SGRPROJ_BORDER_VERT 3 // Vertical border used for Sgr |
42 | 0 | #define SGRPROJ_BORDER_HORZ 3 // Horizontal border used for Sgr |
43 | | |
44 | | #define WIENER_BORDER_VERT 2 // Vertical border used for Wiener |
45 | 29.9k | #define WIENER_HALFWIN 3 |
46 | | #define WIENER_BORDER_HORZ (WIENER_HALFWIN) // Horizontal border for Wiener |
47 | | |
48 | | // RESTORATION_BORDER_VERT determines line buffer requirement for LR. |
49 | | // Should be set at the max of SGRPROJ_BORDER_VERT and WIENER_BORDER_VERT. |
50 | | // Note the line buffer needed is twice the value of this macro. |
51 | | #if SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT |
52 | 0 | #define RESTORATION_BORDER_VERT (SGRPROJ_BORDER_VERT) |
53 | | #else |
54 | | #define RESTORATION_BORDER_VERT (WIENER_BORDER_VERT) |
55 | | #endif // SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT |
56 | | |
57 | | #if SGRPROJ_BORDER_HORZ >= WIENER_BORDER_HORZ |
58 | 0 | #define RESTORATION_BORDER_HORZ (SGRPROJ_BORDER_HORZ) |
59 | | #else |
60 | | #define RESTORATION_BORDER_HORZ (WIENER_BORDER_HORZ) |
61 | | #endif // SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT |
62 | | |
63 | | // How many border pixels do we need for each processing unit? |
64 | 0 | #define RESTORATION_BORDER 3 |
65 | | |
66 | | // How many rows of deblocked pixels do we save above/below each processing |
67 | | // stripe? |
68 | 0 | #define RESTORATION_CTX_VERT 2 |
69 | | |
70 | | // Additional pixels to the left and right in above/below buffers |
71 | | // It is RESTORATION_BORDER_HORZ rounded up to get nicer buffer alignment |
72 | 0 | #define RESTORATION_EXTRA_HORZ 4 |
73 | | |
74 | | // Pad up to 20 more (may be much less is needed) |
75 | | #define RESTORATION_PADDING 20 |
76 | | #define RESTORATION_PROC_UNIT_PELS \ |
77 | | ((RESTORATION_PROC_UNIT_SIZE + RESTORATION_BORDER_HORZ * 2 + RESTORATION_PADDING) * \ |
78 | | (RESTORATION_PROC_UNIT_SIZE + RESTORATION_BORDER_VERT * 2 + RESTORATION_PADDING)) |
79 | | |
80 | 474 | #define RESTORATION_UNITSIZE_MAX 256 |
81 | 0 | #define RESTORATION_UNITPELS_HORZ_MAX (RESTORATION_UNITSIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_HORZ + 16) |
82 | | #define RESTORATION_UNITPELS_VERT_MAX \ |
83 | 0 | ((RESTORATION_UNITSIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_VERT + RESTORATION_UNIT_OFFSET)) |
84 | 0 | #define RESTORATION_UNITPELS_MAX (RESTORATION_UNITPELS_HORZ_MAX * RESTORATION_UNITPELS_VERT_MAX) |
85 | | |
86 | | // Two 32-bit buffers needed for the restored versions from two filters |
87 | | #define SGRPROJ_TMPBUF_SIZE (RESTORATION_UNITPELS_MAX * 2 * sizeof(int32_t)) |
88 | | |
89 | | #define SGRPROJ_EXTBUF_SIZE (0) |
90 | 0 | #define SGRPROJ_PARAMS_BITS 4 |
91 | | #define SGRPROJ_PARAMS (1 << SGRPROJ_PARAMS_BITS) |
92 | | |
93 | | // Precision bits for projection |
94 | 89.8k | #define SGRPROJ_PRJ_BITS 7 |
95 | | // Restoration precision bits generated higher than source before projection |
96 | 0 | #define SGRPROJ_RST_BITS 4 |
97 | | // Internal precision bits for core selfguided_restoration |
98 | | #define SGRPROJ_SGR_BITS 8 |
99 | | #define SGRPROJ_SGR (1 << SGRPROJ_SGR_BITS) |
100 | | |
101 | 29.9k | #define SGRPROJ_PRJ_MIN0 (-(1 << SGRPROJ_PRJ_BITS) * 3 / 4) |
102 | 14.9k | #define SGRPROJ_PRJ_MAX0 (SGRPROJ_PRJ_MIN0 + (1 << SGRPROJ_PRJ_BITS) - 1) |
103 | 29.9k | #define SGRPROJ_PRJ_MIN1 (-(1 << SGRPROJ_PRJ_BITS) / 4) |
104 | 14.9k | #define SGRPROJ_PRJ_MAX1 (SGRPROJ_PRJ_MIN1 + (1 << SGRPROJ_PRJ_BITS) - 1) |
105 | | |
106 | 0 | #define SGRPROJ_PRJ_SUBEXP_K 4 |
107 | | |
108 | | #define SGRPROJ_BITS (SGRPROJ_PRJ_BITS * 2 + SGRPROJ_PARAMS_BITS) |
109 | | |
110 | | #define MAX_RADIUS 2 // Only 1, 2, 3 allowed |
111 | | #define MAX_NELEM ((2 * MAX_RADIUS + 1) * (2 * MAX_RADIUS + 1)) |
112 | | #define SGRPROJ_MTABLE_BITS 20 |
113 | | #define SGRPROJ_RECIP_BITS 12 |
114 | | |
115 | | #define WIENER_HALFWIN1 (WIENER_HALFWIN + 1) |
116 | 0 | #define WIENER_WIN (2 * WIENER_HALFWIN + 1) |
117 | | #define WIENER_WIN2 ((WIENER_WIN) * (WIENER_WIN)) |
118 | | #define WIENER_TMPBUF_SIZE (0) |
119 | | #define WIENER_EXTBUF_SIZE (0) |
120 | | |
121 | | // If WIENER_WIN_CHROMA == WIENER_WIN - 2, that implies 5x5 filters are used for |
122 | | // chroma. To use 7x7 for chroma set WIENER_WIN_CHROMA to WIENER_WIN. |
123 | 0 | #define WIENER_WIN_CHROMA (WIENER_WIN - 2) |
124 | | #define WIENER_WIN2_CHROMA ((WIENER_WIN_CHROMA) * (WIENER_WIN_CHROMA)) |
125 | 0 | #define WIENER_FILT_PREC_BITS 7 |
126 | 0 | #define WIENER_FILT_STEP (1 << WIENER_FILT_PREC_BITS) |
127 | | |
128 | | // Central values for the taps |
129 | 44.9k | #define WIENER_FILT_TAP0_MIDV (3) |
130 | 44.9k | #define WIENER_FILT_TAP1_MIDV (-7) |
131 | 44.9k | #define WIENER_FILT_TAP2_MIDV (15) |
132 | | #define WIENER_FILT_TAP3_MIDV \ |
133 | 0 | (WIENER_FILT_STEP - 2 * (WIENER_FILT_TAP0_MIDV + WIENER_FILT_TAP1_MIDV + WIENER_FILT_TAP2_MIDV)) |
134 | | |
135 | 0 | #define WIENER_FILT_TAP0_BITS 4 |
136 | 0 | #define WIENER_FILT_TAP1_BITS 5 |
137 | 0 | #define WIENER_FILT_TAP2_BITS 6 |
138 | | |
139 | | #define WIENER_FILT_BITS ((WIENER_FILT_TAP0_BITS + WIENER_FILT_TAP1_BITS + WIENER_FILT_TAP2_BITS) * 2) |
140 | | |
141 | 0 | #define WIENER_FILT_TAP0_MINV (WIENER_FILT_TAP0_MIDV - (1 << WIENER_FILT_TAP0_BITS) / 2) |
142 | 0 | #define WIENER_FILT_TAP1_MINV (WIENER_FILT_TAP1_MIDV - (1 << WIENER_FILT_TAP1_BITS) / 2) |
143 | 0 | #define WIENER_FILT_TAP2_MINV (WIENER_FILT_TAP2_MIDV - (1 << WIENER_FILT_TAP2_BITS) / 2) |
144 | | |
145 | 0 | #define WIENER_FILT_TAP0_MAXV (WIENER_FILT_TAP0_MIDV - 1 + (1 << WIENER_FILT_TAP0_BITS) / 2) |
146 | 0 | #define WIENER_FILT_TAP1_MAXV (WIENER_FILT_TAP1_MIDV - 1 + (1 << WIENER_FILT_TAP1_BITS) / 2) |
147 | 0 | #define WIENER_FILT_TAP2_MAXV (WIENER_FILT_TAP2_MIDV - 1 + (1 << WIENER_FILT_TAP2_BITS) / 2) |
148 | | |
149 | 0 | #define WIENER_FILT_TAP0_SUBEXP_K 1 |
150 | 0 | #define WIENER_FILT_TAP1_SUBEXP_K 2 |
151 | 0 | #define WIENER_FILT_TAP2_SUBEXP_K 3 |
152 | | |
153 | | // Max of SGRPROJ_TMPBUF_SIZE, DOMAINTXFMRF_TMPBUF_SIZE, WIENER_TMPBUF_SIZE |
154 | | #define RESTORATION_TMPBUF_SIZE (SGRPROJ_TMPBUF_SIZE) |
155 | | |
156 | | // Max of SGRPROJ_EXTBUF_SIZE, WIENER_EXTBUF_SIZE |
157 | | #define RESTORATION_EXTBUF_SIZE (WIENER_EXTBUF_SIZE) |
158 | | |
159 | | // Check the assumptions of the existing code |
160 | | #if SUBPEL_TAPS != WIENER_WIN + 1 |
161 | | //#error "Wiener filter currently only works if SUBPEL_TAPS == WIENER_WIN + 1" |
162 | | #endif |
163 | | #if WIENER_FILT_PREC_BITS != 7 |
164 | | #error "Wiener filter currently only works if WIENER_FILT_PREC_BITS == 7" |
165 | | #endif |
166 | | |
167 | | typedef struct WienerInfo { |
168 | | DECLARE_ALIGNED(16, InterpKernel, vfilter); |
169 | | DECLARE_ALIGNED(16, InterpKernel, hfilter); |
170 | | } WienerInfo; |
171 | | |
172 | | typedef struct SgrprojInfo { |
173 | | int32_t ep; |
174 | | int32_t xqd[2]; |
175 | | } SgrprojInfo; |
176 | | |
177 | | // Similarly, the column buffers (used when we're at a vertical tile edge |
178 | | // that we can't filter across) need space for one processing unit's worth |
179 | | // of pixels, plus the top/bottom border width |
180 | | #define RESTORATION_COLBUFFER_HEIGHT (RESTORATION_PROC_UNIT_SIZE + 2 * RESTORATION_BORDER) |
181 | | |
182 | | typedef struct RestorationUnitInfo { |
183 | | RestorationType restoration_type; |
184 | | WienerInfo wiener_info; |
185 | | SgrprojInfo sgrproj_info; |
186 | | } RestorationUnitInfo; |
187 | | |
188 | | typedef struct WienerUnitInfo { |
189 | | RestorationType restoration_type; |
190 | | WienerInfo wiener_info; |
191 | | } WienerUnitInfo; |
192 | | |
193 | | typedef struct Av1PixelRect { |
194 | | int32_t left, top, right, bottom; |
195 | | } Av1PixelRect; |
196 | | |
197 | | // A restoration line buffer needs space for two lines plus a horizontal filter |
198 | | // margin of RESTORATION_EXTRA_HORZ on each side. |
199 | | #define RESTORATION_LINEBUFFER_WIDTH (RESTORATION_UNITSIZE_MAX * 3 / 2 + 2 * RESTORATION_EXTRA_HORZ) |
200 | | |
201 | | // Similarly, the column buffers (used when we're at a vertical tile edge |
202 | | // that we can't filter across) need space for one processing unit's worth |
203 | | // of pixels, plus the top/bottom border width |
204 | | #define RESTORATION_COLBUFFER_HEIGHT (RESTORATION_PROC_UNIT_SIZE + 2 * RESTORATION_BORDER) |
205 | | |
206 | | typedef struct RestorationLineBuffers { |
207 | | // Temporary buffers to save/restore 3 lines above/below the restoration |
208 | | // stripe. |
209 | | uint16_t tmp_save_above[RESTORATION_BORDER][RESTORATION_LINEBUFFER_WIDTH]; |
210 | | uint16_t tmp_save_below[RESTORATION_BORDER][RESTORATION_LINEBUFFER_WIDTH]; |
211 | | |
212 | | // Temporary buffers to save/restore 4 column left/right of a processing unit. |
213 | | uint16_t tmp_save_cdef[MAX_SB_SIZE + RESTORATION_UNIT_OFFSET][RESTORATION_EXTRA_HORZ]; |
214 | | uint16_t tmp_save_lr[MAX_SB_SIZE + RESTORATION_UNIT_OFFSET][RESTORATION_EXTRA_HORZ]; |
215 | | } RestorationLineBuffers; |
216 | | |
217 | | typedef struct RestorationStripeBoundaries { |
218 | | uint8_t* stripe_boundary_above; |
219 | | uint8_t* stripe_boundary_below; |
220 | | int32_t stripe_boundary_stride; |
221 | | int32_t stripe_boundary_size; |
222 | | } RestorationStripeBoundaries; |
223 | | |
224 | | typedef struct RestorationInfo { |
225 | | RestorationType frame_restoration_type; |
226 | | int32_t restoration_unit_size; |
227 | | |
228 | | // Fields below here are allocated and initialised by |
229 | | // svt_av1_alloc_restoration_struct. (horz_)units_per_tile give the number of |
230 | | // restoration units in (one row of) the largest tile in the frame. The data |
231 | | // in unit_info is laid out with units_per_tile entries for each tile, which |
232 | | // have stride horz_units_per_tile. |
233 | | // |
234 | | // Even if there are tiles of different sizes, the data in unit_info is laid |
235 | | // out as if all tiles are of full size. |
236 | | int32_t units_per_tile; |
237 | | int32_t vert_units_per_tile, horz_units_per_tile; |
238 | | RestorationUnitInfo* unit_info; |
239 | | RestorationStripeBoundaries boundaries; |
240 | | int32_t optimized_lr; |
241 | | } RestorationInfo; |
242 | | |
243 | 14.9k | static INLINE void set_default_sgrproj(SgrprojInfo* sgrproj_info) { |
244 | 14.9k | sgrproj_info->xqd[0] = (SGRPROJ_PRJ_MIN0 + SGRPROJ_PRJ_MAX0) / 2; |
245 | 14.9k | sgrproj_info->xqd[1] = (SGRPROJ_PRJ_MIN1 + SGRPROJ_PRJ_MAX1) / 2; |
246 | 14.9k | } Unexecuted instantiation: enc_handle.c:set_default_sgrproj Unexecuted instantiation: enc_settings.c:set_default_sgrproj Unexecuted instantiation: aom_dsp_rtcd.c:set_default_sgrproj Unexecuted instantiation: av1me.c:set_default_sgrproj Unexecuted instantiation: cdef_process.c:set_default_sgrproj Unexecuted instantiation: dlf_process.c:set_default_sgrproj Unexecuted instantiation: enc_cdef.c:set_default_sgrproj Unexecuted instantiation: enc_dec_process.c:set_default_sgrproj Unexecuted instantiation: enc_inter_prediction.c:set_default_sgrproj Unexecuted instantiation: enc_intra_prediction.c:set_default_sgrproj Unexecuted instantiation: enc_mode_config.c:set_default_sgrproj entropy_coding.c:set_default_sgrproj Line | Count | Source | 243 | 14.9k | static INLINE void set_default_sgrproj(SgrprojInfo* sgrproj_info) { | 244 | 14.9k | sgrproj_info->xqd[0] = (SGRPROJ_PRJ_MIN0 + SGRPROJ_PRJ_MAX0) / 2; | 245 | 14.9k | sgrproj_info->xqd[1] = (SGRPROJ_PRJ_MIN1 + SGRPROJ_PRJ_MAX1) / 2; | 246 | 14.9k | } |
Unexecuted instantiation: ec_process.c:set_default_sgrproj Unexecuted instantiation: full_loop.c:set_default_sgrproj Unexecuted instantiation: initial_rc_process.c:set_default_sgrproj Unexecuted instantiation: intra_prediction.c:set_default_sgrproj Unexecuted instantiation: md_rate_estimation.c:set_default_sgrproj Unexecuted instantiation: mode_decision.c:set_default_sgrproj Unexecuted instantiation: md_config_process.c:set_default_sgrproj Unexecuted instantiation: md_process.c:set_default_sgrproj Unexecuted instantiation: motion_estimation.c:set_default_sgrproj Unexecuted instantiation: me_process.c:set_default_sgrproj Unexecuted instantiation: noise_model.c:set_default_sgrproj Unexecuted instantiation: packetization_process.c:set_default_sgrproj Unexecuted instantiation: pic_analysis_process.c:set_default_sgrproj Unexecuted instantiation: pcs.c:set_default_sgrproj Unexecuted instantiation: pd_process.c:set_default_sgrproj Unexecuted instantiation: pd_results.c:set_default_sgrproj Unexecuted instantiation: pic_manager_process.c:set_default_sgrproj Unexecuted instantiation: pred_structure.c:set_default_sgrproj Unexecuted instantiation: product_coding_loop.c:set_default_sgrproj Unexecuted instantiation: rc_aq.c:set_default_sgrproj Unexecuted instantiation: rc_process.c:set_default_sgrproj Unexecuted instantiation: rc_rtc_cbr.c:set_default_sgrproj Unexecuted instantiation: rc_vbr_cbr.c:set_default_sgrproj Unexecuted instantiation: rd_cost.c:set_default_sgrproj Unexecuted instantiation: reference_object.c:set_default_sgrproj Unexecuted instantiation: resource_coordination_process.c:set_default_sgrproj Unexecuted instantiation: rest_process.c:set_default_sgrproj Unexecuted instantiation: restoration_pick.c:set_default_sgrproj Unexecuted instantiation: sequence_control_set.c:set_default_sgrproj Unexecuted instantiation: src_ops_process.c:set_default_sgrproj Unexecuted instantiation: super_res.c:set_default_sgrproj Unexecuted instantiation: kernel_dispatch.c:set_default_sgrproj Unexecuted instantiation: temporal_filtering.c:set_default_sgrproj Unexecuted instantiation: transforms.c:set_default_sgrproj Unexecuted instantiation: encode_txb_ref_c.c:set_default_sgrproj Unexecuted instantiation: adaptive_mv_pred.c:set_default_sgrproj Unexecuted instantiation: coding_loop.c:set_default_sgrproj Unexecuted instantiation: coding_unit.c:set_default_sgrproj Unexecuted instantiation: deblocking_filter.c:set_default_sgrproj Unexecuted instantiation: encode_context.c:set_default_sgrproj Unexecuted instantiation: global_me.c:set_default_sgrproj Unexecuted instantiation: global_me_cost.c:set_default_sgrproj Unexecuted instantiation: me_context.c:set_default_sgrproj Unexecuted instantiation: rc_crf_cqp.c:set_default_sgrproj Unexecuted instantiation: ransac.c:set_default_sgrproj |
247 | | |
248 | 14.9k | static INLINE void set_default_wiener(WienerInfo* wiener_info) { |
249 | 14.9k | wiener_info->vfilter[0] = wiener_info->hfilter[0] = WIENER_FILT_TAP0_MIDV; |
250 | 14.9k | wiener_info->vfilter[1] = wiener_info->hfilter[1] = WIENER_FILT_TAP1_MIDV; |
251 | 14.9k | wiener_info->vfilter[2] = wiener_info->hfilter[2] = WIENER_FILT_TAP2_MIDV; |
252 | 14.9k | wiener_info->vfilter[WIENER_HALFWIN] = wiener_info->hfilter[WIENER_HALFWIN] = -2 * |
253 | 14.9k | (WIENER_FILT_TAP2_MIDV + WIENER_FILT_TAP1_MIDV + WIENER_FILT_TAP0_MIDV); |
254 | 14.9k | wiener_info->vfilter[4] = wiener_info->hfilter[4] = WIENER_FILT_TAP2_MIDV; |
255 | 14.9k | wiener_info->vfilter[5] = wiener_info->hfilter[5] = WIENER_FILT_TAP1_MIDV; |
256 | 14.9k | wiener_info->vfilter[6] = wiener_info->hfilter[6] = WIENER_FILT_TAP0_MIDV; |
257 | 14.9k | } Unexecuted instantiation: enc_handle.c:set_default_wiener Unexecuted instantiation: enc_settings.c:set_default_wiener Unexecuted instantiation: aom_dsp_rtcd.c:set_default_wiener Unexecuted instantiation: av1me.c:set_default_wiener Unexecuted instantiation: cdef_process.c:set_default_wiener Unexecuted instantiation: dlf_process.c:set_default_wiener Unexecuted instantiation: enc_cdef.c:set_default_wiener Unexecuted instantiation: enc_dec_process.c:set_default_wiener Unexecuted instantiation: enc_inter_prediction.c:set_default_wiener Unexecuted instantiation: enc_intra_prediction.c:set_default_wiener Unexecuted instantiation: enc_mode_config.c:set_default_wiener entropy_coding.c:set_default_wiener Line | Count | Source | 248 | 14.9k | static INLINE void set_default_wiener(WienerInfo* wiener_info) { | 249 | 14.9k | wiener_info->vfilter[0] = wiener_info->hfilter[0] = WIENER_FILT_TAP0_MIDV; | 250 | 14.9k | wiener_info->vfilter[1] = wiener_info->hfilter[1] = WIENER_FILT_TAP1_MIDV; | 251 | 14.9k | wiener_info->vfilter[2] = wiener_info->hfilter[2] = WIENER_FILT_TAP2_MIDV; | 252 | 14.9k | wiener_info->vfilter[WIENER_HALFWIN] = wiener_info->hfilter[WIENER_HALFWIN] = -2 * | 253 | 14.9k | (WIENER_FILT_TAP2_MIDV + WIENER_FILT_TAP1_MIDV + WIENER_FILT_TAP0_MIDV); | 254 | 14.9k | wiener_info->vfilter[4] = wiener_info->hfilter[4] = WIENER_FILT_TAP2_MIDV; | 255 | 14.9k | wiener_info->vfilter[5] = wiener_info->hfilter[5] = WIENER_FILT_TAP1_MIDV; | 256 | 14.9k | wiener_info->vfilter[6] = wiener_info->hfilter[6] = WIENER_FILT_TAP0_MIDV; | 257 | 14.9k | } |
Unexecuted instantiation: ec_process.c:set_default_wiener Unexecuted instantiation: full_loop.c:set_default_wiener Unexecuted instantiation: initial_rc_process.c:set_default_wiener Unexecuted instantiation: intra_prediction.c:set_default_wiener Unexecuted instantiation: md_rate_estimation.c:set_default_wiener Unexecuted instantiation: mode_decision.c:set_default_wiener Unexecuted instantiation: md_config_process.c:set_default_wiener Unexecuted instantiation: md_process.c:set_default_wiener Unexecuted instantiation: motion_estimation.c:set_default_wiener Unexecuted instantiation: me_process.c:set_default_wiener Unexecuted instantiation: noise_model.c:set_default_wiener Unexecuted instantiation: packetization_process.c:set_default_wiener Unexecuted instantiation: pic_analysis_process.c:set_default_wiener Unexecuted instantiation: pcs.c:set_default_wiener Unexecuted instantiation: pd_process.c:set_default_wiener Unexecuted instantiation: pd_results.c:set_default_wiener Unexecuted instantiation: pic_manager_process.c:set_default_wiener Unexecuted instantiation: pred_structure.c:set_default_wiener Unexecuted instantiation: product_coding_loop.c:set_default_wiener Unexecuted instantiation: rc_aq.c:set_default_wiener Unexecuted instantiation: rc_process.c:set_default_wiener Unexecuted instantiation: rc_rtc_cbr.c:set_default_wiener Unexecuted instantiation: rc_vbr_cbr.c:set_default_wiener Unexecuted instantiation: rd_cost.c:set_default_wiener Unexecuted instantiation: reference_object.c:set_default_wiener Unexecuted instantiation: resource_coordination_process.c:set_default_wiener Unexecuted instantiation: rest_process.c:set_default_wiener Unexecuted instantiation: restoration_pick.c:set_default_wiener Unexecuted instantiation: sequence_control_set.c:set_default_wiener Unexecuted instantiation: src_ops_process.c:set_default_wiener Unexecuted instantiation: super_res.c:set_default_wiener Unexecuted instantiation: kernel_dispatch.c:set_default_wiener Unexecuted instantiation: temporal_filtering.c:set_default_wiener Unexecuted instantiation: transforms.c:set_default_wiener Unexecuted instantiation: encode_txb_ref_c.c:set_default_wiener Unexecuted instantiation: adaptive_mv_pred.c:set_default_wiener Unexecuted instantiation: coding_loop.c:set_default_wiener Unexecuted instantiation: coding_unit.c:set_default_wiener Unexecuted instantiation: deblocking_filter.c:set_default_wiener Unexecuted instantiation: encode_context.c:set_default_wiener Unexecuted instantiation: global_me.c:set_default_wiener Unexecuted instantiation: global_me_cost.c:set_default_wiener Unexecuted instantiation: me_context.c:set_default_wiener Unexecuted instantiation: rc_crf_cqp.c:set_default_wiener Unexecuted instantiation: ransac.c:set_default_wiener |
258 | | |
259 | | typedef struct RestorationTileLimits { |
260 | | int32_t h_start, h_end, v_start, v_end; |
261 | | } RestorationTileLimits; |
262 | | |
263 | | extern const SgrParamsType svt_aom_eb_sgr_params[SGRPROJ_PARAMS]; |
264 | | extern const int32_t svt_aom_eb_x_by_xplus1[256]; |
265 | | extern const int32_t svt_aom_eb_one_by_x[MAX_NELEM]; |
266 | | |
267 | | //void svt_av1_alloc_restoration_struct(struct Av1Common *cm, RestorationInfo *rsi, |
268 | | // int32_t is_uv); |
269 | | void svt_extend_frame(uint8_t* data, int32_t width, int32_t height, int32_t stride, int32_t border_horz, |
270 | | int32_t border_vert, int32_t highbd); |
271 | | void svt_decode_xq(const int32_t* xqd, int32_t* xq, const SgrParamsType* params); |
272 | | |
273 | | // Filter a single loop restoration unit. |
274 | | // |
275 | | // limits is the limits of the unit. rui gives the mode to use for this unit |
276 | | // and its coefficients. If striped loop restoration is enabled, rsb contains |
277 | | // deblocked pixels to use for stripe boundaries; rlbs is just some space to |
278 | | // use as a scratch buffer. tile_rect gives the limits of the tile containing |
279 | | // this unit. tile_stripe0 is the index of the first stripe in this tile. |
280 | | // |
281 | | // ss_x and ss_y are flags which should be 1 if this is a plane with |
282 | | // horizontal/vertical subsampling, respectively. highbd is a flag which should |
283 | | // be 1 in high bit depth mode, in which case bit_depth is the bit depth. |
284 | | // |
285 | | // data8 is the frame data (pointing at the top-left corner of the frame, not |
286 | | // the restoration unit) and stride is its stride. dst8 is the buffer where the |
287 | | // results will be written and has stride dst_stride. Like data8, dst8 should |
288 | | // point at the top-left corner of the frame. |
289 | | // |
290 | | // Finally tmpbuf is a scratch buffer used by the sgrproj filter which should |
291 | | // be at least SGRPROJ_TMPBUF_SIZE big. |
292 | | void svt_av1_loop_restoration_filter_unit(uint8_t need_bounadaries, const RestorationTileLimits* limits, |
293 | | const RestorationUnitInfo* rui, const RestorationStripeBoundaries* rsb, |
294 | | RestorationLineBuffers* rlbs, const Av1PixelRect* tile_rect, |
295 | | int32_t tile_stripe0, int32_t ss_x, int32_t ss_y, int32_t highbd, |
296 | | int32_t bit_depth, uint8_t* data8, int32_t stride, uint8_t* dst8, |
297 | | int32_t dst_stride, int32_t* tmpbuf, int32_t optimized_lr); |
298 | | |
299 | | // Returns 1 if a superres upscaled frame is unscaled and 0 otherwise. |
300 | 200 | static INLINE int32_t av1_superres_unscaled(const FrameSize* frm_size) { |
301 | 200 | return (frm_size->frame_width == frm_size->superres_upscaled_width); |
302 | 200 | } Unexecuted instantiation: enc_handle.c:av1_superres_unscaled Unexecuted instantiation: enc_settings.c:av1_superres_unscaled Unexecuted instantiation: aom_dsp_rtcd.c:av1_superres_unscaled Unexecuted instantiation: av1me.c:av1_superres_unscaled Unexecuted instantiation: cdef_process.c:av1_superres_unscaled Unexecuted instantiation: corner_match.c:av1_superres_unscaled Unexecuted instantiation: dlf_process.c:av1_superres_unscaled Unexecuted instantiation: enc_cdef.c:av1_superres_unscaled Unexecuted instantiation: enc_dec_process.c:av1_superres_unscaled Unexecuted instantiation: enc_inter_prediction.c:av1_superres_unscaled Unexecuted instantiation: enc_intra_prediction.c:av1_superres_unscaled Unexecuted instantiation: enc_mode_config.c:av1_superres_unscaled Unexecuted instantiation: entropy_coding.c:av1_superres_unscaled Unexecuted instantiation: ec_process.c:av1_superres_unscaled Unexecuted instantiation: full_loop.c:av1_superres_unscaled Unexecuted instantiation: hash_motion.c:av1_superres_unscaled Unexecuted instantiation: initial_rc_process.c:av1_superres_unscaled Unexecuted instantiation: intra_prediction.c:av1_superres_unscaled Unexecuted instantiation: md_rate_estimation.c:av1_superres_unscaled Unexecuted instantiation: mode_decision.c:av1_superres_unscaled md_config_process.c:av1_superres_unscaled Line | Count | Source | 300 | 200 | static INLINE int32_t av1_superres_unscaled(const FrameSize* frm_size) { | 301 | 200 | return (frm_size->frame_width == frm_size->superres_upscaled_width); | 302 | 200 | } |
Unexecuted instantiation: md_process.c:av1_superres_unscaled Unexecuted instantiation: motion_estimation.c:av1_superres_unscaled Unexecuted instantiation: me_process.c:av1_superres_unscaled Unexecuted instantiation: noise_model.c:av1_superres_unscaled Unexecuted instantiation: packetization_process.c:av1_superres_unscaled Unexecuted instantiation: palette.c:av1_superres_unscaled Unexecuted instantiation: pic_analysis_process.c:av1_superres_unscaled Unexecuted instantiation: pcs.c:av1_superres_unscaled Unexecuted instantiation: pd_process.c:av1_superres_unscaled Unexecuted instantiation: pd_results.c:av1_superres_unscaled Unexecuted instantiation: pic_manager_process.c:av1_superres_unscaled Unexecuted instantiation: pred_structure.c:av1_superres_unscaled Unexecuted instantiation: product_coding_loop.c:av1_superres_unscaled Unexecuted instantiation: rc_aq.c:av1_superres_unscaled Unexecuted instantiation: rc_process.c:av1_superres_unscaled Unexecuted instantiation: rc_rtc_cbr.c:av1_superres_unscaled Unexecuted instantiation: rc_vbr_cbr.c:av1_superres_unscaled Unexecuted instantiation: rd_cost.c:av1_superres_unscaled Unexecuted instantiation: reference_object.c:av1_superres_unscaled Unexecuted instantiation: resize.c:av1_superres_unscaled Unexecuted instantiation: resource_coordination_process.c:av1_superres_unscaled Unexecuted instantiation: rest_process.c:av1_superres_unscaled Unexecuted instantiation: restoration.c:av1_superres_unscaled Unexecuted instantiation: restoration_pick.c:av1_superres_unscaled Unexecuted instantiation: segmentation.c:av1_superres_unscaled Unexecuted instantiation: sequence_control_set.c:av1_superres_unscaled Unexecuted instantiation: src_ops_process.c:av1_superres_unscaled Unexecuted instantiation: super_res.c:av1_superres_unscaled Unexecuted instantiation: kernel_dispatch.c:av1_superres_unscaled Unexecuted instantiation: temporal_filtering.c:av1_superres_unscaled Unexecuted instantiation: transforms.c:av1_superres_unscaled Unexecuted instantiation: encode_txb_ref_c.c:av1_superres_unscaled Unexecuted instantiation: variance.c:av1_superres_unscaled Unexecuted instantiation: adaptive_mv_pred.c:av1_superres_unscaled Unexecuted instantiation: coding_loop.c:av1_superres_unscaled Unexecuted instantiation: coding_unit.c:av1_superres_unscaled Unexecuted instantiation: deblocking_filter.c:av1_superres_unscaled Unexecuted instantiation: encode_context.c:av1_superres_unscaled Unexecuted instantiation: firstpass.c:av1_superres_unscaled Unexecuted instantiation: global_me.c:av1_superres_unscaled Unexecuted instantiation: global_me_cost.c:av1_superres_unscaled Unexecuted instantiation: mcomp.c:av1_superres_unscaled Unexecuted instantiation: me_context.c:av1_superres_unscaled Unexecuted instantiation: pass2_strategy.c:av1_superres_unscaled Unexecuted instantiation: rc_crf_cqp.c:av1_superres_unscaled Unexecuted instantiation: global_motion.c:av1_superres_unscaled Unexecuted instantiation: ransac.c:av1_superres_unscaled |
303 | | |
304 | | //void svt_av1_loop_restoration_filter_frame(Yv12BufferConfig *frame, |
305 | | // Av1Common *cm, int32_t optimized_lr); |
306 | | typedef void (*RestUnitVisitor)(const RestorationTileLimits* limits, const Av1PixelRect* tile_rect, |
307 | | int32_t rest_unit_idx, void* priv); |
308 | | |
309 | | typedef void (*RestTileStartVisitor)(int32_t tile_row, int32_t tile_col, void* priv); |
310 | | |
311 | | // Call on_rest_unit for each loop restoration unit in the frame. At the start |
312 | | // of each tile, call on_tile. |
313 | | //void svt_aom_foreach_rest_unit_in_frame(Av1Common *cm, int32_t plane, |
314 | | // RestTileStartVisitor on_tile, |
315 | | // RestUnitVisitor on_rest_unit, |
316 | | // void *priv); |
317 | | |
318 | | // Return 1 iff the block at mi_row, mi_col with size bsize is a |
319 | | // top-level superblock containing the top-left corner of at least one |
320 | | // loop restoration unit. |
321 | | // |
322 | | // If the block is a top-level superblock, the function writes to |
323 | | // *rcol0, *rcol1, *rrow0, *rrow1. The rectangle of restoration unit |
324 | | // indices given by [*rcol0, *rcol1) x [*rrow0, *rrow1) are relative |
325 | | // to the current tile, whose starting index is returned as |
326 | | // *tile_tl_idx. |
327 | | struct Av1Common; |
328 | | int32_t svt_av1_loop_restoration_corners_in_sb(struct Av1Common* cm, SeqHeader* seq_header_p, int32_t plane, |
329 | | int32_t mi_row, int32_t mi_col, BlockSize bsize, int32_t* rcol0, |
330 | | int32_t* rcol1, int32_t* rrow0, int32_t* rrow1, int32_t* tile_tl_idx); |
331 | | |
332 | | void svt_av1_loop_restoration_save_boundary_lines(const Yv12BufferConfig* frame, struct Av1Common* cm, |
333 | | int32_t after_cdef); |
334 | | void svt_aom_foreach_rest_unit_in_frame(struct Av1Common* cm, int32_t plane, RestTileStartVisitor on_tile, |
335 | | RestUnitVisitor on_rest_unit, void* priv); |
336 | | void svt_aom_foreach_rest_unit_in_frame_seg(struct Av1Common* cm, int32_t plane, RestTileStartVisitor on_tile, |
337 | | RestUnitVisitor on_rest_unit, void* priv, |
338 | | uint8_t rest_segments_column_count, uint8_t rest_segments_row_count, |
339 | | uint32_t segment_index); |
340 | | |
341 | 0 | #define RDDIV_BITS 7 |
342 | 0 | #define RD_EPB_SHIFT 6 |
343 | | |
344 | | #define RDCOST_DBL(RM, R, D) \ |
345 | 0 | (((((double)(R)) * (RM)) / (double)(1 << AV1_PROB_COST_SHIFT)) + ((double)(D) * (1 << RDDIV_BITS))) |
346 | | |
347 | | typedef struct RestUnitSearchInfo { |
348 | | // The best coefficients for Wiener or Sgrproj restoration |
349 | | WienerInfo wiener; |
350 | | SgrprojInfo sgrproj; |
351 | | |
352 | | // The sum of squared errors for this rtype. |
353 | | int64_t sse[RESTORE_SWITCHABLE_TYPES]; |
354 | | |
355 | | // The rtype to use for this unit given a frame rtype as |
356 | | // index. Indices: WIENER, SGRPROJ, SWITCHABLE. |
357 | | RestorationType best_rtype[RESTORE_TYPES - 1]; |
358 | | } RestUnitSearchInfo; |
359 | | |
360 | | #ifdef __cplusplus |
361 | | } // extern "C" |
362 | | #endif |
363 | | |
364 | | #endif // AV1_COMMON_RESTORATION_H_ |