[SDL] HW accelaration

dcsin at islandnet.com dcsin at islandnet.com
Tue Aug 17 17:28:33 PDT 1999

On Tue, 17 Aug 1999 13:37:25 -0700, Sam wrote:

>> I know how to render a 640x480 screen from a 320x200 screen via cpu.
>> But I was looking for something smarter than just take a pixel and
>> to write it in a buffer 2 times (the same for each scanline..) :)

Rather than writing it twice, why not four times?

>If the 320x200 screen is 8-bit, you can build a 32-bit lookup table
>which contains two pixels for every one original pixels.  The other
>advantage of this is that you get 16-bit depth support for free.
>Then, when you're finished with a scanline, you can double it using
>This is a very fast operation on modern systems, using software 

Would the cache thrashing slow this method down a whole lot? Using
lookup tables isn't ALWAYS a good idea. I think a shift/or might
actually be faster. There are even better ways in assembly, but that
sort of prevents cross-platform development.

shift/or method:

dest = (source << 8) | source;

80x386 method:

mov   al, source
mov   ah, al
mov   dest, ax

Wow. It's been a LOOONG time since I've used assembly.

More information about the SDL mailing list