mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
gst/gstutils.c: Chain trivial case to _scale_int.
Original commit message from CVS: * gst/gstutils.c: (gst_util_uint64_scale), (gst_util_uint64_scale_int): Chain trivial case to _scale_int.
This commit is contained in:
parent
fbf5f16d69
commit
6ceca6153b
2 changed files with 19 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-11-24 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/gstutils.c: (gst_util_uint64_scale),
|
||||||
|
(gst_util_uint64_scale_int):
|
||||||
|
Chain trivial case to _scale_int.
|
||||||
|
|
||||||
2005-11-24 Wim Taymans <wim@fluendo.com>
|
2005-11-24 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* check/gst/gstutils.c: (GST_START_TEST), (gst_utils_suite):
|
* check/gst/gstutils.c: (GST_START_TEST), (gst_utils_suite):
|
||||||
|
|
|
@ -369,9 +369,19 @@ typedef union
|
||||||
guint64
|
guint64
|
||||||
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
|
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
|
||||||
{
|
{
|
||||||
/* implement me with fixed point, if you care */
|
guint64 result;
|
||||||
return gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) *
|
|
||||||
((gst_guint64_to_gdouble (num)) / gst_guint64_to_gdouble (denom)));
|
g_return_val_if_fail (denom != 0, G_MAXUINT64);
|
||||||
|
|
||||||
|
if (num <= G_MAXINT32 && denom <= G_MAXINT32) {
|
||||||
|
result = gst_util_uint64_scale_int (val, (gint) num, (gint) denom);
|
||||||
|
} else {
|
||||||
|
/* implement me with fixed point, if you care */
|
||||||
|
result = gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) *
|
||||||
|
((gst_guint64_to_gdouble (num)) / gst_guint64_to_gdouble (denom)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue