mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
deinterlace: improve framerate transform
Handle G_MAXINT in the framerates better. If we cannot double or divide the framerate, clamp to the smallest/largest possible value we can express instead of failing. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683861
This commit is contained in:
parent
6d9f9bf11a
commit
1c64a91a50
1 changed files with 12 additions and 12 deletions
|
@ -2071,28 +2071,28 @@ gst_fraction_double (gint * n_out, gint * d_out, gboolean half)
|
|||
if (d == 0)
|
||||
return FALSE;
|
||||
|
||||
if (n == 0 || (n == G_MAXINT && d == 1))
|
||||
if (n == 0)
|
||||
return TRUE;
|
||||
|
||||
gcd = gst_util_greatest_common_divisor (n, d);
|
||||
n /= gcd;
|
||||
d /= gcd;
|
||||
|
||||
if (!half) {
|
||||
if (G_MAXINT / 2 >= ABS (n)) {
|
||||
n *= 2;
|
||||
} else if (d >= 2) {
|
||||
d /= 2;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (half) {
|
||||
if (G_MAXINT / 2 >= ABS (d)) {
|
||||
d *= 2;
|
||||
} else if (n >= 2) {
|
||||
} else if (n >= 2 && n != G_MAXINT) {
|
||||
n /= 2;
|
||||
} else {
|
||||
return FALSE;
|
||||
d = G_MAXINT;
|
||||
}
|
||||
} else {
|
||||
if (G_MAXINT / 2 >= ABS (n)) {
|
||||
n *= 2;
|
||||
} else if (d >= 2 && d != G_MAXINT) {
|
||||
d /= 2;
|
||||
} else {
|
||||
n = G_MAXINT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue