mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
634a14bfa6
commit
4308f238c0
690 changed files with 182077 additions and 1 deletions
181
trunk/3rdparty/ffmpeg-4.2-fit/libswresample/x86/audio_convert_init.c
vendored
Normal file
181
trunk/3rdparty/ffmpeg-4.2-fit/libswresample/x86/audio_convert_init.c
vendored
Normal file
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Michael Niedermayer (michaelni@gmx.at)
|
||||
*
|
||||
* This file is part of libswresample
|
||||
*
|
||||
* libswresample 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.
|
||||
*
|
||||
* libswresample 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 libswresample; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/x86/cpu.h"
|
||||
#include "libswresample/swresample_internal.h"
|
||||
#include "libswresample/audioconvert.h"
|
||||
|
||||
#define PROTO(pre, in, out, cap) void ff ## pre ## in## _to_ ##out## _a_ ##cap(uint8_t **dst, const uint8_t **src, int len);
|
||||
#define PROTO2(pre, out, cap) PROTO(pre, int16, out, cap) PROTO(pre, int32, out, cap) PROTO(pre, float, out, cap)
|
||||
#define PROTO3(pre, cap) PROTO2(pre, int16, cap) PROTO2(pre, int32, cap) PROTO2(pre, float, cap)
|
||||
#define PROTO4(pre) PROTO3(pre, mmx) PROTO3(pre, sse) PROTO3(pre, sse2) PROTO3(pre, ssse3) PROTO3(pre, sse4) PROTO3(pre, avx) PROTO3(pre, avx2)
|
||||
PROTO4(_)
|
||||
PROTO4(_pack_2ch_)
|
||||
PROTO4(_pack_6ch_)
|
||||
PROTO4(_pack_8ch_)
|
||||
PROTO4(_unpack_2ch_)
|
||||
PROTO4(_unpack_6ch_)
|
||||
|
||||
av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac,
|
||||
enum AVSampleFormat out_fmt,
|
||||
enum AVSampleFormat in_fmt,
|
||||
int channels){
|
||||
int mm_flags = av_get_cpu_flags();
|
||||
|
||||
ac->simd_f= NULL;
|
||||
|
||||
//FIXME add memcpy case
|
||||
|
||||
#define MULTI_CAPS_FUNC(flag, cap) \
|
||||
if (EXTERNAL_##flag(mm_flags)) {\
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\
|
||||
ac->simd_f = ff_int16_to_int32_a_ ## cap;\
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\
|
||||
ac->simd_f = ff_int32_to_int16_a_ ## cap;\
|
||||
}
|
||||
|
||||
MULTI_CAPS_FUNC(MMX, mmx)
|
||||
MULTI_CAPS_FUNC(SSE2, sse2)
|
||||
|
||||
if(EXTERNAL_MMX(mm_flags)) {
|
||||
if(channels == 6) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_6ch_float_to_float_a_mmx;
|
||||
}
|
||||
}
|
||||
if(EXTERNAL_SSE(mm_flags)) {
|
||||
if(channels == 6) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_6ch_float_to_float_a_sse;
|
||||
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_6ch_float_to_float_a_sse;
|
||||
}
|
||||
}
|
||||
if(EXTERNAL_SSE2(mm_flags)) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_int32_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P)
|
||||
ac->simd_f = ff_int16_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_float_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_float_to_int16_a_sse2;
|
||||
|
||||
if(channels == 2) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P)
|
||||
ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P)
|
||||
ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2;
|
||||
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16)
|
||||
ac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16)
|
||||
ac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2;
|
||||
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P)
|
||||
ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)
|
||||
ac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16)
|
||||
ac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLT)
|
||||
ac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2;
|
||||
}
|
||||
if(channels == 6) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_6ch_int32_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_pack_6ch_float_to_int32_a_sse2;
|
||||
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_6ch_int32_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)
|
||||
ac->simd_f = ff_unpack_6ch_float_to_int32_a_sse2;
|
||||
}
|
||||
if(channels == 8) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_8ch_float_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_8ch_int32_to_float_a_sse2;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_pack_8ch_float_to_int32_a_sse2;
|
||||
}
|
||||
}
|
||||
if(EXTERNAL_SSSE3(mm_flags)) {
|
||||
if(channels == 2) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16)
|
||||
ac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16)
|
||||
ac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16)
|
||||
ac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3;
|
||||
}
|
||||
}
|
||||
if(EXTERNAL_AVX_FAST(mm_flags)) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_int32_to_float_a_avx;
|
||||
}
|
||||
if(EXTERNAL_AVX(mm_flags)) {
|
||||
if(channels == 6) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_6ch_float_to_float_a_avx;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_6ch_int32_to_float_a_avx;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_pack_6ch_float_to_int32_a_avx;
|
||||
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_6ch_float_to_float_a_avx;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)
|
||||
ac->simd_f = ff_unpack_6ch_int32_to_float_a_avx;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)
|
||||
ac->simd_f = ff_unpack_6ch_float_to_int32_a_avx;
|
||||
}
|
||||
if(channels == 8) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_8ch_float_to_float_a_avx;
|
||||
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
|
||||
ac->simd_f = ff_pack_8ch_int32_to_float_a_avx;
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_pack_8ch_float_to_int32_a_avx;
|
||||
}
|
||||
}
|
||||
if(EXTERNAL_AVX2_FAST(mm_flags)) {
|
||||
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
ac->simd_f = ff_float_to_int32_a_avx2;
|
||||
}
|
||||
}
|
90
trunk/3rdparty/ffmpeg-4.2-fit/libswresample/x86/rematrix_init.c
vendored
Normal file
90
trunk/3rdparty/ffmpeg-4.2-fit/libswresample/x86/rematrix_init.c
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Michael Niedermayer (michaelni@gmx.at)
|
||||
*
|
||||
* This file is part of libswresample
|
||||
*
|
||||
* libswresample 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.
|
||||
*
|
||||
* libswresample 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 libswresample; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/x86/cpu.h"
|
||||
#include "libswresample/swresample_internal.h"
|
||||
|
||||
#define D(type, simd) \
|
||||
mix_1_1_func_type ff_mix_1_1_a_## type ## _ ## simd;\
|
||||
mix_2_1_func_type ff_mix_2_1_a_## type ## _ ## simd;
|
||||
|
||||
D(float, sse)
|
||||
D(float, avx)
|
||||
D(int16, mmx)
|
||||
D(int16, sse2)
|
||||
|
||||
av_cold int swri_rematrix_init_x86(struct SwrContext *s){
|
||||
#if HAVE_X86ASM
|
||||
int mm_flags = av_get_cpu_flags();
|
||||
int nb_in = s->used_ch_count;
|
||||
int nb_out = s->out.ch_count;
|
||||
int num = nb_in * nb_out;
|
||||
int i,j;
|
||||
|
||||
s->mix_1_1_simd = NULL;
|
||||
s->mix_2_1_simd = NULL;
|
||||
|
||||
if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){
|
||||
if(EXTERNAL_MMX(mm_flags)) {
|
||||
s->mix_1_1_simd = ff_mix_1_1_a_int16_mmx;
|
||||
s->mix_2_1_simd = ff_mix_2_1_a_int16_mmx;
|
||||
}
|
||||
if(EXTERNAL_SSE2(mm_flags)) {
|
||||
s->mix_1_1_simd = ff_mix_1_1_a_int16_sse2;
|
||||
s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;
|
||||
}
|
||||
s->native_simd_matrix = av_mallocz_array(num, 2 * sizeof(int16_t));
|
||||
s->native_simd_one = av_mallocz(2 * sizeof(int16_t));
|
||||
if (!s->native_simd_matrix || !s->native_simd_one)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for(i=0; i<nb_out; i++){
|
||||
int sh = 0;
|
||||
for(j=0; j<nb_in; j++)
|
||||
sh = FFMAX(sh, FFABS(((int*)s->native_matrix)[i * nb_in + j]));
|
||||
sh = FFMAX(av_log2(sh) - 14, 0);
|
||||
for(j=0; j<nb_in; j++) {
|
||||
((int16_t*)s->native_simd_matrix)[2*(i * nb_in + j)+1] = 15 - sh;
|
||||
((int16_t*)s->native_simd_matrix)[2*(i * nb_in + j)] =
|
||||
((((int*)s->native_matrix)[i * nb_in + j]) + (1<<sh>>1)) >> sh;
|
||||
}
|
||||
}
|
||||
((int16_t*)s->native_simd_one)[1] = 14;
|
||||
((int16_t*)s->native_simd_one)[0] = 16384;
|
||||
} else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){
|
||||
if(EXTERNAL_SSE(mm_flags)) {
|
||||
s->mix_1_1_simd = ff_mix_1_1_a_float_sse;
|
||||
s->mix_2_1_simd = ff_mix_2_1_a_float_sse;
|
||||
}
|
||||
if(EXTERNAL_AVX_FAST(mm_flags)) {
|
||||
s->mix_1_1_simd = ff_mix_1_1_a_float_avx;
|
||||
s->mix_2_1_simd = ff_mix_2_1_a_float_avx;
|
||||
}
|
||||
s->native_simd_matrix = av_mallocz_array(num, sizeof(float));
|
||||
s->native_simd_one = av_mallocz(sizeof(float));
|
||||
if (!s->native_simd_matrix || !s->native_simd_one)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float));
|
||||
memcpy(s->native_simd_one, s->native_one, sizeof(float));
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
100
trunk/3rdparty/ffmpeg-4.2-fit/libswresample/x86/resample_init.c
vendored
Normal file
100
trunk/3rdparty/ffmpeg-4.2-fit/libswresample/x86/resample_init.c
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* audio resampling
|
||||
* Copyright (c) 2004-2012 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* audio resampling
|
||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||
*/
|
||||
|
||||
#include "libavutil/x86/cpu.h"
|
||||
#include "libswresample/resample.h"
|
||||
|
||||
#define RESAMPLE_FUNCS(type, opt) \
|
||||
int ff_resample_common_##type##_##opt(ResampleContext *c, void *dst, \
|
||||
const void *src, int sz, int upd); \
|
||||
int ff_resample_linear_##type##_##opt(ResampleContext *c, void *dst, \
|
||||
const void *src, int sz, int upd)
|
||||
|
||||
RESAMPLE_FUNCS(int16, mmxext);
|
||||
RESAMPLE_FUNCS(int16, sse2);
|
||||
RESAMPLE_FUNCS(int16, xop);
|
||||
RESAMPLE_FUNCS(float, sse);
|
||||
RESAMPLE_FUNCS(float, avx);
|
||||
RESAMPLE_FUNCS(float, fma3);
|
||||
RESAMPLE_FUNCS(float, fma4);
|
||||
RESAMPLE_FUNCS(double, sse2);
|
||||
RESAMPLE_FUNCS(double, avx);
|
||||
RESAMPLE_FUNCS(double, fma3);
|
||||
|
||||
av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
|
||||
{
|
||||
int av_unused mm_flags = av_get_cpu_flags();
|
||||
|
||||
switch(c->format){
|
||||
case AV_SAMPLE_FMT_S16P:
|
||||
if (ARCH_X86_32 && EXTERNAL_MMXEXT(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_int16_mmxext;
|
||||
c->dsp.resample_common = ff_resample_common_int16_mmxext;
|
||||
}
|
||||
if (EXTERNAL_SSE2(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_int16_sse2;
|
||||
c->dsp.resample_common = ff_resample_common_int16_sse2;
|
||||
}
|
||||
if (EXTERNAL_XOP(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_int16_xop;
|
||||
c->dsp.resample_common = ff_resample_common_int16_xop;
|
||||
}
|
||||
break;
|
||||
case AV_SAMPLE_FMT_FLTP:
|
||||
if (EXTERNAL_SSE(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_float_sse;
|
||||
c->dsp.resample_common = ff_resample_common_float_sse;
|
||||
}
|
||||
if (EXTERNAL_AVX_FAST(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_float_avx;
|
||||
c->dsp.resample_common = ff_resample_common_float_avx;
|
||||
}
|
||||
if (EXTERNAL_FMA3_FAST(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_float_fma3;
|
||||
c->dsp.resample_common = ff_resample_common_float_fma3;
|
||||
}
|
||||
if (EXTERNAL_FMA4(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_float_fma4;
|
||||
c->dsp.resample_common = ff_resample_common_float_fma4;
|
||||
}
|
||||
break;
|
||||
case AV_SAMPLE_FMT_DBLP:
|
||||
if (EXTERNAL_SSE2(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_double_sse2;
|
||||
c->dsp.resample_common = ff_resample_common_double_sse2;
|
||||
}
|
||||
if (EXTERNAL_AVX_FAST(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_double_avx;
|
||||
c->dsp.resample_common = ff_resample_common_double_avx;
|
||||
}
|
||||
if (EXTERNAL_FMA3_FAST(mm_flags)) {
|
||||
c->dsp.resample_linear = ff_resample_linear_double_fma3;
|
||||
c->dsp.resample_common = ff_resample_common_double_fma3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue