FFmpeg  4.0
vf_removegrain_init.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 James Darnley
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 
21 #include "libavutil/attributes.h"
22 #include "libavutil/cpu.h"
23 #include "libavutil/x86/cpu.h"
25 
26 void ff_rg_fl_mode_1_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
27 void ff_rg_fl_mode_10_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
28 void ff_rg_fl_mode_11_12_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
29 void ff_rg_fl_mode_13_14_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
30 void ff_rg_fl_mode_19_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
31 void ff_rg_fl_mode_20_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
32 void ff_rg_fl_mode_21_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
33 void ff_rg_fl_mode_22_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
34 #if ARCH_X86_64
35 void ff_rg_fl_mode_2_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
36 void ff_rg_fl_mode_3_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
37 void ff_rg_fl_mode_4_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
38 void ff_rg_fl_mode_5_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
39 void ff_rg_fl_mode_6_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
40 void ff_rg_fl_mode_7_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
41 void ff_rg_fl_mode_8_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
42 void ff_rg_fl_mode_9_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
43 void ff_rg_fl_mode_15_16_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
44 void ff_rg_fl_mode_17_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
45 void ff_rg_fl_mode_18_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
46 void ff_rg_fl_mode_23_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
47 void ff_rg_fl_mode_24_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels);
48 #endif
49 
51 {
52 #if CONFIG_GPL
54  int i;
55 
56  for (i = 0; i < rg->nb_planes; i++) {
57  if (EXTERNAL_SSE2(cpu_flags))
58  switch (rg->mode[i]) {
59  case 1: rg->fl[i] = ff_rg_fl_mode_1_sse2; break;
60  case 10: rg->fl[i] = ff_rg_fl_mode_10_sse2; break;
61  case 11: /* fall through */
62  case 12: rg->fl[i] = ff_rg_fl_mode_11_12_sse2; break;
63  case 13: /* fall through */
64  case 14: rg->fl[i] = ff_rg_fl_mode_13_14_sse2; break;
65  case 19: rg->fl[i] = ff_rg_fl_mode_19_sse2; break;
66  case 20: rg->fl[i] = ff_rg_fl_mode_20_sse2; break;
67  case 21: rg->fl[i] = ff_rg_fl_mode_21_sse2; break;
68  case 22: rg->fl[i] = ff_rg_fl_mode_22_sse2; break;
69 #if ARCH_X86_64
70  case 2: rg->fl[i] = ff_rg_fl_mode_2_sse2; break;
71  case 3: rg->fl[i] = ff_rg_fl_mode_3_sse2; break;
72  case 4: rg->fl[i] = ff_rg_fl_mode_4_sse2; break;
73  case 5: rg->fl[i] = ff_rg_fl_mode_5_sse2; break;
74  case 6: rg->fl[i] = ff_rg_fl_mode_6_sse2; break;
75  case 7: rg->fl[i] = ff_rg_fl_mode_7_sse2; break;
76  case 8: rg->fl[i] = ff_rg_fl_mode_8_sse2; break;
77  case 9: rg->fl[i] = ff_rg_fl_mode_9_sse2; break;
78  case 15: /* fall through */
79  case 16: rg->fl[i] = ff_rg_fl_mode_15_16_sse2; break;
80  case 17: rg->fl[i] = ff_rg_fl_mode_17_sse2; break;
81  case 18: rg->fl[i] = ff_rg_fl_mode_18_sse2; break;
82  case 23: rg->fl[i] = ff_rg_fl_mode_23_sse2; break;
83  case 24: rg->fl[i] = ff_rg_fl_mode_24_sse2; break;
84 #endif /* ARCH_x86_64 */
85  }
86  }
87 #endif /* CONFIG_GPL */
88 }
void ff_rg_fl_mode_20_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
void ff_rg_fl_mode_19_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
static atomic_int cpu_flags
Definition: cpu.c:50
#define src
Definition: vp8dsp.c:254
int stride
Definition: mace.c:144
Macro definitions for various function/variable attributes.
uint8_t
#define av_cold
Definition: attributes.h:82
void ff_rg_fl_mode_22_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
#define EXTERNAL_SSE2(flags)
Definition: cpu.h:59
void ff_rg_fl_mode_21_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
void ff_rg_fl_mode_1_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
av_cold void ff_removegrain_init_x86(RemoveGrainContext *rg)
void ff_rg_fl_mode_13_14_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
void ff_rg_fl_mode_11_12_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:93
void ff_rg_fl_mode_10_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
int pixels
Definition: avisynth_c.h:429
void(* fl[4])(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pixels)
Definition: removegrain.h:40