3 * This file is part of FFmpeg.
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.
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.
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
22 #include "libavutil/attributes.h"
23 #include "libavutil/cpu.h"
24 #include "libavutil/x86/cpu.h"
25 #include "libavfilter/gblur.h"
27 void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float nu, float bscale);
28 void ff_horiz_slice_avx2(float *ptr, int width, int height, int steps, float nu, float bscale);
30 void ff_postscale_slice_sse(float *ptr, int length, float postscale, float min, float max);
31 void ff_postscale_slice_avx2(float *ptr, int length, float postscale, float min, float max);
33 av_cold void ff_gblur_init_x86(GBlurContext *s)
35 int cpu_flags = av_get_cpu_flags();
37 if (EXTERNAL_SSE(cpu_flags)) {
38 s->postscale_slice = ff_postscale_slice_sse;
40 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
41 s->postscale_slice = ff_postscale_slice_avx2;
44 if (EXTERNAL_SSE4(cpu_flags)) {
45 s->horiz_slice = ff_horiz_slice_sse4;
47 if (EXTERNAL_AVX2(cpu_flags)) {
48 s->horiz_slice = ff_horiz_slice_avx2;