FFmpeg
Loading...
Searching...
No Matches
ac3dsp_init.c
Go to the documentation of this file.
1/*
2 * x86-optimized AC-3 DSP functions
3 * Copyright (c) 2011 Justin Ruggles
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
23#include "libavutil/x86/cpu.h"
24#include "libavcodec/ac3dsp.h"
25
26void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
27
28void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, size_t len);
29void ff_float_to_fixed24_avx (int32_t *dst, const float *src, size_t len);
30
31int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
32
35
37{
39
41 c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
42 c->float_to_fixed24 = ff_float_to_fixed24_sse2;
43 c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
44 c->extract_exponents = ff_ac3_extract_exponents_sse2;
45 }
46
49 c->extract_exponents = ff_ac3_extract_exponents_ssse3;
50 }
52 c->float_to_fixed24 = ff_float_to_fixed24_avx;
53 }
54}
55
56#define DOWNMIX_FUNC_OPT(ch, opt) \
57void ff_ac3_downmix_ ## ch ## _to_1_ ## opt(float **samples, \
58 float **matrix, int len); \
59void ff_ac3_downmix_ ## ch ## _to_2_ ## opt(float **samples, \
60 float **matrix, int len);
61
62#define DOWNMIX_FUNCS(opt) \
63 DOWNMIX_FUNC_OPT(3, opt) \
64 DOWNMIX_FUNC_OPT(4, opt) \
65 DOWNMIX_FUNC_OPT(5, opt) \
66 DOWNMIX_FUNC_OPT(6, opt)
67
70DOWNMIX_FUNCS(fma3)
71
73{
75
76#define SET_DOWNMIX(ch, suf, SUF) \
77 if (ch == c->in_channels) { \
78 if (EXTERNAL_ ## SUF (cpu_flags)) { \
79 if (c->out_channels == 1) \
80 c->downmix = ff_ac3_downmix_ ## ch ## _to_1_ ## suf; \
81 else \
82 c->downmix = ff_ac3_downmix_ ## ch ## _to_2_ ## suf; \
83 } \
84 }
85
86#define SET_DOWNMIX_ALL(suf, SUF) \
87 SET_DOWNMIX(3, suf, SUF) \
88 SET_DOWNMIX(4, suf, SUF) \
89 SET_DOWNMIX(5, suf, SUF) \
90 SET_DOWNMIX(6, suf, SUF)
91
94 SET_DOWNMIX_ALL(avx, AVX)
95 SET_DOWNMIX_ALL(fma3, FMA3)
96 }
97}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
void ff_ac3dsp_set_downmix_x86(AC3DSPContext *c)
Definition ac3dsp_init.c:72
static int nb_coefs(int length, int level, uint64_t sn)
Definition af_afwtdn.c:515
int32_t
int8_t exp
Definition eval.c:76
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
static atomic_int cpu_flags
Definition cpu.c:56
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition cpu.c:109
#define AV_CPU_FLAG_ATOM
Atom processor, some SSSE3 instructions are slower.
Definition cpu.h:46
#define AV_CPU_FLAG_AVXSLOW
AVX supported, but slow when using YMM registers (e.g. Bulldozer)
Definition cpu.h:52
#define EXTERNAL_SSSE3(flags)
Definition cpu.h:59
#define EXTERNAL_AVX_FAST(flags)
Definition cpu.h:65
#define EXTERNAL_SSE2(flags)
Definition cpu.h:53
static int sse(const MPVEncContext *const s, const uint8_t *src1, const uint8_t *src2, int w, int h, int stride)
#define src
Definition vp8dsp.c:248
int len
static double c[64]
#define DOWNMIX_FUNCS(opt)
Definition ac3dsp_init.c:62
void ff_ac3_exponent_min_sse2(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs)
void ff_float_to_fixed24_sse2(int32_t *dst, const float *src, size_t len)
av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c)
Definition ac3dsp_init.c:36
int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16])
void ff_ac3_extract_exponents_sse2(uint8_t *exp, int32_t *coef, int nb_coefs)
#define SET_DOWNMIX_ALL(suf, SUF)
void ff_float_to_fixed24_avx(int32_t *dst, const float *src, size_t len)