00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <stdint.h>
00020
00021 #include "config.h"
00022 #include "libavutil/attributes.h"
00023 #include "libavutil/cpu.h"
00024 #include "libavutil/arm/cpu.h"
00025 #include "libavutil/samplefmt.h"
00026 #include "libswresample/swresample_internal.h"
00027 #include "libswresample/audioconvert.h"
00028
00029 void swri_oldapi_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len);
00030 void swri_oldapi_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, int len, int channels);
00031 void swri_oldapi_conv_fltp_to_s16_nch_neon(int16_t *dst, float *const *src, int len, int channels);
00032
00033 static void conv_flt_to_s16_neon(uint8_t **dst, const uint8_t **src, int len){
00034 swri_oldapi_conv_flt_to_s16_neon((int16_t*)*dst, (const float*)*src, len);
00035 }
00036
00037 static void conv_fltp_to_s16_2ch_neon(uint8_t **dst, const uint8_t **src, int len){
00038 swri_oldapi_conv_fltp_to_s16_2ch_neon((int16_t*)*dst, (float *const*)src, len, 2);
00039 }
00040
00041 static void conv_fltp_to_s16_nch_neon(uint8_t **dst, const uint8_t **src, int len){
00042 int channels;
00043 for(channels=3; channels<SWR_CH_MAX && src[channels]; channels++)
00044 ;
00045 swri_oldapi_conv_fltp_to_s16_nch_neon((int16_t*)*dst, (float *const*)src, len, channels);
00046 }
00047
00048 av_cold void swri_audio_convert_init_arm(struct AudioConvert *ac,
00049 enum AVSampleFormat out_fmt,
00050 enum AVSampleFormat in_fmt,
00051 int channels)
00052 {
00053 int cpu_flags = av_get_cpu_flags();
00054
00055 ac->simd_f= NULL;
00056
00057 if (have_neon(cpu_flags)) {
00058 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)
00059 ac->simd_f = conv_flt_to_s16_neon;
00060 if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels == 2)
00061 ac->simd_f = conv_fltp_to_s16_2ch_neon;
00062 if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels > 2)
00063 ac->simd_f = conv_fltp_to_s16_nch_neon;
00064 }
00065 }