A high compression ratio lossless compression method and device for drawing intermediate images
By decomposing and filtering the space with the lowest encoding complexity of drawing intermediate images in multiple color spaces, entropy coding and lossless reduction, the problems of low compression ratio and irreversibility in the prior art are solved, and efficient lossless compression is achieved.
Patent Information
- Application Number
- CN202210774455.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-01
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-07-01
AI Technical Summary
The prior art fails to fully utilize the characteristics of the image when compressing the drawn intermediate image, and lossy compression is not suitable for intermediate images that are only used for calculation, resulting in low compression ratio and irreversibility.
Build a lossless compression model, including an encoder and a decoder, by decomposing images in multiple color spaces, filtering the color space or residual space with the lowest encoding complexity, entropy encoding the residual plane, generating a compressed code stream, and lossless reduction through the decoder.
The high compression ratio lossless compression of the drawing intermediate images is achieved, which improves the compression ratio and ensures lossless restoration of the images.
Smart Images

Figure CN115022627B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of graphics drawing, information coding and image compression, and in particular relates to a lossless compression method and device with a high compression ratio for drawing intermediate images. Background Art
[0002] In recent years, with the rise of new technologies such as cloud gaming, cloud graphics, and cloud rendering, research on real-time rendering that combines cloud and end has also continued to emerge, which has given rise to the need for efficient compression and transmission of various intermediate images in the rendering process. Specifically, the intermediate image data is encoded using existing image / video compression schemes and sent to the client, which is decoded and used by the user device. However, this approach has two limitations. First, they do not consider the characteristics of the intermediate images being rendered. Second, the lossy processing in the scheme is not suitable for intermediate images that are only used for computing purposes and have no visual significance.
[0003] Image compression can be divided into lossy image compression and lossless image compression. Lossy image compression refers to compression in which some data in the original image file is lost. This process is irreversible. Once converted to lossy, it cannot be returned. The more times the compression is performed, the more degradation occurs. Common traditional lossy / lossless image compression algorithms include JPEG, PNG, JPEG 2000, Webp, BPG, and AVIF.
[0004] Image compression also includes AI-based image compression methods, including the deep learning-based image compression and restoration method and transposition disclosed in patent document CN111355965A, including: compressing and encoding the received image to obtain the encoded string of the image; decoding the encoded string to restore the initial restored image; inputting the initial restored image into a pre-built image super-resolution model to obtain a high-definition restored image. It also includes a static image compression method based on a deep learning model disclosed in patent document CN107240136A, which achieves compression of static images through the steps of image segmentation, image classification, PSO parameter optimization, model training, and model testing. These two compression methods can achieve image compression, but there will be a certain visual loss in compression, and the compression ratio is low, which is not conducive to the compression of drawing intermediate images. Summary of the invention
[0005] In view of the above, an object of the present invention is to provide a lossless compression method and apparatus with a high compression ratio for drawing intermediate images, so as to achieve compression and restoration of drawing intermediate images with a high compression ratio and losslessly.
[0006] To achieve the above-mentioned object of the invention, an embodiment provides a lossless compression method with a high compression ratio for drawing an intermediate image, comprising the following steps:
[0007] A lossless compression model is constructed, the lossless compression model comprising an encoder and a decoder, wherein the encoder is used to decompose the input intermediate drawing image into multiple color spaces, perform pixel prediction on the color plane under it in each color space to obtain the corresponding residual plane and residual space, select the residual space with the lowest coding complexity according to the coding complexity of the residual space, and perform entropy coding on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed code stream; or, the encoder is used to decompose the input intermediate drawing image into multiple color spaces, select the color space with the lowest coding complexity according to the coding complexity of the color space, perform pixel prediction on the color plane under it in the color space with the lowest coding complexity to obtain the residual plane, and perform entropy coding on the residual plane to obtain the compressed code stream; the decoder is used to decode the compressed code stream and restore it to obtain the intermediate drawing image;
[0008] The constructed lossless compression model is used to compress and restore the drawn intermediate image.
[0009] In one embodiment, the encoder includes a multi-color space decomposition unit, a first pixel prediction unit, a first coding complexity calculation unit, and a first entropy coding unit;
[0010] The multi-color space decomposition unit is used to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space;
[0011] The first pixel prediction unit is used to perform pixel prediction on all color planes in each color space to obtain a prediction plane, and use the difference between the color plane and the prediction plane as a residual plane, and all residual planes in each color space constitute a residual space;
[0012] The first coding complexity calculation unit is used to calculate the entropy of each residual plane, taking the sum of the entropies of all residual planes in each residual space as the coding complexity of the residual space, and screening to obtain the residual space with the lowest coding complexity;
[0013] The first entropy coding unit is used to perform entropy coding on the residual plane of the residual space with the lowest coding complexity to obtain a compressed code stream and output it.
[0014] In one embodiment, the encoder includes a multi-color space decomposition unit, a second coding complexity calculation unit, a second pixel prediction unit, and a second entropy coding unit;
[0015] The multi-color space decomposition unit is used to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space;
[0016] The second coding complexity calculation unit is used to calculate the entropy of each color plane, taking the sum of the entropies of all color planes in each color space as the coding complexity of the color space, and screening to obtain the color space with the lowest coding complexity;
[0017] The second pixel prediction unit is used to perform pixel prediction on all color planes in the color space with the lowest coding complexity to obtain a prediction plane, and use the difference between the color plane and the prediction plane as a residual plane, and all residual planes in the color space with the lowest coding complexity constitute a residual space;
[0018] The second entropy coding unit is used to perform entropy coding on the residual plane of the residual space to obtain a compressed code stream and output it.
[0019] In one embodiment, the color space includes RGB space, YCoCg space, and Substract Green space.
[0020] In one embodiment, in the first pixel prediction unit and the second pixel prediction unit, the mode of performing pixel prediction on the color plane includes:
[0021] Calculate the sum of the pixels above the pixel T and the pixel on the left of the current pixel in the color plane, and calculate the pixel difference between the sum of the pixels and the pixel of the upper left pixel TL; use the middle number among the upper pixel T, the left pixel L and the pixel difference as the pixel prediction result of the current pixel. The prediction result of all pixels on a color plane is called the prediction plane of the color plane.
[0022] In the first pixel prediction unit and the second pixel prediction unit of one embodiment, the difference between the color plane and the prediction plane is calculated to remove the two-dimensional continuity between the pixels in the drawing intermediate image, and the obtained residual plane reflects the information characteristics of the drawing intermediate image after the two-dimensional continuity is removed.
[0023] In one embodiment, the decoder comprises a decoding unit and a color space inverse conversion unit;
[0024] The decoding unit is used to decode and predict the compressed code stream to obtain the representation of the original image in the selected space;
[0025] The color space inverse transformation unit is used to perform an inverse transformation of the color space on the representation in the selected space to restore the intermediate image.
[0026] In one embodiment, compressing and restoring the drawn intermediate image using the constructed lossless compression model includes:
[0027] After decomposing the input intermediate drawing image into multiple color spaces using an encoder, pixel prediction is performed on the color plane under it in each color space to obtain the corresponding residual plane and residual space, and the residual space with the lowest coding complexity is screened according to the coding complexity of the residual space, and entropy coding is performed on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed bitstream; or, after decomposing the input intermediate drawing image into multiple color spaces using an encoder, the color space with the lowest coding complexity is screened according to the coding complexity of the color space, and pixel prediction is performed on the color plane under it in the color space with the lowest coding complexity to obtain a residual plane, and entropy coding is performed on the residual plane to obtain a compressed bitstream;
[0028] The decoder is used to decode the compressed code stream and restore the intermediate image.
[0029] To achieve the above-mentioned purpose of the invention, the embodiment further provides a high compression ratio and lossless compression device for drawing an intermediate image, comprising:
[0030] The encoding unit is used to decompose the input intermediate drawing image into multiple color spaces by using an encoder, perform pixel prediction on the color plane under it in each color space to obtain the corresponding residual plane and residual space, select the residual space with the lowest coding complexity according to the coding complexity of the residual space, and perform entropy coding on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed bitstream; or, after decomposing the input intermediate drawing image into multiple color spaces by using an encoder, select the color space with the lowest coding complexity according to the coding complexity of the color space, perform pixel prediction on the color plane under it in the color space with the lowest coding complexity to obtain the residual plane, and perform entropy coding on the residual plane to obtain the compressed bitstream;
[0031] The decoding unit is used to decode the compressed code stream using a decoder and restore it to obtain a drawing intermediate image.
[0032] To achieve the above-mentioned purpose of the invention, an embodiment further provides a high compression ratio and lossless compression device for drawing intermediate images, comprising a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor, wherein the computer memory stores a lossless compression model constructed by the above-mentioned lossless compression method with a high compression ratio for drawing intermediate images;
[0033] When the computer processor executes the computer program, the following steps are implemented:
[0034] After decomposing the input intermediate drawing image into multiple color spaces using an encoder, pixel prediction is performed on the color plane under it in each color space to obtain the corresponding residual plane and residual space, and the residual space with the lowest coding complexity is screened according to the coding complexity of the residual space, and entropy coding is performed on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed bitstream; or, after decomposing the input intermediate drawing image into multiple color spaces using an encoder, the color space with the lowest coding complexity is screened according to the coding complexity of the color space, and pixel prediction is performed on the color plane under it in the color space with the lowest coding complexity to obtain a residual plane, and entropy coding is performed on the residual plane to obtain a compressed bitstream;
[0035] The decoder is used to decode the compressed code stream and restore the intermediate image.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] After decomposing the intermediate image into multiple color spaces, pixel prediction is performed on the color plane of each color space to obtain a residual plane and a residual space. The residual space with the lowest coding complexity is screened according to the coding complexity of the residual space. The residual plane under it is entropy encoded in the residual space with the lowest coding complexity to obtain a compressed bitstream. This can greatly improve the compression ratio compared to the case where no color space selection is made. Then, the compressed bitstream is decoded and the color space is inversely transformed to achieve lossless recovery or restoration of the original intermediate image. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 is a schematic diagram of the structure of a lossless compression model provided in an embodiment;
[0040] Figure 2 is a schematic structural diagram of an encoder in another lossless compression model provided by an embodiment;
[0041] Figure 3 It is a flowchart of compressing an intermediate image using a lossless compression model provided by an embodiment. DETAILED DESCRIPTION
[0042] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.
[0043] Compared with images in the real world, the intermediate images in the drawing process have some characteristics and properties that are obviously different from those in the real world. The main ones are: the color concentration of the intermediate images is much higher than that of the images in the real world. Based on this, in order to achieve high compression ratio lossless compression and restoration of the intermediate images, an embodiment provides a high compression ratio lossless compression method for the intermediate images, including two processes: building a lossless compression model and compressing and restoring the intermediate images using the lossless compression model. Each process is described in detail below.
[0044] The lossless compression model provided in the embodiment includes an encoder and a decoder. The encoder is used to decompose the input intermediate image into multiple color spaces, perform pixel prediction on the color plane under it in each color space, obtain the corresponding residual plane and residual space, and select the residual space with the lowest coding complexity according to the coding complexity of the residual space, and perform entropy coding on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed code stream; the decoder is used to decode the compressed code stream and restore it to obtain the intermediate image.
[0045] Specifically, Figure 1 As shown, the encoder provided by the embodiment includes a multi-color space decomposition unit, a first pixel prediction unit, a first coding complexity calculation unit, and a first entropy coding unit. Among them, the multi-color space decomposition unit is used to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space. After analysis, the number of color spaces involved in decomposition and comparison has a certain impact on the compression efficiency and the final compression result. If the number of color spaces is too large, it will take a lot of time to judge and select the color space with the lowest coding complexity; if the number of color spaces is too small, the possibilities that can be explored will be very limited, and it will be difficult to cover better space selection. Preferably, it can be selected to decompose and compare in three color spaces. Among them, the three color spaces include RGB space, YCoCg space, and Substract Green space, and three color planes under each color space are obtained after decomposition.
[0046] The intermediate drawing image to be compressed is generally in RGB format, that is, it is already in the RGB space and can be directly decomposed into three color planes of R, G, and B. Therefore, the original intermediate drawing image can be transformed into the YCoCg space and Subtract Green space respectively through the following two matrix transformations:
[0047]
[0048]
[0049] Among them, the first matrix converts the three color planes R, G, and B to the three color planes Y, Co, and Cg in the YCoCg space; the second matrix obtains the three color planes RG, G, and BG under Substract Green by subtracting the value of the green channel from the red channel and the blue channel respectively. This transformation is created by Google's Webp image compression scheme.
[0050] Of course, the preset color space (such as RGB, YCoCg or Subtract Green) in the multi-color space decomposition unit can also be replaced, and other color space options can be provided for the intermediate image to be encoded based on engineering experience or derivation calculations to seek the possibility of higher coding gain. The new color space provided to the multi-color space decomposition unit does not need to be limited to the existing color space, as long as it can achieve lossless reversible space transformation of the original image, it can be selected as a new color space.
[0051] In an embodiment, the first pixel prediction unit is used to perform pixel prediction on all color planes under each color space to obtain a prediction plane, and the difference between the color plane and the prediction plane is used as the residual plane. The new space composed of all residual planes under each color space is the residual space. The residual space corresponds to the original color space after removing the two-dimensional continuity. The number of residual planes is the same as the number of color planes, and the number of residual spaces is the same as the number of color spaces.
[0052] In the first pixel prediction unit, the modes of performing pixel prediction on the color plane include:
[0053] Calculate the sum of the pixels above the current pixel T and the left pixel L in the color plane, and calculate the difference between the sum of the pixels and the pixel above the left pixel TL; take the middle number among the above pixel T, the left pixel L and the pixel difference as the pixel prediction result of the current pixel, construct a prediction plane with all pixel prediction results, and subtract the prediction plane from the color plane to get the residual plane. The residual space composed of the residual plane better reflects the information characteristics of the original drawn intermediate image after removing the two-dimensional continuity, such as distribution and density.
[0054] In the embodiment, the first coding complexity calculation unit is used to calculate the entropy of each residual plane, and take the sum of the entropies of all residual planes in each residual space as the coding complexity of the residual space, and screen out the residual space with the lowest coding complexity.
[0055] Coding complexity refers to the expected difficulty, time consumption and size of the coding result in the current space. It is related to the complexity of the image to be coded and the space in which the image is located. Generally, the higher the coding complexity, the longer the coding time and the larger the coding result. The coding complexity here does not refer to the complexity of the coding algorithm.
[0056] In the embodiment, the three residual planes corresponding to each residual space are recorded as ErrorX, ErrorY and ErrorZ, and the three residual planes are used as random variables. The color value range and color value probability of each residual plane correspond to the value range and probability distribution of the random variable. Then, the entropy of a discrete random variable (plane) is calculated according to the following formula, that is, the entropy of the residual plane is:
[0057]
[0058] Substitute ErrorX, ErrorY and ErrorZ into X in the above formula, then P(x) is the pixel value distribution corresponding to ErrorX, ErrorY and ErrorZ, which can be obtained by traversing and counting the three residual planes. After obtaining P(ErrorX), P(ErrorY) and P(ErrorZ), the entropy values of the three residual planes in the residual space can be calculated, which are recorded as H(ErrorX), H(ErrorY) and H(ErrorZ) as above. They reflect the size / amount of information left in each residual plane after removing the continuity. At the same time, since the residual plane is also the direct input of the subsequent entropy coding stage, their entropy values can also be used as an idealized estimate of the size of the final coding result. In the embodiment, the coding complexity of the original drawn intermediate image in the residual space can be evaluated by the following formula:
[0059] H(ErrorX)+H(ErrorY)+H(ErrorZ)
[0060] That is, the sum of the entropy values of all residual planes in the residual space is used as a measure of the coding complexity. Then, the coding complexity of the intermediate image to be coded in the three spaces of RGB, YCoCg and Subtract Green is calculated according to the above formula, and the residual space with the lowest coding complexity is selected as the space for subsequent entropy coding.
[0061] In the embodiment, the first entropy coding unit is used to perform entropy coding on the residual plane of the residual space with the lowest coding complexity to obtain a compressed code stream and output it. The screened residual space with the lowest coding complexity is the optimal coding space, which is a technical means not involved in various image compression schemes at present, and the subsequent specific compression operation (entropy coding) of drawing the intermediate image can be achieved with the help of various existing lossless image compression methods. This embodiment is limited to using the FLIF lossless image compression algorithm for entropy coding, and finally obtains a compressed code stream. Specifically, it is limited to entropy coding the residual plane using the entropy coding method in the FLIF compression algorithm to obtain a compressed code stream.
[0062] like Figure 1 As shown, the decoder provided by the embodiment includes a decoding unit and a color space inverse transformation unit. The decoding unit is used to decode and predict the compressed code stream to obtain the representation of the intermediate image in the selected space; since the encoder uses the FLIF compression algorithm to perform the final substantial compression encoding, the decoder is limited to also use the FLIF algorithm decoding method to restore the compressed code stream, and then obtain the original intermediate image through the color space inverse transformation.
[0063] In the embodiment, the color space inverse transformation unit is used to perform an inverse transformation of the color space of the representation under the selected space according to the color space configuration information recorded in the code stream to restore the intermediate image. Specifically, the corresponding inverse space transformation is performed according to the color space used in encoding to restore the original intermediate image. The operation of restoring from the YCoCg space to the RGB space can be completed by the following matrix:
[0064]
[0065] The operation of restoring from Subtract Green space to RGB space can be completed by the following matrix:
[0066]
[0067] When the encoder selects RGB, no reduction operation is required.
[0068] The embodiment also provides another lossless compression model, including an encoder and a decoder, the encoder is used to decompose the input drawing intermediate image into multiple color spaces, screen the color space with the lowest coding complexity according to the coding complexity of the color space, perform pixel prediction on the color plane under it in the color space with the lowest coding complexity to obtain a residual plane, and perform entropy encoding on the residual plane to obtain a compressed code stream; the decoder decodes the compressed code stream and restores it to obtain the drawing intermediate image.
[0069] like Figure 2As shown, the encoder includes a multi-color space decomposition unit, a second coding complexity calculation unit, a second pixel prediction unit, and a second entropy coding unit. The multi-color space decomposition unit is used to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space. The implementation process and effect of the multi-color space decomposition unit are similar to Figure 1 The multiple color space decomposition units in the encoder shown are the same and will not be described again here.
[0070] In the embodiment, the second coding complexity calculation unit is used to calculate the entropy of each color plane, take the sum of the entropies of all color planes in each color space as the coding complexity of the color space, and screen out the color space with the lowest coding complexity.
[0071] Unlike the first coding complexity calculation unit, the second coding complexity calculation unit calculates the entropy of the color plane and selects the color space with the lowest coding complexity. The specific entropy calculation process is basically the same as the entropy calculation process of the residual plane in the first coding complexity calculation unit. The difference is that the original color plane is regarded as a random variable here, while the first coding complexity calculation unit regards the predicted residual plane as a random variable.
[0072] In an embodiment, the second pixel prediction unit is used to perform pixel prediction on all color planes in the color space with the lowest coding complexity to obtain a prediction plane, and the difference between the color plane and the prediction plane is used as the residual plane, and all residual planes in the color space with the lowest coding complexity constitute the residual space.
[0073] The processing object of the second pixel prediction unit is all color planes in the color space with the lowest coding complexity. The specific operation is to perform pixel prediction on the color plane to obtain the prediction plane, and use the difference between the color plane and the prediction plane as the residual plane. The process is the same as the processing method of the first pixel prediction unit, and will not be repeated here.
[0074] In the embodiment, the second entropy coding unit is used to entropy code the residual plane of the residual space to obtain and output a compressed code stream. The coding object of the second entropy coding unit is the residual plane output by the second pixel prediction unit. The specific coding method is the same as that of the first entropy coding unit, which will not be repeated here.
[0075] In fact, it can be proved that if the image is losslessly and reversibly transformed into multiple color spaces, then the joint entropy of the color planes of these spaces is equal. Specifically, we can record the joint entropy of the color planes of the image in each color space as H(R,G,B), H(Y,Co,Cg), etc. Since the spatial transformation is reversible, the color distribution in each color space is actually expressing the same original distribution, but the mapping method is different. For example, suppose the probability of the original image taking the value at color c is p. Due to the reversibility of the spatial transformation, there is only one set of values corresponding to color c in the RGB and YCoCg spaces. For example, red corresponds to (1,0,0) RGB and (0.25, 0.5, -0.25) YCoCg And so on. The probability of these values is naturally equal to the probability of color c. Since color c represents any color in the original image, the range and probability of the color value are determined in each color space, which is reflected in the joint entropy of the color plane, which measures the sum of the information contained in these color planes, which is exactly equal to the amount of information in the original image. On this basis, each color space introduces varying degrees of redundancy in expression, so the embodiment no longer performs pixel prediction but directly calculates the sum of the color plane entropy values of each space:
[0076] H(X)+H(Y)+H(Z)
[0077] This value must be greater than or equal to their joint entropy H(X,Y,Z), and the extra part is the redundant part. As we know from the previous section, there is an equation H(X,Y,Z)=H(R,G,B)=H(Y,Co,Cg). Therefore, if H(X)+H(Y)+H(Z) is smaller, or closer to H(X,Y,Z), it means that the redundant information entropy in the space where XYZ is located is less, and thus the amount of information that needs to be encoded is less. After determining and selecting the space with the smallest redundant information entropy, subsequent pixel prediction and entropy coding are performed in this space.
[0078] The lossless compression model constructed above can perceive the characteristics of the intermediate drawing image to be encoded, and improve its final compression ratio by selecting the optimal space for encoding. The compressed bitstream can also ensure lossless recovery / restore back to the original intermediate drawing image.
[0079] After constructing the above-mentioned lossless compression model consisting of an encoder and a decoder, the lossless compression model can be used to select the most suitable space for efficient compression encoding and decoding to restore the intermediate image according to the characteristics of the intermediate image.
[0080] When using Figure 1The lossless compression model shown compresses and restores the intermediate drawing image, including: using an encoder to decompose the input intermediate drawing image into multiple color spaces, performing pixel prediction on the color plane under it in each color space to obtain a residual plane and a residual space, screening the residual space with the lowest coding complexity according to the coding complexity of the residual space, and entropy encoding the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed code stream; using a decoder to decode the compressed code stream and restore it to obtain the intermediate drawing image.
[0081] like Figure 3 As shown, specifically, the compression process of drawing the intermediate image includes:
[0082] Step 1: Decompose the drawn intermediate image in multiple color spaces using a multi-color space decomposition unit to obtain multiple color planes of the image in RGB space, YCoCg space, and Substract Green space.
[0083] Step 2: Use the first pixel prediction unit to perform pixel prediction on all color planes in each color space to obtain a prediction plane, and use the difference between the color plane and the prediction plane as a residual plane. All residual planes in each color space constitute a residual space.
[0084] Step 3: Utilize the first coding complexity calculation unit to calculate the entropy of each residual plane, take the sum of the entropies of all residual planes in each residual space as the coding complexity of the residual space, and screen out the residual space with the lowest coding complexity.
[0085] Step 4: Use the first entropy coding unit to entropy encode the residual plane of the residual space with the lowest coding complexity to obtain a compressed code stream and output it.
[0086] When using Figure 2 The lossless compression model shown compresses and restores the intermediate drawing image, including: using an encoder to decompose the input intermediate drawing image into multiple color spaces, screening the color space with the lowest coding complexity according to the coding complexity of the color space, performing pixel prediction on the color plane under it in the color space with the lowest coding complexity to obtain a residual plane, and entropy encoding the residual plane to obtain a compressed code stream; using a decoder to decode the compressed code stream and restore it to obtain the intermediate drawing image.
[0087] Specifically, the compression process of drawing the intermediate image includes:
[0088] Step 1, using a multi-color space decomposition unit to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space, that is, to obtain multiple color planes corresponding to the image in RGB space, YCoCg space, and Substract Green space.
[0089] Step 2, using the second coding complexity calculation unit to calculate the entropy of each color plane, taking the sum of the entropies of all color planes in each color space as the coding complexity of the color space, and screening to obtain the color space with the lowest coding complexity;
[0090] Step 3, using the second pixel prediction unit to perform pixel prediction on all color planes in the color space with the lowest coding complexity to obtain a prediction plane, and taking the difference between the color plane and the prediction plane as a residual plane, and all residual planes in the color space with the lowest coding complexity constitute a residual space;
[0091] Step 4: Use the second entropy coding unit to entropy encode the residual plane of the residual space to obtain a compressed code stream and output it.
[0092] The embodiment also provides a high compression ratio and lossless compression device for drawing an intermediate image, comprising:
[0093] The encoding unit is used to decompose the inputted drawing intermediate image into multiple color spaces by using an encoder, perform pixel prediction on the color plane under it in each color space to obtain a residual plane and a residual space, select the residual space with the lowest coding complexity according to the coding complexity of the residual space, and perform entropy coding on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed code stream;
[0094] The decoding unit is used to decode the compressed code stream using a decoder and restore it to obtain a drawing intermediate image.
[0095] The embodiment also provides a high compression ratio and lossless compression device for drawing an intermediate image, comprising:
[0096] The encoding unit is used to perform color space decomposition on the inputted drawing intermediate image by using an encoder, select the color space with the lowest coding complexity according to the coding complexity of the color space, perform pixel prediction on the color plane under the color space with the lowest coding complexity to obtain a residual plane, and perform entropy coding on the residual plane to obtain a compressed bit stream;
[0097] The decoding unit is used to decode the compressed code stream using a decoder and restore it to obtain a drawing intermediate image.
[0098] It should be noted that the high compression ratio and lossless compression device for drawing intermediate images provided in the above embodiments should be illustrated by the division of the above functional units when performing high compression ratio and lossless compression of drawing intermediate images. The above functions can be assigned to different functional units as needed, that is, the internal structure of the terminal or server is divided into different functional units to complete all or part of the functions described above. In addition, the high compression ratio and lossless compression device for drawing intermediate images provided in the above embodiments and the high compression ratio lossless compression method embodiment for drawing intermediate images belong to the same concept. The specific implementation process is detailed in the high compression ratio lossless compression method embodiment for drawing intermediate images, which will not be repeated here.
[0099] The embodiment also provides a high compression ratio and lossless compression device for drawing an intermediate image, comprising a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor. The computer memory stores Figure 1 The lossless compression model shown; when a computer processor executes the computer program, the following steps are implemented:
[0100] Step 1, after decomposing the input drawing intermediate image into multiple color spaces by using an encoder, pixel prediction is performed on the color plane under it in each color space to obtain a residual plane and a residual space, and the residual space with the lowest coding complexity is selected according to the coding complexity of the residual space, and entropy coding is performed on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed bitstream;
[0101] Step 2: Use a decoder to decode the compressed code stream and restore it to obtain the intermediate image.
[0102] The embodiment also provides a high compression ratio and lossless compression device for drawing an intermediate image, comprising a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor, wherein the computer memory stores a lossless compression model as shown in FIG. 2; when the computer processor executes the computer program, the following steps are implemented:
[0103] Step 1, after decomposing the inputted drawing intermediate image into multiple color spaces by using an encoder, a color space with the lowest coding complexity is selected according to the coding complexity of the color space, pixel prediction is performed on the color plane under the color space with the lowest coding complexity to obtain a residual plane, and entropy coding is performed on the residual plane to obtain a compressed bitstream;
[0104] Step 2: Use a decoder to decode the compressed code stream and restore it to obtain the intermediate image.
[0105] In the high compression ratio and lossless compression device, the encoding process and decoding process of drawing the intermediate image implemented by the encoder and the decoder are the same as the above-mentioned high compression ratio and lossless compression method, and will not be repeated here.
[0106] In practical applications, the computer memory may be a volatile memory at the near end, such as RAM, or a non-volatile memory, such as ROM, FLASH, a floppy disk, a mechanical hard disk, etc., or a remote storage cloud. The computer processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), that is, the steps of the high compression ratio lossless compression method for drawing the intermediate image may be implemented by these processors.
[0107] This high compression ratio and lossless compression method explores the possibility of higher coding gain for the intermediate image to be encoded in multiple color spaces, and effectively selects the current best coding space by defining, calculating and comparing its coding complexity in different color spaces. Figure 1 The encoder in the lossless compression model shown can achieve a 100% non-negative compression ratio improvement (41%, 48%, 12% and 0%) on all drawn intermediate images participating in the test (including normal map, scene position map position buffer, irraddiance map and metalness roughness specular map) compared to the original FLIF compression scheme when using FLIF as the underlying encoding algorithm (pixel prediction and entropy coding). At the same time, the lossless compression ratio of this lossless compression model on various types of drawn intermediate images is also better than the lossless compression ratios of several current mainstream compression formats, such as Webp, BPG and AVIF.
[0108] The high compression ratio lossless compression method and device for drawing intermediate images provided in the embodiment can utilize the characteristics of drawing intermediate images to efficiently compress them. Compared with ordinary image compression schemes, the device greatly improves its compression ratio on various types of drawing intermediate images, reduces the memory and bandwidth occupied by the original image, and can also ensure the lossless restoration of the original drawing intermediate image.
[0109] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A high compression ratio lossless compression method for drawing intermediate images, characterized in that: The following steps are involved: A lossless compression model is constructed, the lossless compression model comprising an encoder and a decoder, wherein the encoder is used to decompose the input intermediate drawing image into multiple color spaces, perform pixel prediction on the color plane under it in each color space to obtain the corresponding residual plane and residual space, select the residual space with the lowest coding complexity according to the coding complexity of the residual space, and perform entropy coding on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed code stream; or, the encoder is used to decompose the input intermediate drawing image into multiple color spaces, select the color space with the lowest coding complexity according to the coding complexity of the color space, perform pixel prediction on the color plane under it in the color space with the lowest coding complexity to obtain the residual plane, and perform entropy coding on the residual plane to obtain the compressed code stream; the decoder is used to decode the compressed code stream and restore it to obtain the intermediate drawing image; The mode of pixel prediction for the color plane includes: calculating the sum of the pixels of the upper pixel T and the left pixel L of the current pixel in the color plane, and calculating the pixel difference between the pixel sum and the upper left pixel TL; taking the middle number among the upper pixel T, the left pixel L and the pixel difference as the pixel prediction result of the current pixel, and the prediction result of all pixels on a color plane is called the prediction plane of the color plane; Among them, coding complexity refers to the expected difficulty, time consumption and size of coding results in the current space. It is related to the complexity of the image to be encoded itself and the space where the image is located. The coding complexity of the residual space is the sum of the entropies of all residual planes in each residual space; the coding complexity of the color space is the sum of the entropies of all color planes in each color space; specifically, each residual plane or color plane is taken as a random variable, and the color value range and color value probability of each residual plane or color plane correspond to the value range and probability distribution of the random variable, and then the entropy of a discrete random variable is calculated to obtain the entropy of the residual plane or color plane, which reflects the amount of information left after removing the continuity of each residual plane or color plane; The constructed lossless compression model is used to compress and restore the drawn intermediate image.
2. The high compression ratio lossless compression method for drawing intermediate images according to claim 1, characterized in that: The encoder comprises a multi-color space decomposition unit, a first pixel prediction unit, a first coding complexity calculation unit, and a first entropy coding unit; The multi-color space decomposition unit is used to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space; The first pixel prediction unit is used to perform pixel prediction on all color planes in each color space to obtain a prediction plane, and use the difference between the color plane and the prediction plane as a residual plane, and all residual planes in each color space constitute a residual space; The first coding complexity calculation unit is used to calculate the entropy of each residual plane, taking the sum of the entropies of all residual planes in each residual space as the coding complexity of the residual space, and screening to obtain the residual space with the lowest coding complexity; The first entropy coding unit is used to perform entropy coding on the residual plane of the residual space with the lowest coding complexity to obtain a compressed code stream and output it.
3. The high compression ratio lossless compression method for drawing intermediate images according to claim 1, characterized in that: The encoder comprises a multi-color space decomposition unit, a second coding complexity calculation unit, a second pixel prediction unit, and a second entropy coding unit; The multi-color space decomposition unit is used to decompose the drawn intermediate image in multiple color spaces to obtain multiple color planes corresponding to each color space; The second coding complexity calculation unit is used to calculate the entropy of each color plane, taking the sum of the entropies of all color planes in each color space as the coding complexity of the color space, and screening to obtain the color space with the lowest coding complexity; The second pixel prediction unit is used to perform pixel prediction on all color planes in the color space with the lowest coding complexity to obtain a prediction plane, and use the difference between the color plane and the prediction plane as a residual plane, and all residual planes in the color space with the lowest coding complexity constitute a residual space; The second entropy coding unit is used to perform entropy coding on the residual plane in the residual space to obtain a compressed code stream and output it.
4. The high compression ratio lossless compression method for drawing intermediate images according to any one of claims 1 to 3, characterized in that: The color space includes RGB space, YCoCg space, and Substract Green space.
5. The method and device for lossless compression with high compression ratio for drawing intermediate images according to claim 2 or 3, characterized in that: In the first pixel prediction unit and the second pixel prediction unit, the difference between the color plane and the prediction plane is calculated to remove the two-dimensional continuity between the pixels in the drawing intermediate image, and the obtained residual plane reflects the information characteristics of the drawing intermediate image after the two-dimensional continuity is removed.
6. The high compression ratio lossless compression method for drawing intermediate images according to claim 1, characterized in that: The decoder comprises a decoding unit and a color space inverse conversion unit; The decoding unit is used to decode and predict the compressed code stream to obtain the representation of the original image in the selected space; The color space inverse transformation unit is used to perform an inverse transformation of the color space on the representation in the selected space to restore the intermediate image.
7. According to the lossless compression method with high compression ratio for rendering intermediate images according to claim 1, compressing and restoring the rendering intermediate images by using the constructed lossless compression model comprises: After decomposing the input intermediate image into multiple color spaces by using an encoder, pixel prediction is performed on the color plane under it in each color space to obtain the corresponding residual plane and residual space, and the residual space with the lowest coding complexity is selected according to the coding complexity of the residual space, and entropy coding is performed on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed bit stream; Or, after decomposing the inputted drawing intermediate image into multiple color spaces by using an encoder, a color space with the lowest coding complexity is selected according to the coding complexity of the color space, pixel prediction is performed on the color plane under the color space with the lowest coding complexity to obtain a residual plane, and entropy coding is performed on the residual plane to obtain a compressed bitstream; The decoder is used to decode the compressed code stream and restore the intermediate image.
8. A high compression ratio and lossless compression device for drawing intermediate images, characterized in that: include: The encoding unit is used to decompose the inputted drawing intermediate image into multiple color spaces by using an encoder, perform pixel prediction on the color plane under it in each color space to obtain the corresponding residual plane and residual space, select the residual space with the lowest coding complexity according to the coding complexity of the residual space, and perform entropy coding on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed code stream; Or, after decomposing the inputted drawing intermediate image in multiple color spaces by using an encoder, a color space with the lowest coding complexity is selected according to the coding complexity of the color space, pixel prediction is performed on the color plane under the color space with the lowest coding complexity to obtain a residual plane, and entropy coding is performed on the residual plane to obtain a compressed bitstream; The mode of pixel prediction for the color plane includes: calculating the sum of the pixels of the upper pixel T and the left pixel L of the current pixel in the color plane, and calculating the pixel difference between the pixel sum and the upper left pixel TL; taking the middle number among the upper pixel T, the left pixel L and the pixel difference as the pixel prediction result of the current pixel, and the prediction result of all pixels on a color plane is called the prediction plane of the color plane; Among them, coding complexity refers to the expected difficulty, time consumption and size of coding results in the current space. It is related to the complexity of the image to be encoded itself and the space where the image is located. The coding complexity of the residual space is the sum of the entropies of all residual planes in each residual space; the coding complexity of the color space is the sum of the entropies of all color planes in each color space; specifically, each residual plane or color plane is taken as a random variable, and the color value range and color value probability of each residual plane or color plane correspond to the value range and probability distribution of the random variable, and then the entropy of a discrete random variable is calculated to obtain the entropy of the residual plane or color plane, which reflects the amount of information left after removing the continuity of each residual plane or color plane; The decoding unit is used to decode the compressed code stream using a decoder and restore it to obtain a drawing intermediate image.
9. A high compression ratio and lossless compression device for drawing intermediate images, comprising a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor, characterized in that: The computer memory stores a lossless compression model constructed by using the lossless compression method with a high compression ratio for drawing an intermediate image according to any one of claims 1 to 7; When the computer processor executes the computer program, the following steps are implemented: After decomposing the input intermediate image into multiple color spaces by using an encoder, pixel prediction is performed on the color plane under it in each color space to obtain the corresponding residual plane and residual space, and the residual space with the lowest coding complexity is selected according to the coding complexity of the residual space, and entropy coding is performed on the residual plane under it in the residual space with the lowest coding complexity to obtain a compressed bit stream; Or, after decomposing the inputted drawing intermediate image into multiple color spaces by using an encoder, a color space with the lowest coding complexity is selected according to the coding complexity of the color space, pixel prediction is performed on the color plane under the color space with the lowest coding complexity to obtain a residual plane, and entropy coding is performed on the residual plane to obtain a compressed bitstream; The decoder is used to decode the compressed code stream and restore the intermediate image.
Citation Information
Patent Citations
Static image compression method based on depth learning model
CN107240136A
Image compression and restoration method and device based on deep learning
CN111355965A
Systems and methods for RGB video coding enhancement
CN110971905A