FFmpeg
dsp_init.c
Go to the documentation of this file.
1 /*
2  * VVC filters DSP
3  *
4  * Copyright (C) 2024 Zhao Zhili
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 
23 #include "libavutil/cpu.h"
24 #include "libavutil/aarch64/cpu.h"
26 #include "libavcodec/vvc/dsp.h"
27 #include "libavcodec/vvc/dec.h"
28 #include "libavcodec/vvc/ctu.h"
29 
30 #define BIT_DEPTH 8
31 #include "alf_template.c"
32 #undef BIT_DEPTH
33 
34 #define BIT_DEPTH 10
35 #include "alf_template.c"
36 #undef BIT_DEPTH
37 
38 #define BIT_DEPTH 12
39 #include "alf_template.c"
40 #undef BIT_DEPTH
41 
42 void ff_vvc_dsp_init_aarch64(VVCDSPContext *const c, const int bd)
43 {
45  if (!have_neon(cpu_flags))
46  return;
47 
48  if (bd == 8) {
49  for (int i = 0; i < FF_ARRAY_ELEMS(c->sao.band_filter); i++)
50  c->sao.band_filter[i] = ff_h26x_sao_band_filter_8x8_8_neon;
51  c->sao.edge_filter[0] = ff_vvc_sao_edge_filter_8x8_8_neon;
52  for (int i = 1; i < FF_ARRAY_ELEMS(c->sao.edge_filter); i++)
53  c->sao.edge_filter[i] = ff_vvc_sao_edge_filter_16x16_8_neon;
54  c->alf.filter[LUMA] = alf_filter_luma_8_neon;
55  c->alf.filter[CHROMA] = alf_filter_chroma_8_neon;
56  } else if (bd == 10) {
57  c->alf.filter[LUMA] = alf_filter_luma_10_neon;
58  c->alf.filter[CHROMA] = alf_filter_chroma_10_neon;
59  } else if (bd == 12) {
60  c->alf.filter[LUMA] = alf_filter_luma_12_neon;
61  c->alf.filter[CHROMA] = alf_filter_chroma_12_neon;
62  }
63 }
LUMA
#define LUMA
Definition: filter.c:31
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:103
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:52
dsp.h
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
dsp.h
ff_vvc_sao_edge_filter_8x8_8_neon
void ff_vvc_sao_edge_filter_8x8_8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst, const int16_t *sao_offset_val, int eo, int width, int height)
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
cpu.h
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
have_neon
#define have_neon(flags)
Definition: cpu.h:26
ff_h26x_sao_band_filter_8x8_8_neon
void ff_h26x_sao_band_filter_8x8_8_neon(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, const int16_t *sao_offset_val, int sao_left_class, int width, int height)
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
CHROMA
@ CHROMA
Definition: vf_waveform.c:49
ff_vvc_dsp_init_aarch64
void ff_vvc_dsp_init_aarch64(VVCDSPContext *const c, const int bd)
Definition: dsp_init.c:42
ff_vvc_sao_edge_filter_16x16_8_neon
void ff_vvc_sao_edge_filter_16x16_8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst, const int16_t *sao_offset_val, int eo, int width, int height)
alf_template.c
ctu.h
cpu.h
dec.h
VVCDSPContext
Definition: dsp.h:169