30 #if defined(TEMPLATE_RESAMPLE_DBL)
32 # define RENAME(N) N ## _double
33 # define FILTER_SHIFT 0
36 # define FELEM2 double
37 # define FELEM2U double
39 # define OUT(d, v) d = v
41 #elif defined(TEMPLATE_RESAMPLE_FLT)
43 # define RENAME(N) N ## _float
44 # define FILTER_SHIFT 0
48 # define FELEM2U float
50 # define OUT(d, v) d = v
52 #elif defined(TEMPLATE_RESAMPLE_S32)
54 # define RENAME(N) N ## _int32
55 # define FILTER_SHIFT 30
56 # define DELEM int32_t
57 # define FELEM int32_t
58 # define FELEM2 int64_t
59 # define FELEM2U uint64_t
60 # define FELEM_MAX INT32_MAX
61 # define FELEM_MIN INT32_MIN
62 # define FOFFSET (1<<(FILTER_SHIFT-1))
63 # define OUT(d, v) (d) = av_clipl_int32((v)>>FILTER_SHIFT)
65 #elif defined(TEMPLATE_RESAMPLE_S16)
67 # define RENAME(N) N ## _int16
68 # define FILTER_SHIFT 15
69 # define DELEM int16_t
70 # define FELEM int16_t
71 # define FELEM2 int32_t
72 # define FELEM2U uint32_t
73 # define FELEML int64_t
74 # define FELEM_MAX INT16_MAX
75 # define FELEM_MIN INT16_MIN
76 # define FOFFSET (1<<(FILTER_SHIFT-1))
77 # define OUT(d, v) (d) = av_clip_int16((v)>>FILTER_SHIFT)
85 const DELEM *
src = source;
88 for (dst_index = 0; dst_index < dst_size; dst_index++) {
89 dst[dst_index] =
src[index2 >> 32];
95 void *dest,
const void *source,
96 int n,
int update_ctx)
99 const DELEM *
src = source;
103 int sample_index = 0;
105 while (
index >=
c->phase_count) {
110 for (dst_index = 0; dst_index < n; dst_index++) {
116 for (
i = 0;
i + 1 <
c->filter_length;
i+=2) {
120 if (i < c->filter_length)
125 OUT(dst[dst_index],
val + val2);
128 frac +=
c->dst_incr_mod;
130 if (frac >=
c->src_incr) {
135 while (
index >=
c->phase_count) {
150 void *dest,
const void *source,
151 int n,
int update_ctx)
154 const DELEM *
src = source;
158 int sample_index = 0;
159 #if FILTER_SHIFT == 0
160 double inv_src_incr = 1.0 /
c->src_incr;
163 while (
index >=
c->phase_count) {
168 for (dst_index = 0; dst_index < n; dst_index++) {
173 for (
i = 0;
i <
c->filter_length;
i++) {
180 #
if FILTER_SHIFT == 0
188 frac +=
c->dst_incr_mod;
190 if (frac >=
c->src_incr) {
195 while (
index >=
c->phase_count) {
static double val(void *priv, double ch)
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
static int RENAME() resample_linear(ResampleContext *c, void *dest, const void *source, int n, int update_ctx)
static void RENAME() resample_one(void *dest, const void *source, int dst_size, int64_t index2, int64_t incr)
static int RENAME() resample_common(ResampleContext *c, void *dest, const void *source, int n, int update_ctx)