32#define DECLARE_RESAMPLE_COMMON_TEMPLATE(TYPE, DELEM, FELEM, FELEM2, OUT) \
34void ff_resample_common_apply_filter_x4_##TYPE##_neon(FELEM2 *acc, const DELEM *src, \
35 const FELEM *filter, int length); \
37void ff_resample_common_apply_filter_x8_##TYPE##_neon(FELEM2 *acc, const DELEM *src, \
38 const FELEM *filter, int length); \
40static int ff_resample_common_##TYPE##_neon(ResampleContext *c, void *dest, const void *source, \
41 int n, int update_ctx) \
44 const DELEM *src = source; \
46 int index = c->index; \
48 int sample_index = 0; \
49 int x4_aligned_filter_length = c->filter_length & ~3; \
50 int x8_aligned_filter_length = c->filter_length & ~7; \
52 while (index >= c->phase_count) { \
54 index -= c->phase_count; \
57 for (dst_index = 0; dst_index < n; dst_index++) { \
58 FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; \
62 if (x8_aligned_filter_length >= 8) { \
63 ff_resample_common_apply_filter_x8_##TYPE##_neon(&val, &src[sample_index], \
64 filter, x8_aligned_filter_length); \
65 i += x8_aligned_filter_length; \
67 } else if (x4_aligned_filter_length >= 4) { \
68 ff_resample_common_apply_filter_x4_##TYPE##_neon(&val, &src[sample_index], \
69 filter, x4_aligned_filter_length); \
70 i += x4_aligned_filter_length; \
72 for (; i < c->filter_length; i++) { \
73 val += src[sample_index + i] * (FELEM2)filter[i]; \
75 OUT(dst[dst_index], val); \
77 frac += c->dst_incr_mod; \
78 index += c->dst_incr_div; \
79 if (frac >= c->src_incr) { \
80 frac -= c->src_incr; \
84 while (index >= c->phase_count) { \
86 index -= c->phase_count; \
95 return sample_index; \
98#define OUT(d, v) d = v
102#define OUT(d, v) (v) = ((v) + (1<<(14)))>>15; (d) = av_clip_int16(v)
115 c->dsp.resample_common = ff_resample_common_float_neon;
118 c->dsp.resample_common = ff_resample_common_s16_neon;
#define DECLARE_RESAMPLE_COMMON_TEMPLATE(TYPE, DELEM, FELEM, FELEM2, OUT)
av_cold void swri_resample_dsp_aarch64_init(ResampleContext *c)
simple assert() macros that are a bit more flexible than ISO C assert().
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Macro definitions for various function/variable attributes.
static atomic_int cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.