[mythtv] MMX blend
Andrew Mahone
andrewmahone at eml.cc
Sun Feb 22 05:43:49 EST 2004
Attached is an MMX blend patch. I've split the blend function used several
places in the OSD into a separate file, providing paired MMX and C
implementations with a common prototype, so that a pointer to the appropriate
one can be stored in OSDSurface. Currently available are blendregion and
blendcolor. The first blends an alpha-masked rectangle onto a surface, the
second blends an alpha-masked constant color onto a surface.
The MMX blends work better than I expected. A simple test program shows the
MMX version is a little slower for regions with <7 columns (because the
entire blend is done by C code), or for very small regions. At around 32
pixels in the blended region, they're about the same speed, and past that,
the MMX blend quickly gains speed vs the C blend, until it peaks at about 2x
the speed of the C version. Most text blends appear to be large enough for
the maximum gain. I can provide the test program if anybody feels like
timing this on their own system.
The C blend has been tweaked a bit from the original. The most notable change
is removal of conditional blending - the tests that were being done to skip
parts of the blend are not necessary, as the special-case results they
produce are identical to the ones obtained by performing the blend. On my
system, it timed faster without the conditional special cases, probably due
to branch prediction costs. The inner loop is split into two versions, one
for even lines, and one for odd. I got a slight gain by doing this, and
moving the even line check out of the inner loop.
OSDSurface is patched to provide the second LUT needed by the MMX functions.
TTFont is patched to use blendcolor. I'm still working on the stuff in
OSDTypes, and from what Isaac said earlier, one or two more variations on the
existing blend functions may be needed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmxblend.patch.bz2
Type: application/x-bzip2
Size: 4613 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20040222/b50180ab/mmxblend.patch.bin
More information about the mythtv-dev
mailing list