User Guide for GOWIN models including: MJPEG Decoder IP, Decoder IP
Gowin MJPEG Decoder IP is designed to perform frame-by-frame decoding of images compressed using the Baseline JPEG standard while utilizing ...
File Info : application/pdf, 22 Pages, 778.10KB
DocumentDocumentGowin MJPEG Decoder IP User Guide IPUG1192-1.0E, 09/26/2024 Copyright © 2024 Guangdong Gowin Semiconductor Corporation. All Rights Reserved. is a trademark of Guangdong Gowin Semiconductor Corporation and is registered in China, the U.S. Patent and Trademark Office, and other countries. All other words and logos identified as trademarks or service marks are the property of their respective holders. No part of this document may be reproduced or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written consent of GOWINSEMI. Disclaimer GOWINSEMI assumes no liability and provides no warranty (either expressed or implied) and is not responsible for any damage incurred to your hardware, software, data, or property resulting from usage of the materials or intellectual property except as outlined in the GOWINSEMI Terms and Conditions of Sale. GOWINSEMI may make changes to this document at any time without prior notice. Anyone relying on this documentation should contact GOWINSEMI for the current documentation and errata. Revision History Date 09/26/2024 Version 1.0E Description Initial version published. Contents Contents Contents .......................................................................................................................i List of Figures.............................................................................................................ii List of Tables .............................................................................................................iii 1 About This Guide.....................................................................................................1 1.1 Purpose...............................................................................................................1 1.2 Related Documents.............................................................................................1 1.3 Terminology and Abbreviations...........................................................................2 1.4 Support and Feedback ........................................................................................2 2 Overview...................................................................................................................2 3 Features and Performance .....................................................................................4 3.1 Features ..............................................................................................................4 3.2 Max. Frequency ..................................................................................................4 3.3 Latency ...............................................................................................................4 3.4 Resource Utilization ............................................................................................4 4 Functional Description............................................................................................6 4.1 Gowin MJPEG Decoder IP Structure and Function.............................................6 4.2 Block Diagram Description ..................................................................................6 4.2.1 Huffman Decode ...................................................................................................... 6 4.2.2 De-Quantization ....................................................................................................... 7 4.2.3 De-Zigzag ................................................................................................................ 7 4.2.4 Inverse Discrete Cosine Transform .......................................................................... 7 4.2.5 Sampling Restoration............................................................................................... 8 4.2.6 Color Space Conversion .......................................................................................... 9 5 Port Description.....................................................................................................10 6 Timing Description ................................................................................................12 7 Interface Configuration .........................................................................................13 8 Reference Design ..................................................................................................15 IPUG1192-1.0E i List of Figures List of Figures Figure 4-1 Gowin MJPEG Decoder IP Configuration Interface ......................................................... 6 Figure 4-2 De-Zigzag Table ............................................................................................................... 7 Figure 4-3 Inverse Discrete Cosine Transform Representation ........................................................ 8 Figure 4-4 Sampling Restoration ....................................................................................................... 8 Figure 5-1 Port Diagram .................................................................................................................... 10 Figure 6-1 Signal Timing.................................................................................................................... 12 Figure 7-1 Open the IP via Toolbar Icon............................................................................................ 13 Figure 7-2 Gowin MJPEG Decoder IP Configuration Interface ......................................................... 14 IPUG1192-1.0E ii List of Tables List of Tables Table 1-1 Terminology and Abbreviations ......................................................................................... 2 Table 2-1 Gowin MJPEG Decoder IP Overview ................................................................................ 3 Table 3-1 Gowin MJPEG Decoder IP Resource Utilization ............................................................... 5 Table 5-1 I/O List of Gowin MJPEG Decoder IP................................................................................ 10 IPUG1192-1.0E iii 1 About This Guide 1.1 Purpose 1 About This Guide 1.1 Purpose The purpose of Gowin MJPEG Decoder IP User Guide is to help you learn the features and usage of Gowin MJPEG Decoder IP by providing the descriptions of functions, GUI, and reference design, etc. It helps users quickly learn the features and usage of Gowin MJPEG Decoder IP. 1.2 Related Documents The latest user guides are available on the GOWINSEMI website. You can find the related documents at www.gowinsemi.com: DS961, GW2ANR series of FPGA Products Data Sheet DS102, GW2A series of FPGA Products Data Sheet DS226, GW2AR series of FPGA Products Data Sheet DS976, GW2AN-55 Data Sheet DS1228, Arora V FPGA Products Overview DS981, Arora V 138K & 75K FPGA Products Data Sheet DS1225, Arora V 60K FPGA Products Data Sheet DS1103, Arora V 25K FPGA Products Data Sheet SUG100, Gowin Software User Guide IPUG1192-1.0E 1(15) 1 About This Guide 1.3 Terminology and Abbreviations 1.3 Terminology and Abbreviations The terminology and abbreviations used in this manual are as shown in Table 1-1. Table 1-1 Terminology and Abbreviations Terminology and Abbreviations Meaning ALU Arithmetic Logical Unit BSRAM Block Static Random Access Memory CSC Color Space Conversion IDCT Inverse Discrete Cosine Transform LUT Look-up Table MJPEG Motion Joint Photographic Experts Group SSRAM Shadow Static Random Access Memory 1.4 Support and Feedback Gowin Semiconductor provides customers with comprehensive technical support. If you have any questions, comments, or suggestions, please feel free to contact us directly using the information provided below. Website: www.gowinsemi.com E-mail: support@gowinsemi.com IPUG1192-1.0E 2(15) 2 Overview 2 Overview Gowin MJPEG Decoder IP is a dynamic image frame-by-frame decoder that can decompress image data compressed according to the Baseline JPEG standard and convert it into RGB format. By decompressing multiple frames of JPEG-standard images, it enables dynamic video output. Due to the varying characteristics of the images and the compression ratios used, the input and output rates are not fixed. Gowin MJPEG Decoder IP is designed to perform frame-by-frame decoding of images compressed using the Baseline JPEG standard while utilizing minimal logic resources. Table 2-1 Gowin MJPEG Decoder IP Overview Gowin MJPEG Decoder IP Logic Resource Please refer to Table 3-1 Delivered Doc. Design Files Verilog Reference Design Verilog TestBench Verilog Test and Design Flow Synthesis Software GowinSynthesis Application Software Gowin Software Note! For the devices supported, you can click here to get the information. IPUG1192-1.0E 3(15) 3 Features and Performance 3.1 Features 3 Features and Performance 3.1 Features The input image information can be determined dynamically through the JPEG header data, including: - Supported image height of 64-1080 pixels - Supported image width of 64-1920 pixels - Supported dynamic 444, 420, 422 subsampling - Supported dynamic De-Huffman Table, with up to 2 DC and 2 AC tables - Supported dynamic De Quantization Table Supported predefined size (static) The input compressed data bit width is 32 bits The output image data bit width per channel is 8 bits, i.e., 24 bits for RGB The output rate can reach up to 1080P at 30 FPS 3.2 Max. Frequency The max. frequency of Gowin MJPEG Decoder IP is mainly determined by speed grade of the selected devices. When using the GW5A-25 series of devices, a maximum decoding speed of 65 MHz can be achieved. 3.3 Latency The latency of Gowin MJPEG Decoder IP is determined by the configuration parameters. 3.4 Resource Utilization Gowin MJPEG Decoder IP can be implemented by Verilog. Its performance and resource utilization may vary when the design is employed in different devices, or at different densities, speeds, or grades. IPUG1192-1.0E 4(15) 3 Features and Performance 3.4 Resource Utilization Take GW5A-25 FPGA as an example. See Table 3-1 for the resource utilization. For the applications on the other GOWINSEMI devices, please refer to the later release. Table 3-1 Gowin MJPEG Decoder IP Resource Utilization Device Speed Grade Resource Name Resource Utilization BSRAM 18 SSRAM 0 GW5A-25 C8/I7 Registers LUTs ALUs 15306 7363 6207 I/O Buf IPUG1192-1.0E 5(15) 4 Functional Description 4.1 Gowin MJPEG Decoder IP Structure and Function 4 Functional Description 4.1 Gowin MJPEG Decoder IP Structure and Function Gowin MJPEG Decoder IP can perform continuous decompression of JPEG-standard images. It processes the received compressed image data through various modules, including De-Huffman, De-quantize, De-Zigzag, Inverse Discrete Cosine Transform (IDCT), and color space conversion (YCbCr to RGB), before outputting the image. The system block diagram is as shown in Figure 4-1. Figure 4-1 Gowin MJPEG Decoder IP Configuration Interface 4.2 Block Diagram Description 4.2.1 Huffman Decode Huffman decode refers to the process of restoring data that has been compressed using Huffman Encode. To decode Huffman-encoded data, the corresponding Huffman table is required, which maps characters to their respective Huffman codes. The input data and the codes in the table are then compared one by one until a match is found. IPUG1192-1.0E 6(15) 4 Functional Description 4.2 Block Diagram Description 4.2.2 De-Quantization De-quantization involves multiplying the DCT coefficients by the quantization coefficients. The quantization coefficient table is transmitted along with the JPEG header data. De-quantization involves multiplying non-zero coefficients by their respective quantization factors. 4.2.3 De-Zigzag De-zigzag refers to the reordering of coefficients that are zigzagged during compression, according to the following index, as shown below. Figure 4-2 De-Zigzag Table 4.2.4 Inverse Discrete Cosine Transform The IDCT uses the de-quantized DCT coefficients in the IDCT algorithm to convert them from the frequency domain back to the original time domain. The minimum computational unit of JPEG is 8x8. By inputting an 8x8 2D frequency domain IDCT coefficient matrix C, the IDCT can calculate the restored pixel value matrix P using the following formula: The calculation formula is as follows: (, ) = 1 64 7 =0 7 =0 (, ) · () · () · cos[(2 +161)] () = {12 , 1, =0 1 IPUG1192-1.0E 7(15) 4 Functional Description 4.2 Block Diagram Description Figure 4-3 Inverse Discrete Cosine Transform Representation This module is implemented as shown in the figure above. To reduce DSP utilization and increase speed, the IDCT module employs a butterfly transform algorithm in the FPGA to perform the conversion operations. By performing two 1D IDCT operations, the 2D matrix multiplication result is obtained, which is the output of the IDCT module. In Gowin MJPEG Decoder IP, the butterfly transform algorithm is implemented using shifters and adders in the FPGA to simulate multiplication. As a result, the actual outcome may have a slight error compared to the result obtained from the formula, with an error margin of less than 5%. 4.2.5 Sampling Restoration The sampling standard for the frame can be obtained from the JPEG header data. During decoding, the image is restored according to the corresponding sampling standard. This IP supports three sampling standards: 4:4:4, 4:2:0, and 4:2:2, as shown in the figure below. Figure 4-4 Sampling Restoration IPUG1192-1.0E 8(15) 4 Functional Description 4.2 Block Diagram Description 4.2.6 Color Space Conversion Color Space Conversion (CSC) involves converting Y (luminance), Cb (Chrominance), and Cr (Chroma) components into RGB image pixels. The conversion formulas are as follows: = ( + 1.402 × ( - 128)) = ( - 0.344 × ( - 128)) - 0.714 × ( - 128) = ( - 1.772 × ( - 128)) To reduce DSP utilization and increase speed, the CSC module in the MJPEG Decoder IP simulates multiplication using shifts and additions based on the above formulas. As a result, the actual output may differ slightly from the calculated values, with an error margin of less than 5%. IPUG1192-1.0E 9(15) 5 Port Description 5 Port Description The IO port descriptions of Gowin MJPEG Decoder IP are as shown in . The port diagram is as shown in Figure 5-1. Figure 5-1 Port Diagram Table 5-1 I/O List of Gowin MJPEG Decoder IP Signal Data Width I/O Description clk 1 Input Input clock signal clk2 1 Input Output clock signal rstn 1 Input Reset signal, active-low In_valid 1 Input Input data valid In_data 32 Input Input data In_strb 4 Input Fixed input 4'hF IPUG1192-1.0E 10(15) 5 Port Description Signal In_last Out_in_accept Data Width 1 1 I/O Input Output Out_valid 1 Width 16 Height 16 Coordinate_x 16 Output Output Output Output Coordinate_y 16 Output R 8 Output G 8 Output B 8 Output Description Temporarily unused signal Output signal indicating acceptance of next data Output pixel valid indicator Output image width Output image height Horizontal coordinate of the valid pixel Vertical coordinate of the valid pixel Output 8-bit red channel Output 8-bit green channel Output 8-bit blue channel IPUG1192-1.0E 11(15) 6 Timing Description 6 Timing Description This section describes the timing of Gowin MJPEG Decoder IP. The timing of Gowin MJPEG Decoder IP is as shown in Figure 6-1. Figure 6-1 Signal Timing As shown in the figure above, assert in_valid and input the compressed image data using Baseline JPEG standard, and the out_in_accept signal indicates that the next data can be input. out_valid signal is outputted, indicating that the output data is valid. IPUG1192-1.0E 12(15) 7 Interface Configuration 7 Interface Configuration Start "IP Core Generator" from the "Tools" menu in Gowin Software, then you can call and configure MJPEG Decoder in "Multimedia" type. Toolbar icon is also available as shown in Figure 7-1. Figure 7-1 Open the IP via Toolbar Icon MJPEG Decoder IP configuration interface is as shown in Figure 7-2. IPUG1192-1.0E 13(15) 7 Interface Configuration Figure 7-2 Gowin MJPEG Decoder IP Configuration Interface This manual takes GW2A-55 chip and GW2A-LV55PG484C8/I7 part number as an example. You can configure the generated IP file name in the "File Name" text box. You can configure the generated IP module name in the "Module Name" text box. You can configure the path of generated IP core folder in the "Create In" text box. IPUG1192-1.0E 14(15) 8 Reference Design 8 Reference Design Please refer to the related test cases in Gowin MJPEG Decoder IP RefDesign. IPUG1192-1.0E 15(15)