Welcome! Log In Create A New Profile

Advanced

SDL Wii video mode

Posted by oibaf 
SDL Wii video mode
January 04, 2015 04:45PM
Making some tests and looking at SDL Wii code I found out the default bitdepth is 16 with RGB565 colour space (i.e the SDL surface obtained by SDL_SetVideoMode(width, height, 0, flags)).

Surely this is neither the Wii hardware resolution nor the best resolution to use on the Wii.

Wii uses YUY2 colour space where 8 bits are used for the luminance of one pixel, 8 bit for the luminance of the adjacent pixel and 16 bits for the 2 shared chrominance signals of the 2 pixels (total of 32 bits for 2 pixels). In this representation there are 2^24 colours even if 2 adjacent bits have the same chrominance signal (but different luminance). This format is used on television for historical reasons but also because the human eye is more sensible at the luminance that at the chrominance.

[www.dbfinteractive.com]

If we want to show a 24 bit RGB image on the screen through SDL Wii there is a big difference if we use 16 bit depth (the default) or 24 bits.

If you use the default setting (16 bits) the colours number is reduced from 2^24 to 2^16 without any filter. This can cause a terrible posterization effect provided that we do not apply a filter to the image like this one:

[registry.gimp.org]

Instead if we use 24 bit colour space this effect is not present and the image quality is much better.

In both cases the SDL library loads the image in a texture which is passed to the GX rendering engine that makes the conversion into the YUY2 colour space and possibly the upscale, if a 320X240 resolution is used (this is what I understood from the Wii SDL code).

The passage to YUY2 can cause some artefacts which are in any case less visible than the passage from RGB888 (24 bits) to RGB565 (16 bits)



Edited 2 time(s). Last edit at 01/04/2015 06:45PM by oibaf.
Re: SDL Wii video mode
January 05, 2015 07:51AM
The default video code in SDL-wii is bad from both quality and performance perspectives, that's why when I used it for my projects I rewrote it to use either 32/24bpp RGB (directly to the EFB, no texturing) or 8bpp RGB paletted mode (with a 24-bit color palette).
Re: SDL Wii video mode
January 05, 2015 10:41AM
Tueidj, I saw that you included a modified version of SDL in CorsixTH source code.

There are other games with modified SDL source code included? Which is the best version?



Edited 1 time(s). Last edit at 01/05/2015 10:42AM by oibaf.
Re: SDL Wii video mode
January 05, 2015 11:52AM
I used it for eduke32 as well, not sure where the source code for it ended up being hosted but it should be around somewhere.
The "best" version is still part of an unreleased dosbox port.
Re: SDL Wii video mode
January 05, 2015 12:25PM
Found it here:

[dukeworld.duke4.net]

Thanks a lot
Sorry, only registered users may post in this forum.

Click here to login