FFmpeg
vvc_inter_template.c
Go to the documentation of this file.
1 /*
2  * VVC inter prediction DSP
3  *
4  * Copyright (C) 2022 Nuo Mi
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
24 
25 static void FUNC(avg)(uint8_t *_dst, const ptrdiff_t _dst_stride,
26  const int16_t *src0, const int16_t *src1, const int width, const int height)
27 {
28  pixel *dst = (pixel*)_dst;
29  const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel);
30  const int shift = FFMAX(3, 15 - BIT_DEPTH);
31  const int offset = 1 << (shift - 1);
32 
33  for (int y = 0; y < height; y++) {
34  for (int x = 0; x < width; x++)
35  dst[x] = av_clip_pixel((src0[x] + src1[x] + offset) >> shift);
36  src0 += MAX_PB_SIZE;
37  src1 += MAX_PB_SIZE;
38  dst += dst_stride;
39  }
40 }
41 
42 static void FUNC(w_avg)(uint8_t *_dst, const ptrdiff_t _dst_stride,
43  const int16_t *src0, const int16_t *src1, const int width, const int height,
44  const int denom, const int w0, const int w1, const int o0, const int o1)
45 {
46  pixel *dst = (pixel*)_dst;
47  const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel);
48  const int shift = denom + FFMAX(3, 15 - BIT_DEPTH);
49  const int offset = (((o0 + o1) << (BIT_DEPTH - 8)) + 1) << (shift - 1);
50 
51  for (int y = 0; y < height; y++) {
52  for (int x = 0; x < width; x++)
53  dst[x] = av_clip_pixel((src0[x] * w0 + src1[x] * w1 + offset) >> shift);
54  src0 += MAX_PB_SIZE;
55  src1 += MAX_PB_SIZE;
56  dst += dst_stride;
57  }
58 }
59 
60 static void FUNC(put_ciip)(uint8_t *_dst, const ptrdiff_t _dst_stride,
61  const int width, const int height,
62  const uint8_t *_inter, const ptrdiff_t _inter_stride, const int intra_weight)
63 {
64  pixel *dst = (pixel *)_dst;
65  pixel *inter = (pixel *)_inter;
66  const size_t dst_stride = _dst_stride / sizeof(pixel);
67  const size_t inter_stride = _inter_stride / sizeof(pixel);
68  const int inter_weight = 4 - intra_weight;
69 
70  for (int y = 0; y < height; y++) {
71  for (int x = 0; x < width; x++)
72  dst[x] = (dst[x] * intra_weight + inter[x] * inter_weight + 2) >> 2;
73  dst += dst_stride;
74  inter += inter_stride;
75  }
76 }
77 
78 static void FUNC(put_gpm)(uint8_t *_dst, ptrdiff_t dst_stride,
79  const int width, const int height,
80  const int16_t *src0, const int16_t *src1,
81  const uint8_t *weights, const int step_x, const int step_y)
82 {
83  const int shift = FFMAX(5, 17 - BIT_DEPTH);
84  const int offset = 1 << (shift - 1);
85  pixel *dst = (pixel *)_dst;
86 
87  dst_stride /= sizeof(pixel);
88  for (int y = 0; y < height; y++) {
89  for (int x = 0; x < width; x++) {
90  const uint8_t w = weights[x * step_x];
91  dst[x] = av_clip_pixel((src0[x] * w + src1[x] * (8 - w) + offset) >> shift);
92  }
93  dst += dst_stride;
94  src0 += MAX_PB_SIZE;
95  src1 += MAX_PB_SIZE;
96  weights += step_y;
97  }
98 }
99 
100 //8.5.6.3.3 Luma integer sample fetching process, add one extra pad line
101 static void FUNC(bdof_fetch_samples)(int16_t *_dst, const uint8_t *_src, const ptrdiff_t _src_stride,
102  const int x_frac, const int y_frac, const int width, const int height)
103 {
104  const int x_off = (x_frac >> 3) - 1;
105  const int y_off = (y_frac >> 3) - 1;
106  const ptrdiff_t src_stride = _src_stride / sizeof(pixel);
107  const pixel *src = (pixel*)_src + (x_off) + y_off * src_stride;
108  int16_t *dst = _dst - 1 - MAX_PB_SIZE;
109  const int shift = 14 - BIT_DEPTH;
110  const int bdof_width = width + 2 * BDOF_BORDER_EXT;
111 
112  // top
113  for (int i = 0; i < bdof_width; i++)
114  dst[i] = src[i] << shift;
115 
116  dst += MAX_PB_SIZE;
117  src += src_stride;
118 
119  for (int i = 0; i < height; i++) {
120  dst[0] = src[0] << shift;
121  dst[1 + width] = src[1 + width] << shift;
122  dst += MAX_PB_SIZE;
123  src += src_stride;
124  }
125  for (int i = 0; i < bdof_width; i++)
126  dst[i] = src[i] << shift;
127 }
128 
129 //8.5.6.3.3 Luma integer sample fetching process
130 static void FUNC(fetch_samples)(int16_t *_dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int x_frac, const int y_frac)
131 {
132  FUNC(bdof_fetch_samples)(_dst, _src, _src_stride, x_frac, y_frac, AFFINE_MIN_BLOCK_SIZE, AFFINE_MIN_BLOCK_SIZE);
133 }
134 
135 static void FUNC(prof_grad_filter)(int16_t *_gradient_h, int16_t *_gradient_v, const ptrdiff_t gradient_stride,
136  const int16_t *_src, const ptrdiff_t src_stride, const int width, const int height, const int pad)
137 {
138  const int shift = 6;
139  const int16_t *src = _src;
140  int16_t *gradient_h = _gradient_h + pad * (1 + gradient_stride);
141  int16_t *gradient_v = _gradient_v + pad * (1 + gradient_stride);
142 
143  for (int y = 0; y < height; y++) {
144  const int16_t *p = src;
145  for (int x = 0; x < width; x++) {
146  gradient_h[x] = (p[1] >> shift) - (p[-1] >> shift);
147  gradient_v[x] = (p[src_stride] >> shift) - (p[-src_stride] >> shift);
148  p++;
149  }
150  gradient_h += gradient_stride;
151  gradient_v += gradient_stride;
152  src += src_stride;
153  }
154  if (pad) {
155  pad_int16(_gradient_h + 1 + gradient_stride, gradient_stride, width, height);
156  pad_int16(_gradient_v + 1 + gradient_stride, gradient_stride, width, height);
157  }
158 }
159 
160 static void FUNC(apply_prof)(int16_t *dst, const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y)
161 {
162  const int limit = (1 << FFMAX(13, BIT_DEPTH + 1)); ///< dILimit
163 
164  int16_t gradient_h[AFFINE_MIN_BLOCK_SIZE * AFFINE_MIN_BLOCK_SIZE];
165  int16_t gradient_v[AFFINE_MIN_BLOCK_SIZE * AFFINE_MIN_BLOCK_SIZE];
167 
168  for (int y = 0; y < AFFINE_MIN_BLOCK_SIZE; y++) {
169  for (int x = 0; x < AFFINE_MIN_BLOCK_SIZE; x++) {
170  const int o = y * AFFINE_MIN_BLOCK_SIZE + x;
171  const int di = gradient_h[o] * diff_mv_x[o] + gradient_v[o] * diff_mv_y[o];
172  const int val = src[x] + av_clip(di, -limit, limit - 1);
173  dst[x] = val;
174 
175  }
176  src += MAX_PB_SIZE;
177  dst += MAX_PB_SIZE;
178  }
179 }
180 
181 static void FUNC(apply_prof_uni)(uint8_t *_dst, const ptrdiff_t _dst_stride, const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y)
182 {
183  const int limit = (1 << FFMAX(13, BIT_DEPTH + 1)); ///< dILimit
184  pixel *dst = (pixel*)_dst;
185  const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel);
186  const int shift = 14 - BIT_DEPTH;
187 #if BIT_DEPTH < 14
188  const int offset = 1 << (shift - 1);
189 #else
190  const int offset = 0;
191 #endif
192  int16_t gradient_h[AFFINE_MIN_BLOCK_SIZE * AFFINE_MIN_BLOCK_SIZE];
193  int16_t gradient_v[AFFINE_MIN_BLOCK_SIZE * AFFINE_MIN_BLOCK_SIZE];
194 
196 
197  for (int y = 0; y < AFFINE_MIN_BLOCK_SIZE; y++) {
198  for (int x = 0; x < AFFINE_MIN_BLOCK_SIZE; x++) {
199  const int o = y * AFFINE_MIN_BLOCK_SIZE + x;
200  const int di = gradient_h[o] * diff_mv_x[o] + gradient_v[o] * diff_mv_y[o];
201  const int val = src[x] + av_clip(di, -limit, limit - 1);
202  dst[x] = av_clip_pixel((val + offset) >> shift);
203 
204  }
205  src += MAX_PB_SIZE;
206  dst += dst_stride;
207  }
208 }
209 
210 static void FUNC(apply_prof_uni_w)(uint8_t *_dst, const ptrdiff_t _dst_stride,
211  const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y,
212  const int denom, const int wx, const int _ox)
213 {
214  const int limit = (1 << FFMAX(13, BIT_DEPTH + 1)); ///< dILimit
215  pixel *dst = (pixel*)_dst;
216  const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel);
217  const int shift = denom + FFMAX(2, 14 - BIT_DEPTH);
218  const int offset = 1 << (shift - 1);
219  const int ox = _ox * (1 << (BIT_DEPTH - 8));
220  int16_t gradient_h[AFFINE_MIN_BLOCK_SIZE * AFFINE_MIN_BLOCK_SIZE];
221  int16_t gradient_v[AFFINE_MIN_BLOCK_SIZE * AFFINE_MIN_BLOCK_SIZE];
222 
224 
225  for (int y = 0; y < AFFINE_MIN_BLOCK_SIZE; y++) {
226  for (int x = 0; x < AFFINE_MIN_BLOCK_SIZE; x++) {
227  const int o = y * AFFINE_MIN_BLOCK_SIZE + x;
228  const int di = gradient_h[o] * diff_mv_x[o] + gradient_v[o] * diff_mv_y[o];
229  const int val = src[x] + av_clip(di, -limit, limit - 1);
230  dst[x] = av_clip_pixel(((val * wx + offset) >> shift) + ox);
231  }
232  src += MAX_PB_SIZE;
233  dst += dst_stride;
234  }
235 }
236 
237 static void FUNC(derive_bdof_vx_vy)(const int16_t *_src0, const int16_t *_src1,
238  const int16_t **gradient_h, const int16_t **gradient_v, ptrdiff_t gradient_stride,
239  int* vx, int* vy)
240 {
241  const int shift2 = 4;
242  const int shift3 = 1;
243  const int thres = 1 << 4;
244  int sgx2 = 0, sgy2 = 0, sgxgy = 0, sgxdi = 0, sgydi = 0;
245  const int16_t *src0 = _src0 - 1 - MAX_PB_SIZE;
246  const int16_t *src1 = _src1 - 1 - MAX_PB_SIZE;
247 
248  for (int y = 0; y < BDOF_GRADIENT_SIZE; y++) {
249  for (int x = 0; x < BDOF_GRADIENT_SIZE; x++) {
250  const int diff = (src0[x] >> shift2) - (src1[x] >> shift2);
251  const int idx = gradient_stride * y + x;
252  const int temph = (gradient_h[0][idx] + gradient_h[1][idx]) >> shift3;
253  const int tempv = (gradient_v[0][idx] + gradient_v[1][idx]) >> shift3;
254  sgx2 += FFABS(temph);
255  sgy2 += FFABS(tempv);
256  sgxgy += VVC_SIGN(tempv) * temph;
257  sgxdi += -VVC_SIGN(temph) * diff;
258  sgydi += -VVC_SIGN(tempv) * diff;
259  }
260  src0 += MAX_PB_SIZE;
261  src1 += MAX_PB_SIZE;
262  }
263  *vx = sgx2 > 0 ? av_clip((sgxdi * (1 << 2)) >> av_log2(sgx2) , -thres + 1, thres - 1) : 0;
264  *vy = sgy2 > 0 ? av_clip(((sgydi * (1 << 2)) - ((*vx * sgxgy) >> 1)) >> av_log2(sgy2), -thres + 1, thres - 1) : 0;
265 }
266 
267 static void FUNC(apply_bdof_min_block)(pixel* dst, const ptrdiff_t dst_stride, const int16_t *src0, const int16_t *src1,
268  const int16_t **gradient_h, const int16_t **gradient_v, const int vx, const int vy)
269 {
270  const int shift4 = 15 - BIT_DEPTH;
271  const int offset4 = 1 << (shift4 - 1);
272 
273  const int16_t* gh[] = { gradient_h[0] + 1 + BDOF_PADDED_SIZE, gradient_h[1] + 1 + BDOF_PADDED_SIZE };
274  const int16_t* gv[] = { gradient_v[0] + 1 + BDOF_PADDED_SIZE, gradient_v[1] + 1 + BDOF_PADDED_SIZE };
275 
276  for (int y = 0; y < BDOF_BLOCK_SIZE; y++) {
277  for (int x = 0; x < BDOF_BLOCK_SIZE; x++) {
278  const int idx = y * BDOF_PADDED_SIZE + x;
279  const int bdof_offset = vx * (gh[0][idx] - gh[1][idx]) + vy * (gv[0][idx] - gv[1][idx]);
280  dst[x] = av_clip_pixel((src0[x] + offset4 + src1[x] + bdof_offset) >> shift4);
281  }
282  dst += dst_stride;
283  src0 += MAX_PB_SIZE;
284  src1 += MAX_PB_SIZE;
285  }
286 }
287 
288 static void FUNC(apply_bdof)(uint8_t *_dst, const ptrdiff_t _dst_stride, int16_t *_src0, int16_t *_src1,
289  const int block_w, const int block_h)
290 {
291  int16_t gradient_h[2][BDOF_PADDED_SIZE * BDOF_PADDED_SIZE];
292  int16_t gradient_v[2][BDOF_PADDED_SIZE * BDOF_PADDED_SIZE];
293  int vx, vy;
294  const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel);
295  pixel* dst = (pixel*)_dst;
296 
297  FUNC(prof_grad_filter)(gradient_h[0], gradient_v[0], BDOF_PADDED_SIZE,
298  _src0, MAX_PB_SIZE, block_w, block_h, 1);
299  pad_int16(_src0, MAX_PB_SIZE, block_w, block_h);
300  FUNC(prof_grad_filter)(gradient_h[1], gradient_v[1], BDOF_PADDED_SIZE,
301  _src1, MAX_PB_SIZE, block_w, block_h, 1);
302  pad_int16(_src1, MAX_PB_SIZE, block_w, block_h);
303 
304  for (int y = 0; y < block_h; y += BDOF_BLOCK_SIZE) {
305  for (int x = 0; x < block_w; x += BDOF_BLOCK_SIZE) {
306  const int16_t* src0 = _src0 + y * MAX_PB_SIZE + x;
307  const int16_t* src1 = _src1 + y * MAX_PB_SIZE + x;
308  pixel *d = dst + x;
309  const int idx = BDOF_PADDED_SIZE * y + x;
310  const int16_t* gh[] = { gradient_h[0] + idx, gradient_h[1] + idx };
311  const int16_t* gv[] = { gradient_v[0] + idx, gradient_v[1] + idx };
312  FUNC(derive_bdof_vx_vy)(src0, src1, gh, gv, BDOF_PADDED_SIZE, &vx, &vy);
313  FUNC(apply_bdof_min_block)(d, dst_stride, src0, src1, gh, gv, vx, vy);
314  }
315  dst += BDOF_BLOCK_SIZE * dst_stride;
316  }
317 }
318 
319 #define DMVR_FILTER(src, stride) \
320  (filter[0] * src[x] + \
321  filter[1] * src[x + stride])
322 
323 //8.5.3.2.2 Luma sample bilinear interpolation process
324 static void FUNC(dmvr)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride,
325  const int height, const intptr_t mx, const intptr_t my, const int width)
326 {
327  const pixel *src = (const pixel *)_src;
328  const ptrdiff_t src_stride = _src_stride / sizeof(pixel);
329 #if BIT_DEPTH > 10
330  const int shift4 = BIT_DEPTH - 10;
331  const int offset4 = 1 << (shift4 - 1);
332  #define DMVR_SHIFT(s) (((s) + offset4) >> shift4)
333 #else
334  #define DMVR_SHIFT(s) ((s) << (10 - BIT_DEPTH))
335 #endif
336 
337  for (int y = 0; y < height; y++) {
338  for (int x = 0; x < width; x++)
339  dst[x] = DMVR_SHIFT(src[x]);
340  src += src_stride;
341  dst += MAX_PB_SIZE;
342  }
343 #undef DMVR_SHIFT
344 }
345 
346 //8.5.3.2.2 Luma sample bilinear interpolation process
347 static void FUNC(dmvr_h)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride,
348  const int height, const intptr_t mx, const intptr_t my, const int width)
349 {
350  const pixel *src = (const pixel*)_src;
351  const ptrdiff_t src_stride = _src_stride / sizeof(pixel);
352  const int8_t *filter = ff_vvc_inter_luma_dmvr_filters[mx];
353  const int shift1 = BIT_DEPTH - 6;
354  const int offset1 = 1 << (shift1 - 1);
355 
356  for (int y = 0; y < height; y++) {
357  for (int x = 0; x < width; x++)
358  dst[x] = (DMVR_FILTER(src, 1) + offset1) >> shift1;
359  src += src_stride;
360  dst += MAX_PB_SIZE;
361  }
362 }
363 
364 //8.5.3.2.2 Luma sample bilinear interpolation process
365 static void FUNC(dmvr_v)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride,
366  const int height, const intptr_t mx, const intptr_t my, const int width)
367 {
368  const pixel *src = (pixel*)_src;
369  const ptrdiff_t src_stride = _src_stride / sizeof(pixel);
370  const int8_t *filter = ff_vvc_inter_luma_dmvr_filters[my];
371  const int shift1 = BIT_DEPTH - 6;
372  const int offset1 = 1 << (shift1 - 1);
373 
374  for (int y = 0; y < height; y++) {
375  for (int x = 0; x < width; x++)
376  dst[x] = (DMVR_FILTER(src, src_stride) + offset1) >> shift1;
377  src += src_stride;
378  dst += MAX_PB_SIZE;
379  }
380 
381 }
382 
383 //8.5.3.2.2 Luma sample bilinear interpolation process
384 static void FUNC(dmvr_hv)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride,
385  const int height, const intptr_t mx, const intptr_t my, const int width)
386 {
387  int16_t tmp_array[(MAX_PB_SIZE + BILINEAR_EXTRA) * MAX_PB_SIZE];
388  int16_t *tmp = tmp_array;
389  const pixel *src = (const pixel*)_src;
390  const ptrdiff_t src_stride = _src_stride / sizeof(pixel);
391  const int8_t *filter = ff_vvc_inter_luma_dmvr_filters[mx];
392  const int shift1 = BIT_DEPTH - 6;
393  const int offset1 = 1 << (shift1 - 1);
394  const int shift2 = 4;
395  const int offset2 = 1 << (shift2 - 1);
396 
397  src -= BILINEAR_EXTRA_BEFORE * src_stride;
398  for (int y = 0; y < height + BILINEAR_EXTRA; y++) {
399  for (int x = 0; x < width; x++)
400  tmp[x] = (DMVR_FILTER(src, 1) + offset1) >> shift1;
401  src += src_stride;
402  tmp += MAX_PB_SIZE;
403  }
404 
405  tmp = tmp_array + BILINEAR_EXTRA_BEFORE * MAX_PB_SIZE;
407  for (int y = 0; y < height; y++) {
408  for (int x = 0; x < width; x++)
409  dst[x] = (DMVR_FILTER(tmp, MAX_PB_SIZE) + offset2) >> shift2;
410  tmp += MAX_PB_SIZE;
411  dst += MAX_PB_SIZE;
412  }
413 }
414 
415 #define PEL_FUNC(dst, C, idx1, idx2, a) \
416  do { \
417  for (int w = 0; w < 7; w++) \
418  inter->dst[C][w][idx1][idx2] = FUNC(a); \
419  } while (0) \
420 
421 #define DIR_FUNCS(d, C, c) \
422  PEL_FUNC(put_##d, C, 0, 0, put_##d##_pixels); \
423  PEL_FUNC(put_##d, C, 0, 1, put_##d##_##c##_h); \
424  PEL_FUNC(put_##d, C, 1, 0, put_##d##_##c##_v); \
425  PEL_FUNC(put_##d, C, 1, 1, put_##d##_##c##_hv); \
426  PEL_FUNC(put_##d##_w, C, 0, 0, put_##d##_w_pixels); \
427  PEL_FUNC(put_##d##_w, C, 0, 1, put_##d##_##c##_w_h); \
428  PEL_FUNC(put_##d##_w, C, 1, 0, put_##d##_##c##_w_v); \
429  PEL_FUNC(put_##d##_w, C, 1, 1, put_##d##_##c##_w_hv);
430 
431 #define FUNCS(C, c) \
432  PEL_FUNC(put, C, 0, 0, put_pixels); \
433  PEL_FUNC(put, C, 0, 1, put_##c##_h); \
434  PEL_FUNC(put, C, 1, 0, put_##c##_v); \
435  PEL_FUNC(put, C, 1, 1, put_##c##_hv); \
436  DIR_FUNCS(uni, C, c); \
437 
439 {
440  FUNCS(LUMA, luma);
441  FUNCS(CHROMA, chroma);
442 
443  inter->avg = FUNC(avg);
444  inter->w_avg = FUNC(w_avg);
445 
446  inter->dmvr[0][0] = FUNC(dmvr);
447  inter->dmvr[0][1] = FUNC(dmvr_h);
448  inter->dmvr[1][0] = FUNC(dmvr_v);
449  inter->dmvr[1][1] = FUNC(dmvr_hv);
450 
451  inter->put_ciip = FUNC(put_ciip);
452  inter->put_gpm = FUNC(put_gpm);
453 
454  inter->fetch_samples = FUNC(fetch_samples);
455  inter->bdof_fetch_samples = FUNC(bdof_fetch_samples);
456  inter->apply_prof = FUNC(apply_prof);
457  inter->apply_prof_uni = FUNC(apply_prof_uni);
458  inter->apply_prof_uni_w = FUNC(apply_prof_uni_w);
459  inter->apply_bdof = FUNC(apply_bdof);
460  inter->prof_grad_filter = FUNC(prof_grad_filter);
461  inter->sad = vvc_sad;
462 }
463 
464 #undef FUNCS
465 #undef PEL_FUNC
466 #undef DMVR_FUNCS
av_clip
#define av_clip
Definition: common.h:98
BIT_DEPTH
#define BIT_DEPTH
Definition: aom_film_grain.c:61
src1
const pixel * src1
Definition: h264pred_template.c:421
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
w
uint8_t w
Definition: llviddspenc.c:38
BDOF_BORDER_EXT
#define BDOF_BORDER_EXT
Definition: vvcdsp.c:80
chroma
static av_always_inline void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror, int jobnr, int nb_jobs)
Definition: vf_waveform.c:1639
filter
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
BDOF_PADDED_SIZE
#define BDOF_PADDED_SIZE
Definition: vvcdsp.c:82
h2656_inter_template.c
ff_vvc_inter_luma_dmvr_filters
const int8_t ff_vvc_inter_luma_dmvr_filters[VVC_INTER_LUMA_DMVR_FACTS][VVC_INTER_LUMA_DMVR_TAPS]
Definition: vvc_data.c:1906
val
static double val(void *priv, double ch)
Definition: aeval.c:78
apply_bdof
static void FUNC() apply_bdof(uint8_t *_dst, const ptrdiff_t _dst_stride, int16_t *_src0, int16_t *_src1, const int block_w, const int block_h)
Definition: vvc_inter_template.c:288
FUNCS
#define FUNCS(C, c)
Definition: vvc_inter_template.c:431
width
#define width
fetch_samples
static void FUNC() fetch_samples(int16_t *_dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int x_frac, const int y_frac)
Definition: vvc_inter_template.c:130
w_avg
static void FUNC() w_avg(uint8_t *_dst, const ptrdiff_t _dst_stride, const int16_t *src0, const int16_t *src1, const int width, const int height, const int denom, const int w0, const int w1, const int o0, const int o1)
Definition: vvc_inter_template.c:42
DMVR_SHIFT
#define DMVR_SHIFT(s)
vvc_sad
static int vvc_sad(const int16_t *src0, const int16_t *src1, int dx, int dy, const int block_w, const int block_h)
Definition: vvcdsp.c:49
apply_bdof_min_block
static void FUNC() apply_bdof_min_block(pixel *dst, const ptrdiff_t dst_stride, const int16_t *src0, const int16_t *src1, const int16_t **gradient_h, const int16_t **gradient_v, const int vx, const int vy)
Definition: vvc_inter_template.c:267
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
dmvr_v
static void FUNC() dmvr_v(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const intptr_t mx, const intptr_t my, const int width)
Definition: vvc_inter_template.c:365
pixel
uint8_t pixel
Definition: tiny_ssim.c:41
dmvr_hv
static void FUNC() dmvr_hv(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const intptr_t mx, const intptr_t my, const int width)
Definition: vvc_inter_template.c:384
DMVR_FILTER
#define DMVR_FILTER(src, stride)
Definition: vvc_inter_template.c:319
dmvr_h
static void FUNC() dmvr_h(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const intptr_t mx, const intptr_t my, const int width)
Definition: vvc_inter_template.c:347
VVC_SIGN
#define VVC_SIGN(v)
Definition: vvcdsp.c:27
prof_grad_filter
static void FUNC() prof_grad_filter(int16_t *_gradient_h, int16_t *_gradient_v, const ptrdiff_t gradient_stride, const int16_t *_src, const ptrdiff_t src_stride, const int width, const int height, const int pad)
Definition: vvc_inter_template.c:135
shift
static int shift(int a, int b)
Definition: bonk.c:262
apply_prof_uni
static void FUNC() apply_prof_uni(uint8_t *_dst, const ptrdiff_t _dst_stride, const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y)
Definition: vvc_inter_template.c:181
AFFINE_MIN_BLOCK_SIZE
#define AFFINE_MIN_BLOCK_SIZE
Definition: vvc_ctu.h:63
bdof_fetch_samples
static void FUNC() bdof_fetch_samples(int16_t *_dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int x_frac, const int y_frac, const int width, const int height)
Definition: vvc_inter_template.c:101
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:164
height
#define height
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
BDOF_BLOCK_SIZE
#define BDOF_BLOCK_SIZE
Definition: vvcdsp.c:83
avg
static void FUNC() avg(uint8_t *_dst, const ptrdiff_t _dst_stride, const int16_t *src0, const int16_t *src1, const int width, const int height)
Definition: vvc_inter_template.c:25
apply_prof_uni_w
static void FUNC() apply_prof_uni_w(uint8_t *_dst, const ptrdiff_t _dst_stride, const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y, const int denom, const int wx, const int _ox)
Definition: vvc_inter_template.c:210
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
MAX_PB_SIZE
#define MAX_PB_SIZE
Definition: hevcdsp.h:32
weights
static const int weights[]
Definition: hevc_pel.c:32
ff_vvc_inter_dsp_init
static void FUNC() ff_vvc_inter_dsp_init(VVCInterDSPContext *const inter)
Definition: vvc_inter_template.c:438
put_ciip
static void FUNC() put_ciip(uint8_t *_dst, const ptrdiff_t _dst_stride, const int width, const int height, const uint8_t *_inter, const ptrdiff_t _inter_stride, const int intra_weight)
Definition: vvc_inter_template.c:60
shift2
static const uint8_t shift2[6]
Definition: dxa.c:49
dmvr
static void FUNC() dmvr(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const intptr_t mx, const intptr_t my, const int width)
Definition: vvc_inter_template.c:324
BDOF_GRADIENT_SIZE
#define BDOF_GRADIENT_SIZE
Definition: vvcdsp.c:84
limit
static double limit(double x)
Definition: vf_pseudocolor.c:142
CHROMA
@ CHROMA
Definition: vf_waveform.c:49
av_clip_pixel
#define av_clip_pixel(a)
Definition: bit_depth_template.c:98
derive_bdof_vx_vy
static void FUNC() derive_bdof_vx_vy(const int16_t *_src0, const int16_t *_src1, const int16_t **gradient_h, const int16_t **gradient_v, ptrdiff_t gradient_stride, int *vx, int *vy)
Definition: vvc_inter_template.c:237
apply_prof
static void FUNC() apply_prof(int16_t *dst, const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y)
Definition: vvc_inter_template.c:160
FUNC
#define FUNC(a)
Definition: bit_depth_template.c:104
VVCInterDSPContext
Definition: vvcdsp.h:47
BILINEAR_EXTRA_BEFORE
#define BILINEAR_EXTRA_BEFORE
Definition: vvc_ctu.h:57
src0
const pixel *const src0
Definition: h264pred_template.c:420
BILINEAR_EXTRA
#define BILINEAR_EXTRA
Definition: vvc_ctu.h:59
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
d
d
Definition: ffmpeg_filter.c:409
pad_int16
static void av_always_inline pad_int16(int16_t *_dst, const ptrdiff_t dst_stride, const int width, const int height)
Definition: vvcdsp.c:29
shift1
static const uint8_t shift1[6]
Definition: dxa.c:48
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
put_gpm
static void FUNC() put_gpm(uint8_t *_dst, ptrdiff_t dst_stride, const int width, const int height, const int16_t *src0, const int16_t *src1, const uint8_t *weights, const int step_x, const int step_y)
Definition: vvc_inter_template.c:78
LUMA
#define LUMA
Definition: hevc_filter.c:31