Ticket #2713: patchrational.diff

File patchrational.diff, 833 bytes (added by cehoyos, 3 years ago)
  • libavutil/rational.c

    diff --git a/libavutil/rational.c b/libavutil/rational.c
    index aabe58f..7f8bf9b 100644
    a b AVRational av_d2q(double d, int max) 
    114114        return (AVRational) { d < 0 ? -1 : 1, 0 }; 
    115115    exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); 
    116116    den = 1LL << (61 - exponent); 
     117printf("d: %f, den: %"PRId64", d*den: %f, (int64_t)(d*den+0.5): %"PRId64", rint(d*den): %f, \n(uint64_t)rint(d*den): %"PRId64", (int64_t)rint(d*den):  %"PRId64", llrint(d*den): %lld \n", 
     118d, den, d*den, (int64_t)(d * den + 0.5), rint(d*den), (uint64_t)rint(d*den), (int64_t)rint(d*den), llrint(d*den)); 
    117119    av_reduce(&a.num, &a.den, rint(d * den), den, max); 
    118120    if ((!a.num || !a.den) && d && max>0 && max<INT_MAX) 
    119121        av_reduce(&a.num, &a.den, llrint(d * den), den, INT_MAX);