FFmpeg
vf_convolution_init.c
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include "config.h"
21 
22 #include "libavutil/attributes.h"
23 #include "libavutil/cpu.h"
24 #include "libavutil/x86/cpu.h"
26 
27 void ff_filter_3x3_sse4(uint8_t *dst, int width,
28  float rdiv, float bias, const int *const matrix,
29  const uint8_t *c[], int peak, int radius,
30  int dstride, int stride, int size);
31 
32 void ff_filter_sobel_avx512icl(uint8_t *dst, int width,
33  float scale, float delta, const int *const matrix,
34  const uint8_t *c[], int peak, int radius,
35  int dstride, int stride, int size);
36 
38 {
39 #if ARCH_X86_64
40  int i;
42  for (i = 0; i < 4; i++) {
43  if (s->mode[i] == MATRIX_SQUARE) {
44  if (s->matrix_length[i] == 9 && s->depth == 8) {
46  s->filter[i] = ff_filter_3x3_sse4;
47  }
48  }
49  }
50 #endif
51 }
52 
53 av_cold void ff_sobel_init_x86(ConvolutionContext *s, int depth, int nb_planes)
54 {
55 #if ARCH_X86_64
57  for (int i = 0; i < nb_planes; i++) {
58  if (depth == 8) {
60  s->filter[i] = ff_filter_sobel_avx512icl;
61  }
62  }
63 #endif
64 }
cpu.h
matrix
Definition: vc1dsp.c:42
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:103
convolution.h
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:52
ff_filter_sobel_avx512icl
void ff_filter_sobel_avx512icl(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
scale
static av_always_inline float scale(float x, float s)
Definition: vf_v360.c:1389
av_cold
#define av_cold
Definition: attributes.h:90
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:256
MATRIX_SQUARE
@ MATRIX_SQUARE
Definition: convolution.h:27
bias
static int bias(int x, int c)
Definition: vqcdec.c:113
ff_sobel_init_x86
av_cold void ff_sobel_init_x86(ConvolutionContext *s, int depth, int nb_planes)
Definition: vf_convolution_init.c:53
ConvolutionContext
Definition: convolution.h:33
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
ff_convolution_init_x86
av_cold void ff_convolution_init_x86(ConvolutionContext *s)
Definition: vf_convolution_init.c:37
cpu.h
size
int size
Definition: twinvq_data.h:10344
attributes.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
delta
float delta
Definition: vorbis_enc_data.h:430
stride
#define stride
Definition: h264pred_template.c:537
EXTERNAL_SSE4
#define EXTERNAL_SSE4(flags)
Definition: cpu.h:68
EXTERNAL_AVX512ICL
#define EXTERNAL_AVX512ICL(flags)
Definition: cpu.h:83
ff_filter_3x3_sse4
void ff_filter_3x3_sse4(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)