break;
case 2:
w = 2.0*x / (factor*tap_count*M_PI);
- y *= bessel(16*sqrt(FFMAX(1-w*w, 0))) / bessel(16);
+ y *= bessel(16*sqrt(FFMAX(1-w*w, 0)));
break;
}
}
void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){
- assert(!c->compensation_distance); //FIXME
-
+// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
c->compensation_distance= compensation_distance;
- c->dst_incr-= c->ideal_dst_incr * sample_delta / compensation_distance;
+ c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
}
/**
}
if(update_ctx){
if(c->compensation_distance){
- c->compensation_distance -= index;
+ c->compensation_distance -= dst_index;
if(!c->compensation_distance)
c->dst_incr= c->ideal_dst_incr;
}
c->index=0;
}
*consumed= index >> PHASE_SHIFT;
+#if 0
+ if(update_ctx && !c->compensation_distance){
+#undef rand
+ av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2);
+av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->compensation_distance);
+ }
+#endif
+
return dst_index;
}