Schrijver
| Question about MSX1 palette
| mrbolha msx friend Berichten: 6 | Geplaatst: 17 Maart 2007, 16:48   | Hello!
I've spent the last 12 hours trying to figure out how to derive the RGB values of the MSX1 color palette from the TMS9918 datasheet. I couldn't find any clear indication on how to calculate the RGB values from the Y, R-Y and B-Y values given in the datasheet. The values are given as percents of the black/white voltage swing, and it doesn't help me to figure out how do these values translate into (possibly) Y'PbPr colorspace, so I can apply the proper transformation matrix.
I have already found one derivation here:
http://bifi.msxnet.org/msxnet/tech/tms9918a.txt
Which by the way are the same values used in BlueMSX. However, this calculation derives the RGB values without taking into consideration the whole transformation matrix, as given here:
http://en.wikipedia.org/wiki/YCbCr
and here:
http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC28
Anyway, I couldn't figure out how to translate de relative-voltage values. Does the 0.47 black level means that I have to subtract 0.47 from every value in order to get them to the [-0.5, 0.5] range defined for this color space? What happens with a value of 1.0, like the Dark Blue color? Should I instead subtract 0.5? Would it mean that black is not completely black?
I believe the key to understanding this is to understand how outputs signals Y, B-Y and R-Y are processed in a RGB encoder or in a monitor. However, I lack the necessary hardware knowledge. Can anyone help?
Thanks,
Leonardo | | manuel msx guru Berichten: 3531 | Geplaatst: 17 Maart 2007, 17:21   | Here's how openMSX does it. | | mrbolha msx friend Berichten: 6 | Geplaatst: 04 April 2007, 13:33   | I can see that openMSX uses the exact same palette as blueMSX.
I've done my own calculations, and arrived at these values:
0, 0, 0
0, 241, 20
68, 249, 86
85, 79, 255
128, 111, 255
250, 80, 51
12, 255, 255
255, 81, 52
255, 115, 86
226, 210, 4
242, 217, 71
4, 212, 19
231, 80, 229
208, 208, 208
255, 255, 255
What I did was to apply gamma correction, so that the 0.47 from the datasheet would fall at 0.5 without changing the 0-1 extremes, and used the proper YCbCr conversion, considering that the values were normalized. Also, I clamped resulting values below zero and above 255.
What do you think about this palette? I believe my yellow tones are much better ;-)
--
Leonardo
| | ro msx guru Berichten: 2346 | Geplaatst: 04 April 2007, 15:22   | ...waiting for _Wolf to comment  | | wolf_
 msx legend Berichten: 4777 | Geplaatst: 04 April 2007, 15:35   | Oo?
I'd go for the Mexican color scheme any day..  | | mrbolha msx friend Berichten: 6 | Geplaatst: 04 April 2007, 20:15   | ¡Yo no lo compreendo, señor!
| | wolf_
 msx legend Berichten: 4777 | Geplaatst: 04 April 2007, 21:33   | never mind, inside joke  | | dvik msx master Berichten: 1339 | Geplaatst: 04 April 2007, 21:52   | I'll give your palette a try Leornado. blueMSX uses indeed the derivation you mention. I'll connect my real MSX and emulator to the same monitor and see which palette looks closest to the real MSX.
| | manuel msx guru Berichten: 3531 | Geplaatst: 04 April 2007, 22:38   | depends on both your monitors and NTSC vs PAL I suppose.... It's really tough to make such a decision. OTOH: it's nice to see the values from a different approach.
| | ro msx guru Berichten: 2346 | Geplaatst: 05 April 2007, 10:34   | Quote:
| never mind, inside joke 
|
 Yeah, that 1 never grows tired. hahah | | mrbolha msx friend Berichten: 6 | Geplaatst: 05 April 2007, 14:34   | I've just read the article about the YUV color space, and redone my calculations. I was using the YCbCr transform, now I tried the YUV transform:
0, 0, 0
38, 229, 0
100, 240, 49
93, 57, 255
132, 94, 255
214, 104, 20
64, 228, 255
253, 111, 15
255, 145, 49
216, 230, 0
232, 233, 14
40, 202, 0
205, 86, 255
208, 208, 208
255, 255, 255
It felt weird, though. The red tones seem a little bit too orange...
| | mrbolha msx friend Berichten: 6 | Geplaatst: 05 April 2007, 14:58   | Serves me right for doing things in a hurry... I made a mistake, now it's correct with regard to YUV color space. These are really cool!
0, 0, 0
0, 241, 20
68, 249, 86
85, 79, 255
128, 111, 255
250, 80, 51
12, 255, 255
255, 81, 52
255, 115, 86
226, 210, 4
242, 217, 71
4, 212, 19
231, 80, 229
208, 208, 208
255, 255, 255
Leonardo
| | mrbolha msx friend Berichten: 6 | Geplaatst: 05 April 2007, 15:05   | OMG... the last values are the same with regard to YCbCr colorspace...
I triple checked it: i used different matrices to make the calculations. Maybe it means something?
| | hap msx addict Berichten: 504 | Geplaatst: 05 April 2007, 16:56   | Like manuel noted, it depends on the screen (monitor/tv) decoder, and also user-preferred hue, saturation, brightness, contrast, gamma. There is no single "best" MSX1 palette. The matrices you're calculating with are probably based on standard NTSC.
| | hap msx addict Berichten: 504 | Geplaatst: 06 April 2007, 10:57   | Somewhat related, an old discussion about custom MSX1 palettes: http://www.bluemsx.com/blueforum/viewtopic.php?t=1281
If (to make mrbolha happy  ) emulator authors are planning to implement user-customised MSX1 palettes, we should use a standard for inter-compatibility. I suggest a binary 45 byte .pal file, with as contents 24-bit r,g,b data of the 15 colours. | |
| |
| |