Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to convert YCrCb to RGB using FPGA?

Status
Not open for further replies.

etrobin

Member level 1
Joined
Feb 25, 2002
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
206
Dear all,

Anyone can show me how to convert YCrCb to RGB by FPGA???
The equation as .............

R = Y + 1.402 (Cr-128)
G = Y - 0.34414 (Cb-128) - 0.71414 (Cr-128)
B = Y + 1.772 (Cb-128)

Thank you for reply!!!:D

regards,
etrobin
 

ycrcb

That equation may not be quite right. Here is something to get you started.
Code:
//---------------------------------------------------------------
// red_pixel_reg = 19(y-16)/16 + 13(cr-128)/8
// grn_pixel_reg = 19(y-16)/16 - 25(cb-128)/64 - 13(cr-128)/16
// blu_pixel_reg = 19(y-16)/16 + 2(cb-128)
//---------------------------------------------------------------

//----------------------------------
// y_term = 19(y-16)/16 
//----------------------------------
always@( y_sub1 )
begin
    y_mult = 5'h13 * y_sub1;
end

//-------------------------------------------------
//   13(cr-128)/8
//   13(cr-128)/16
//-------------------------------------------------
always@( cr_sub1 )
begin
    cr_mult = 4'hd * cr_sub1;
end

//----------------------------------------------------
// add
// grn_pixel_reg = y_term - grn_cr_term - grn_cb_term
//-----------------------------------------------------
always@(grn_cr_term or grn_cb_term )
begin
    grn_term =  -grn_cr_term - grn_cb_term;
end

always@( y_term or grn_term )
begin
    grn_add = y_term + grn_term;
end

You need to register the values, normalize each term, perform two's complement if necessary, find the multiplicand, and perform the multiplication and addition. Not exactly trivial.
 

ycrcb to rgb formula

Hi etrobin,

perhaps a bit late, but Xilinx offers comprehensive information about color space conversion. Appnote xapp283 describes YCrCb to RGB, xapp637 the other way.
I came across this today while evaluating the Xilinx System Generator where they have a Simulink model for RGB to YCrCb.

HTH,
Holger
 

rgb to ycrcb

it also depend what is the format of the YCBCR. in most cases you will also
need to do upsampling of the YCBCR data and also some sort of filtering.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top