I'm taking in YCbCr 4:2:2 input video from our FPGA (ID=1, style 3, 24 bit) where only the Y[11:0] bits are being used to represent grayscale video, the Cb/Cr[11:0] bits are static at 0x880 (ideally it would be 0x800 but the 8 LSBs are hard-wired). At the moment I don't have a way to capture 12 bit color depth video so I'm letting the ADV7513 stay in DVI mode which forces the output to be RGB, and I've tried using both 4:2:2 and 4:4:4 output formats for the sake of this question.
I'm setting these register values (note this is a subset of my initialization settings):
0x15 = 0x01
0x16 = 0x2E
0x55 = 0x12
0xAF = 0x04
Since I don't want Cb/Cr to influence my output colormap, I've enabled and set up the CSC coefficients like this (CSC_mode=1):
A1 A2 A3 A4
0 2047 0 0
B1 B2 B3 B4
0 2048 0 0
C1 C2 C3 C4
0 2047 0 0
i.e., zeroing out all but A2,B2,C2 makes it so only Y applies. With this I get a good black to white grayscale video output, and the above coefficients make all 3 CSC output channels span 0-4095 as Y goes from 0-4095.
I can also set the coefficients to give an inverted video output like this:
A1 A2 A3 A4
0 -2047 0 2047
B1 B2 B3 B4
0 -2047 0 2047
C1 C2 C3 C4
0 -2047 0 2047
All 3 CSC output channels span 4094-1 as Y goes from 0-4095, so video goes white to black.
From the above I'm presuming that no clipping is being done to the output channels since at no time does the 12 bit output go below 0 or above 4095. Further, I'm presuming that the ADV7513 is automatically scaling the 12 bit outputs down to 8 bits for RGB 4:4:4 output format.
Now I want to make some pseudocolor maps, so I tried this (CSC_mode=0):
A1 A2 A3 A4
0 4095 0 -2047
B1 B2 B3 B4
0 4095 0 -1023
C1 C2 C3 C4
0 4095 0 0
The equations yield Red channel output going -2047 to 2047, Green channel output going -1023 to 3071, and Blue channel output going 0 to 4094. If I assume negative values will be clipped to 0 by the CSC, then I should get video that goes from black into brightening shades of blue as Y goes 0-4095. However, when implemented I get video going from orange into white. Shouldn't the clipping registers 0xC0-0xC7 take care of negative output values (i.e. less than the programmed 0x000)?
Another scheme I tried:
A1 A2 A3 A4
0 4095 0 0
B1 B2 B3 B4
0 0 0 0
C1 C2 C3 C4
0 -4096 0 4095
This keeps Green channel output at 0, Red goes 0-4094 and Blue goes 4095-0. I would expect this would yield video going from blue through red as Y goes 0-4095. However, when implemented I get video going from green through yellow. Am I not understanding something about how the CSC is computing RGB output?
Thanks.