YCbCr10Bit to RGB888 Converter - Documentation

YCbCr10-Bit to RGB888 Converter
April 2013
Reference Design RD1157
Introduction
YCbCr 10-bit to RGB888 converter converts YCbCr 4:2:2 10-bit color space information to RGB888 color space. To
facilitate easy insertion to practical video systems, the design example takes up to three video stream control signals (H_SYNC, V_SYNC, FID, and DEN) and delays them appropriately, so that control signals can be easily synchronized with the output video stream.
Features
• 10-bit YCbCr 4:2:2 input and RGB888 output
• Pipelined implementation
• Latency of four cycles
• H_SYNC, V_SYNC, FID and DEN control signals for video synchronization
• VHDL RTL and functional test bench
System Block Diagram
Figure 1. System Block Diagram
iCE CMD
i_PIX_CLK
IO
i_RESET_B
IO
o_RGB_DEN
IO
i_PIX_DEN
IO
o_RGB_HSYNC
IO
i_PIX_HSYNC
YCbCr
Source
o_RGB_VSYNC
IO
i_PIX_VSYNC
IO
i_PIX_FID
IO
i_Y_PIX[9:0]
IO
i_Cr_PIX[9:0]
IO
i_Cb_PIX[9:0]
IO
YCbCr 10bit
to RGB888
Converter
IO
o_RGB_FID
RGB
Device
IO
o_RGB_DATA
IO
© 2013 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at www.latticesemi.com/legal. All other brand
or product names are trademarks or registered trademarks of their respective holders. The specifications and information herein are subject to change without notice.
www.latticesemi.com
1
rd1157_01.0
YCbCr10-Bit to RGB888 Converter
Signal Description
Table 1. Signal Description
Signal Name
Width
Pin Type
Signal Description
i_PIX_CLK
1
Input
Input pixel clock
i_RESET_B
1
Input
Active high asynchronous system reset
i_PIX_DEN
1
Input
Synchronous Data enable(YCbCr valid)
i_PIX_HSYNC
1
Input
Horizontal Sync
i_PIX_VSYNC
1
Input
Vertical Sync
i_PIX_FID
1
Input
Input Frame ID(odd/even field indicator)
i_Y_PIX[9:0]
10
Input
Y component of pixel
i_Cr_PIX[9:0]
10
Input
Cr component of pixel
i_Cb_PIX[9:0]
10
Input
o_RGB_DEN
1
Output
Cb component of pixel
RGB Data valid
o_RGB_HSYNC
1
Output
Pipelined Horizontal Sync
o_RGB_VSYNC
1
Output
Pipelined Vertical Sync
o_RGB_FID
1
Output
Output odd/even field indicator
o_RGB_DATA[23:0]
24
Output
Converted RGB pixel
Functional Block Diagram
Figure 2. Functional Block Diagram
F/F
Y-64
M
U
L
i_PIX_CLK
F/F
A
D
D
F/F
MIN/
MAX
F/F
R
i_RESET_B
o_RGB_DEN
i_PIX_DEN
i_PIX_HSYNC
Cr512
o_RGB_FID
F/F
M
U
L
i_PIX_VSYNC
F/F
A
D
D
F/F
MIN/
MAX
o_RGB_HSYNC
F/F
G
o_RGB_DATA
i_PIX_FID
i_Y_PIX[9:0]
i_Cr_PIX[9:0]
o_RGB_VSYNC
Cb512
F/F
i_Cb_PIX[9:0]
M
U
L
F/F
A
D
D
F/F
MIN/
MAX
F/F
B
Configurable parameter
None
2
YCbCr10-Bit to RGB888 Converter
Register Map
This design does not have any user accessible registers or memory.
Design Details
This module converts 10-bit YCbCr 4:2:2 to RGB888 as per the following conversion expressions:
• R = 1.164(Y-64) + 1.596(Cr-512)
• G = 1.164(Y-64) - 0.813(Cr-512) - 0.392(Cb-512)
• B = 1.164(Y-64) + 2.017(Cb-512)
The implementation comprises of a set of constant coefficient multipliers and add/sub logic arranged in pipelined
fashion. Considering the large amount of data path involved here, a pipelined implementation is provided here to
improve the performance. If the converted R, G and B values falls outside the allowed range, then the values are
clipped and limited to the maximum/minimum possible range. This is a fully synchronous design and all the modules listed in the block diagram generates registered output through input pixel clock. To facilitate easy insertion to
practical video systems, the design makes use of video synchronization signals pixel clock (i_PIX_CLK), valid data
indicator (i_PIX_DEN) and generates a delayed version of i_PIX_HSYNC, i_PIX_VSYNC, i_PIX_DEN and
i_PIX_FID so that control signals synchronized with the output RGB888 stream.
Initialization Conditions
This design does not have any user specific initialization conditions.
Timing Diagram
Figure 3. Timing Diagram
i_PIX_CLK
i_RESET_B
i_PIX_HSYNC
i_PIX_VSYNC
i_PIX_FID
i_PIX_DEN
i_Y/Cr/Cb_PIX
o_RGB_HSYNC
o_RGB_VSYNC
o_RGB_FID
o_RGB_DEN
o_RGB_DATA
3
YCbCr10-Bit to RGB888 Converter
Simulation Waveforms
Figure 4. Simulation Waveforms
Usage Examples
Common YCbCr video sources include NTSC video decoders, MPEG decoders, and cameras. YCbCr to RGB converters are useful in applications like Video Surveillance, Display Systems, Image/Video processing applications,
Image decompression systems etc…
Example usage of this module is illustrated in the block diagram below, which interfaces NTSL/PAL/SECAM Video
Decoder to a Display system. Video Pixelization module decodes YCbCr stream and generates HSync, VSync,
DEN and FID control signals.
Simulation setup comprises of a testbench which provides input Y, Cb, Cr values for various colors like red, blue,
green, white, black, cyan, magenta and yellow. The DUT generated output RGB888 values are compared against
the corresponding known RGB888 values.
4
YCbCr10-Bit to RGB888 Converter
Figure 5. Usage Example
Control
Control
TVP5150
Video
Decoder
VideoInterface
Pixelization
Display
Buffer and
LCD
Controller
YCrCb2RGB
Converter
YCbCr
Memory
Implementation
This design is implemented in VHDL. When using this design in a different device, density, speed or grade, performance and utilization may vary.
Performance and Resource Utilization
Table 2. Performance and Resource Utilization
Family
Language
Utilization (LUTs)
fMAX (MHz)
I/Os
Architecture
Resources
iCE401
VHDL
336
>50
63
(70/160) PLBs
1. Performance and utilization characteristics are generated using iCE40-LP1K-CM121 with iCEcube2 design software.
References
• iCE40 Family Handbook
Technical Support Assistance
Hotline: 1-800-LATTICE (North America)
+1-503-268-8001 (Outside North America)
e-mail: [email protected]
Internet: www.latticesemi.com
Revision History
Date
Version
April 2013
01.0
Change Summary
Initial release.
5