FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
avf_showcqt_init.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Muhammad Faiz <mfcc64@gmail.com>
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 #define DECLARE_CQT_CALC(type) \
27 void ff_showcqt_cqt_calc_##type(FFTComplex *dst, const FFTComplex *src, \
28  const Coeffs *coeffs, int len, int fft_len)
29 
31 DECLARE_CQT_CALC(sse3);
32 DECLARE_CQT_CALC(avx);
33 DECLARE_CQT_CALC(fma3);
34 DECLARE_CQT_CALC(fma4);
35 
36 #define permute_coeffs_0 NULL
37 
38 static void permute_coeffs_01452367(float *v, int len)
39 {
40  int k;
41  for (k = 0; k < len; k += 8) {
42  FFSWAP(float, v[k+2], v[k+4]);
43  FFSWAP(float, v[k+3], v[k+5]);
44  }
45 }
46 
48 {
49  int cpuflags = av_get_cpu_flags();
50 
51 #define SELECT_CQT_CALC(type, TYPE, align, perm) \
52 if (EXTERNAL_##TYPE(cpuflags)) { \
53  s->cqt_calc = ff_showcqt_cqt_calc_##type; \
54  s->cqt_align = align; \
55  s->permute_coeffs = permute_coeffs_##perm; \
56 }
57 
58  SELECT_CQT_CALC(sse, SSE, 4, 0);
59  SELECT_CQT_CALC(sse3, SSE3_FAST, 4, 0);
60  SELECT_CQT_CALC(fma4, FMA4, 4, 0); // using xmm
61  SELECT_CQT_CALC(avx, AVX_FAST, 8, 01452367);
62  SELECT_CQT_CALC(fma3, FMA3_FAST, 8, 01452367);
63 }
static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride)
Macro definitions for various function/variable attributes.
#define av_cold
Definition: attributes.h:82
#define s(width, name)
Definition: cbs_vp9.c:257
#define SELECT_CQT_CALC(type, TYPE, align, perm)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:93
static void permute_coeffs_01452367(float *v, int len)
int len
av_cold void ff_showcqt_init_x86(ShowCQTContext *s)
#define FFSWAP(type, a, b)
Definition: common.h:99
#define DECLARE_CQT_CALC(type)