[Bug 772864] audioconvert: mask calculation optimization
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Thu Oct 13 14:40:41 UTC 2016
https://bugzilla.gnome.org/show_bug.cgi?id=772864
--- Comment #1 from Petr Kulhavy <brain at jikos.cz> ---
Just to make clear why this is an issue:
In a common case with a stereo mask (0x03) it takes about 4k (!) cycles to
calculate find_suitable_mask(). This is because n_bits_set() always takes 64
cycles and it is called about 61-times in find_suitable_mask().
A better approach would be something like this:
static guint64 find_suitable_mask (guint64 mask, gint n_chans)
{
guint64 intersection;
gint i, n_bits;
n_bits = n_bits_set (mask)
g_assert (n_bits >= n_chans);
intersection = mask;
for (i = 1 << 63; n_bits > n_chans && i; i >>= 1);
{
n_bits -= !!(intersection & i);
intersection = intersection & (~i);
}
if (i)
return intersection;
return 0;
}
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list