1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * This file is part of FFmpeg. 3cabdff1aSopenharmony_ci * 4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or 5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public 6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either 7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 8cabdff1aSopenharmony_ci * 9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful, 10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12cabdff1aSopenharmony_ci * Lesser General Public License for more details. 13cabdff1aSopenharmony_ci * 14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public 15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software 16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17cabdff1aSopenharmony_ci */ 18cabdff1aSopenharmony_ci 19cabdff1aSopenharmony_ci#include <stdint.h> 20cabdff1aSopenharmony_ci 21cabdff1aSopenharmony_ci#include "config.h" 22cabdff1aSopenharmony_ci#include "libavutil/cpu.h" 23cabdff1aSopenharmony_ci#include "libavutil/aarch64/cpu.h" 24cabdff1aSopenharmony_ci#include "libavutil/internal.h" 25cabdff1aSopenharmony_ci#include "libavutil/samplefmt.h" 26cabdff1aSopenharmony_ci#include "libavresample/resample.h" 27cabdff1aSopenharmony_ci 28cabdff1aSopenharmony_ci#include "asm-offsets.h" 29cabdff1aSopenharmony_ci 30cabdff1aSopenharmony_ciAV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK); 31cabdff1aSopenharmony_ciAV_CHECK_OFFSET(struct ResampleContext, filter_length, FILTER_LENGTH); 32cabdff1aSopenharmony_ciAV_CHECK_OFFSET(struct ResampleContext, phase_shift, PHASE_SHIFT); 33cabdff1aSopenharmony_ciAV_CHECK_OFFSET(struct ResampleContext, phase_mask, PHASE_MASK); 34cabdff1aSopenharmony_ci 35cabdff1aSopenharmony_civoid ff_resample_one_dbl_neon(struct ResampleContext *c, void *dst0, 36cabdff1aSopenharmony_ci int dst_index, const void *src0, 37cabdff1aSopenharmony_ci unsigned int index, int frac); 38cabdff1aSopenharmony_civoid ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0, 39cabdff1aSopenharmony_ci int dst_index, const void *src0, 40cabdff1aSopenharmony_ci unsigned int index, int frac); 41cabdff1aSopenharmony_civoid ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0, 42cabdff1aSopenharmony_ci int dst_index, const void *src0, 43cabdff1aSopenharmony_ci unsigned int index, int frac); 44cabdff1aSopenharmony_civoid ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0, 45cabdff1aSopenharmony_ci int dst_index, const void *src0, 46cabdff1aSopenharmony_ci unsigned int index, int frac); 47cabdff1aSopenharmony_ci 48cabdff1aSopenharmony_ciav_cold void ff_audio_resample_init_aarch64(ResampleContext *c, 49cabdff1aSopenharmony_ci enum AVSampleFormat sample_fmt) 50cabdff1aSopenharmony_ci{ 51cabdff1aSopenharmony_ci int cpu_flags = av_get_cpu_flags(); 52cabdff1aSopenharmony_ci 53cabdff1aSopenharmony_ci if (have_neon(cpu_flags)) { 54cabdff1aSopenharmony_ci if (!c->linear) { 55cabdff1aSopenharmony_ci switch (sample_fmt) { 56cabdff1aSopenharmony_ci case AV_SAMPLE_FMT_DBLP: 57cabdff1aSopenharmony_ci c->resample_one = ff_resample_one_dbl_neon; 58cabdff1aSopenharmony_ci break; 59cabdff1aSopenharmony_ci case AV_SAMPLE_FMT_FLTP: 60cabdff1aSopenharmony_ci c->resample_one = ff_resample_one_flt_neon; 61cabdff1aSopenharmony_ci break; 62cabdff1aSopenharmony_ci case AV_SAMPLE_FMT_S16P: 63cabdff1aSopenharmony_ci c->resample_one = ff_resample_one_s16_neon; 64cabdff1aSopenharmony_ci break; 65cabdff1aSopenharmony_ci case AV_SAMPLE_FMT_S32P: 66cabdff1aSopenharmony_ci c->resample_one = ff_resample_one_s32_neon; 67cabdff1aSopenharmony_ci break; 68cabdff1aSopenharmony_ci } 69cabdff1aSopenharmony_ci } 70cabdff1aSopenharmony_ci } 71cabdff1aSopenharmony_ci} 72