27 #if defined(CONFIG_RESAMPLE_DBL) 28 #define SET_TYPE(func) func ## _dbl 32 #define OUT(d, v) d = v 33 #define DBL_TO_FELEM(d, v) d = v 34 #elif defined(CONFIG_RESAMPLE_FLT) 35 #define SET_TYPE(func) func ## _flt 39 #define OUT(d, v) d = v 40 #define DBL_TO_FELEM(d, v) d = v 41 #elif defined(CONFIG_RESAMPLE_S32) 42 #define SET_TYPE(func) func ## _s32 44 #define FELEM2 int64_t 45 #define FELEML int64_t 46 #define OUT(d, v) d = av_clipl_int32((v + (1 << 29)) >> 30) 47 #define DBL_TO_FELEM(d, v) d = av_clipl_int32(llrint(v * (1 << 30))); 49 #define SET_TYPE(func) func ## _s16 51 #define FELEM2 int32_t 52 #define FELEML int64_t 53 #define OUT(d, v) d = av_clip_int16((v + (1 << 14)) >> 15) 54 #define DBL_TO_FELEM(d, v) d = av_clip_int16(lrint(v * (1 << 15))) 61 dst[dst_index] = src[
index];
70 unsigned int sample_index =
index >>
c->phase_shift;
73 c->filter_length * (
index &
c->phase_mask);
76 for (i = 0; i <
c->filter_length; i++) {
77 val += src[sample_index +
i] * (
FELEM2)filter[i];
78 v2 += src[sample_index +
i] * (
FELEM2)filter[i +
c->filter_length];
82 OUT(dst[dst_index], val);
86 void *dst0,
int dst_index,
const void *
src0,
92 unsigned int sample_index =
index >>
c->phase_shift;
95 c->filter_length * (
index &
c->phase_mask);
97 for (i = 0; i <
c->filter_length; i++)
98 val += src[sample_index + i] * (
FELEM2)filter[
i];
100 OUT(dst[dst_index], val);
108 for (i = 0; i < tap_count; i++) {
#define DBL_TO_FELEM(d, v)
static void SET_TYPE() set_filter(void *filter0, double *tab, int phase, int tap_count)
static void filter0(SUINT32 *dst, const int32_t *src, int32_t coeff, ptrdiff_t len)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
static void SET_TYPE() resample_nearest(void *dst0, int dst_index, const void *src0, unsigned int index)
static void SET_TYPE() resample_linear(ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
static void SET_TYPE() resample_one(ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
common internal and external API header
static const struct twinvq_data tab
static double val(void *priv, double ch)