[gst-devel] Gstreamer WIN32 status

Steve Lhomme steve.lhomme at free.fr
Mon Apr 10 00:26:06 CEST 2006


David Schleef wrote:
>> 2) Some plugins use rint (audioresample, videobalance). I've found and 
>> used #ifdef WIN32 #define rint(x) (floor((x)+0.5)) #endif. Is it correct  ?
> 
> It would be better to add a test for HAVE_RINT and use that.  rint() is
> missing on more platforms than just MSVC.  The use of rint() in these
> places is due to me being lazy about converting them to liboil.  Bad
> me.

This is the code used in DrFFMPEG:

static always_inline long int lrintf(float x)
{
#ifdef CONFIG_WIN32
#  ifdef ARCH_X86
     int32_t i;
     asm volatile(
         "fistpl %0\n\t"
         : "=m" (i) : "t" (x) : "st"
     );
     return i;
#  elif _MSC_VER
     int32_t i;
     __asm
     {
         fld   x
         fistp i
     }
     return i;
#  else
     /* XXX: incorrect, but make it compile */
     return (int)(x + (x < 0 ? -0.5 : 0.5));
#  endif /* ARCH_X86 */
#else
     return (int)(rint(x));
#endif /* CONFIG_WIN32 */
}





More information about the gstreamer-devel mailing list