Go to the documentation of this file.
25 static void FUNC(
avg)(uint8_t *_dst,
const ptrdiff_t _dst_stride,
29 const ptrdiff_t dst_stride = _dst_stride /
sizeof(
pixel);
33 for (
int y = 0; y <
height; y++) {
34 for (
int x = 0; x <
width; x++)
42 static void FUNC(
w_avg)(uint8_t *_dst,
const ptrdiff_t _dst_stride,
44 const int denom,
const int w0,
const int w1,
const int o0,
const int o1)
47 const ptrdiff_t dst_stride = _dst_stride /
sizeof(
pixel);
51 for (
int y = 0; y <
height; y++) {
52 for (
int x = 0; x <
width; x++)
60 static void FUNC(
put_ciip)(uint8_t *_dst,
const ptrdiff_t _dst_stride,
62 const uint8_t *_inter,
const ptrdiff_t _inter_stride,
const int intra_weight)
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;
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;
74 inter += inter_stride;
78 static void FUNC(
put_gpm)(uint8_t *_dst, ptrdiff_t dst_stride,
80 const int16_t *
src0,
const int16_t *
src1,
81 const uint8_t *
weights,
const int step_x,
const int step_y)
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];
102 const int x_frac,
const int y_frac,
const int width,
const int height)
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;
113 for (
int i = 0;
i < bdof_width;
i++)
125 for (
int i = 0;
i < bdof_width;
i++)
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)
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)
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);
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);
150 gradient_h += gradient_stride;
151 gradient_v += gradient_stride;
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)
171 const int di = gradient_h[o] * diff_mv_x[o] + gradient_v[o] * diff_mv_y[o];
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)
185 const ptrdiff_t dst_stride = _dst_stride /
sizeof(
pixel);
200 const int di = gradient_h[o] * diff_mv_x[o] + gradient_v[o] * diff_mv_y[o];
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)
216 const ptrdiff_t dst_stride = _dst_stride /
sizeof(
pixel);
219 const int ox = _ox * (1 << (
BIT_DEPTH - 8));
228 const int di = gradient_h[o] * diff_mv_x[o] + gradient_v[o] * diff_mv_y[o];
238 const int16_t **gradient_h,
const int16_t **gradient_v, ptrdiff_t gradient_stride,
242 const int shift3 = 1;
243 const int thres = 1 << 4;
244 int sgx2 = 0, sgy2 = 0, sgxgy = 0, sgxdi = 0, sgydi = 0;
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);
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;
268 const int16_t **gradient_h,
const int16_t **gradient_v,
const int vx,
const int vy)
271 const int offset4 = 1 << (shift4 - 1);
279 const int bdof_offset = vx * (gh[0][idx] - gh[1][idx]) + vy * (gv[0][idx] - gv[1][idx]);
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)
294 const ptrdiff_t dst_stride = _dst_stride /
sizeof(
pixel);
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 };
319 #define DMVR_FILTER(src, stride) \
320 (filter[0] * src[x] + \
321 filter[1] * src[x + stride])
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)
328 const ptrdiff_t src_stride = _src_stride /
sizeof(
pixel);
331 const int offset4 = 1 << (shift4 - 1);
332 #define DMVR_SHIFT(s) (((s) + offset4) >> shift4)
334 #define DMVR_SHIFT(s) ((s) << (10 - BIT_DEPTH))
337 for (
int y = 0; y <
height; y++) {
338 for (
int x = 0; x <
width; x++)
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)
351 const ptrdiff_t src_stride = _src_stride /
sizeof(
pixel);
354 const int offset1 = 1 << (
shift1 - 1);
356 for (
int y = 0; y <
height; y++) {
357 for (
int x = 0; x <
width; x++)
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)
369 const ptrdiff_t src_stride = _src_stride /
sizeof(
pixel);
372 const int offset1 = 1 << (
shift1 - 1);
374 for (
int y = 0; y <
height; y++) {
375 for (
int x = 0; x <
width; x++)
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)
388 int16_t *
tmp = tmp_array;
390 const ptrdiff_t src_stride = _src_stride /
sizeof(
pixel);
393 const int offset1 = 1 << (
shift1 - 1);
395 const int offset2 = 1 << (
shift2 - 1);
399 for (
int x = 0; x <
width; x++)
407 for (
int y = 0; y <
height; y++) {
408 for (
int x = 0; x <
width; x++)
415 #define PEL_FUNC(dst, C, idx1, idx2, a) \
417 for (int w = 0; w < 7; w++) \
418 inter->dst[C][w][idx1][idx2] = FUNC(a); \
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);
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); \
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
const int8_t ff_vvc_inter_luma_dmvr_filters[VVC_INTER_LUMA_DMVR_FACTS][VVC_INTER_LUMA_DMVR_TAPS]
static double val(void *priv, double ch)
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)
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)
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)
static int vvc_sad(const int16_t *src0, const int16_t *src1, int dx, int dy, const int block_w, const int block_h)
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)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
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)
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)
#define DMVR_FILTER(src, stride)
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)
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)
static int shift(int a, int b)
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)
#define AFFINE_MIN_BLOCK_SIZE
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)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
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
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)
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)
#define i(width, name, range_min, range_max)
static const int weights[]
static void FUNC() ff_vvc_inter_dsp_init(VVCInterDSPContext *const inter)
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)
static const uint8_t shift2[6]
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)
#define BDOF_GRADIENT_SIZE
static double limit(double x)
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)
static void FUNC() apply_prof(int16_t *dst, const int16_t *src, const int16_t *diff_mv_x, const int16_t *diff_mv_y)
#define BILINEAR_EXTRA_BEFORE
static void av_always_inline pad_int16(int16_t *_dst, const ptrdiff_t dst_stride, const int width, const int height)
static const uint8_t shift1[6]
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)