Rescomp colour conversion

SGDK only sub forum

Moderator: Stef

Post Reply
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Rescomp colour conversion

Post by matteus » Fri Mar 16, 2018 9:49 am

I thought I'd post here as I think grand master Stef is busy :)

Does anyone know how rescomp decides upon the colours it uses for conversion?

Does it use standard 9-bit colour RGB values
0, 32, 64, 96, 128, 160, 192, 224, 256

Old incorrect linear levels RGB values
0, 36, 72, 108, 144, 180, 216, 252/255

Or Tiido's Nonlinear levels RGB values
0, 52, 87, 116, 144, 172, 206, 255

Grind
Very interested
Posts: 69
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

Re: Rescomp colour conversion

Post by Grind » Fri Mar 16, 2018 2:10 pm

Looks like it uses the standard.

In tools/rescomp/src/tools.c:

Code: Select all

unsigned short toVDPColor(unsigned char b, unsigned char g, unsigned char r)
{
    // genesis only define on 3 bits (but shifted to 1 left)
    r = (r >> 4) & 0xE;
    g = (g >> 4) & 0xE;
    b = (b >> 4) & 0xE;

    return (r << 0) | (g << 4) | (b << 8);
}

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Rescomp colour conversion

Post by Sik » Fri Mar 16, 2018 2:44 pm

Huh... I just did some checks and if you take Tiido's values and leave only the higher three bits (like rescomp does) it actually gives the correct result. Go figure.
Sik is pronounced as "seek", not as "sick".

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Rescomp colour conversion

Post by TmEE co.(TM) » Sat Mar 17, 2018 7:41 am

I just do 255/34 in my tools and it works for linear and the nonlinear ramp too.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Post Reply