48 int dst_index,
const void *src0,
int src_size,
54 #define CONFIG_RESAMPLE_DBL
56 #undef CONFIG_RESAMPLE_DBL
59 #define CONFIG_RESAMPLE_FLT
61 #undef CONFIG_RESAMPLE_FLT
64 #define CONFIG_RESAMPLE_S32
66 #undef CONFIG_RESAMPLE_S32
81 for (i = 1; v != lastv; i++) {
97 const int center = (tap_count - 1) / 2;
99 tab =
av_malloc(tap_count *
sizeof(*tab));
106 for (ph = 0; ph < phase_count; ph++) {
108 for (i = 0; i < tap_count; i++) {
109 x =
M_PI * ((double)(i - center) - (double)ph / phase_count) *
factor;
114 const float d = -0.5;
115 x = fabs(((
double)(i - center) - (
double)ph / phase_count) * factor);
116 if (x < 1.0) y = 1 - 3 * x*x + 2 * x*x*x + d * ( -x*x + x*x*x);
117 else y = d * (-4 + 8 * x - 5 * x*x + x*x*x);
121 w = 2.0 * x / (factor * tap_count) +
M_PI;
122 y *= 0.3635819 - 0.4891775 * cos( w) +
123 0.1365995 * cos(2 * w) -
124 0.0106411 * cos(3 * w);
127 w = 2.0 * x / (factor * tap_count *
M_PI);
136 for (i = 0; i < tap_count; i++)
137 tab[i] = tab[i] / norm;
211 in_rate * (int64_t)phase_count, INT32_MAX / 2))
254 if (compensation_distance < 0)
256 if (!compensation_distance && sample_delta)
260 #if FF_API_RESAMPLE_CLOSE_OPEN
264 int restore_matrix = 0;
269 if (fifo_samples > 0) {
293 if (restore_matrix) {
305 if (fifo_samples > 0) {
319 if (compensation_distance) {
321 (int64_t)sample_delta / compensation_distance;
333 int *consumed,
int src_size,
int dst_size,
int update_ctx)
347 int64_t index2 = ((int64_t)index) << 32;
349 dst_size =
FFMIN(dst_size,
350 (src_size-1-index) * (int64_t)c->
src_incr /
354 for(dst_index = 0; dst_index < dst_size; dst_index++) {
355 c->
resample_one(c, 1, dst, dst_index, src, 0, index2 >> 32, 0);
359 dst_index = dst_size;
362 index += (frac + dst_index * (int64_t)dst_incr_frac) / c->
src_incr;
363 frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->
src_incr;
365 for (dst_index = 0; dst_index < dst_size; dst_index++) {
369 -sample_index >= src_size)
373 c->
resample_one(c, 0, dst, dst_index, src, src_size, index, frac);
375 frac += dst_incr_frac;
381 if (dst_index + 1 == compensation_distance) {
382 compensation_distance = 0;
395 if (compensation_distance) {
396 compensation_distance -= dst_index;
397 if (compensation_distance <= 0)
411 int ch, in_samples, in_leftover, consumed = 0, out_samples = 0;
422 }
else if (!in_leftover) {
448 if (out_samples < 0) {
456 av_dlog(c->
avr,
"resampled %d in + %d leftover to %d out + %d leftover\n",