diff options
author | Mans Rullgard <mans@mansr.com> | 2012-09-09 19:25:43 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-24 23:16:14 +0200 |
commit | 0eebde07a99f14cf5f96bd64e705db45b6de6364 (patch) | |
tree | 26c2b8a471d17bd0ca163b37b51ab80064e0548c /libswresample/arm/audio_convert_init.c | |
parent | bbe9fe469a1c53e3a0029e98b3dc93a45ca450c8 (diff) | |
download | ffmpeg-0eebde07a99f14cf5f96bd64e705db45b6de6364.tar.gz |
ARM: libswresample: NEON optimised flat float to s16 conversion
Adapted to swr by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/arm/audio_convert_init.c')
-rw-r--r-- | libswresample/arm/audio_convert_init.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libswresample/arm/audio_convert_init.c b/libswresample/arm/audio_convert_init.c new file mode 100644 index 0000000000..f8f80078a7 --- /dev/null +++ b/libswresample/arm/audio_convert_init.c @@ -0,0 +1,48 @@ +/* + * 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 <stdint.h> + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/samplefmt.h" +#include "libswresample/swresample_internal.h" +#include "libswresample/audioconvert.h" + +void swri_oldapi_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len); + +static void conv_flt_to_s16_neon(uint8_t **dst, const uint8_t **src, int len){ + swri_oldapi_conv_flt_to_s16_neon((int16_t*)*dst, (const float*)*src, len); +} + +av_cold void swri_audio_convert_init_arm(struct AudioConvert *ac, + enum AVSampleFormat out_fmt, + enum AVSampleFormat in_fmt, + int channels) +{ + int cpu_flags = av_get_cpu_flags(); + + ac->simd_f= NULL; + + if (have_neon(cpu_flags)) { + 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 = conv_flt_to_s16_neon; + } +} |