Incorrect RGB conversion

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Post Reply
Zenju
Snes9x White Belt
Posts: 16
Joined: Mon May 19, 2014 4:46 pm

Incorrect RGB conversion

Post by Zenju »

Hi,

for the Windows port the RGB565 to RGB32 is implemented as:

Code: Select all

#define CONVERT_16_TO_32(pixel) 
    (((((pixel) >> 11)        ) << /*RedShift+3*/  19) | 
     ((((pixel) >> 6)   & 0x1f) << /*GreenShift+3*/11) | 
     (((pixel)         & 0x1f) << /*BlueShift+3*/ 3))
The green pixel needlessly is stripped off its least significant bit, i.e. instad of 6 it is treated as a 5-bit color. Here's the fix:

Code: Select all

     ((((pixel) >> 5)   & 0x3f) << /*GreenShift+2*/10) | 
Regards, Zenju
adventure_of_link
Hero of Hyrule | Official Port Recruiter
Posts: 2588
Joined: Mon May 24, 2004 5:06 pm
Location: 255.255.255.255

Re: Incorrect RGB conversion

Post by adventure_of_link »

Moved to Public Dev. :)
Image

Unofficial Test Monkey For:
* Snes9X GX (Wii)
* Snes9X EX (Android)
* Snes9X 64-bits (PC/Mac)

ZSNES|Ben Heck|NSRT|Bob Smiley
User avatar
OV2
Official Win32 Porter/Dev
Posts: 679
Joined: Thu Aug 30, 2007 10:15 pm

Re: Incorrect RGB conversion

Post by OV2 »

I've already applied it. Now I just need to find some time for xbrz...
User avatar
MELERIX
Snes9x White Belt
Posts: 46
Joined: Wed Oct 31, 2012 1:18 am

Re: Incorrect RGB conversion

Post by MELERIX »

how this can be 16 bit to 32 bit RGB conversion ? if the SNES work with 15 bit BGR.

http://wiki.superfamicom.org/snes/show/Palettes
Post Reply