A WebP encoding method and device
By performing pipeline parallel processing of WebP encoding on the FPGA acceleration card, the problem of low CPU processing efficiency caused by the complexity of the WebP encoding algorithm is solved, and more efficient WebP encoding efficiency is achieved.
Patent Information
- Application Number
- CN202011261404.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-12
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2040-11-12
AI Technical Summary
The complexity of the WebP encoding algorithm is high, resulting in low CPU processing efficiency and unable to effectively improve WebP encoding efficiency.
The FPGA acceleration card works in concert with the CPU, and the pipeline parallel processing is performed by dividing the WebP encoding process into multiple encoding steps executed sequentially. The pipeline parallel processing is performed using the FPGA's pipeline parallel characteristics to reduce the dependence on the CPU.
It significantly improves the running speed and efficiency of WebP encoding, and avoids the inefficiency problem of relying solely on the CPU to execute the encoding process.
Smart Images

Figure CN112437308B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image compression, and in particular to a WebP encoding method and device. Background Art
[0002] WebP is an image file format that provides both lossy and lossless compression. Compared with the PNG image format, the file size of a WebP lossless image is 26% smaller; under the same SSIM quality index, a WebP lossy image is 25%-34% smaller than a JPEG image. Thanks to its excellent compression efficiency, the WebP format can significantly save bandwidth without reducing image quality, so it is supported by many Internet vendors. However, the complexity of the WebP compression algorithm is about ten times that of the JPEG compression algorithm, which is a huge challenge for CPU processors, and the efficiency of completing WebP encoding is low. Summary of the invention
[0003] In view of the above problems in the prior art, the present invention proposes a WebP encoding method and device to improve the WebP encoding efficiency.
[0004] In a first aspect, an embodiment of the present invention provides a WebP encoding method, which is applied to a device including an FPGA accelerator card and a CPU end, and the method includes:
[0005] The DDR cache end of the FPGA acceleration card receives the target image sent by the CPU end;
[0006] The FPGA accelerator card reads the YUV image data of the target image from the DDR cache end, and divides the WebP encoding process of the YUV image data into a plurality of encoding steps executed sequentially for pipeline parallel processing to obtain an encoded WebP code stream;
[0007] The FPGA acceleration card transmits the WebP code stream back to the DDR cache end;
[0008] The DDR cache sends the WebP code stream to the CPU.
[0009] Optionally, the WebP encoding process of the YUV image data is divided into a plurality of encoding steps executed sequentially for pipeline parallel processing, including:
[0010] The FPGA acceleration card reads each block of the YUV image data from the DDR cache end in sequence; wherein, when reading the second block of YUV image data, the first block of YUV image data is compressed and calculated in parallel; when reading the i-th block of YUV image data, the i-1th block of YUV image data is compressed and calculated in parallel, and the compression result of the i-2th block of YUV image data is arithmetically encoded in parallel, i is 3 to N in sequence, and N is the number of blocks of the target image.
[0011] Optionally, the FPGA acceleration card sequentially reads each block of the YUV image data from the DDR cache end, including:
[0012] The FPGA acceleration card reads each block of YUV image data from the DDR cache end, and divides the read current block of YUV image data into multiple pixel blocks, wherein the multiple pixel blocks include 16x16 brightness pixel blocks and 8x8 color pixel blocks, wherein each 16x16 brightness pixel block is divided into 4x4 brightness pixel blocks.
[0013] Optionally, the performing compression calculation on the i-1th block of YUV image data of the target picture includes:
[0014] The 16x16 brightness pixel block, the 4x4 brightness pixel block and the 8x8 color pixel block in the i-1th block of YUV image data are compressed and calculated in parallel to obtain a transformed pixel block corresponding to each pixel block.
[0015] Optionally, the compression calculation performed on each pixel block in the 16x16 luminance pixel block, the 4x4 luminance pixel block, and the 8x8 color pixel block in the (i-1)th block of YUV image data includes:
[0016] At least by sequentially performing discrete cosine transform, quantization processing and inverse cosine transform processing on the pixel block, a transformed pixel block corresponding to the pixel block is obtained.
[0017] Optionally, after the DDR cache sends the WebP code stream to the CPU, the method further includes:
[0018] The CPU performs post-processing on the received WebP code stream to obtain a processed WebP code stream;
[0019] The processed WebP code stream is packaged to obtain a WebP format compressed image corresponding to the target image.
[0020] In a second aspect, an embodiment of the present invention provides a WebP encoding device, including an FPGA accelerator card and a CPU end, wherein:
[0021] The CPU end is used to send the target image to the DDR cache end of the FPGA acceleration card;
[0022] The DDR cache end of the FPGA acceleration card is used to receive the target image sent by the CPU end;
[0023] The FPGA accelerator card is used to read the YUV image data of the target image from the DDR cache end, divide the WebP encoding process of the YUV image data into a plurality of encoding steps executed sequentially for pipeline parallel processing to obtain an encoded WebP code stream, and return the WebP code stream to the DDR cache end;
[0024] The DDR cache end is also used to send the WebP code stream to the CPU end.
[0025] Optionally, the FPGA acceleration card is specifically used for:
[0026] Each block of the YUV image data is read from the DDR cache end in sequence; wherein, when reading the second block of YUV image data, the first block of YUV image data is compressed and calculated in parallel; when reading the i-th block of YUV image data, the i-1th block of YUV image data is compressed and calculated in parallel, and the compression result of the i-2th block of YUV image data is arithmetically encoded in parallel, i is 3 to N in sequence, and N is the number of blocks of the target image.
[0027] Optionally, the FPGA acceleration card is specifically used for:
[0028] Read the i-th block of YUV image data from the DDR cache end;
[0029] The i-th block of YUV image data read in is divided into a plurality of pixel blocks, wherein the plurality of pixel blocks include 16x16 brightness pixel blocks and 8x8 color pixel blocks, wherein each 16x16 brightness pixel block is divided into 4x4 brightness pixel blocks.
[0030] Optionally, the FPGA acceleration card is specifically used for:
[0031] The 16x16 brightness pixel block, the 4x4 brightness pixel block and the 8x8 color pixel block in the i-1th block of YUV image data are compressed and calculated in parallel to obtain a transformed pixel block corresponding to each pixel block.
[0032] One or more technical solutions provided by the embodiments of the present invention achieve at least the following technical effects or advantages:
[0033] The DDR cache of the FPGA accelerator card receives the target image sent by the CPU; the FPGA accelerator card reads the YUV image data of the target image from the DDR cache, and divides the WebP encoding process of the YUV image data into multiple encoding steps that are executed sequentially for pipeline parallel processing to obtain the encoded WebP code stream; the FPGA accelerator card returns the obtained WebP code stream to the DDR cache; the DDR cache sends the WebP code stream to the CPU. Thus, the pipeline parallel characteristics of the FPGA are used to realize the pipeline parallel processing of the WebP encoding process, and the running speed of the WebP encoding is accelerated through the FPGA, and it no longer relies solely on the CPU to execute the WebP encoding process, thereby improving the WebP encoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0035] Figure 1 A flowchart of a WebP encoding method according to an embodiment of the present invention is shown;
[0036] Figure 2 A schematic diagram showing pipeline parallel WebP encoding in an embodiment of the present invention is shown;
[0037] Figure 3 A schematic diagram of the division result of Y data is shown;
[0038] Figure 4 A schematic diagram of the division results of UV data is shown;
[0039] Figure 5 A schematic diagram showing a parallel compression calculation;
[0040] Figure 6 A schematic diagram of the structure of a WebP encoding device in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0041] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0042] The term "and / or" that appears in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship; the word "comprising" does not exclude the existence of elements or steps that are not listed in the claims. The word "one" or "an" placed before an element does not exclude the existence of multiple such elements. The present invention can be implemented with the aid of hardware including several different elements and with the aid of appropriately programmed computers. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
[0043] First embodiment
[0044] The first embodiment of the present invention provides a WebP encoding method, which can be applied to an electronic device including an FPGA accelerator card and a CPU end, and the electronic device can be a user device or a server. The electronic device is configured with an FPGA (Field Programmable Gate Array) accelerator card, so that the main processor (CPU) of the electronic device interacts with the FPGA, and a WebP encoding method based on a CPU+FPGA heterogeneous computing architecture is implemented to improve the WebP encoding efficiency.
[0045] Figure 1 A method flow chart of the WebP encoding method in an embodiment of the present invention is shown. Figure 1 As shown, the WebP encoding method provided by the embodiment of the present invention is described in detail:
[0046] First, execute S101: the CPU obtains a target image.
[0047] Specifically, the target image is a YUV format image, and the CPU can obtain a YUV format image by image format conversion or directly obtain a YUV format image.
[0048] Next, S102 is executed: a DDR SDRAM (Double Data Rate Synchronous Dynamic Random Access Memory) cache end of the FPGA acceleration card receives the target image sent by the CPU end.
[0049] After receiving the target image, the DDR cache end caches it and obtains the YUV image data from the target image for the hardware of the FPGA accelerator card to read and perform subsequent WebP encoding processing. The YUV image data of the target image contains brightness information (Y) and color information (UV).
[0050] Next, S103 is executed: the FPGA accelerator card reads the YUV image data of the target image from the DDR cache, and divides the WebP encoding process of the YUV image data into a plurality of encoding steps executed sequentially for pipeline parallel processing to obtain the encoded WebP code stream.
[0051] Specifically, the FPGA accelerator card adopts a pipeline parallel processing method to read each block of YUV image data from the DDR cache in turn, and uses the WebP encoding algorithm to perform compression calculation and arithmetic encoding on each block of YUV image data read in to obtain the encoded WebP code stream.
[0052] The following describes in detail the implementation process of the FPGA accelerator card dividing the WebP encoding process of YUV image data into multiple encoding steps that are executed sequentially for pipeline parallel processing: the FPGA accelerator card reads each block of YUV image data from the DDR cache in sequence; when reading the second block of YUV image data, the first block of YUV image data is compressed and calculated in parallel; when reading the i-th block of YUV image data, the i-1th block of YUV image data is compressed and calculated in parallel, and the compression results of the i-2th block of YUV image data are arithmetically encoded in parallel, where i is 3 to N in sequence, and N is the number of blocks of the target image.
[0053] Therefore, the reading of the i-th block of YUV image data, the compression calculation of the i-1-th block of YUV image data, and the arithmetic coding of the compression result of the i-2-th block of YUV image data are performed at the same time, thereby utilizing the pipeline parallel characteristics of the FPGA accelerator card and realizing the pipeline parallel processing of the WebP encoding algorithm, which can greatly speed up the running speed of the WebP encoding algorithm and thereby improve the WebP encoding efficiency.
[0054] Below, reference Figure 2 , an example of pipeline parallel processing of the target image's YUV image data is given below:
[0055] First, within time t1, the FPGA accelerator card reads the first block of YUV image data from the DDR cache.
[0056] Then, within time t2, the FPGA accelerator card reads the second block of YUV image data from the DDR cache, and while reading the second block of YUV image data, it performs compression calculations on the first block of YUV image data in parallel to obtain the compression result of the first block of YUV image data. Therefore, within time t2, not only the second block of YUV image data is read, but also the compression result of the first block of YUV image data is obtained, thereby improving the encoding efficiency.
[0057] Then, within time t3, the FPGA accelerator card reads the third block of YUV image data from the DDR cache, and while reading the third block of YUV image data, it performs compression calculation on the second block of YUV image data and performs arithmetic coding on the compression result of the first block of YUV image data in parallel. ..., and so on, within time t i Within the time, the FPGA accelerator card reads the corresponding block of YUV image data from the DDR cache, and while reading the i-th block of YUV image data, it performs compression calculation on the i-1th block of YUV image data in parallel, and performs arithmetic coding on the compression result of the i-2th block of YUV image data in parallel; until the arithmetic coding of the last block of YUV image data in the target image is completed to obtain the WebP code stream of the target image.
[0058] In the above-mentioned pipeline parallel mode, each block of YUV image data of the target image is continuously read in, and compression calculation and arithmetic coding are continuously performed on the read YUV image data. There is no need to wait for the arithmetic coding of the current block of YUV image data to be completed before reading in the next block of YUV image data, thereby improving the running speed of the WebP encoding algorithm.
[0059] Specifically, since the WebP encoding algorithm performs compression calculations in blocks, after the FPGA accelerator card reads the i-th block of YUV image data from the DDR cache, it divides the read i-th block of YUV image data into multiple pixel blocks: 16x16 brightness pixel blocks and 8x8 color pixel blocks, where each 16x16 brightness pixel block is further divided into 4x4 brightness pixel blocks.
[0060] It should be noted that each block of YUV image data read into the FPGA acceleration card must be divided into blocks based on the above method to achieve the purpose of dividing each block of YUV image data into 16x16 brightness pixel blocks (such as Figure 3 Represented as Y16x16) and 8x8 color pixel blocks (such as Figure 4 UV8x8), where each 16x16 luminance pixel block is further divided into 4x4 luminance pixel blocks (such as Figure 3 Expressed as Y4x4).
[0061] Specifically, the brightness information (Y data) in the YUV image data is divided into 16x16 brightness pixel blocks, where each 16x16 brightness pixel block is further divided into 4x4 brightness pixel blocks, and the color information (UV data) in the YUV image data is divided into 8x8 color pixel blocks.
[0062] Specifically, the Y data is divided into 16x16 brightness pixel blocks and 4x4 brightness pixel blocks. Figure 3 As shown, the UV data is divided into 8x8 color pixel blocks. Figure 4 shown.
[0063] In an optional implementation, in order to further improve the running speed of the WebP encoding algorithm, the data parallel characteristics of FPGA are used to perform compression calculations. Figure 5 As shown, when compression calculation is performed on any block of YUV image data, compression calculation is performed on three pixel blocks, namely, 16x16 brightness pixel block, 4x4 brightness pixel block and 8x8 color pixel block in parallel.
[0064] Reference below Figure 5 For example, in the compression calculation step, first, at time k1, the compression calculations of the three pixel blocks Y16x16, Y4x4 and UV8x8 in the first block of YUV image data are performed in parallel; next, at time k2, the compression calculations of the three pixel blocks Y16x16, Y4x4 and UV8x8 in the second block of YUV image data are performed in parallel; next, at time k3, the compression calculations of the three pixel blocks Y16x16, Y4x4 and UV8x8 in the third block of YUV image data are performed in parallel, and so on. In this way, at time k i At the same time, the compression calculations of the three pixel blocks Y16x16, Y4x4 and UV8x8 in the i-th YUV image data are performed in parallel until the compression calculations of the three pixel blocks Y16x16, Y4x4 and UV8x8 in the last YUV image data in the target picture are completed.
[0065] The compression calculation for each pixel block is: performing discrete cosine transform, quantization processing and inverse cosine transform on the pixel block in sequence to obtain a transformed pixel block corresponding to the pixel block.
[0066] When the FPGA accelerator card reads the i-th block of YUV image data, it also reads the corresponding intra-frame prediction data of the i-th block of YUV image data from the DDR cache; wherein the prediction data of the i-th block of YUV image data includes the prediction data of each pixel block. Therefore, when performing compression calculation on any pixel block (specifically, Y16x16, Y4x4 or UV8x8 in any YUV image data), the difference matrix is calculated based on the original image data and the prediction data of the pixel block, and finally the difference matrix is discrete cosine transformed. Taking a Y16x16 pixel block as an example, the original image data of the Y16x16 pixel block is subtracted from the corresponding prediction data to obtain the difference matrix.
[0067] Through the above-mentioned transformation of the WebP algorithm, it can better adapt to the characteristics of FPGA pipeline parallelism and data parallelism, making the running speed of the WebP algorithm on the FPGA platform several times that of the CPU.
[0068] S104: The FPGA accelerator card transmits the WebP code stream back to the DDR cache.
[0069] S105: The DDR cache sends the WebP code stream to the CPU.
[0070] The CPU performs post-processing on the received WebP code stream to obtain the processed WebP code stream; specifically, the post-processing of the WebP code stream includes adding image information, such as the size and format of the image, etc.; packaging the processed WebP code stream to obtain the WebP format compressed image corresponding to the target image. By adding the image information, it is easier for the decoder to decode and restore the compressed WebP format compressed image.
[0071] Second embodiment
[0072] The embodiment of the present invention provides a WebP encoding device, referring to Figure 6 As shown, the WebP encoding device includes an FPGA accelerator card and a CPU end, wherein the CPU end is used to send the target image to the DDR cache end of the FPGA accelerator card; the DDR cache end of the FPGA accelerator card is used to receive the target image sent by the CPU end; the FPGA accelerator card is used to use the WebP encoding algorithm to perform pipeline parallel processing on the YUV image data read from the DDR cache end to obtain an encoded WebP code stream; wherein, when the i-th block of YUV image data of the target image is read from the DDR cache end, the i-1th block of YUV image data of the target image is also compressed and calculated in parallel, and the compression result of the i-2th block of YUV image data of the target image is arithmetic encoded in parallel; the WebP code stream is returned to the DDR cache end; the DDR cache end is also used to send the WebP code stream to the CPU end.
[0073] In an optional implementation manner, the FPGA accelerator card is specifically used for:
[0074] Read the i-th block of YUV image data from the DDR buffer;
[0075] The i-th block of YUV image data read in is divided into a plurality of pixel blocks, wherein the plurality of pixel blocks include a 16x16 brightness pixel block and an 8x8 color pixel block, wherein each 16x16 brightness pixel block is divided into a 4x4 brightness pixel block.
[0076] In an optional implementation manner, the FPGA accelerator card is specifically used for:
[0077] The 16x16 brightness pixel block, the 4x4 brightness pixel block and the 8x8 color pixel block in the i-1th block of YUV image data are compressed and calculated in parallel to obtain a transformed pixel block corresponding to each pixel block.
[0078] In an optional implementation manner, the FPGA accelerator card is specifically used for:
[0079] At least by sequentially performing discrete cosine transformation, quantization processing and inverse cosine transformation processing on the pixel block, a transformed pixel block corresponding to the pixel block is obtained.
[0080] In an optional implementation manner, the CPU is further used for:
[0081] Post-process the received WebP code stream to obtain a processed WebP code stream;
[0082] After packaging and processing, the WebP code stream is compressed in the WebP format corresponding to the target image.
[0083] It should be noted that the specific implementation and technical effects of the WebP encoding device provided in the embodiment of the present invention are the same as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0084] The WebP encoding method and device provided by the embodiments of the present invention achieve at least the following technical effects or advantages:
[0085] The DDR cache of the FPGA accelerator card receives the target image sent by the CPU; the FPGA accelerator card reads the YUV image data of the target image from the DDR cache, and divides the WebP encoding process of the YUV image data into multiple encoding steps that are executed sequentially for pipeline parallel processing to obtain the encoded WebP code stream; the FPGA accelerator card returns the obtained WebP code stream to the DDR cache; the DDR cache sends the WebP code stream to the CPU. Thus, the pipeline parallel characteristics of the FPGA are used to realize the pipeline parallel processing of the WebP encoding process, and the running speed of the WebP encoding is accelerated through the FPGA, and it no longer relies solely on the CPU to execute the WebP encoding process, thereby improving the WebP encoding efficiency.
[0086] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0087] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0088] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0089] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0090] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0091] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A WebP encoding method, applied to a device including an FPGA accelerator card and a CPU end, characterized in that: The method comprises: The DDR cache end of the FPGA acceleration card receives the target image sent by the CPU end; The FPGA accelerator card reads the YUV image data of the target image from the DDR cache end, and divides the WebP encoding process of the YUV image data into a plurality of encoding steps executed sequentially for pipeline parallel processing to obtain an encoded WebP code stream, including: the FPGA accelerator card sequentially reads each block of YUV image data from the DDR cache end; wherein, when reading the second block of YUV image data, the first block of YUV image data is compressed and calculated in parallel; when reading the i-th block of YUV image data, the i-1th block of YUV image data is compressed and calculated in parallel, and the compression result of the i-2th block of YUV image data is arithmetic encoded in parallel, i is 3 to N in sequence, and N is the number of blocks of the target image; The i-1th block of YUV image data is compressed and calculated, including: compressing and calculating the 16x16 brightness pixel block, the 4x4 brightness pixel block and the 8x8 color pixel block in the i-1th block of YUV image data in parallel to obtain a transformed pixel block corresponding to each pixel block, including: performing discrete cosine transform, quantization processing and inverse cosine transform on the pixel block in sequence to obtain a transformed pixel block corresponding to the pixel block, wherein, when reading the i-th block of YUV image data, the FPGA accelerator card also reads the corresponding intra-frame prediction data of the i-th block of YUV image data from the DDR cache end at the same time, and the prediction data of the i-th block of YUV image data includes the prediction data of each pixel block, and when compressing and calculating any pixel block, a difference matrix is obtained by calculating based on the original image data and the prediction data of the pixel block, and the difference matrix is discrete cosine transformed; The FPGA acceleration card transmits the WebP code stream back to the DDR cache end; The DDR cache sends the WebP code stream to the CPU.
2. The method according to claim 1, characterized in that The FPGA acceleration card sequentially reads each block of YUV image data from the DDR cache end, including: The FPGA acceleration card reads each block of YUV image data from the DDR cache end, and divides the read current block of YUV image data into multiple pixel blocks, wherein the multiple pixel blocks include 16x16 brightness pixel blocks and 8x8 color pixel blocks, wherein each 16x16 brightness pixel block is divided into 4x4 brightness pixel blocks.
3. The method according to any one of claims 1-2, characterized in that: After the DDR cache sends the WebP code stream to the CPU, the method further includes: The CPU performs post-processing on the received WebP code stream to obtain a processed WebP code stream; The processed WebP code stream is packaged to obtain a WebP format compressed image corresponding to the target image.
4. A WebP encoding device, characterized in that: Including FPGA accelerator card and CPU side, among which, The CPU end is used to send the target image to the DDR cache end of the FPGA acceleration card; The DDR cache end of the FPGA acceleration card is used to receive the target image sent by the CPU end and obtain YUV image data from the target image; The FPGA accelerator card is used to read the YUV image data of the target image from the DDR cache end, and divide the WebP encoding process of the YUV image data into a plurality of encoding steps executed sequentially for pipeline parallel processing to obtain an encoded WebP code stream, and return the WebP code stream to the DDR cache end, including: the FPGA accelerator card sequentially reads each block of YUV image data of the YUV image data from the DDR cache end; wherein, when reading the second block of YUV image data, the first block of YUV image data is compressed and calculated in parallel; when reading the i-th block of YUV image data, the i-1th block of YUV image data is compressed and calculated in parallel, and the compression result of the i-2th block of YUV image data is arithmetic encoded in parallel, i is 3 to N in sequence, and N is the number of blocks of the target image; The i-1th block of YUV image data is compressed and calculated, including: compressing and calculating the 16x16 brightness pixel block, the 4x4 brightness pixel block and the 8x8 color pixel block in the i-1th block of YUV image data in parallel to obtain a transformed pixel block corresponding to each pixel block, including: performing discrete cosine transform, quantization processing and inverse cosine transform on the pixel block in sequence to obtain a transformed pixel block corresponding to the pixel block, wherein, when reading the i-th block of YUV image data, the FPGA accelerator card also reads the corresponding intra-frame prediction data of the i-th block of YUV image data from the DDR cache end at the same time, and the prediction data of the i-th block of YUV image data includes the prediction data of each pixel block, and when compressing and calculating any pixel block, a difference matrix is obtained by calculating based on the original image data and the prediction data of the pixel block, and the difference matrix is discrete cosine transformed; The DDR cache end is also used to send the WebP code stream to the CPU end.
5. The device according to claim 4, characterized in that The FPGA acceleration card is specifically used for: Read the i-th block of YUV image data from the DDR cache end; The i-th block of YUV image data read in is divided into a plurality of pixel blocks, wherein the plurality of pixel blocks include 16x16 brightness pixel blocks and 8x8 color pixel blocks, wherein each 16x16 brightness pixel block is divided into 4x4 brightness pixel blocks.
Citation Information
Patent Citations
High speed JPEG (joint photographic expert group) image processing system based on FPGA (field programmable gate array) and processing method thereof
CN102148988A
Device and method for parallelly processing images
CN103246499A
H264 video code parallel operation method
CN103763561A
WebP lossy compression method and apparatus
CN107124615A
Method, device and system for implementing WebP lossy compression algorithm
CN107154062A
