| Line | Branch | Exec | Source |
|---|---|---|---|
| 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/mem.h" | ||
| 25 | #include "libavutil/x86/cpu.h" | ||
| 26 | #include "libavfilter/gblur.h" | ||
| 27 | |||
| 28 | void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float nu, float bscale, float *localbuf); | ||
| 29 | void ff_horiz_slice_avx2(float *ptr, int width, int height, int steps, float nu, float bscale, float *localbuf); | ||
| 30 | void ff_horiz_slice_avx512(float *ptr, int width, int height, int steps, float nu, float bscale, float *localbuf); | ||
| 31 | |||
| 32 | void ff_postscale_slice_sse(float *ptr, int length, float postscale, float min, float max); | ||
| 33 | void ff_postscale_slice_avx2(float *ptr, int length, float postscale, float min, float max); | ||
| 34 | void ff_postscale_slice_avx512(float *ptr, int length, float postscale, float min, float max); | ||
| 35 | |||
| 36 | void ff_verti_slice_avx2(float *buffer, int width, int height, int column_begin, int column_end, | ||
| 37 | int steps, float nu, float bscale); | ||
| 38 | void ff_verti_slice_avx512(float *buffer, int width, int height, int column_begin, int column_end, | ||
| 39 | int steps, float nu, float bscale); | ||
| 40 | |||
| 41 | 14 | av_cold void ff_gblur_init_x86(GBlurContext *s) | |
| 42 | { | ||
| 43 | 14 | int cpu_flags = av_get_cpu_flags(); | |
| 44 | |||
| 45 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 3 times.
|
14 | if (EXTERNAL_SSE(cpu_flags)) { |
| 46 | 11 | s->postscale_slice = ff_postscale_slice_sse; | |
| 47 | } | ||
| 48 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
14 | if (EXTERNAL_AVX2_FAST(cpu_flags)) { |
| 49 | 1 | s->postscale_slice = ff_postscale_slice_avx2; | |
| 50 | } | ||
| 51 | #if ARCH_X86_64 | ||
| 52 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 7 times.
|
14 | if (EXTERNAL_SSE4(cpu_flags)) { |
| 53 | 7 | s->horiz_slice = ff_horiz_slice_sse4; | |
| 54 | } | ||
| 55 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
|
14 | if (EXTERNAL_AVX2(cpu_flags)) { |
| 56 | 1 | s->verti_slice = ff_verti_slice_avx2; | |
| 57 | } | ||
| 58 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if (EXTERNAL_AVX512(cpu_flags)) { |
| 59 | ✗ | s->postscale_slice = ff_postscale_slice_avx512; | |
| 60 | ✗ | s->verti_slice = ff_verti_slice_avx512; | |
| 61 | } | ||
| 62 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
|
14 | if (EXTERNAL_AVX2(cpu_flags)) { |
| 63 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | s->stride = EXTERNAL_AVX512(cpu_flags) ? 16 : 8; |
| 64 | 1 | s->localbuf = av_malloc(s->stride * sizeof(float) * s->planewidth[0] * s->planeheight[0]); | |
| 65 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (!s->localbuf) |
| 66 | ✗ | return; | |
| 67 | |||
| 68 | 1 | s->horiz_slice = ff_horiz_slice_avx2; | |
| 69 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (EXTERNAL_AVX512(cpu_flags)) { |
| 70 | ✗ | s->horiz_slice = ff_horiz_slice_avx512; | |
| 71 | } | ||
| 72 | } | ||
| 73 | #endif | ||
| 74 | } | ||
| 75 |