FFmpeg
of_template.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 Zhao Zhili <quinkblack@foxmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
22 
23 void FUNC2(ff_vvc_apply_bdof_block, BIT_DEPTH, _neon)(pixel* dst,
24  ptrdiff_t dst_stride, const int16_t *src0, const int16_t *src1,
25  const int16_t **gh, const int16_t **gv, int16_t *vx, int16_t *vy);
26 
27 static void FUNC(apply_bdof)(uint8_t *_dst, ptrdiff_t _dst_stride,
28  const int16_t *_src0, const int16_t *_src1,
29  int block_w, int block_h) {
30  // +2 for pad left and right
31  int16_t gradient_buf_h[2][BDOF_BLOCK_SIZE * BDOF_BLOCK_SIZE + 2];
32  int16_t gradient_buf_v[2][BDOF_BLOCK_SIZE * BDOF_BLOCK_SIZE + 2];
33  int16_t *gradient_h[2] = {&gradient_buf_h[0][1], &gradient_buf_h[1][1]};
34  int16_t *gradient_v[2] = {&gradient_buf_v[0][1], &gradient_buf_v[1][1]};
35  ptrdiff_t dst_stride = _dst_stride / sizeof(pixel);
36  pixel *dst = (pixel *) _dst;
37 
38  ff_vvc_prof_grad_filter_8x_neon(gradient_h[0], gradient_v[0],
40  _src0, MAX_PB_SIZE, block_w, block_h);
41  ff_vvc_prof_grad_filter_8x_neon(gradient_h[1], gradient_v[1],
43  _src1, MAX_PB_SIZE, block_w, block_h);
44 
45  for (int y = 0; y < block_h; y += BDOF_MIN_BLOCK_SIZE) {
46  for (int x = 0; x < block_w; x += BDOF_MIN_BLOCK_SIZE * 2) {
47  const int16_t *src0 = _src0 + y * MAX_PB_SIZE + x;
48  const int16_t *src1 = _src1 + y * MAX_PB_SIZE + x;
49  pixel *d = dst + x;
50  int idx = BDOF_BLOCK_SIZE * y + x;
51  const int16_t *gh[] = {gradient_h[0] + idx, gradient_h[1] + idx};
52  const int16_t *gv[] = {gradient_v[0] + idx, gradient_v[1] + idx};
53  int16_t vx[2], vy[2];
54  int pad_mask = !x | ((!y) << 1) |
55  ((x + 2 * BDOF_MIN_BLOCK_SIZE == block_w) << 2) |
56  ((y + BDOF_MIN_BLOCK_SIZE == block_h) << 3);
57  ff_vvc_derive_bdof_vx_vy_neon(src0, src1, pad_mask, gh, gv, vx, vy);
58  FUNC2(ff_vvc_apply_bdof_block, BIT_DEPTH, _neon)(d, dst_stride,
59  src0, src1, gh, gv,
60  vx, vy);
61  }
62  dst += BDOF_MIN_BLOCK_SIZE * dst_stride;
63  }
64 }
_dst
uint8_t * _dst
Definition: dsp.h:52
src1
const pixel * src1
Definition: h264pred_template.c:421
BDOF_MIN_BLOCK_SIZE
#define BDOF_MIN_BLOCK_SIZE
Definition: dsp_init.c:31
apply_bdof
static void FUNC() apply_bdof(uint8_t *_dst, const ptrdiff_t _dst_stride, const int16_t *_src0, const int16_t *_src1, const int block_w, const int block_h)
Definition: inter_template.c:442
BDOF_BLOCK_SIZE
#define BDOF_BLOCK_SIZE
Definition: dsp_init.c:30
FUNC2
void FUNC2(ff_vvc_apply_bdof_block, BIT_DEPTH, _neon)
Definition: of_template.c:23
pixel
uint8_t pixel
Definition: tiny_ssim.c:41
ff_vvc_derive_bdof_vx_vy_neon
void ff_vvc_derive_bdof_vx_vy_neon(const int16_t *_src0, const int16_t *_src1, int pad_mask, const int16_t **gradient_h, const int16_t **gradient_v, int16_t *vx, int16_t *vy)
bit_depth_template.c
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
MAX_PB_SIZE
#define MAX_PB_SIZE
Definition: dsp.h:32
FUNC
#define FUNC(a)
Definition: bit_depth_template.c:104
BIT_DEPTH
#define BIT_DEPTH
Definition: dsp_init.c:55
src0
const pixel *const src0
Definition: h264pred_template.c:420
ff_vvc_prof_grad_filter_8x_neon
void ff_vvc_prof_grad_filter_8x_neon(int16_t *gradient_h, int16_t *gradient_v, ptrdiff_t gradient_stride, const int16_t *_src, ptrdiff_t src_stride, int width, int height)