Colour Match: Background to Frame

Designing hardware and software that uses the VS23S0X0 family of ICs as a 8-bit or SPI SRAM memory or as a Video Controller for generating Composite Video (TV-Out) or driving other kinds of displays.
Post Reply
wfriedrich
Senior User
Posts: 31
Joined: Tue 2017-08-08 13:46

Colour Match: Background to Frame

Post by wfriedrich »

Hello VLSI team,

I am trying to match the colour of my usable image background (default colour of all pixels) with the frame around the image (defined by the protoline).
I am using NTSC 320x200 with the attached 8bit palette, which is YUV422.
Palette.png
Palette.png (96.52 KiB) Viewed 2666 times
And the desired colour is the dark blue, circled in the palette image. The 8-bit pixel code for this colour is 0x41.

The protoline 16-bit words are interpreted as YUV844 data.
I use the following code to set the colour of the frame in Protoline 0:

Code: Select all

// Blue frame background
{
  	#define Frame  		0x44
    u_int16 w = BLANKEND;
	
    while (w < FRPORCH) {
		P42Display.SPIWriteWord (CH0, w++, (u_int16)(Frame<<8) + 0x66 + 9, false);
	}
}
The written hex word of 0x4409 is close to the desired blue, but only found by trying different numbers.
The SPIWriteWord(channel, addr, data, debug) function writes a 16-bit word into memory of one of the 4 channels in the VS23S040.

How would I calculate from my 8-bit pixel colour to the 16-bit protoline colour?

Thanks,
- Wolfgang.
Hannu
VLSI Staff
Posts: 537
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: Colour Match: Background to Frame

Post by Hannu »

It has been a while since I've worked with the video part of VS23S. And I haven't done any NTSC stuff. Hopefully we end up some sane result.

If I understood your microcode correctly:
1: u = Pick 2, shift 2
2: v = Pick 2, shift 2
3: y = Pick 4, shift 4
4: pick 1 shift none.

And let's work the 0x41 octet.

Code: Select all

0100 0001 0x41
0100 0001 -> u = 01
  00 0001 -> v = 00
     0001 -> y = 0001
Now we want it YUV844. Lets add some zeros.

Code: Select all

u = 0100
v = 0000
y = 00010000
Those would give in UVY format 0x4010
But that's probably not it. As protolines are referenced to SYNC_LEVEL, not BLACK_LEVEL. If we add BLACK_LEVEL to y component, it might correct. Or it is correct as it is awfully close what you have experienced.
wfriedrich
Senior User
Posts: 31
Joined: Tue 2017-08-08 13:46

Re: Colour Match: Background to Frame

Post by wfriedrich »

Hello Hannu,
Thanks for the explanation, I think it makes sense.
I am going to try this with and without added black level on my good colour monitor soon and report back.
- Wolfgang.
Post Reply