diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 00:04:35 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 00:06:23 +0100 |
commit | db3f6465a63130f3c2133073dd6aaf88298497bc (patch) | |
tree | 2f8f9f6ddaa6b75105a7dc5b29bf46823eb287a9 /libavresample/arm/resample_init.c | |
parent | 52a1a55f3014e0a9ad2461e2e17896ee27ba794d (diff) | |
parent | 12655c48049f9a52e5504bde90fe738862b0ff08 (diff) | |
download | ffmpeg-db3f6465a63130f3c2133073dd6aaf88298497bc.tar.gz |
Merge commit '12655c48049f9a52e5504bde90fe738862b0ff08'
* commit '12655c48049f9a52e5504bde90fe738862b0ff08':
libavresample: NEON optimized FIR audio resampling
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample/arm/resample_init.c')
-rw-r--r-- | libavresample/arm/resample_init.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/libavresample/arm/resample_init.c b/libavresample/arm/resample_init.c new file mode 100644 index 0000000000..10af09cb91 --- /dev/null +++ b/libavresample/arm/resample_init.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net> + * + * 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/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/internal.h" +#include "libavutil/samplefmt.h" + +#include "libavresample/resample.h" + +#include "asm-offsets.h" + +AV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK); +AV_CHECK_OFFSET(struct ResampleContext, filter_length, FILTER_LENGTH); +AV_CHECK_OFFSET(struct ResampleContext, src_incr, SRC_INCR); +AV_CHECK_OFFSET(struct ResampleContext, phase_shift, PHASE_SHIFT); +AV_CHECK_OFFSET(struct ResampleContext, phase_mask, PHASE_MASK); + +void ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); +void ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); +void ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); + +void ff_resample_linear_flt_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); + +av_cold void ff_audio_resample_init_arm(ResampleContext *c, + enum AVSampleFormat sample_fmt) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_neon(cpu_flags)) { + switch (sample_fmt) { + case AV_SAMPLE_FMT_FLTP: + if (c->linear) + c->resample_one = ff_resample_linear_flt_neon; + else + c->resample_one = ff_resample_one_flt_neon; + break; + case AV_SAMPLE_FMT_S16P: + if (!c->linear) + c->resample_one = ff_resample_one_s16_neon; + break; + case AV_SAMPLE_FMT_S32P: + if (!c->linear) + c->resample_one = ff_resample_one_s32_neon; + break; + } + } +} |