diff options
author | Lynne <dev@lynne.ee> | 2019-03-16 17:30:16 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2019-03-31 23:35:00 +0200 |
commit | 4a2c65162029755a4717528014a456a400590e36 (patch) | |
tree | 39b5b3c3f92dc7f8da1df5d6cd901b072d6edadb /libavcodec/x86/celt_pvq_init.c | |
parent | 4eec0082599adf4b7a25ce6e6ec761f6849783a3 (diff) | |
download | ffmpeg-4a2c65162029755a4717528014a456a400590e36.tar.gz |
x86/opus_dsp: rename to celt_pvq
Its only used in the encoder and in CELT's PVQ.
Diffstat (limited to 'libavcodec/x86/celt_pvq_init.c')
-rw-r--r-- | libavcodec/x86/celt_pvq_init.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libavcodec/x86/celt_pvq_init.c b/libavcodec/x86/celt_pvq_init.c new file mode 100644 index 0000000000..3890a9cb9f --- /dev/null +++ b/libavcodec/x86/celt_pvq_init.c @@ -0,0 +1,45 @@ +/* + * Opus encoder assembly optimizations + * Copyright (C) 2017 Ivan Kalvachev <ikalvachev@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/x86/cpu.h" +#include "libavcodec/opus_pvq.h" + +extern float ff_pvq_search_approx_sse2(float *X, int *y, int K, int N); +extern float ff_pvq_search_approx_sse4(float *X, int *y, int K, int N); +extern float ff_pvq_search_exact_avx (float *X, int *y, int K, int N); + +av_cold void ff_celt_pvq_init_x86(CeltPVQ *s) +{ + int cpu_flags = av_get_cpu_flags(); + +#if CONFIG_OPUS_ENCODER + if (EXTERNAL_SSE2(cpu_flags)) + s->pvq_search = ff_pvq_search_approx_sse2; + + if (EXTERNAL_SSE4(cpu_flags)) + s->pvq_search = ff_pvq_search_approx_sse4; + + if (EXTERNAL_AVX_FAST(cpu_flags)) + s->pvq_search = ff_pvq_search_exact_avx; +#endif +} |