summaryrefslogtreecommitdiff
path: root/libavfilter/vf_idet.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-03 17:14:29 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-03 17:14:29 +0100
commit5d590d87b30c59dfb853ebde6276d36f8a8bbc58 (patch)
treeee7f2f735f178cb0367ac845c1d99cedc1bd9324 /libavfilter/vf_idet.c
parentfe6f5f2908ae9ac49e8f4f0aae66839f1557c61a (diff)
downloadffmpeg-5d590d87b30c59dfb853ebde6276d36f8a8bbc58.tar.gz
avfilter/vf_idet: fix rounding of av_dict_set_fxp()
fixes the remainder overflowing beyond .999 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_idet.c')
-rw-r--r--libavfilter/vf_idet.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 01d7eca5a7..05f361af71 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -62,8 +62,13 @@ static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t value, u
int flags)
{
char valuestr[44];
+ uint64_t print_precision = uintpow(10, digits);
+
+ value = av_rescale(value, print_precision, PRECISION);
+
snprintf(valuestr, sizeof(valuestr), "%"PRId64".%0*"PRId64,
- value / PRECISION, digits, ( value % PRECISION ) / ( PRECISION / uintpow(10,digits) ));
+ value / print_precision, digits, value % print_precision);
+
return av_dict_set(pm, key, valuestr, flags);
}