Page 1 of 1

Rescomp colour conversion

Posted: Fri Mar 16, 2018 9:49 am
by matteus
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

Re: Rescomp colour conversion

Posted: Fri Mar 16, 2018 2:10 pm
by Grind
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);
}

Re: Rescomp colour conversion

Posted: Fri Mar 16, 2018 2:44 pm
by Sik
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.

Re: Rescomp colour conversion

Posted: Sat Mar 17, 2018 7:41 am
by TmEE co.(TM)
I just do 255/34 in my tools and it works for linear and the nonlinear ramp too.