47 int dst_index,
const void *src0,
int src_size,
53 #define CONFIG_RESAMPLE_DBL
55 #undef CONFIG_RESAMPLE_DBL
58 #define CONFIG_RESAMPLE_FLT
60 #undef CONFIG_RESAMPLE_FLT
63 #define CONFIG_RESAMPLE_S32
65 #undef CONFIG_RESAMPLE_S32
80 for (i = 1; v != lastv; i++) {
96 const int center = (tap_count - 1) / 2;
98 tab =
av_malloc(tap_count *
sizeof(*tab));
105 for (ph = 0; ph < phase_count; ph++) {
107 for (i = 0; i < tap_count; i++) {
108 x =
M_PI * ((double)(i - center) - (double)ph / phase_count) *
factor;
113 const float d = -0.5;
114 x = fabs(((
double)(i - center) - (
double)ph / phase_count) * factor);
115 if (x < 1.0) y = 1 - 3 * x*x + 2 * x*x*x + d * ( -x*x + x*x*x);
116 else y = d * (-4 + 8 * x - 5 * x*x + x*x*x);
120 w = 2.0 * x / (factor * tap_count) +
M_PI;
121 y *= 0.3635819 - 0.4891775 * cos( w) +
122 0.1365995 * cos(2 * w) -
123 0.0106411 * cos(3 * w);
126 w = 2.0 * x / (factor * tap_count *
M_PI);
135 for (i = 0; i < tap_count; i++)
136 tab[i] = tab[i] / norm;
210 in_rate * (int64_t)phase_count, INT32_MAX / 2))
253 if (compensation_distance < 0)
255 if (!compensation_distance && sample_delta)
259 #if FF_API_RESAMPLE_CLOSE_OPEN
263 int restore_matrix = 0;
268 if (fifo_samples > 0) {
292 if (restore_matrix) {
304 if (fifo_samples > 0) {
318 if (compensation_distance) {
320 (int64_t)sample_delta / compensation_distance;
332 int *consumed,
int src_size,
int dst_size,
int update_ctx)
346 int64_t index2 = ((int64_t)index) << 32;
348 dst_size =
FFMIN(dst_size,
349 (src_size-1-index) * (int64_t)c->
src_incr /
353 for(dst_index = 0; dst_index < dst_size; dst_index++) {
354 c->
resample_one(c, 1, dst, dst_index, src, 0, index2 >> 32, 0);
358 dst_index = dst_size;
361 index += (frac + dst_index * (int64_t)dst_incr_frac) / c->
src_incr;
362 frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->
src_incr;
364 for (dst_index = 0; dst_index < dst_size; dst_index++) {
368 -sample_index >= src_size)
372 c->
resample_one(c, 0, dst, dst_index, src, src_size, index, frac);
374 frac += dst_incr_frac;
380 if (dst_index + 1 == compensation_distance) {
381 compensation_distance = 0;
394 if (compensation_distance) {
395 compensation_distance -= dst_index;
396 if (compensation_distance <= 0)
410 int ch, in_samples, in_leftover, consumed = 0, out_samples = 0;
421 }
else if (!in_leftover) {
447 if (out_samples < 0) {
455 av_dlog(c->
avr,
"resampled %d in + %d leftover to %d out + %d leftover\n",