2 * This file is part of FFmpeg.
4 * FFmpeg 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.
9 * FFmpeg 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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "libavutil/cpu.h"
23 #include "libavutil/aarch64/cpu.h"
24 #include "libavutil/internal.h"
25 #include "libavutil/samplefmt.h"
26 #include "libavresample/resample.h"
28 #include "asm-offsets.h"
30 AV_CHECK_OFFSET(struct ResampleContext
, filter_bank
, FILTER_BANK
);
31 AV_CHECK_OFFSET(struct ResampleContext
, filter_length
, FILTER_LENGTH
);
32 AV_CHECK_OFFSET(struct ResampleContext
, phase_shift
, PHASE_SHIFT
);
33 AV_CHECK_OFFSET(struct ResampleContext
, phase_mask
, PHASE_MASK
);
35 void ff_resample_one_dbl_neon(struct ResampleContext
*c
, void *dst0
,
36 int dst_index
, const void *src0
,
37 unsigned int index
, int frac
);
38 void ff_resample_one_flt_neon(struct ResampleContext
*c
, void *dst0
,
39 int dst_index
, const void *src0
,
40 unsigned int index
, int frac
);
41 void ff_resample_one_s16_neon(struct ResampleContext
*c
, void *dst0
,
42 int dst_index
, const void *src0
,
43 unsigned int index
, int frac
);
44 void ff_resample_one_s32_neon(struct ResampleContext
*c
, void *dst0
,
45 int dst_index
, const void *src0
,
46 unsigned int index
, int frac
);
48 void ff_audio_resample_init_aarch64(ResampleContext
*c
,
49 enum AVSampleFormat sample_fmt
)
51 int cpu_flags
= av_get_cpu_flags();
53 if (have_neon(cpu_flags
)) {
56 case AV_SAMPLE_FMT_DBLP
:
57 c
->resample_one
= ff_resample_one_dbl_neon
;
59 case AV_SAMPLE_FMT_FLTP
:
60 c
->resample_one
= ff_resample_one_flt_neon
;
62 case AV_SAMPLE_FMT_S16P
:
63 c
->resample_one
= ff_resample_one_s16_neon
;
65 case AV_SAMPLE_FMT_S32P
:
66 c
->resample_one
= ff_resample_one_s32_neon
;