FFmpeg
audio_convert_init.c
Go to the documentation of this file.
1 /*
2  * This file is part of libswresample.
3  *
4  * libswresample is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * libswresample is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with libswresample; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <stdint.h>
20 
21 #include "config.h"
22 #include "libavutil/attributes.h"
23 #include "libavutil/cpu.h"
24 #include "libavutil/arm/cpu.h"
25 #include "libavutil/samplefmt.h"
28 
29 void swri_oldapi_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len);
30 void swri_oldapi_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, int len, int channels);
31 void swri_oldapi_conv_fltp_to_s16_nch_neon(int16_t *dst, float *const *src, int len, int channels);
32 
33 static void conv_flt_to_s16_neon(uint8_t **dst, const uint8_t **src, int len){
34  swri_oldapi_conv_flt_to_s16_neon((int16_t*)*dst, (const float*)*src, len);
35 }
36 
37 static void conv_fltp_to_s16_2ch_neon(uint8_t **dst, const uint8_t **src, int len){
38  swri_oldapi_conv_fltp_to_s16_2ch_neon((int16_t*)*dst, (float *const*)src, len, 2);
39 }
40 
41 static void conv_fltp_to_s16_nch_neon(uint8_t **dst, const uint8_t **src, int len){
42  int channels;
44  ;
45  swri_oldapi_conv_fltp_to_s16_nch_neon((int16_t*)*dst, (float *const*)src, len, channels);
46 }
47 
49  enum AVSampleFormat out_fmt,
50  enum AVSampleFormat in_fmt,
51  int channels)
52 {
54 
55  ac->simd_f= NULL;
56 
57  if (have_neon(cpu_flags)) {
58  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)
60  if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels == 2)
62  if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels > 2)
64  if(ac->simd_f)
66  }
67 }
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
AudioConvert::in_simd_align_mask
int in_simd_align_mask
Definition: audioconvert.h:41
swri_audio_convert_init_arm
av_cold void swri_audio_convert_init_arm(struct AudioConvert *ac, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels)
Definition: audio_convert_init.c:48
channels
channels
Definition: aptx.c:30
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:93
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:50
swri_oldapi_conv_fltp_to_s16_2ch_neon
void swri_oldapi_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, int len, int channels)
samplefmt.h
AudioConvert::out_simd_align_mask
int out_simd_align_mask
Definition: audioconvert.h:42
conv_fltp_to_s16_nch_neon
static void conv_fltp_to_s16_nch_neon(uint8_t **dst, const uint8_t **src, int len)
Definition: audio_convert_init.c:41
src
#define src
Definition: vp8dsp.c:254
av_cold
#define av_cold
Definition: attributes.h:84
conv_flt_to_s16_neon
static void conv_flt_to_s16_neon(uint8_t **dst, const uint8_t **src, int len)
Definition: audio_convert_init.c:33
conv_fltp_to_s16_2ch_neon
static void conv_fltp_to_s16_2ch_neon(uint8_t **dst, const uint8_t **src, int len)
Definition: audio_convert_init.c:37
AudioConvert::simd_f
simd_func_type * simd_f
Definition: audioconvert.h:44
NULL
#define NULL
Definition: coverity.c:32
cpu.h
swri_oldapi_conv_flt_to_s16_neon
void swri_oldapi_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len)
cpu.h
have_neon
#define have_neon(flags)
Definition: cpu.h:26
swresample_internal.h
attributes.h
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
swri_oldapi_conv_fltp_to_s16_nch_neon
void swri_oldapi_conv_fltp_to_s16_nch_neon(int16_t *dst, float *const *src, int len, int channels)
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
uint8_t
uint8_t
Definition: audio_convert.c:194
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
len
int len
Definition: vorbis_enc_data.h:452
SWR_CH_MAX
#define SWR_CH_MAX
Definition: af_amerge.c:35
config.h
AudioConvert
Definition: audio_convert.c:48
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:63
audioconvert.h