aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-11 16:49:21 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-11 18:17:18 +0100
commit351e625d60165be67c362af6e96ead6c9262623f (patch)
treeea3c1eeceb6eb4b2a27cfcec48955e7fb7353e12 /libswresample
parent6770a9d6898a0c7561586dabd7a4e5b5187bed62 (diff)
downloadffmpeg-351e625d60165be67c362af6e96ead6c9262623f.tar.gz
swresample/resample: increase precision for compensation
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/resample.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libswresample/resample.c b/libswresample/resample.c
index c5ee62d842..77f3a0d4cd 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -355,6 +355,10 @@ static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_r
c->compensation_distance= 0;
if(!av_reduce(&c->src_incr, &c->dst_incr, out_rate, in_rate * (int64_t)phase_count, INT32_MAX/2))
goto error;
+ while (c->dst_incr < (1<<20) && c->src_incr < (1<<20)) {
+ c->dst_incr *= 2;
+ c->src_incr *= 2;
+ }
c->ideal_dst_incr = c->dst_incr;
c->dst_incr_div = c->dst_incr / c->src_incr;
c->dst_incr_mod = c->dst_incr % c->src_incr;