Microsemi UG0639 Color Space Conversion User Guide

June 5, 2024
Microsemi

UG0639
User Guide
Color Space Conversion

Revision History

The revision history describes the changes that were implemented in the document. The changes are listed by revision, starting with the current publication.

Revision 5.0

The following is a summary of the changes in this revision.

  • Updated Figure 1, page 3, and Figure 3, page 4.
  • Updated Table 6, page 6, and Table 7, page 8.
  • Added figures to show system-level block diagram. See, Figure 2, page 3, and Figure 4, page 4.
  • Added figure to show testbench results. See, Figure 8, page 8, and Figure 10, page 8.
  • Added table for input and output ports of the RGB to YCbCr422 block. See, Table 3, page 5.
  • Resource Utilization tables were added. See, Table 8, page 9, and Table 10, page 9.
  • Added sections Key Features, page 4, Supported Families, page 4, License, page 7, Obfuscated, page 7, and RTL, page 7.
Revision 4.0

The following is a summary of the changes in this revision.

  • Los and equations were updated.
  • Figure 1, page 3, and Figure 3, page 4 were updated.
  • Input and Output Port were updated. See, Table 2, page 5, and Table 4, page 6.
  • Added figure to show Testbench results. See, Figure 7, page 8, and Figure 9, page 8.
  • Resource Utilization values were updated. See, Resource Utilizations, page 8.
Revision 3.0

Updated the Resource Utilization section and the Resource Utilization Report. See Resource Utilization, page 8.

Revision 2.0

The following is a summary of the changes in this revision.

  • The Testbench section was added to the document as per SAR 76100. For more information, see Testbench, page 8.
  • Resource Utilization values were updated as per SAR 76100. For more information, see Resource Utilization, page 8.
Revision 1.0

The first publication of this document.

Introduction

A color space is a mathematical representation of a set of colors. The most popular color models are:

  • RGB – Used in computer graphics
  • YIQ, YUV, and YCbCr – Used in video compression

The red, green, and blue (RGB) color space is widely used in computer graphics. These are three primary additive colors and are represented by a three-dimensional, Cartesian coordinate system. These three colors are used to create any desired color. Therefore, the choice of the RGB color space simplifies the architecture and design of the system. Also, the system that is designed using the RGB color space takes advantage of a large number of existing software routines.

However, RGB is not very efficient in terms of bandwidth as all the three components have to be present in equal bandwidth to produce any color. So an RGB-based frame buffer must have the same pixel depth and display resolution for each RGB component. Processing an image in RGB color space is usually not the most efficient method. For example: to modify the intensity or color of a given pixel, the three RGB values must be read from the frame buffer, the intensity or color calculated, desired modifications performed, new RGB values calculated, and written back into the frame buffer.

The same can be achieved if the image color properties are stored directly in intensity and color format.

Due to this reason, many video standards use luma and two color difference signals. One of the common color spaces in this format is the YCbCr color space format.

The YCbCr color space was developed as part of ITU-R VT.601 during the development of a worldwide digital component video standard. The luma component Y is defined to have a nominal 8-bit range of 16235 range of values. The color information is represented as Cb and Cr with a nominal 8-bit range of 16240 range of values. There are several
YCbCr sampling formats such as 4:4:4, 4:2:2,4:1:1, and 4:2:0.

Table 1 • YCbCr Sample Formats

YCbCr Sample

Format Description
4:4:4 Each sample has a Y, a Cb, and a Cr value represented typically using

8-bits or 10-bits per component. Therefore, each sample in a 4:4:4 sampling format requires either 24-bits or 30 bits.
4:2:2| In the 4:2:2 sampling format, for every two horizontal Y samples, there is one Cb and Cr value. Each component sample is typically represented as 8-bits or 10-bits. Therefore, each sample in a 4:2:2 sampling format requires either 16-bits or 20-bits.
4:1:1| In the 4:1:1 sampling format, for every four horizontal Y samples, there is one Cb and Cr value. Each component sample is typically represented as 8-bits. Therefore, each sample in a 4:1:1 sampling format requires 12-bits.
4:2:0| In the 4:2:0 sampling format, the 2:1 reduction is done on both horizontal and vertical values. It is commonly used in video compression.

The advantages and disadvantages of various color space formats lead to requirements for color space conversions. The objective is to convert the video inputs into the desired color space before performing any video processing on it. The RGB to YCbCr and vice-versa conversion is one such example.

Hardware Implementation

This section describes the implementation of the Color Space Conversion block.

Design Description

The Color space conversion IP block contains two modules — RGB to YCbCr and YCbCr to RGB. The RGB to YCbCr Color Space Converter IP module implements the equations to convert 24-bit input RGB color samples to 24-bit YCbCr output samples. The YCbCr to RGB Color Space Converter IP module converts vice-versa of the RGB to YCbCr. Both the converters use a 4:4:4 sampling format.

Both the modules take data-enabled, as inputs and pipeline them accordingly to match the conversion video data outputs.

To convert the floating-point constants into integer multiplication, the floating point constants are scaled by multiplying these constants with 2₈= 256. Then after the computation of the above equations, the output is divided by the scaling factor 2₁₆ = 65536.

After scaling, the RGB to YCbCr equations are:
Y= 16 + 65.738R/256 + 129.057G/256 + 25.064B/256
Cb = 128-37.945
R/256 – 74.494G/256 + 112.439B/256
Cr = 128+112.439R – 94.154G/256 – 18.285B/256
After scaling, the YCbCr to RGB equations are:
R = 298.082
Y/256 + 408.583 Cr/256 – 222.921
G = 298.082
Y/256 -100.291Cb/256 – 208.120Cr/256 + 135.576
B = 298.082Y/256 + 516.412Cb/256 – 276.836
The following figures show the system-level block diagrams of the RGB to YCbCr block.

Figure 1 • System-Level Block Diagram of RGB to YCbCr444

Figure 2 • System-Level Block Diagram of RGB to YCbCr422

The following figures show the system-level block diagrams of the YCbCr to RGB blocks.

Figure 3 • System-Level Block Diagram of YCbCr444 to RGB

Figure 4 • System-Level Block Diagram of YCbCr422toRGB

Key Features
  • Supports RGBtoYCbCr444 and RGBtoYCbCr422 upsampling color space conversion also supports YCbCr444toRGB and YCbCr422toRGB downsampling color space conversion.
  • Supports 8, 10, and 12 data width.
Supported Families
  • PolarFire® SoC
  • PolarFire®
  • RTG ™4
  • IGLOO®2
  • SmartFusion ®2
Inputs and Outputs

The following tables show the input and output ports of the RGB to YCbCr.

Table 2 • Input and Output Ports of the RGB to YCbCr444 Block

Signal Name Direction Width Description
RESET_N_I Input Active low asynchronous reset signal to

design
CLOCK_I| Input| –| System clock
RED_I| Input| [(G_RGB_DATA_BIT_WIDTH-1):0]| Red pixel data input
GREEN_I| Input| [(G_RGB_DATA_BIT_WIDTH-1):0]| Green pixel data input
BLUE_I| Input| [(G_RGB_DATA_BIT_WIDTH-1):0]| Blue pixel data input
DATA_VALID_I| Input| –| Input data valid signal
YOUT0| Output| [(G_YCbCr_DATA_BIT_WIDTH-1):0]| Y pixel data output
Cb_OUT_O| Output| [(G_YCbCr_DATA_BIT_WIDTH-1):0]| Cb pixel data output
Cr OUT 0| Output| [(G_YCbCr_DATA_BIT_WIDTH-1):0]| Cr pixel data output
DATA VALID 0| Output| –| Output data valid signal

Table 3 • Input and Output Ports of the RGB to YCbCr422 Block

Signal Name Direction Width Description
RESET_N_I Input Active low asynchronous reset signal to design
CLOCK_I Input System clock
RED_I Input [(G RGB DATA BIT WIDTH-1):0] Red pixel data input
GREEN_I Input [(G RGB DATA BIT WIDTH-1):0] Green pixel data input
BLUE_I Input [(G RGB DATA BIT WIDTH-1):0] Blue pixel data input
DATA_VALID_I Input Input data valid signal
Y OUT Output [(G_YCbCr_DATA_BIT_WIDTH-1):O] Y pixel data output
C OUT Output [(G_YCbCr_DATA_BIT_WIDTH-1):0] C pixel data output
DATA VALID 0 Output Output data valid signal

The following tables show the input and output ports of the YCbCr to RGB blocks.

Table 4 • Input and Output Ports of the YCbCr444-to-RGB Block

Signal Name Direction Width Description
RESET N I Input Active low asynchronous reset signal to design
CLOCK_I Input System clock
Y I Input [(GYCbCr DATA BIT WIDTH-1):0] Y pixel data input
Cb_I Input [(G_YCbCr_DATA_BIT_WIDTH-1):0] Cb pixel data input
CU Input [(G_YCbCr_DATA_BIT_WIDTH-1):0] Cr pixel data input
DATA VALID I Input Input data valid signal
RED_O Output [(G_RGB_DATA_BIT_WIDTH-1):0] Red pixel data output
GREEN_O Output [(G_RGB_DATA_BIT_WIDTH-1):0] Green pixel data output
BLUE_O Output [(G_RGB_DATA_BIT_WIDTH-1):0] Blue pixel data output
DATA VALID 0 Output Output data valid signal

Table 5 • Input and Output Ports of the YCbCr422 to RGB Block

Signal Name Direction Width Description
RESET N I Input Active low asynchronous reset signal to design
CLOCK_I Input System clock
Y I Input [(G_YCbCr_DATA_BIT_WIDTH-1):0] Y pixel data input
C_I Input [(G_YCbCr_DATA_BIT_WIDTH-1):0] C pixel data input
DATA VALID I Input Input data valid signal
REDO Output [(G_RGB_DATA_BIT_WIDTH-1):0] Red pixel data output
GREEN_O Output [(G_RGB_DATA_BIT_WIDTH-1):0] Green pixel data output
BLUE_O Output [(G_RGB_DATA_BIT_WIDTH-1):0] Blue pixel data output
DATA VALID 0 Output Output data valid signal
Configuration Parameters

The following table shows the configuration parameters used in the hardware implementation of RGB to YCbCr and YCbCr to RGB blocks. These are generic parameters and can be varied as per the application requirements.

Table 6 • configuration Parameters

Name Description
G RGB DATA BIT WIDTH RGB data bit width
G YCbCr DATA BIT WIDTH YCbCr data bit width
G YCbCr_FORMAT YCbCr444 and YCbCr422

License

Color space conversion IP clear RTL is license locked and the obfuscated RTL is available for free.

Obfuscated

Complete RTL code is provided for the core, allowing the core to be instantiated with the SmartDesign tool. Simulation, synthesis, and layout can be performed within Libero
® System-on-Chip (SoC). The RTL code for the core is obfuscated.

RTL

Complete RTL source code is provided for the core.

Timing Diagrams

The following figure shows the timing diagrams of RGB to YCbCr444.

Figure 5 • Timing Diagram of RGB to YCbCr444

Figure 6 • Timing Diagram of YCbCr444 to RGB

Note: All other input signals get delayed by the clock cycles as shown in Figure 6, page 7.

Testbench

A testbench is provided to check the functionality of the Color Space Converter core. The following figure shows the testbench results for RGB to YCbCr color space conversion.

Resource Utilizations

The color space conversion block is implemented on an M2S150T SmartFusion® 2 System-on-Chip (SoC) FPGA in the FC1152 package) and PolarFire FPGA (MPF300TS_ES – 1FCG1152E package). The following tables show the Resource Utilization of RGB to YCbCr.

Table 7 • Resource Utilization of RGB to YCbCr444

Resource Usage
DFFs 51
4-input LUTs 86
MACC 9
RAM1kx18 0
RAM64x18 0

Table 8 • Resource Utilization of RGB to YCbCr422

Resource Usage
DFFs 69
4-input LUTs 94
MACC 9
RAM1kx18 0
RAM64x18 0

The following table shows the Resource Utilization of YCbCr to RGB.

Table 9 • Resource Utilization of YCbCr444 to RGB

Resource Usage
DFFs 85
4-input LUTs 134
MACC 5 5
RAM1kx18 0
RAM64x18 0

Table 10 • Resource Utilization of YCbCr422 to RGB

Resource Usage
DFFs 87
4-input LUTs 137
MACC 5 5
RAM1kx18 0
RAM64x18 0

Microsemi Proprietary UG0639 Revision 5.0

Microsemi makes no warranty, representation, or guarantee regarding the information contained herein or the suitability of its products and services for any particular purpose, nor does Microsemi assume any liability whatsoever arising out of the application or use of any product or circuit. The products sold hereunder and any other products sold by Microsemi have been subject to limited testing and should not be used in conjunction with mission-critical equipment or applications. Any performance specifications are believed to be reliable but are not verified, and the Buyer must conduct and complete all performance and other testing of the products, alone and together with, or installed in, any end-products. The buyer shall not rely on any data and performance specifications or parameters provided by Microsemi. It is the Buyer’s responsibility to independently determine the suitability of any products and to test and verify the same. The information provided by Microsemi hereunder is provided “as is, where is” and with all faults, and the entire risk associated with such information is entire with the Buyer. Microsemi does not grant, explicitly or implicitly, to any party any patent rights, licenses, or any other IP rights, whether with regard to such information itself or anything described by such information. Information provided in this document is proprietary to Microsemi, and Microsemi reserves the right to make any changes to the information in this document or to any products and services at any time without notice.

About Microsemi

Microsemi, a wholly-owned subsidiary of Microchip Technology Inc. (Nasdaq: MCHP), offers a comprehensive portfolio of semiconductor and system solutions for aerospace & defense, communications, data center, and industrial markets. Products include high-performance and radiation-hardened analog mixed-signal integrated circuits, FPGAs, SoCs, and ASICs; power management products; timing and synchronization devices and precise time solutions, setting the world’s standard for time; voice processing devices; RF solutions; discrete components; enterprise storage and communication solutions, security technologies, and scalable anti-tamper products; Ethernet solutions; Power- over-Ethernet ICs and midspans; as well as custom design capabilities and services. Learn more at www.microsemi.com.

Microsemi Headquarters
One Enterprise, Aliso Viejo,
CA 92656 USA
Within the USA: +1 800-713-4113
Outside the USA: +1 949-380-6100
Sales: +1 949-380-6136
Fax: +1 949-215-4996
Email: sales.support@microsemi.com
www.microsemi.com

©2020 Microsemi, a wholly-owned
a subsidiary of Microchip Technology Inc. All
rights reserved. Microsemi and the
Microsemi logos are registered trademarks of
Microsemi Corporation. All other trademarks and service marks are the property of their respective owners.

Microsemi makes no warranty, representation, or guarantee regarding the information contained herein or the suitability of its products and services for any particular purpose, nor does Microsemi assume any liability whatsoever arising out of the application or use of any product or circuit. The products sold hereunder and any other products sold by Microsemi have been subject to limited testing and should not be used in conjunction with mission-critical equipment or applications. Any performance specifications are believed to be reliable but are not verified, and the Buyer must conduct and complete all performance and other testing of the products, alone and together with, or installed in, any end-products. The buyer shall not rely on any data and performance specifications or parameters provided by Microsemi. It is the Buyer’s responsibility to independently determine the suitability of any products and to test and verify the same. The information provided by Microsemi hereunder is provided “as is, where is” and with all faults, and the entire risk associated with such information is entire with the Buyer. Microsemi does not grant, explicitly or implicitly, to any party any patent rights, licenses, or any other IP rights, whether with regard to such information itself or anything described by such information. Information provided in this document is proprietary to Microsemi, and Microsemi reserves the right to make any changes to the information in this document or to any products and services at any time without notice.

About Microsemi

Microsemi, a wholly-owned subsidiary of Microchip Technology Inc. (Nasdaq: MCHP), offers a comprehensive portfolio of semiconductor and system solutions for aerospace & defense, communications, data center, and industrial markets. Products include high-performance and radiation-hardened analog mixed-signal integrated circuits, FPGAs, SoCs, and ASICs; power management products; timing and synchronization devices and precise time solutions, setting the world’s standard for time; voice processing devices; RF solutions; discrete components; enterprise storage and communication solutions, security technologies, and scalable anti-tamper products; Ethernet solutions; Power- over-Ethernet ICs and midspans; as well as custom design capabilities and services. Learn more at www.microsemi.com.

50200639. 5.0 12/20

References

Read User Manual Online (PDF format)

Loading......

Download This Manual (PDF format)

Download this manual  >>

Related Manuals