Display Enhancement UG0646 User Guide Table of Contents Introduction ....................................................................................................................3 Hardware Implementation .............................................................................................4 Design Description......................................................................................................................................... 4 Inputs and Outputs ........................................................................................................................................ 5 Configuration Parameters.............................................................................................................................. 6 Timing Diagrams............................................................................................................................................ 6 Testbench ...................................................................................................................................................... 7 Resource Utilization ....................................................................................................................................... 8 List of Changes ..............................................................................................................9 Product Support........................................................................................................... 10 Customer Service ........................................................................................................................................ 10 Customer Technical Support Center ........................................................................................................... 10 Technical Support ........................................................................................................................................ 10 Website ........................................................................................................................................................ 10 Contacting the Customer Technical Support Center ................................................................................... 10 ITAR Technical Support .............................................................................................................................. 11 2 UG0646: Display Enhancement User Guide Introduction Display Enhancement module enables you to adjust the brightness, contrast, saturation, and hue of the final video display to personal preferences. These adjustments are done on YCbCr color space as calculations are simpler compared to RGB domain. The following equations are for adjusting brightness, contrast, saturation, and hue values on Y, Cb, and Cr: ππβ² = οΏ½(ππ β 16) × πΆπΆοΏ½ + π΅π΅ + 16 πΆπΆπΆπΆ" = (((πΆπΆπΆπΆ β 128) × πΆπΆπΆπΆπΆπΆ(π»π») + (πΆπΆπΆπΆ β 128) × ππππππ(π»π»)) × πΆπΆ × ππ) + 128 Where, πΆπΆπΆπΆ" = (((πΆπΆπΆπΆ β 128 × πΆπΆπΆπΆπΆπΆ(π»π») β (πΆπΆπΆπΆ β 128) × ππππππ(π»π»)) × πΆπΆ × ππ) + 128 EQ1 EQ2 EQ3 B = Brightness constant C = Contrast constant S = Saturation constant H = Hue angle In EQ1, input Y value is subtracted by number 16 to position the black level at zero. It removes the DC offset, therefore adjusting the contrast does not vary the black level. Multiply the YCbCr pixel values by a constant to adjust the contrast. If Cb and Cr are not adjusted, color shift will result whenever the contrast is changed. The brightness value is added or subtracted from the contrast adjusted Y value. Brightness control is done after the contrast control to avoid introducing a varying DC offset due to contrast adjustment. The value 16 is added to bring back the black level at 16. In EQ2 and EQ3, inputs Cb and Cr values are subtracted by 128 to position the range about zero. The subtraction of Cb and Cr values by 128 can result in negative values which needs to addressed. The hue value is adjusted by mixing the Cb and Cr values, as shown in EQ2 and EQ3. Saturation and Contrast values are adjusted by multiplying the hue mixed Cb and Cr values by a pair of constants, and then by adding 128 to resultant Cb and Cr. UG0646: Display Enhancement User Guide 3 Hardware Implementation Design Description The display enhancement module performs the adjustment of brightness, contrast, saturation, and hue as per the equations mentioned in the Design Description section. The module takes YCbCr inputs and outputs the resultant YCbCr after computation. It receives signed values of brightness, contrast, saturation, and hue as inputs from an external controller. It also takes data enable, horizontal, and vertical sync signals as inputs, and pipelines them to match the converted video data outputs. Figure 1 shows the top-level input and output signals of the display enhancement module. VIDEO_CLOCK_I RESET_N_I mem_write_clock brightness_i contrast_i saturation_i hue_i Y_out_o sin_write_en_i Cb_out_o cos_write_en_i Cr_out_o sin_write_addr_i cos_write_addr_i data_enable_o Display Enhancement horz_sync_o sin_value_i vert_sync_o cos_value_i hactive_o Y_i vactive_o Cb_i Cr_i data_enable_i horz_sync_i vert_sync_i hactive_i vactive_i Figure 1 · Top-Level Block Diagram of Display Enhancement Inputs and Outputs 4 UG0646: Display Enhancement User Guide Inputs and Outputs Inputs and Outputs Table 1 shows the input and output ports of the display enhancement module. Table 1 · Input and Output Ports of the Display Enhancement Module Width Signal Name Direction Description RESET_N_I Input β Active low asynchronous reset signal to design VIDEO_CLOCK_I Input β System clock input mem_write_clock Input β Sine-Cosine memory write clock Y_i Input [(g_YCbCr_DATA_BIT_WIDTH -1) : 0] Luma input value Cb_i Input [(g_YCbCr_DATA_BIT_WIDTH -1) : 0] Cb input value Cr_i Input [(g_YCbCr_DATA_BIT_WIDTH -1) : 0] Cr input value data_enable_i Input β Video data enable input horz_sync_i Input β Horizontal sync signal vert_sync_i Input β Vertical sync signal brightness_i Input [(g_B_C_SAT_CONSTANT_WIDTH-1):0] Input brightness constant contrast_i Input [(g_B_C_SAT_CONSTANT_WIDTH-1):0] Input contrast constant saturation_i Input [(g_B_C_SAT_CONSTANT_WIDTH-1):0] Input saturation constant hue_i Input [(g_HUE_CONSTANT_WIDTH -1):0] Input hue angle constant sin_write_en_i Input β Sine memory write enable cos_write_en_i Input β Cosine memory write enable sin_write_addr_i Input [7:0] Sine memory write address cos_write_addr_i Input [7:0] Cosine memory write address sin_value_i Input [(g_SIN_COS_DWIDTH-1):0] Input Sine value cos_value_i Input [(g_SIN_COS_DWIDTH-1):0] Input Cosine value hactive_i Input β Horizontal active input vactive_i Input β Vertical active input Y_out_o Output [(g_YCbCr_DATA_BIT_WIDTH -1) : 0] Resultant luma output value Cb_out_o Output [(g_YCbCr_DATA_BIT_WIDTH -1) : 0] Resultant Cb output value Cr_out_o Output [(g_YCbCr_DATA_BIT_WIDTH -1) : 0] Resultant Cr output value data_enable_o Output β Video data enable output horz_sync_o Output β Horizontal sync signal vert_sync_o Output β Vertical sync signal hactive_o Output β Horizontal active output vactive_o Output β Vertical active output For hue adjustments, the Sine and Cosine values for angles ranging from 0° to 180° are received from an external controller, which are stored in the blockβs internal ram buffers. The -180° to -1° angle values are calculated by performing required manipulation on the corresponding Sine and Cosine values of the absolute value of the angle from the ram buffer. UG0646: Display Enhancement User Guide 5 Hardware Implementation Table 2 shows the input value range for every adjustment parameter. Table 2 · Input Value Range for Adjustment Parameters Value Range Parameters Brightness -128 to +127 Contrast -128 to +127 Saturation -128 to +127 -180o to +180o Hue In the display enhancement module, the Y, Cb, and Cr values for each pixel are sign extended to perform all the sign calculations. It checks the overflow and underflow conditions by saturating the final luma Y value in 16-235 range and Cb and Cr values in 16-240 range. Configuration Parameters Table 3 shows the configuration parameters used in the hardware implementation of the display enhancement module. These parameters are generic and can be varied based on the application requirement. Table 3 · Configuration Parameters of the Display Enhancements Name Description g_B_C_SAT_CONSTANT_WIDTH Brightness, contrast, and saturation constants data bit width g_YCbCr_DATA_BIT_WIDTH YCbCr data bit width g_HUE_CONSTANT_WIDTH Hue degree data bit width g_SIN_COS_DWIDTH Data width of Sin and Cos values for the hue degree value g_SIN_COS_MEM_DEPTH Depth of the memory storing the Sin and Cos values for the hue degree value Timing Diagrams Figure 2 shows writing of Sine and Cosine values into the internal memory. mem_write_clock sin_write_addr_i/ cos_write_addr_i addr0 addr1 addr2 addr3 addr4 addrn-1 addrn sin_value_i/ cos_value_i data0 data1 data2 data3 data4 datan-1 datan sin_write_en_i/ cos_write_en_i Figure 2 · Timing Diagram shows the Connection Between Address Inputs sin_write_addr_i/cos_write_addr_i, Data Inputs sin_value_i/ cos_value_i and Write Enable Inputs sin_write_en_i/cos_write_en_i 6 UG0646: Display Enhancement User Guide Testbench Figure 3 shows the connection between the YCbCr and data_enable inputs and the corresponding YCbCr and data_enable output. VIDEO_CLOCK_I Y_i Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10 Y11 Y12 Cb_i Cb0 Cb1 Cb2 Cb3 Cb4 Cb5 Cb6 Cb7 Cb8 Cb9 Cb10 Cb11 Cr_i Cr0 Cr1 Cr2 Cr3 Cr4 Cr5 Cr6 Cr7 Cr8 Cr9 Cr10 Cr11 Y13 Y14 Y15 Y16 Cb12 Cb13 Cb14 Cb15 Cr12 Y18 Y19 Cb16 Cb17 Cb18 Cb19 Cr14 Cr15 Cr16 Cr17 Cr18 Cr19 Y_out_o Y0 Y1 Y2 Y3 Y4 Y5 Cb_out_o Cb0 Cb1 Cb2 Cb3 Cb4 Cb5 Cr_out_o Cr0 Cr1 Cr2 Cr3 Cr4 Cr5 Cr13 Y17 data_enable_i data_enable_o Figure 3 · Timing Diagram of the YCbCr Input and YCbCr Output for the Display Enhancement Module Testbench A testbench is provided to check the functionality of display enhancement core. Table 4 · lists the parameters that can be configured according to application: Table 4 · Configuration Parameters Name Description CLKPERIOD Clock period HEIGHT Height of the image WIDTH Width of the image WRITE_CLK Clock period of Sine-Cosine memory write clock DATA_BIT_WIDTH RGB data bit width WAIT Delay between two lines of input (Image) IMAGE_FILE_NAME Input (image) file name UG0646: Display Enhancement User Guide 7 Hardware Implementation Resource Utilization Table 5 · shows the resource utilization of the display enhancement module implemented in the SmartFusion®2 system-on-chip (SoC) field programmable gate array (FPGA) device. Table 5 · Resource Utilization of Display Enhancement Module Resource Usage DFFs 1050 4-input LUTs 510 MACC 9 RAM1Kx18 2 RAM64x18 0 8 UG0646: Display Enhancement User Guide List of Changes The following table shows important changes made in this document for each revision. Revision Revision 2 (February 2016) Changes Updated Figure 1 · and Table 1 · for clock parameter name change (SAR 75773). Added Testbench section in the document (SAR 75773). Revision 1 (July 2015) Initial release. UG0646: Display Enhancement User Guide Page 5 and 5 7 NA 9 Product Support Microsemi SoC Products Group backs its products with various support services, including Customer Service, Customer Technical Support Center, a website, electronic mail, and worldwide sales offices. This appendix contains information about contacting Microsemi SoC Products Group and using these support services. Customer Service Contact Customer Service for non-technical product support, such as product pricing, product upgrades, update information, order status, and authorization. From North America, call 800.262.1060 From the rest of the world, call 650.318.4460 Fax, from anywhere in the world 650. 318.8044 Customer Technical Support Center Microsemi SoC Products Group staffs its Customer Technical Support Center with highly skilled engineers who can help answer your hardware, software, and design questions about Microsemi SoC Products. The Customer Technical Support Center spends a great deal of time creating application notes, answers to common design cycle questions, documentation of known issues and various FAQs. So, before you contact us, please visit our online resources. It is very likely we have already answered your questions. Technical Support For Microsemi SoC Products Support, visit http://www.microsemi.com/products/fpga-soc/design-support/fpga-socsupport. Website You can browse a variety of technical and non-technical information on the Microsemi SoC Products Group home page, at http://www.microsemi.com/products/fpga-soc/fpga-and-soc. Contacting the Customer Technical Support Center Highly skilled engineers staff the Technical Support Center. The Technical Support Center can be contacted by email or through the Microsemi SoC Products Group website. Email You can communicate your technical questions to our email address and receive answers back by email, fax, or phone. Also, if you have design problems, you can email your design files to receive assistance. We constantly monitor the email account throughout the day. When sending your request to us, please be sure to include your full name, company name, and your contact information for efficient processing of your request. The technical support email address is [email protected]. My Cases Microsemi SoC Products Group customers may submit and track technical cases online by going to My Cases. 10 UG0646: Display Enhancement User Guide ITAR Technical Support Outside the U.S. Customers needing assistance outside the US time zones can either contact technical support via email ([email protected]) or contact a local sales office. Visit About Us for sales office listings and corporate contacts. ITAR Technical Support For technical support on RH and RT FPGAs that are regulated by International Traffic in Arms Regulations (ITAR), contact us via [email protected]. Alternatively, within My Cases, select Yes in the ITAR drop-down list. For a complete list of ITAR-regulated Microsemi FPGAs, visit the ITAR web page. UG0646: Display Enhancement User Guide 11 Microsemi Corporation (Nasdaq: MSCC) offers a comprehensive portfolio of semiconductor and system solutions for communications, defense & security, aerospace 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. Microsemi is headquartered in Aliso Viejo, Calif., and has approximately 4,800 employees globally. Learn more at www.microsemi.com. Microsemi Corporate 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 E-mail: [email protected] © 2016 Microsemi Corporation. All rights reserved. Microsemi and the Microsemi logo are 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 Buyer must conduct and complete all performance and other testing of the products, alone and together with, or installed in, any end-products. Buyer shall not rely on any data and performance specifications or parameters provided by Microsemi. It is the Buyerβs responsibility to independently determine 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 entirely 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. 50200646-2/02.16