Re: [Ogle-user] Sun compiler & Solaris x86

Darrel Hankerson <[email protected]> Sun, 28 Dec 2003 12:00:43 -0600
Newsgroups gmane.comp.video.ogle.devel
Message-ID <200312281800.hBSI0hgI015082__49440.9687155441$1072696904@yak.dms.auburn.edu>
H}kan Hjort <[email protected]> writes:

   > [from Jake Goerzen]
   > An interesting update:  I installed medialib on a Solaris 9 x86 machine,
   > compiled ogle with gcc 2.95.3 configured w/ --disable-mmx which works but
   > is slow (<2 frames per sec) and the color conversion is messed up.

   medialib for x86 seems to just be plain C code, not using MMX.

I also tested medialib on x86 and experienced color problems and
very slow performance.

Concerning the use of both mmx and medialib, Bj|rn Englund
<[email protected]> wrote (to Laurent Blume):

   There shouldn't be any problems with them both true,
   what compile errors do you get?

video_stream.c needs mmx.h.  yuv2rgb_init in yuv2rgb.c needs to
consider the case that both HAVE_MMX and HAVE_MLIB are defined.

A very simple change giving a small improvement is to define the
fast versions of "byte swap" (endian conversion).  I tested the
following asm fragments taken verbatim from a Linux 2.2 system:

   #define __bswap_constant_16(x) \
	((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))

   # define __bswap_16(x) \
	(__extension__                                                \
	 ({ register unsigned short int __v;                          \
	    if (__builtin_constant_p (x))                             \
	      __v = __bswap_constant_16 (x);                          \
	    else                                                      \
	      __asm__ __volatile__ ("rorw $8, %w0"                    \
				    : "=r" (__v)                      \
				    : "0" ((unsigned short int) (x))  \
				    : "cc");                          \
	    __v; }))

   /* Swap bytes in 32 bit value.  */
   #define __bswap_constant_32(x) \
	((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |    \
	 (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))

   #  define __bswap_32(x) \
	(__extension__                                                \
	 ({ register unsigned int __v;                                \
	    if (__builtin_constant_p (x))                             \
	      __v = __bswap_constant_32 (x);                          \
	    else                                                      \
	      __asm__ __volatile__ ("bswap %0"                        \
				    : "=r" (__v)                      \
				    : "0" ((unsigned int) (x)));      \
	    __v; }))
   #define FROM_BE_16 __bswap_16
   #define FROM_BE_32 __bswap_32


These were placed in include/ogle_endian.h.  Solaris/x86 apparently
has these conversions but as functions:

   [sys/sunddi.h]
   /*
    * these are software byte swapping functions
    */
   uint16_t
   ddi_swap16(uint16_t value);

   uint32_t
   ddi_swap32(uint32_t value);

Tests were with Solaris 8 running on a 350 MHz Pentium II.  The
performance in fps is horrible, but use of the fast byte swap macros
makes a small but significant difference.

--Darrel Hankerson [email protected]