mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-13 02:34:54 +00:00
dont just resample half of the data sometimes
Originally committed as revision 3535 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
63dd1377b3
commit
80e8528865
@ -160,9 +160,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
|
|||||||
int frac= c->frac;
|
int frac= c->frac;
|
||||||
int dst_incr_frac= c->dst_incr % c->src_incr;
|
int dst_incr_frac= c->dst_incr % c->src_incr;
|
||||||
int dst_incr= c->dst_incr / c->src_incr;
|
int dst_incr= c->dst_incr / c->src_incr;
|
||||||
|
int compensation_distance= c->compensation_distance;
|
||||||
if(c->compensation_distance && c->compensation_distance < dst_size)
|
|
||||||
dst_size= c->compensation_distance;
|
|
||||||
|
|
||||||
for(dst_index=0; dst_index < dst_size; dst_index++){
|
for(dst_index=0; dst_index < dst_size; dst_index++){
|
||||||
short *filter= c->filter_bank + c->filter_length*(index & PHASE_MASK);
|
short *filter= c->filter_bank + c->filter_length*(index & PHASE_MASK);
|
||||||
@ -199,18 +197,25 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
|
|||||||
frac -= c->src_incr;
|
frac -= c->src_incr;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(dst_index + 1 == compensation_distance){
|
||||||
|
compensation_distance= 0;
|
||||||
|
dst_incr_frac= c->ideal_dst_incr % c->src_incr;
|
||||||
|
dst_incr= c->ideal_dst_incr / c->src_incr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*consumed= FFMAX(index, 0) >> PHASE_SHIFT;
|
*consumed= FFMAX(index, 0) >> PHASE_SHIFT;
|
||||||
index= FFMIN(index, 0);
|
index= FFMIN(index, 0);
|
||||||
|
|
||||||
if(update_ctx){
|
if(compensation_distance){
|
||||||
if(c->compensation_distance){
|
compensation_distance -= dst_index;
|
||||||
c->compensation_distance -= dst_index;
|
assert(compensation_distance > 0);
|
||||||
if(!c->compensation_distance)
|
|
||||||
c->dst_incr= c->ideal_dst_incr;
|
|
||||||
}
|
}
|
||||||
|
if(update_ctx){
|
||||||
c->frac= frac;
|
c->frac= frac;
|
||||||
c->index= index;
|
c->index= index;
|
||||||
|
c->dst_incr= dst_incr_frac + c->src_incr*dst_incr;
|
||||||
|
c->compensation_distance= compensation_distance;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if(update_ctx && !c->compensation_distance){
|
if(update_ctx && !c->compensation_distance){
|
||||||
|
Loading…
Reference in New Issue
Block a user