Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17049 Discussions

separate Y from CbCr in YCbCr

Altera_Forum
Honored Contributor II
2,852 Views

Hi 

 

I have YCbCr video data in two color spaces in sequence(on the same 8bit data bus). I want to separate Y component from CbCr. 

can you help me please! 

 

thank You
0 Kudos
12 Replies
Altera_Forum
Honored Contributor II
902 Views

If the video is 422 YCbCr you just extract every other data value with a toggling signal. 

 

so you get Y1 Cb1 Y2 Cr1 Y3 Cb2 Y4 Cr2 etc etc
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

Thank You Tricky for again replying me! 

 

toggling signal?? 

I am working in dsp builder v6.0. 

please guide me how is it possible in dsp builder?? 

 

actually I want to buffer a full frame (640x480) in real time video and then I have to divide it into blockset i.e 8x8 or 16x16 or 32x32. (I have to do all this in dsp builder) 

 

1st of all I have to separate Y from CbCr.
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

Your YCbCr signal probably has a data rate of 27MHz (pixel rate x2). You need to create a signal that toggles at 13.5MHz to pick out every Y value from the data stream, because thats how fast it change. 

 

All you need is a signal that looks something like this in VHDL: 

 

process(clk, reset) begin if reset = '1' then y_valid <= '0'; elsif rising_edge(clk) y_valid <= not y_valid; end if; end process;  

 

So in DSP builder you just need a register with the input being in inverted version of its output.
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

 

--- Quote Start ---  

 

A register with the input being in inverted version of its output. 

--- Quote End ---  

 

 

 

Why input being in inverted version of its output?? 

I can not understand it.
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

You are creating a toggle. You want to select the Y values while ignoring the C values you can use this toggle as the write enable on another register or memory.

0 Kudos
Altera_Forum
Honored Contributor II
902 Views

have you tried the Color Plane Sequencer?

0 Kudos
Altera_Forum
Honored Contributor II
902 Views

Hi thepancake! 

 

I am using dsp builder, quartus II v6.0, there is no color plane sequencer.
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

Hi Tricky! 

 

I have separate Y from CbCr By using 1to2 demux. 

And I made Y component to zero. 

 

Result is: 

The display is dark but little effects can be feel, when we move camera here and there. 

 

 

Is it prove that Y component are completely separated from CbCr???? 

 

Thank You
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

If you separated the Y component from the input, the output would be very clearly a black and white version of the input.  

 

So unless you are putting a camera in a dark room, maybe you've extracted Cb/Cr instead of Y. But if you did this, you'd have a screen that was mid-grey most of the time.
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

Hi Tricky! 

 

thanks for your guideline. 

I have made the following design flow: 

 

deinterlacer >> 1to2 demux(y=0,Cb and Cr = real video values) >>chroma resampler >> color space converter >> scaler megacore functions. 

 

So it means I have made Y=0, and play the video with just Cb and Cr values. After that I have used color space converter to make it RGB(that is connected to vga). 

 

I think it is fine because I set Y=0 (it means brightness=0) so output must be dark(as I brief in last post).
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

You need Y, Cb and Cr if you are going to colour space convert to RGB. Setting Y to 0 just kills an RGB output. The conversion is done via a matrix transform. But depending on what your input and output are for affects the matrix. 

 

Raw video off a DAC is likely to have Y values in the range 16 to 235. PC monitors often expect the range 0 to 255 for RGB for peak values, so you can either rescale the input to 0 to 255 or use a different matrix for the colour space conversion. 

 

The standard matrix for conversion is: 

 

(R) = ( 1.0 , 0.0 , 1.140 , 0.0 ) (Y ) (G) = ( 1.0 , -0.396 , -0.581 , 0.0 ) * (Cb-128) (B) = ( 1.0 , 2.029 , 0.0 , 0.0)) (Cr-128) So R = Y + 1.14(Cr-128) G = Y - 0.396(Cb-128) - 0.581(Cr-128) B = Y + 2.029(Cb-128)
0 Kudos
Altera_Forum
Honored Contributor II
902 Views

TO_BE_DONE

0 Kudos
Reply