Author Topic: ADV7513 Colour Correction  (Read 2342 times)

0 Members and 2 Guests are viewing this topic.

Offline ninja1980Topic starter

  • Newbie
  • Posts: 3
  • Country: gb
ADV7513 Colour Correction
« on: August 13, 2023, 01:06:11 pm »
I'm very new into the world of FPGAs.  I am trying use a 24bit RGB (4:4:4) signal which I've generated from the FPGA to feed into a ADV7513.  I've managed to output a stable signal at 720p and 1080p.  The only issue I'm having is the colour seems to be off in the output.  I've captured the HMDI signal and I'm getting a discrepancy within the RGB values (it is also noticeable on the TV).  All component values seem to be out, but the Red seems to be the most affected. 

I've been pulling my hair out over this for weeks  |O 

Does anyone have any experience with the ADV7513 or have any suggestions? It would be massively appreciated.
« Last Edit: August 13, 2023, 01:35:10 pm by ninja1980 »
 

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1730
  • Country: gb
Re: ADV7513 Colour Correction
« Reply #1 on: August 13, 2023, 02:32:11 pm »
Are you running into the difference between the computer world and the TV world? The former uses the whole 0 to 255 range whereas the latter uses 16 for black level and 239 for peak white.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8766
  • Country: ca
    • LinkedIn
Re: ADV7513 Colour Correction
« Reply #2 on: August 13, 2023, 03:55:44 pm »
Do you have the ADV7513's programmers guide?
Did you try disabling the built in color space converter for a direct RGB drive?
What the color error, is it off by a fixed fraction, or is it just wrong colors everywhere?
Are you using it in HDMI or DVI mode?
Did you set the HDMI mode to RGB or YUV?

I've used the ADV7510 and AD7513 without color issues.  You need to read their programmer's guide...

Here is my simple AD7513 setup for dumb DVI/HDMI transmit mode.  (HDMI mode enables audio support)

Code: [Select]
localparam            HDMI_TABLE_len                       = 34 ; // Optional, length of init table.
localparam bit [16:0] HDMI_TABLE_data [0:HDMI_TABLE_len-1] = '{   // Optional, init LUT data.  17'h {1'function,8'register_address,8'write_data},...
   // ADV7513 HDMI transmitter setup.
   17'h1_02FF, // Delay for 255 millisecond.
   17'h1_0072, // 4 Set ADV7513 HDMI transmitter's device address.
               // Program ADV7513 HDMI transmitter's registers.
   17'h0_9803, // Must be set to 0x03 for proper operation
   17'h0_0100, // Set 'N' value at 6144
   17'h0_0218, // Set 'N' value at 6144
   17'h0_0300, // Set 'N' value at 6144
   17'h0_1470, // Set Ch count in the channel status to 8.
   17'h0_1520, // Input 444 (RGB or YCrCb) with Separate Syncs, 48kHz fs
   17'h0_1630, // Output format 444, 24-bit input
   17'h0_1846, // Disable CSC
   17'h0_4080, // General control packet enable
   17'h0_4110, // Power down control
   17'h0_49A8, // Set dither mode - 12-to-10 bit
   17'h0_5510, // Set RGB in AVI infoframe
   17'h0_5608, // Set active format aspect
   17'h0_96F6, // Set interrup
   17'h0_7307, // Info frame Ch count to 8
   17'h0_761f, // Set speaker allocation for 8 channels
   17'h0_9803, // Must be set to 0x03 for proper operation
   17'h0_9902, // Must be set to Default Value
   17'h0_9ae0, // Must be set to 0b1110000
   17'h0_9c30, // PLL filter R1 value
   17'h0_9d61, // Set clock divide
   17'h0_a2a4, // Must be set to 0xA4 for proper operation
   17'h0_a3a4, // Must be set to 0xA4 for proper operation
   17'h0_a504, // Must be set to Default Value
   17'h0_ab40, // Must be set to Default Value

//   17'h0_af16, // Select HDMI mode
   17'h0_af14, // Select DVI mode

   17'h0_ba60, // No clock delay
   17'h0_d1ff, // Must be set to Default Value
   17'h0_de10, // Must be set to Default for proper operation
   17'h0_e460, // Must be set to Default Value
   17'h0_fa7d, // Nbr of times to look for good phase

   17'h1_0101  // Allow loop the reprogramming since the ADV7513 monitor HPD doesn't always work.
};

I2C utility: https://github.com/BrianHGinc/BHG_I2C_init_RS232_debugger

Offline ninja1980Topic starter

  • Newbie
  • Posts: 3
  • Country: gb
Re: ADV7513 Colour Correction
« Reply #3 on: August 14, 2023, 08:07:48 am »
Thanks for the reply.  The colour discrepancy seems to be mostly in the red space with HMDI output.  I've followed the programming guide and I've extracted my current code below but I cant see any errors.   

Code: [Select]

-- Select between YCbCr 4:2:2 and RGB 4:4:4 modes
   g_rgb444_support : if (RGB444 >= 2) generate
      cfg_ycbcr_mode <= not cfg_rgb444;
   end generate;
   g_no_rgb444_support : if (RGB444 <= 1) generate
      cfg_ycbcr_mode <= '1' when (RGB444 = 0) else '0';
   end generate;

   -- Instructions
   data <=
      ("0000000001110100010010000010",
       -- Power-up the TX
       x"72" & "1" & x"41" & "1" & x"10" & "10",
       -- Fixed registers that must be set on power up
       x"72" & "1" & x"98" & "1" & x"03" & "10",
       x"72" & "1" & x"9A" & "1" & x"E0" & "10",
       x"72" & "1" & x"9C" & "1" & x"30" & "10",
       x"72" & "1" & x"9D" & "1" & x"61" & "10",
       x"72" & "1" & x"A2" & "1" & x"A4" & "10",
       x"72" & "1" & x"A3" & "1" & x"A4" & "10",
       x"72" & "1" & x"E0" & "1" & x"D0" & "10",
       x"72" & "1" & x"F9" & "1" & x"00" & "10",
       -- Set up the video input mode
       x"72" & "1" & x"14" & "1" & x"02" & "10",
       x"72" & "1" & x"15" & "1" & x"3" & "000" & cfg_ycbcr_mode & "10",
       x"72" & "1" & x"16" & "1" & cfg_ycbcr_mode & "011" & x"9" & "10",
       x"72" & "1" & x"48" & "1" & x"0" & conv_std_logic_vector(1-ADV7513, 1) & "000" & "10",
       x"72" & "1" & x"BA" & "1" & x"A0" & "10",
       x"72" & "1" & x"D0" & "1" & x"3C" & "10",
       -- Set up the video output mode
       x"72" & "1" & x"AF" & "1" & x"06" & "10",
       x"72" & "1" & x"55" & "1" & "00" & cfg_ycbcr_mode & "0" & x"0" & "10",
       x"72" & "1" & x"56" & "1" & x"08" & "10",
       x"72" & "1" & x"DE" & "1" & x"18" & "10",
       -- Audio setup
       x"72" & "1" & x"02" & "1" & x"10" & "10",
       x"72" & "1" & x"40" & "1" & x"80" & "10",
       x"72" & "1" & x"73" & "1" & x"01" & "10",
       -- Audio mode
       x"72" & "1" & x"0C" & "1" & x"84" & "10",
       x"72" & "1" & x"0D" & "1" & x"10" & "10",
       -- Monitor sense input
       x"72" & "1" & x"96" & "1" & x"20" & "10");

 

Offline ninja1980Topic starter

  • Newbie
  • Posts: 3
  • Country: gb
Re: ADV7513 Colour Correction
« Reply #4 on: August 14, 2023, 08:08:29 am »
This is a really good point but I've tested both modes and it gives the same results.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8766
  • Country: ca
    • LinkedIn
Re: ADV7513 Colour Correction
« Reply #5 on: August 14, 2023, 02:49:27 pm »
   17'h0_1630, // Output format 444, 24-bit input
   17'h0_1846, // Disable CSC

This bypasses all color processing.  The data at the digital inputs are fed directly as HDMI/DVI data.
I've been using it flawlessly.  If you are using this, then the problem is on your other side.

If you are transmitting YUV data, then you will be F-ed up as you then need to set the HDMI flags to tell the other side which color space you are using, ITU-R BT.601, or  ITU-R BT.709.  You also need to make sure you encode your source RGB into the appropriate color space.  It gets worse, some TVs and capture cards may assume 709 even if you set 601 in the description header.  You also need to set the amplitude, in the description header, 16-239, or 0-255, not to mention will your receiver respond automatically to the header, or assume a video signal where some may perform an auto black crush and auto contrast.  All in all, there are something like 64 tables of CSC settings to cross accommodate all the possibilities from the different color standards and you need to get everything right or the picture may be pink looking, or green looking, pale, or too contrasty.  Color bands will also appear from missing colors if you do not use RGB raw when you get the chance because any YUV conversion will only have around around 4 million colors out of the true 16million when sticking with RGB 0-255.  This usually leads to circular bands when dealing with the lower shaded color or foggy scenes in video.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf