[MPlayer-dev-eng] Fwd: [MPlayer-users] Work done twice: problems in libswscale assembly optimization codes
Guillaume POIRIER
poirierg at gmail.com
Thu Jan 18 23:10:52 CET 2007
The below message is more appropriate in this mailing list, so I'm
forwarding it here...
---------- Forwarded message ----------
From: Netex <netex at 163.com>
Date: Jan 5, 2007 10:04 AM
Subject: [MPlayer-users] Work done twice: problems in libswscale
assembly optimization codes
To: "MPlayer usage questions, feature requests, bug reports"
<mplayer-users at mplayerhq.hu>
Hi,
Today I read libswscale codes and found there are problems in #ifdef's
branching. See the code:
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t
*dst,long src_size)
{
uint8_t *dest = dst;
const uint8_t *s = src;
const uint8_t *end;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
end = s + src_size;
#ifdef HAVE_MMX
// ...MMX Codes...
#endif
while(s < end)
{
#ifdef WORDS_BIGENDIAN
/* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
s++;
dest[2] = *s++;
dest[1] = *s++;
dest[0] = *s++;
dest += 3;
#else
*dest++ = *s++;
*dest++ = *s++;
*dest++ = *s++;
s++;
#endif
}
}
If HAVE_MMX is not defined, the code equals to:
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t
*dst,long src_size)
{
uint8_t *dest = dst;
const uint8_t *s = src;
const uint8_t *end;
end = s + src_size;
while(s < end)
{
#ifdef WORDS_BIGENDIAN
/* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
s++;
dest[2] = *s++;
dest[1] = *s++;
dest[0] = *s++;
dest += 3;
#else
*dest++ = *s++;
*dest++ = *s++;
*dest++ = *s++;
s++;
#endif
}
}
If HAVE_MMX is defined, the code equals to:
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t
*dst,long src_size)
{
uint8_t *dest = dst;
const uint8_t *s = src;
const uint8_t *end;
const uint8_t *mm_end;
end = s + src_size;
// ...MMX Codes...
while(s < end)
{
#ifdef WORDS_BIGENDIAN
/* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
s++;
dest[2] = *s++;
dest[1] = *s++;
dest[0] = *s++;
dest += 3;
#else
*dest++ = *s++;
*dest++ = *s++;
*dest++ = *s++;
s++;
#endif
}
}
So the work are done *TWICE*. Am I too stupid?
--
netex at 163.com
_______________________________________________
MPlayer-users mailing list
MPlayer-users at mplayerhq.hu
http://lists.mplayerhq.hu/mailman/listinfo/mplayer-users
More information about the MPlayer-dev-eng
mailing list