CN116405678A - Low-complexity and fixed compression ratio still image compression method - Google Patents
Low-complexity and fixed compression ratio still image compression method Download PDFInfo
- Publication number
- CN116405678A CN116405678A CN202310394024.9A CN202310394024A CN116405678A CN 116405678 A CN116405678 A CN 116405678A CN 202310394024 A CN202310394024 A CN 202310394024A CN 116405678 A CN116405678 A CN 116405678A
- Authority
- CN
- China
- Prior art keywords
- residual
- pixel
- pixels
- coding
- basic block
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 166
- 230000006835 compression Effects 0.000 title claims abstract description 44
- 238000007906 compression Methods 0.000 title claims abstract description 44
- 239000003086 colorant Substances 0.000 claims description 23
- 238000004364 calculation method Methods 0.000 claims description 21
- 238000013139 quantization Methods 0.000 claims description 13
- 230000000007 visual effect Effects 0.000 abstract description 7
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/60—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/70—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The embodiment of the disclosure provides a low-complexity and fixed-compression-ratio still image compression method, which belongs to the technical field of image processing and specifically comprises the following steps: step 1, converting a still image from YUV space to RGB space and dividing the still image according to the size of 2 multiplied by 6 to obtain a plurality of basic blocks; step 2, pre-coding each basic block, and calculating the mean square error of an original value corresponding to each basic block after each basic block is reconstructed by different coding methods and syntax elements to be coded of each basic block, wherein the coding methods comprise an ETC method, an SP method and a plurality of IC methods; step 3, selecting the coding method with the minimum mean square error of each basic block, and performing compression coding on the basic block according to the corresponding element to be coded to obtain a plurality of coding blocks; and 4, storing all the coding blocks into a compressed code stream file. By the scheme, the visual quality after compression coding is improved.
Description
Technical Field
The embodiment of the disclosure relates to the technical field of image processing, in particular to a low-complexity and fixed-compression-ratio still image compression method.
Background
Currently, still images are commonly compression-encoded using a JPEG (joint photographic experts group), a compression-encoding algorithm for still images, series of standards. JPEG compression techniques are generally frameworks that employ discrete cosine/wavelet transform + quantization + run-length coding + Huffman coding (or arithmetic coding). Due to lossy operations such as quantization, there is a blocking effect or the like in the visual quality after image encoding, and it is difficult to achieve a fixed compression ratio at the block level. Furthermore, applications such as smartphones, information appliances, smartwatches, etc. often require random access, i.e. the ability to locally refresh/window, and are highly demanding with respect to visual quality, and are sensitive to the cost of hardware implementations (chip-containing implementations or I P cores).
It can be seen that there is a need for an RGB888 image compression method suitable for smart phones, information appliances, smart watches, etc., which supports a partial refresh/windowing operation, realizes a fixed compression ratio in units of blocks, and has the advantages of good visual quality after encoding and low computational complexity.
Disclosure of Invention
In view of the above, the embodiments of the present disclosure provide a low-complexity and fixed compression ratio still image compression method supporting partial refresh. The method takes 2x6 image blocks as basic coding units in an RGB color space, each block has no dependency relationship, and does not need to refer to pixel values of any adjacent blocks, and texture compression is carried out according to a fixed compression ratio of 5:1. The basic coding idea is to compress by using the correlation of adjacent pixels in a block and adopting a method of 'block average value + residual error' or 'structure reference pixel + residual error'. The advantages are that: texture image compression at a fixed 5:1 compression ratio in arbitrary 2x6 image blocks can be achieved, i.e. a 2x6 block/partial windowing refresh operation is supported. In addition, since no lossy operations such as transform coding and quantization are adopted, the quality of the coded image is good, and the computational complexity is low.
The embodiment of the disclosure provides a low-complexity and fixed compression ratio still image compression method, comprising:
step 1, converting a still image from YUV space to RGB space and dividing the still image according to the size of 2 multiplied by 6 to obtain a plurality of basic blocks;
step 2, pre-coding each basic block, and calculating the mean square error of an original value corresponding to each basic block after each basic block is reconstructed by different coding methods and syntax elements to be coded of each basic block, wherein the coding methods comprise an ETC method, an SP method and a plurality of IC methods;
step 3, selecting the coding method with the minimum mean square error of each basic block, and performing compression coding on the basic block according to the corresponding element to be coded to obtain a plurality of coding blocks;
and 4, storing all the coding blocks into a compressed code stream file.
According to a specific implementation manner of the embodiment of the present disclosure, when the encoding method is an ETC method, the step 2 specifically includes:
calculating the RGB average value of the basic block, searching the first residual error table to traverse each residual error r under the level i for each pixel ij The average of the components using quantization-inverse quantization is combined with the residual r ij Reconstructing the current pixel to find the residual error r with minimum error ij The method comprises the steps of taking an optimal residual of a pixel under a level i, recording an index column number j of the optimal residual, traversing all residual levels i, finding an optimal residual index of each pixel under each residual level, selecting a residual level with the minimum mean square error of a reconstructed value and an original pixel block as the optimal residual level of a current block, and taking a quantized block average value, the optimal residual level and the optimal residual index number corresponding to each pixel under the level as syntax elements to be coded, wherein a row number i of a first residual table corresponds to different residual levels, and a column number j corresponds to different residual under the level; or,
traversing a second residual table by taking the first pixel of the basic block as a reference pixel for the rest pixelsTraversing the residual r in the residual table for each pixel j Reconstructing the residual pixels according to the reference pixel RGB component value plus residual error, and finding the residual error r with the minimum error j And recording index positions of the optimal residual errors of the current pixel, and taking RGB values of the reference pixel and the optimal residual error index of the residual pixel as syntax elements to be encoded.
According to a specific implementation manner of the embodiment of the present disclosure, when the encoding method is an SP method, the step 2 specifically includes:
dividing basic blocks into a plurality of groups in a preset grouping mode, calculating flatness information of each group, and marking the groups as flat or non-flat according to the flatness information;
for flat groupings, the pixels within a group are reconstructed using the quantized-dequantized group average for that group;
for non-flat grouping, intra-group pixels are reconstructed with the quantized-dequantized group averages of the group in combination with residuals, with each group average, the group number of the flat group, and the residual index number of the non-flat group as syntax elements to be encoded.
According to a specific implementation of an embodiment of the disclosure, the I C method includes I C method, I C method, I C3 method, IC4 method and IC5 method.
According to a specific implementation manner of the embodiment of the present disclosure, when the IC method is an IC1 method, the step 2 specifically includes:
selecting 6 pixels from each basic block as reference pixels according to a preset distribution mode, and selecting 2 basic primary colors from the reference pixels to interpolate to obtain a color table;
traversing the color table for each reference pixel, finding the pixel closest to the original value of the pixel as a reconstruction value of the pixel, and recording the index of the pixel in the color table;
traversing the selection modes of various basic colors, and selecting an optimal selection mode as the selection mode of the basic colors under the current distribution side;
reconstructing a reference pixel according to the method, reconstructing a corresponding prediction pixel according to a preset calculation formula, and forming a reconstructed basic block;
and selecting the most optimal distribution mode of the distribution mode with the minimum mean square error between the reconstructed basic block and the initial basic block, wherein indexes of the 2 basic colors and the reference pixels selected in the distribution mode in a color table are used as syntax elements to be coded.
According to a specific implementation manner of the embodiment of the present disclosure, when the IC method is an IC2 method, the step 2 specifically includes:
3 reference pixels are selected from the basic block to be directly encoded, and the residual predicted pixels are obtained by interpolation according to the positions and the distances of the residual predicted pixels and surrounding reference pixels.
According to a specific implementation manner of the embodiment of the present disclosure, when the IC method is an IC3 method, the step 2 specifically includes:
selecting 2 pixels in a basic block as basic colors in an interval list mode, and interpolating according to a preset formula to obtain a color table;
searching the optimal index of the reference pixels except the pixels corresponding to the basic color in the color table, reconstructing 6 reference pixels, reconstructing the corresponding prediction pixels according to a preset calculation formula, and forming a reconstructed basic block.
According to a specific implementation manner of the embodiment of the present disclosure, when the IC method is an IC4 method, the step 2 specifically includes:
4 reference pixels are selected from the basic block for encoding;
and determining the weight of linear interpolation according to the distance between the linear interpolation and the reference pixel in the horizontal direction, and then interpolating to obtain the predicted pixel.
According to a specific implementation manner of the embodiment of the present disclosure, when the IC method is an IC5 method, the step 2 specifically includes:
selecting 6 pixels from each basic block as reference pixels according to a preset distribution mode, selecting pixels with minimum sum and maximum sum of RGB component values as basic primary colors from the reference pixels, and interpolating to obtain a color table;
traversing each distribution mode, determining the position of a reference pixel and a calculation formula of a predicted pixel according to the current distribution mode, searching a color table for each reference pixel to find a pixel closest to an original value, and recording indexes of the pixels in the color table;
thereby reconstructing the reference pixels, calculating the predicted pixels according to a preset calculation formula and forming a reconstructed basic block.
According to a specific implementation manner of the embodiment of the present disclosure, the step 3 specifically includes:
comparing the reconstruction value of the basic block under each coding mode of the pre-coding stage with the mean square error of the original pixel block, and selecting the coding mode with the minimum mean square error as the optimal coding mode of the current block;
writing the corresponding flag word into the head of the compressed data stream of the current block;
and writing the syntax element to be coded in the coding mode into the code stream.
A low complexity and fixed compression ratio still image compression scheme in an embodiment of the present disclosure includes: step 1, converting a still image from YUV space to RGB space and dividing the still image according to the size of 2 multiplied by 6 to obtain a plurality of basic blocks; step 2, pre-coding each basic block, and calculating the mean square error of an original value corresponding to each basic block after each basic block is reconstructed by different coding methods and syntax elements to be coded of each basic block, wherein the coding methods comprise an ETC method, an SP method and a plurality of IC methods; step 3, selecting the coding method with the minimum mean square error of each basic block, and performing compression coding on the basic block according to the corresponding element to be coded to obtain a plurality of coding blocks; and 4, storing all the coding blocks into a compressed code stream file.
The beneficial effects of the embodiment of the disclosure are that: by the scheme, 5:1 compression is carried out in an RGB color space by taking a 2x6 image block as a basic coding unit, and no adjacent pixels need to be referenced. Therefore, the method can compress any 2x6 image block of the still image by 5:1, realize windowing/partial refreshing operation of a 2x6 image area, and ensure that each color component of a basic block selects an optimal coding mode, thereby effectively ensuring the visual quality of the compressed image, improving the compression efficiency and reducing the calculation cost.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
Fig. 1 is a flow chart of a low-complexity and fixed compression ratio still image compression method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart illustrating a process for implementing a low-complexity and fixed compression ratio still image compression method according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a decoding process involved in a low-complexity and fixed compression ratio still image compression method according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
Other advantages and effects of the present disclosure will become readily apparent to those skilled in the art from the following disclosure, which describes embodiments of the present disclosure by way of specific examples. It will be apparent that the described embodiments are merely some, but not all embodiments of the present disclosure. The disclosure may be embodied or practiced in other different specific embodiments, and details within the subject specification may be modified or changed from various points of view and applications without departing from the spirit of the disclosure. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict. All other embodiments, which can be made by one of ordinary skill in the art without inventive effort, based on the embodiments in this disclosure are intended to be within the scope of this disclosure.
It is noted that various aspects of the embodiments are described below within the scope of the following claims. It should be apparent that the aspects described herein may be embodied in a wide variety of forms and that any specific structure and/or function described herein is merely illustrative. Based on the present disclosure, one skilled in the art will appreciate that one aspect described herein may be implemented independently of any other aspect, and that two or more of these aspects may be combined in various ways. For example, an apparatus may be implemented and/or a method practiced using any number of the aspects set forth herein. In addition, such apparatus may be implemented and/or such methods practiced using other structure and/or functionality in addition to one or more of the aspects set forth herein.
It should also be noted that the illustrations provided in the following embodiments merely illustrate the basic concepts of the disclosure by way of illustration, and only the components related to the disclosure are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complicated.
In addition, in the following description, specific details are provided in order to provide a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects may be practiced without these specific details.
The embodiment of the disclosure provides a low-complexity and fixed-compression-ratio still image compression method, which can be applied to data transmission or storage of internet scenes.
Referring to fig. 1, a flow chart of a low-complexity and fixed compression ratio still image compression method is provided in an embodiment of the present disclosure. As shown in fig. 1 and 2, the method mainly comprises the following steps:
step 1, converting a still image from YUV space to RGB space and dividing the still image according to the size of 2 multiplied by 6 to obtain a plurality of basic blocks;
in particular, the present encoding method uses the RGB color space. For a YUV format still image, bt.709 standard is required, the still image may be first converted from YUV space to RGB space and divided according to a size of 2×6, so as to obtain a plurality of basic blocks, so as to facilitate a subsequent encoding process. The still image is divided according to 2x6 blocks in an RGB color space, and compression coding is carried out by taking the 2x6 blocks as basic coding units, so that the compressed image has almost visually lossless image quality while realizing a fixed compression ratio of 5:1.
Step 2, pre-coding each basic block, and calculating the mean square error of an original value corresponding to each basic block after each basic block is reconstructed by different coding methods and syntax elements to be coded of each basic block, wherein the coding methods comprise an ETC method, an SP method and a plurality of IC methods;
on the basis of the foregoing embodiment, when the encoding method is an ETC method, the step 2 specifically includes:
calculating the RGB average value of the basic block, searching the first residual error table to traverse each residual error r under the level i for each pixel ij The average of the components using quantization-inverse quantization is combined with the residual r ij Reconstructing the current pixel to find the residual error r with minimum error ij The method comprises the steps of taking an optimal residual of a pixel under a level i, recording an index column number j of the optimal residual, traversing all residual levels i, finding an optimal residual index of each pixel under each residual level, selecting a residual level with the minimum mean square error of a reconstructed value and an original pixel block as the optimal residual level of a current block, and taking a quantized block average value, the optimal residual level and the optimal residual index number corresponding to each pixel under the level as syntax elements to be coded, wherein a row number i of a first residual table corresponds to different residual levels, and a column number j corresponds to different residual under the level; or,
traversing a second residual table by taking a first pixel of the basic block as a reference pixel, traversing a residual r in the residual table for each pixel of the remaining pixels j Reconstructing the residual pixels according to the reference pixel RGB component value plus residual error, and finding the residual error r with the minimum error j And recording index positions of the optimal residual errors of the current pixel, and taking RGB values of the reference pixel and the optimal residual error index of the residual pixel as syntax elements to be encoded.
Further, when the encoding method is an SP method, the step 2 specifically includes:
dividing basic blocks into a plurality of groups in a preset grouping mode, calculating flatness information of each group, and marking the groups as flat or non-flat according to the flatness information;
for flat groupings, the pixels within a group are reconstructed using the quantized-dequantized group average for that group;
for non-flat grouping, intra-group pixels are reconstructed with the quantized-dequantized group averages of the group in combination with residuals, with each group average, the group number of the flat group, and the residual index number of the non-flat group as syntax elements to be encoded.
Alternatively, the IC method includes an IC1 method, an IC2 method, an IC3 method, an IC4 method, and an IC5 method.
Further, when the IC method is I C method, the step 2 specifically includes:
selecting 6 pixels from each basic block as reference pixels according to a preset distribution mode, and selecting 2 basic primary colors from the reference pixels to interpolate to obtain a color table;
traversing the color table for each reference pixel, finding the pixel closest to the original value of the pixel as a reconstruction value of the pixel, and recording the index of the pixel in the color table;
traversing the selection modes of various basic colors, and selecting an optimal selection mode as the selection mode of the basic colors under the current distribution side;
reconstructing a reference pixel according to the method, reconstructing a corresponding prediction pixel according to a preset calculation formula, and forming a reconstructed basic block;
and selecting the most optimal distribution mode of the distribution mode with the minimum mean square error between the reconstructed basic block and the initial basic block, wherein indexes of the 2 basic colors and the reference pixels selected in the distribution mode in a color table are used as syntax elements to be coded.
Further, when the IC method is I C2, the step 2 specifically includes:
3 reference pixels are selected from the basic block to be directly encoded, and the residual predicted pixels are obtained by interpolation according to the positions and the distances of the residual predicted pixels and surrounding reference pixels.
Further, when the IC method is I C method, the step 2 specifically includes:
selecting 2 pixels in a basic block as basic colors in an interval list mode, and interpolating according to a preset formula to obtain a color table;
searching the optimal index of the reference pixels except the pixels corresponding to the basic color in the color table, reconstructing 6 reference pixels, reconstructing the corresponding prediction pixels according to a preset calculation formula, and forming a reconstructed basic block.
Further, when the IC method is I C method, the step 2 specifically includes:
4 reference pixels are selected from the basic block for encoding;
and determining the weight of linear interpolation according to the distance between the linear interpolation and the reference pixel in the horizontal direction, and then interpolating to obtain the predicted pixel.
Further, when the IC method is I C5, the step 2 specifically includes:
selecting 6 pixels from each basic block as reference pixels according to a preset distribution mode, selecting pixels with minimum sum and maximum sum of RGB component values as basic primary colors from the reference pixels, and interpolating to obtain a color table;
traversing each distribution mode, determining the position of a reference pixel and a calculation formula of a predicted pixel according to the current distribution mode, searching a color table for each reference pixel to find a pixel closest to an original value, and recording indexes of the pixels in the color table;
thereby reconstructing the reference pixels, calculating the predicted pixels according to a preset calculation formula and forming a reconstructed basic block.
In specific implementation, the basic coding thought is to compress by using the correlation of adjacent pixels in a block and adopting a 'block average value+residual error' or a 'constructed reference pixel+residual error'. Currently, the supported image format is BMP file in RGB888 format, i.e. each color channel is in 8 bit color depth (8 bpc), 4:4:4 sampling format. Specifically, the code rate before and after each 2×6 block is shown in table 1.
TABLE 1
In this embodiment, according to the different conditions of the pixels in the 2×6 basic block, 7 encoding modes are designed, namely, ETC, SP and a series of I C methods. The bits and main parameter information required for each mode are summarized in Table 2. Whichever coding method is used, each 2x6 basic coding unit does not exceed 57 bits in the coded code stream. Fig. 2 is a basic flow of the encoder. The encoding process and basis of each method is analyzed later.
TABLE 2
When each 2x6 block is encoded, pre-encoding is first performed. The pre-coding stage needs to test preset ETC, SP and IC coding methods in sequence to obtain an optimal coding mode and syntax elements to be coded in the mode. The purpose of the pre-coding is to ensure that each color component of the basic block selects the optimal coding mode, thereby effectively ensuring the visual quality of the compressed image. The specific flow is as follows:
(1) ETC method
The main idea is as follows: the texture image coding method ETC deduced by Edison is referred to, and the idea of 'block average value plus residual error' is adopted. Specifically, the cases are divided into 2 cases.
First kind: firstly, calculating the average value of R, G and B three color components in a 2x6 block; the residual of each pixel (RGB) and the quantization-inverse quantization average (RGB) is then calculated. Note that: 1. quantization/dequantization, as referred to herein, refers to changing the original pixel from RGB888 to RGB666, i.e., right-shifted by 2 bits (i.e., quantized in steps of 4); 2. the residual referred to herein is not a real residual, but is a residual closest to the quantization-inverse quantization average found by searching the first fixed residual table (two-dimensional table of 8x8, row number i corresponding to different residual levels, column number j corresponding to different residuals under the levels) of the ETC method in table 2, and the quantization average and the index number corresponding to the residual of each pixel in the table are syntax elements to be encoded.
Second kind: the first pixel of the 2x6 block is taken as a reference pixel, and the residual pixel is calculated by using the reference pixel and residual error. The residual here is searched from the second residual table of ETC. The specific operation during precoding is as follows:
first case: firstly, calculating the RGB average value of the block; searching a first residual table { rij|0.ltoreq.i.ltoreq.7, 0.ltoreq.j.ltoreq.7 }, traversing each residual r under level i for each pixel ij Average value of each component + residual r quantized by quantization-inverse quantization ij "reconstruct current pixel, find residual error r with minimum error ij Recording an index column number j of the optimal residual error of the pixel under the level i; after traversing all pixels in the block, the method can obtainIndex number j representing the optimal residual corresponding to the nth pixel under the level i; traversing all residual error grades i according to the method, and finding out the optimal residual error index of each pixel under each residual error grade; and selecting the residual error grade with the minimum reconstruction value and the MSE of the original pixel block as the optimal residual error grade of the current block, and taking the quantized block average value, the optimal residual error grade and the optimal residual error index number corresponding to each pixel in the grade as syntax elements to be coded.
Second case: traversing a second residual table of ETC by taking a first pixel of the 2x6 block as a reference pixel, traversing the residual r in the residual table for each pixel of the remaining 11 pixels j Reconstructing the residual pixels according to the reference pixel RGB component value plus residual error, and finding the residual error r with the minimum error j As the optimal residual error of the current pixel, the index position is recorded, and the search is completed to obtainThe RGB value of the reference pixel and the optimal residual index of the residual pixel are the syntax elements to be coded. Table 3 is a code stream format encoded using the ETC method.
TABLE 3 Table 3
(2) SP method
The main idea is as follows: the pixels in the block are grouped, and each group is based on flatness information (sum of absolute errors of RGB component values and component mean values of the respective pixels in the group), the larger the value is, the more uneven the value is. The method is mainly aimed at blocks with larger pixel value variation in the blocks, and is suitable for blocks with more edge and image details. The specific method comprises the following steps:
dividing the 2x6 blocks into 2 groups (minimum 4 pixels and maximum 8 pixels in each group) according to a preset grouping mode; calculating flatness information of each group; for flatter groupings, the pixels within the group are reconstructed using the quantized-dequantized group average for the group; for non-flat groupings, all pixels within a group are reconstructed with the "quantization-inverse group mean + residual" of that group. The precoding flow is as follows:
traversing preset 16 grouping modes, grouping according to a current grouping mode d i, and calculating the group average value and flatness of each group; reconstructing all pixels in the group for a flat grouping using the quantization-inverse quantization average; for non-flat grouping, searching a residual table (a two-dimensional table of 16x 4) of the SP method in the table 2, searching for an optimal residual index of each pixel of the group according to the ETC method, and reconstructing the pixels in the group by using a quantization-inverse quantization group average value and residual; calculating the MSE of the reconstruction value and the original pixel block in the current grouping mode; traversing all grouping modes, and finding a grouping mode with the minimum MSE as an optimal grouping mode, wherein the average value of 2 groups, the group number of a flat group and the residual index number of a non-flat group in the mode are syntax elements to be coded. Table 4 shows the code stream format encoded by the SP method.
TABLE 4 Table 4
(3) I C1 method
The main idea is as follows: due to similarity of pixels in the blocks, 6 pixels are selected as reference pixels for direct coding according to 4 preset distribution modes in each 2x6 block, and the rest pixels are obtained by prediction according to the position relation with the known red reference pixels as prediction pixels. The specific method comprises the following steps:
traversing preset 4 distribution modes, and determining the position of a reference pixel and the calculation mode of a predicted pixel according to the current distribution mode d i, wherein the calculation mode is shown in table 3; 2 out of the current 6 reference pixels (co Seed selection), denoted b0, b1, interpolates b0 and b1, wherein b2=1/3×b0+2/3×b1, b3=2/3×b0+1/3×b1, thereby obtaining the color table { b0, b1, b2, b3}; traversing the color table for each reference pixel, finding the pixel closest to the original value of the pixel as a reconstruction value of the pixel, and recording the index of the pixel in the color table; for each distribution mode, traversing 15 basic color selection modes, and selecting an optimal selection mode as a basic color selection mode under the current distribution mode di; reconstructing the reference pixels according to the method, and reconstructing corresponding prediction pixels according to the calculation formula in table 5; and selecting the most optimal distribution mode of the reconstructed whole block and the minimum MSE distribution mode of the original pixel block, wherein indexes of the 2 basic colors and the reference pixels selected in the distribution mode in a color table are syntax elements to be coded. Table 6 shows the code stream format encoded by the IC1 method.
TABLE 5
Coding mode | Distribution mode | Two basic colors | Index of reference pixels in color table | Totals to |
2 | 2 | 776+776 | (6*2bit) | 56bit |
TABLE 6
(4) IC2 method
The basic idea is as follows: similar to the IC method, the method selects 3 reference pixels from the 2x6 block to directly encode, and the remaining predicted pixels are interpolated according to the positions and distances from surrounding reference pixels (only referring to the horizontal direction). Table 7 shows the code stream format encoded by the IC2 method.
TABLE 7
The prediction pixel determines the weight of linear interpolation according to the distance between the prediction pixel and the reference pixel in the horizontal direction, and the closer the distance is, the larger the weight is allocated, as in the distribution mode shown in table 7, when the distribution mode number is 0, the distance from B to a is 1, the distance from F is 4, and the distance from C1 is 2, then b= (4xa+f+2xc1)/7; the distance a to D is 3, the distance C1 to D is 2,F to D is 2, the total distance is 7, then d= (2×a+3×c1+2×f)/7, and so on. The code stream format is as in table 8:
coding mode | Distribution mode | Reference pixel | Totals to |
2 | 1 | (6+6+6)*3 | 57bit |
TABLE 8
(5) IC3 method
The main idea is as follows: the method is consistent with the coding flow of the IC method, and only changes the calculation mode of the color table. The concrete operation is as follows:
let the set a= { ai|i=0, 1,2,3,4,5} = {9,18,27,37,45}, select the pixel with the number A, F in the block (IntervalList mode select A, F1) as the basic primary color b0, b1, interpolate b0, b1 according to the following formula:
b2=1/3*b0+2/3*b1
b3=2/3*b0+1/3*b1
b4=3/8*b0+5/8*b1
b5=5/8*b0+3/8*b1
comparing the sizes of b0, b1, if b0> b1, b0-ai, b1+ai; otherwise, b0+ai, b1-ai, obtaining 10 new pixels b6-b15, thereby constructing a color table { bi|0 +.i +.ltoreq.15 };
the optimal index in the color table of all reference pixels (excluding the 2 basic primary colors that have been selected) is searched, thereby reconstructing 6 reference pixels, and then the remaining predicted pixels are calculated according to the same procedure as in the IC method. The code stream format is as in table 9:
TABLE 9
(6) I C4 method
The method selects 4 reference pixels from a 2x6 block to directly encode, and the residual predicted pixels are obtained by interpolation according to the positions and the distances of the residual predicted pixels and surrounding reference pixels (only referring to the horizontal direction).
Table 10
The predicted pixel determines the weight of linear interpolation according to the distance from the reference pixel in the horizontal direction, and the closer the distance is, the larger the weight is allocated, as shown in table 10, when the distribution mode number is 0, the distance from B to a is 1, and the distance from F is 4, then b= (4×a+f)/5; the code stream format is as in table 11:
coding mode | Distribution mode | Reference pixel | Totals to |
2 | 3 | (4+5+4)*4 | 57bit |
TABLE 11
(7) IC5 method
The main idea is as follows: similar to the IC method, 2 basic primary colors are selected, a color table is constructed by interpolation, the values of reference pixels are obtained by searching the color table, and predicted pixels are obtained by calculation according to the position close relation with the reference pixels. The specific flow is as follows:
for a 2x6 block, pixels with minimum and maximum sum of RGB component values, denoted b0, b1, respectively, are calculated, and these 2 pixels are used as the primary colors, interpolated as follows:
b2=1/8*b0+7/8*b1
b3=7/8*b0+1/8*b1
b4=2/8*b0+6/8*b1
b5=6/8*b0+6/8*b1
b6=3/8*b0+5/8*b1
b7=5/8*b0+3/8*b1
b6=(b0+b1)/2;
b7=b1-b0;
the color table { bi|i=0, 1,2,3,4,5,6,7} is thus obtained.
Traversing 4 distribution modes, determining the position of a reference pixel and a calculation formula of a predicted pixel according to a current distribution mode di, searching a k color table for each reference pixel to find a pixel closest to an original value, and recording indexes of the pixels in the color table; thereby reconstructing the reference pixel, and calculating the predicted pixel according to the corresponding calculation formula in table 12:
table 12
The code stream format is shown in table 13.
TABLE 13
Step 3, selecting the coding method with the minimum mean square error of each basic block, and performing compression coding on the basic block according to the corresponding element to be coded to obtain a plurality of coding blocks;
on the basis of the above embodiment, the step 3 specifically includes:
comparing the reconstruction value of the basic block under each coding mode of the pre-coding stage with the mean square error of the original pixel block, and selecting the coding mode with the minimum mean square error as the optimal coding mode of the current block;
writing the corresponding flag word into the head of the compressed data stream of the current block;
and writing the syntax element to be coded in the coding mode into the code stream.
In specific implementation, the reconstructed value obtained in the pre-coding stage in various coding modes can be compared with the MSE of the original pixel block, and the coding mode with the minimum MSE is selected as the optimal coding mode of the current block; writing the corresponding flag word into the head of the compressed data stream of the current block; and writing the syntax element to be coded in the coding mode into the code stream, as shown in table 14.
Table 14 step 4, the entire encoded blocks are saved as a compressed code stream file.
In the implementation, after all the basic blocks are compressed to obtain the coding blocks, all the coding blocks can be stored to form a compressed code stream file. Of course, when the compressed file needs to be decoded, as shown in fig. 3, the decoding process is the inverse process of encoding, and the image is restored according to the code stream. The decoding is still reconstructed in 2x6 blocks. When reconstructing each block, the encoding mode of the block is read, then the grammar elements with corresponding length are read according to the encoding mode, and the image data of the block can be recovered by reconstructing the whole block according to the corresponding method.
The low-complexity and fixed-compression-ratio still image compression method provided by the embodiment performs 5:1 compression in an RGB color space by taking a 2x6 image block as a basic coding unit, and does not need to refer to any adjacent pixels. Therefore, the method can compress any 2x6 image block of the still image by 5:1, realize windowing/partial refreshing operation of a 2x6 image area, and ensure that each color component of a basic block selects an optimal coding mode, thereby effectively ensuring the visual quality of the compressed image, improving the compression efficiency and reducing the calculation cost.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware.
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.
The foregoing is merely specific embodiments of the disclosure, but the protection scope of the disclosure is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the disclosure are intended to be covered by the protection scope of the disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims (10)
1. A low-complexity and fixed compression ratio still image compression method, comprising:
step 1, converting a still image from YUV space to RGB space and dividing the still image according to the size of 2 multiplied by 6 to obtain a plurality of basic blocks;
step 2, pre-coding each basic block, and calculating the mean square error of an original value corresponding to each basic block after each basic block is reconstructed by different coding methods and syntax elements to be coded of each basic block, wherein the coding methods comprise an ETC method, an SP method and a plurality of IC methods;
step 3, selecting the coding method with the minimum mean square error of each basic block, and performing compression coding on the basic block according to the corresponding element to be coded to obtain a plurality of coding blocks;
and 4, storing all the coding blocks into a compressed code stream file.
2. The method according to claim 1, wherein when the encoding method is an ETC method, the step 2 specifically includes:
calculating the RGB average value of the basic block, searching the first residual error table to traverse each residual error r under the level i for each pixel ij The average of the components using quantization-inverse quantization is combined with the residual r ij Reconstructing the current pixel to find the residual error r with minimum error ij The method comprises the steps of taking an optimal residual of a pixel under a level i, recording an index column number j of the optimal residual, traversing all residual levels i, finding an optimal residual index of each pixel under each residual level, selecting a residual level with the minimum mean square error of a reconstructed value and an original pixel block as the optimal residual level of a current block, and taking a quantized block average value, the optimal residual level and the optimal residual index number corresponding to each pixel under the level as syntax elements to be coded, wherein a row number i of a first residual table corresponds to different residual levels, and a column number j corresponds to different residual under the level; or,
traversing a second residual table by taking a first pixel of the basic block as a reference pixel, traversing a residual r in the residual table for each pixel of the remaining pixels j Reconstructing the residual pixels according to the reference pixel RGB component value plus residual error, and finding the residual error r with the minimum error j And recording index positions of the optimal residual errors of the current pixel, and taking RGB values of the reference pixel and the optimal residual error index of the residual pixel as syntax elements to be encoded.
3. The method according to claim 1, wherein when the encoding method is an SP method, the step 2 specifically comprises:
dividing basic blocks into a plurality of groups in a preset grouping mode, calculating flatness information of each group, and marking the groups as flat or non-flat according to the flatness information;
for flat groupings, the pixels within a group are reconstructed using the quantized-dequantized group average for that group;
for non-flat grouping, intra-group pixels are reconstructed with the quantized-dequantized group averages of the group in combination with residuals, with each group average, the group number of the flat group, and the residual index number of the non-flat group as syntax elements to be encoded.
4. The method of claim 1, wherein the IC method comprises an IC1 method, an IC2 method, an IC3 method, an IC4 method, and an IC5 method.
5. The method according to claim 4, wherein when the IC method is an IC1 method, the step 2 specifically includes:
selecting 6 pixels from each basic block as reference pixels according to a preset distribution mode, and selecting 2 basic primary colors from the reference pixels to interpolate to obtain a color table;
traversing the color table for each reference pixel, finding the pixel closest to the original value of the pixel as a reconstruction value of the pixel, and recording the index of the pixel in the color table;
traversing the selection modes of various basic colors, and selecting an optimal selection mode as the selection mode of the basic colors under the current distribution side;
reconstructing a reference pixel according to the method, reconstructing a corresponding prediction pixel according to a preset calculation formula, and forming a reconstructed basic block;
and selecting the most optimal distribution mode of the distribution mode with the minimum mean square error between the reconstructed basic block and the initial basic block, wherein indexes of the 2 basic colors and the reference pixels selected in the distribution mode in a color table are used as syntax elements to be coded.
6. The method according to claim 4, wherein when the IC method is an IC2 method, the step 2 specifically includes:
3 reference pixels are selected from the basic block to be directly encoded, and the residual predicted pixels are obtained by interpolation according to the positions and the distances of the residual predicted pixels and surrounding reference pixels.
7. The method according to claim 4, wherein when the IC method is an IC3 method, the step 2 specifically includes:
selecting 2 pixels in a basic block as basic colors in an interval list mode, and interpolating according to a preset formula to obtain a color table;
searching the optimal index of the reference pixels except the pixels corresponding to the basic color in the color table, reconstructing 6 reference pixels, reconstructing the corresponding prediction pixels according to a preset calculation formula, and forming a reconstructed basic block.
8. The method according to claim 4, wherein when the IC method is an IC4 method, the step 2 specifically includes:
4 reference pixels are selected from the basic block for encoding;
and determining the weight of linear interpolation according to the distance between the linear interpolation and the reference pixel in the horizontal direction, and then interpolating to obtain the predicted pixel.
9. The method according to claim 4, wherein when the IC method is an IC5 method, the step 2 specifically includes:
selecting 6 pixels from each basic block as reference pixels according to a preset distribution mode, selecting pixels with minimum sum and maximum sum of RGB component values as basic primary colors from the reference pixels, and interpolating to obtain a color table;
traversing each distribution mode, determining the position of a reference pixel and a calculation formula of a predicted pixel according to the current distribution mode, searching a color table for each reference pixel to find a pixel closest to an original value, and recording indexes of the pixels in the color table;
thereby reconstructing the reference pixels, calculating the predicted pixels according to a preset calculation formula and forming a reconstructed basic block.
10. The method according to claim 4, wherein the step 3 specifically includes:
comparing the reconstruction value of the basic block under each coding mode of the pre-coding stage with the mean square error of the original pixel block, and selecting the coding mode with the minimum mean square error as the optimal coding mode of the current block;
writing the corresponding flag word into the head of the compressed data stream of the current block;
and writing the syntax element to be coded in the coding mode into the code stream.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310394024.9A CN116405678A (en) | 2023-04-13 | 2023-04-13 | Low-complexity and fixed compression ratio still image compression method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310394024.9A CN116405678A (en) | 2023-04-13 | 2023-04-13 | Low-complexity and fixed compression ratio still image compression method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116405678A true CN116405678A (en) | 2023-07-07 |
Family
ID=87013899
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310394024.9A Pending CN116405678A (en) | 2023-04-13 | 2023-04-13 | Low-complexity and fixed compression ratio still image compression method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116405678A (en) |
-
2023
- 2023-04-13 CN CN202310394024.9A patent/CN116405678A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020253829A1 (en) | Coding/decoding method and device, and storage medium | |
CN102939753B (en) | For the method and apparatus by video being decoded according to pixel groups compensated pixel value | |
JP5890520B2 (en) | Method and apparatus for predicting color difference component of image using luminance component of image | |
CN102474614B (en) | Video encoding method and apparatus and video decoding method and apparatus, based on hierarchical coded block pattern information | |
US9307250B2 (en) | Optimization of intra block size in video coding based on minimal activity directions and strengths | |
TWI816439B (en) | Block-based prediction | |
CN103220520B (en) | For the method for decoding to video | |
CN104581153A (en) | Method and apparatus for dencoding video by using deblocking filtering | |
CN105072443A (en) | Method and device for interpolating images by using a smoothing interpolation filter | |
CN104980757A (en) | Video decoding method using offset adjustments according to pixel classification and apparatus therefor | |
CN104683811B (en) | A kind of Information hiding and extracting method based on the modulation of integer DCT coefficient | |
US9106897B2 (en) | Picture encoding and decoding method, picture encoding and decoding device and network system | |
CN107864380A (en) | 3D HEVC fast intra-mode prediction decision-making techniques based on DCT | |
TWI833073B (en) | Coding using intra-prediction | |
CN107736021A (en) | Picture decoding method and device for the method for encoding images and device of sample value compensation and for sample value compensation | |
CN116405678A (en) | Low-complexity and fixed compression ratio still image compression method | |
TW202139704A (en) | Mip for all channels in the case of 4:4:4-chroma format and of single tree | |
JP6992825B2 (en) | Video coding device, video coding method, video decoding device, video decoding method, and video coding system | |
CN112954350A (en) | Video post-processing optimization method and device based on frame classification | |
CN113676616B (en) | Image reversible information hiding method and system based on DCT coefficient correlation | |
CN116405676A (en) | RGB565 image fixed compression ratio rapid compression method | |
CN114900693B (en) | Image compression method, decompression method and device based on block truncated coding | |
EP2887667A1 (en) | Coding of high dynamic range images | |
CN116320453A (en) | Point cloud entropy encoding method, decoding method, device, equipment and readable storage medium | |
CN114025166A (en) | Video compression method, electronic device and computer-readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |