aboutsummaryrefslogtreecommitdiff
path: root/libswresample
diff options
context:
space:
mode:
authorMichael Niedermayer2014-04-15 06:35:35 +0200
committerMichael Niedermayer2014-04-15 06:35:35 +0200
commit2b58c9c945f7aa2062cbdd204d51949a225b3480 (patch)
tree6e42bde317faae93c7abea951f4274977ac93082 /libswresample
parent0bf25c7b08d45e8023e11ebaa61c3abea649bd31 (diff)
swresample/resample_template: try to consider src_size more exactly
This should avoid slight differences in the output causes by input size alignment differences between archs Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/resample_template.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
index a627f1194a..f42846ac5b 100644
--- a/libswresample/resample_template.c
+++ b/libswresample/resample_template.c
@@ -106,7 +106,9 @@ int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int
if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){
int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index;
int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr;
- dst_size= FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr);
+ int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr;
+
+ dst_size= FFMIN(dst_size, new_size);
for(dst_index=0; dst_index < dst_size; dst_index++){
dst[dst_index] = src[index2>>32];