[gstreamer-bugs] [Bug 420079] [audioconvert] Uses biased rounding which results in distortions

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Mon Mar 19 06:59:51 PDT 2007


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=420079

  GStreamer | gst-plugins-base | Ver: HEAD CVS


Stefan Kost (gstreamer, gtkdoc dev) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ensonic at sonicpulse.de




------- Comment #2 from Stefan Kost (gstreamer, gtkdoc dev)  2007-03-19 13:57 UTC -------
for performance reasons I would like to see this refactored (scale can't change
in the loop)

for (;count; count--) {                                               \
  tmp = *src++;                                                       \
  if (scale > 0 && tmp > 0 && G_MAXINT32 - tmp < (1<<(scale-1)))      \
    tmp = G_MAXINT32;                                                 \
  else if (scale > 0)                                                 \
    tmp += 1<<(scale-1);                                              \
  tmp = (tmp ^ (sign)) >> scale;                                      \
  WRITE_FUNC (p, tmp);                                                \
  p+=stride;                                                          \
}                                                                     \

if(scale>0) {                                                         \
  for (;count; count--) {                                             \
    tmp = *src++;                                                     \
    if (tmp > 0 && G_MAXINT32 - tmp < (1<<(scale-1)))                 \
      tmp = G_MAXINT32;                                               \
    else                                                              \
      tmp += 1<<(scale-1);                                            \
    tmp = (tmp ^ (sign)) >> scale;                                    \
    WRITE_FUNC (p, tmp);                                              \
    p+=stride;                                                        \
  }                                                                   \
}                                                                     \
else {                                                                \
  for (;count; count--) {                                             \
    tmp = *src++;                                                     \
    tmp = (tmp ^ (sign)) >> scale;                                    \
    WRITE_FUNC (p, tmp);                                              \
    p+=stride;                                                        \
  }                                                                   \
}

maybe also moving (1<<(scale-1)) out of the loop and assigning it to a nicly
named variable.


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email




More information about the Gstreamer-bugs mailing list