[FFmpeg-devel] [PATCH 3/3] avutil/rational: never return greater num/den than the maximum allowed in av_d2q

Marton Balint cus at passwd.hu
Fri Nov 15 10:53:58 EET 2024



On Sun, 10 Nov 2024, Marton Balint wrote:

> This reverts 887d74c47efa70d7d1513e9492d41cf7f88dee0b, because it ignores the
> maximum allowed numerator/denominator. Even if the result was rounded to zero
> or infinity, it should not be cause to ignore the maximum allowed number, this
> "feature" is unintuitive and undocumented.

Ping for this, will apply soon.

Thanks,
Marton

>
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
> libavutil/rational.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/libavutil/rational.c b/libavutil/rational.c
> index 329fbf3302..1b7c6350e9 100644
> --- a/libavutil/rational.c
> +++ b/libavutil/rational.c
> @@ -118,8 +118,6 @@ AVRational av_d2q(double d, int max)
>     // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64,
>     // see Ticket2713 for affected gcc/glibc versions
>     av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max);
> -    if ((!a.num || !a.den) && d && max>0 && max<INT_MAX)
> -        av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, INT_MAX);
>
>     return a;
> }
> -- 
> 2.43.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list