History

avutil/rational: never return greater num/den than the maximum allowed in av_d2q

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.

Marton Balint committed 2 years ago

Commit d8846061 parent 25efe341 file · +0 −2Browse files

Unified · Split

libavutil/rational.c+0−2
@@ -118,8 +118,6 @@ AVRational av_d2q(double d, int max) · 117 unmodified lines
118118 // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64,
119119 // see Ticket2713 for affected gcc/glibc versions
120120 av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max);
121− if ((!a.num || !a.den) && d && max>0 && max<INT_MAX)
122− av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, INT_MAX);
123121
124122 return a;
125123 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t