[MPlayer-dev-eng] Questions about libvo/osd_template.c
Zuxy Meng
zuxy.meng at gmail.com
Sat May 20 12:07:31 CEST 2006
Hi,
I want to write an SSE2 version of osd_template.c and have some
question about the original C and MMX versions.
In some places the semantic of the C and the MMX versions isn't quite
the same. For example, in the inner loop of vo_draw_alpha_yv12:
The C version is:
for (x = 0; x < w; x++)
if (srca[x])
dstbase[x] = ((dstbase[x] * srca[x]) >> 8) + src[x];
While the MMX version is equivalent to:
for (x = 0; x < w; x += 8) {
if (srca[x] == 0 && srca[x + 1] == 0 && .. && srca[x + 7] = 0)
continue;
dstbase[x] = ((dstbase[x] * srca[x]) >> 8) + src[x];
dstbase[x + 1] = ((dstbase[x + 1] * srca[x + 1]) >> 8) + src[x + 1];
...
dstbase[x + 7] = ((dstbase[x + 7] * srca[x + 7]) >> 8) + src[x + 7];
}
You can see that these two versions will produce different result.
Firstly, operations on the trailing elements are not performed in the
MMX version (I guess there should be something like 'for (; x < w;
x++)' following the vectorized code); and lastly, in the C version, if
srca[x] == 0, dstbase[x] won't get changed, but in the MMX version,
dstbase[x] mighty get assigned the value of src[x] even is srca[x] ==
0.
Are these two inconsistencies only too trivial to care about?
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
More information about the MPlayer-dev-eng
mailing list