Lossless encoding method
By predicting the Golomb-Rice parameter m and decomposing the quantization coefficients into encoding prefixes and suffixes, the problem of fixed and increasing Golomb-Rice parameter m is solved, thereby accelerating the encoding convergence speed and improving the data compression rate.
Patent Information
- Application Number
- CN202211271291.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-10-17
AI Technical Summary
In existing technologies, the Golomb-Rice parameter m is only updated incrementally, which cannot cope with complex quantization coefficient distributions. Furthermore, the Golomb-Rice parameter m of the quantization coefficients is fixed, resulting in slow encoding convergence speed.
A lossless encoding method is provided, which predicts the Golomb-Rice parameter m of the current pixel by using the average value of the quantization coefficients of all preceding pixels, and divides the quantization coefficients into an encoding prefix and an encoding suffix. The encoding prefix is unary encoded and the suffix is binary encoded. The encoding of all pixel blocks is performed cyclically. The Golomb-Rice parameter m can be incremented or decremented and is not fixed.
It accelerates the convergence speed of encoding and improves the data compression rate, with a data compression rate improvement of about 20% compared to the binarization process of CAVLC.
Smart Images

Figure CN115604469B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of coding, in particular to a lossless coding method. BACKGROUND
[0002] The most widely used block-based Golomb-Rice coding method is used in the CAVLC (Context-based Adaptive Variable-Length Code) coding of the H.264 video compression coding standard.
[0003] In the H.264 coding standard, the CAVLC coding is performed on the 4x4 pixel block which has been quantized. Golomb-Rice is an important part of the CAVLC coding, and is used to complete the binary coding of each quantized coefficient LevelCode in the 4x4 block. The implementation of Golomb-Rice is as follows: two important parameters, Level_prefix and Level_suffix, are calculated.
[0004] Level_prefix=LevelCode / (1<<SuffixLength)
[0005] Level_Suffix=LevelCode%(1<<SuffixLength)
[0006] In the above formula, the parameter SuffixLength is the parameter m in the Golomb-Rice standard algorithm. The H.264 coding standard determines the SuffixLength parameter according to the size of the current quantized coefficient value, and updates the Golomb-Rice parameter m in a unidirectional increasing manner.
[0007] However, the prior art has the following problems: 1. The Golomb-Rice parameter m is only updated in a stepwise increasing manner, and there is no decreasing branch, so it cannot cope with complex quantized coefficient distribution; 2. The Golomb-Rice parameter m of the quantized coefficient is fixed, which reduces the convergence speed of the coding. SUMMARY
[0008] The present application provides a lossless coding method, and the Golomb-Rice parameter m provided by the present application can be increasing or decreasing according to the arrangement of the pixel block or the pixel, and the quantized Golomb-Rice parameter m is not fixed, which accelerates the convergence speed of the coding.
[0009] In order to achieve the above object, the present application provides a lossless encoding method, comprising:
[0010] S1: providing quantized 4X4 pixel blocks, each of the pixel blocks comprising a plurality of pixels, each of the pixels having a quantized coefficient;
[0011] S2: predicting a Golomb-Rice parameter m value of a current pixel by using a mean value of quantized coefficients of all pixels in front;
[0012] S3: dividing the quantized coefficient corresponding to the current pixel into an encoding prefix and an encoding suffix according to the Golomb-Rice parameter m, the encoding prefix being unary encoded according to a unary encoding table, and the encoding suffix being binary encoded;
[0013] S4: repeating steps S2-S3 until the encoding of all pixel blocks is completed.
[0014] Optionally, in the lossless encoding method, the encoding of all pixel blocks is completed according to steps S2-S3 from the first pixel.
[0015] Optionally, in the lossless encoding method, the encoding of all pixel blocks is completed in the order of rows.
[0016] Optionally, in the lossless encoding method, each of the pixel blocks comprises nine prediction modes.
[0017] Optionally, in the lossless encoding method, the method for calculating the mean value of quantized coefficients of all pixels in front comprises: the sum of quantized coefficients of all pixels divided by the number of all pixels.
[0018] Optionally, in the lossless encoding method, the method for predicting the Golomb-Rice parameter m value comprises: m=[log 2 (N+1)]; wherein m is the Golomb-Rice parameter m value, and N is the mean value of quantized coefficients of all pixels in front.
[0019] Optionally, in the lossless encoding method, the method for dividing the quantized coefficient corresponding to the current pixel into the encoding prefix and the encoding suffix according to the Golomb-Rice parameter m comprises:
[0020] q=M / m; r=M%m; wherein q is the encoding prefix, M is the quantized coefficient, m is the Golomb-Rice parameter m value, and r is the encoding suffix.
[0021] Optionally, in the lossless encoding method, the method for encoding the prefix by using the unary encoding table comprises the following steps: querying a line with the same value of the Golomb-Rice parameter m value, and entering the unary encoding table from the line; and taking the value of the line and the value of the next line as the encoding result of the prefix.
[0022] Optionally, in the lossless encoding method, the unary encoding table is a table with Y+1 lines and 6 columns, Y is an integer greater than or equal to 0, and when Y is 0, Y+1 lines are numbered from 0 to Y, and the value of each line is the same as the number of the line.
[0023] Optionally, in the lossless encoding method, the quantized coefficient of the pixel and the Golomb-Rice parameter m value are stored in the form of an index, the index value is the combination of the encoding prediction mode of the pixel block in which the pixel is located and the position of the pixel, and the pixel corresponding to the index value, the quantized coefficient and the Golomb-Rice parameter m value corresponding to the index value can be queried according to the index value.
[0024] In the lossless encoding method provided by the application, the lossless encoding method comprises the following steps: S1, providing a quantized 4X4 pixel block, each pixel block comprises a plurality of pixels, and each pixel corresponds to a quantized coefficient; S2, predicting the Golomb-Rice parameter m value of the current pixel by using the average value of the quantized coefficients of all pixels in front of the current pixel; S3, dividing the quantized coefficient corresponding to the current pixel into an encoding prefix and an encoding suffix according to the Golomb-Rice parameter m, the encoding prefix is encoded by using a unary encoding table, and the encoding suffix is encoded by using a binary encoding table; and S4, repeating steps S2 to S3 until the encoding of all pixel blocks is completed. The Golomb-Rice parameter m is increasing or decreasing along with the arrangement of the pixel block or the pixel, and the quantized Golomb-Rice parameter m is not fixed, so that the convergence speed of the encoding is accelerated. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 It is a flowchart of the lossless encoding method of the embodiment of the application;
[0026] Figure 2 It is a unary encoding table of the embodiment of the application;
[0027] Figure 3 It is a binary encoding table of the embodiment of the application. DETAILED DESCRIPTION
[0028] The specific embodiments of the present application will be described below in greater detail with reference to the accompanying drawings. The advantages and features of the present application will become more apparent from the following description in conjunction with the drawings. It should be noted that the drawings are in extremely simplified form and are not drawn to precise scale, and are used merely to facilitate the understanding of the embodiments of the present application.
[0029] Hereinafter, the terms "first", "second", and the like are used to distinguish between similar elements, and are not necessarily used to describe a particular chronological or temporal order. It will be understood that, where appropriate, the terms so used can be interchanged. Similarly, if a method described herein includes a series of steps, the order in which the steps are presented is not necessarily the only order in which the steps can be performed, and some of the steps can be omitted and / or other steps not described herein can be added to the method.
[0030] Please refer to Figure 1 The present application provides a lossless encoding method, comprising:
[0031] S1: providing quantized 4X4 pixel blocks, each pixel block comprising a plurality of pixels, each pixel having a quantized coefficient;
[0032] S2: predicting the Golomb-Rice parameter m value of the current pixel using the average value of the quantized coefficients of all pixels in front;
[0033] S3: dividing the quantized coefficient corresponding to the current pixel into a coding prefix and a coding suffix according to the Golomb-Rice parameter m, the coding prefix being unary coded according to a unary coding table, and the coding suffix being binary coded;
[0034] S4: repeating steps S2-S3 until the encoding of all pixel blocks is completed.
[0035] Further, from the first pixel, the encoding of all pixel blocks is completed according to steps S2-S3.
[0036] Preferably, the encoding of all pixel blocks is completed in the order of rows. Using the block-by-block updating method, the corresponding context content is updated after the completion of each encoding block. At the same time, the context is refreshed after the completion of the encoding of each row of blocks to ensure the controllability of the amount of context content information. Each block is named in the form of an index, and the quantization coefficients and Golomb-Rice parameter m values of the pixel are also stored in the form of an index, wherein the index value is the combination of the encoding prediction mode of the pixel block in which the pixel is located and the position of the pixel. According to the index value, the pixel corresponding to the index value and the corresponding quantization coefficients and Golomb-Rice parameter m values can be queried. Determination of the context index: the present application uses the prediction mode PredMode of the block and the position BlockIdx of the pixel in the block as the index of the context information to create a context index table Context[PredMode][BlockIdx]. The two values of the prediction mode and the pixel position not only contain gradient information, but also effectively support the quantization coefficients (frequency domain coefficients and time domain coefficients). For example, if a similar H.264 intra prediction is used, each pixel block includes 9 prediction modes, and for a 4x4 block, only 9x16 = 144 Context table entries are needed for a whole image, and each table entry has the pixel and the corresponding quantization coefficients and Golomb-Rice parameter m values.
[0037] wherein the updating process of each pixel block is as follows:
[0038] Context[PredMode][BlockIdx] = Context[PredMode][BlockIdx] + abs(Coeff), BlockNum[PredMode][BlockIdx] = BlockNum[PredMode][BlockIdx] + 1, wherein abs(Coeff) is the absolute value of the quantization coefficient, Context[PredMode][BlockIdx] is the Context table entry of the current block, and BlockNum[PredMode][BlockIdx] is the pixel block.
[0039] Preferably, the method for calculating the average value of the quantization coefficients of all pixels in the forward direction comprises: dividing the sum of all pixel quantization coefficients by the number of all pixels.
[0040] Preferably, the method for predicting the Golomb-Rice parameter m value comprises: m = [log 2(N+1)]; wherein, m is Golomb-Rice parameter m value, N is the average value of quantization coefficients of all pixels in front. Golomb coding is a lossless data compression method, invented by mathematician Solomon W. Golomb in the 1960s. Golomb coding can only encode non-negative integers, and the probability of the symbol in the symbol table conforms to the geometric distribution, so the optimal effect can be achieved by using Golomb coding, that is, Golomb coding is more suitable for small numbers than large numbers. It uses shorter code length to encode smaller numbers and longer code length to encode larger numbers. Golomb coding is a grouping coding, which needs a positive integer parameter m, and then groups the numbers to be encoded by m. Specifically, for any non-negative positive integer N to be encoded, Golomb coding divides it into two parts: the quotient of the to-be-encoded number N and the parameter m, and the remainder of the quotient. For the obtained group number q, unary coding is used, and the remaining part r is encoded using fixed-length binary coding. Among them, unary coding is a simple method that can only encode non-negative integers. For any non-negative integer N, its unary coding is N 1 followed by a 0.
[0041] Therefore, the method of dividing the quantization coefficient corresponding to the current pixel into a coding prefix and a coding suffix according to the Golomb-Rice parameter m includes:
[0042] q=M / m; r=M%m; wherein q is the coding prefix, M is the quantization coefficient, m is the Golomb-Rice parameter m value, and r is the coding suffix.
[0043] Next, the method of unary coding the coding prefix includes: querying the same value as the Golomb-Rice parameter m value from the row, and entering the unary coding table from the row; and taking the value of the row and the value of the next row as the coding result of the coding prefix. Preferably, the unary coding table is a table of Y+1 rows and 6 columns, Y is an integer greater than or equal to 0, and when Y is 0, Y+1 rows are numbered from 0 to Y, and the value of each row is the same as the number of the row. Specifically, as shown in Figure 2 , Figure 2 The unary coding table of the embodiment of the application is 11 rows and 6 columns. If the Golomb-Rice parameter m value is 0, it starts from the m=0 row. If the Golomb-Rice parameter m value is 2, it starts from the m=2 row. The specific operation can be referred to Golomb coding, which is not described here.
[0044] The index table is not unique and can be customized as required, the variable grouping characteristic of Golomb-Rice parameter m value can effectively accelerate the error convergence speed, and the value range of Golomb-Rice parameter m value is effectively controlled. For example, during the encoding process of a certain quantization coefficient L=15, m=1 is determined through context prediction, and the index process enters from m=1. Due to the effective range [0, 11] of the row value of m=1, 111111 is output before entering m=2. The block branch of m=2 is entered, 0 is first output, and 2 bits 11 are output in the suffix, that is, 111111011 is output, and a total of 9 bits are output. If context prediction is not used, the initial value of m is 0, and 16 bits are output. If the index table is not used, Golomb-Rice parameter m value is always 1, and 10 bits are output. Through the index table updating grouping parameter mode, the encoding convergence speed is effectively improved, compared with the binarization process of CAVLC, the data compression rate is improved by about 20%.
[0045] Then, the suffix is encoded according to the binary encoding, so that the encoding of the Golomb-Rice parameter m value is completed, and the specific encoding method of the binary encoding can refer to the Golomb encoding, which is not described herein. The binary encoding of the embodiment of the present application is as follows Figure 3 .
[0046] In summary, in the lossless encoding method provided by the embodiment of the present application, the lossless encoding method comprises: S1: providing a quantized 4X4 pixel block, each pixel block comprising a plurality of pixels, each pixel corresponding to a quantization coefficient; S2: predicting the Golomb-Rice parameter m value of the current pixel according to the average value of the quantization coefficients of all pixels in front; S3: dividing the quantization coefficient corresponding to the current pixel into a coding prefix and a coding suffix according to the Golomb-Rice parameter m, the coding prefix is one-dimensional coded according to the one-dimensional coding table, and the coding suffix is binary coded; S4: repeating steps S2-S3 until the coding of all pixel blocks is completed. The Golomb-Rice parameter m provided is arranged in an increasing or decreasing manner with the pixel block or pixel, and the quantization Golomb-Rice parameter m is not fixed, which accelerates the convergence speed of the coding.
[0047] The above is only the preferred embodiment of the present application, and does not limit the present application in any way. Any person skilled in the art can make any form of equivalent replacement, modification or change to the technical solutions and technical content disclosed by the present application without departing from the scope of the technical solutions of the present application, which still belongs to the protection scope of the present application.
Claims
1. A lossless encoding method, characterized in that, include: S1: Provide a quantized 4x4 pixel block, each pixel block comprising a plurality of pixels, each pixel having a quantization coefficient; S2: Predict the Golomb-Rice parameter m of the current pixel using the average of the quantization coefficients of all preceding pixels; S3: Divide the quantization coefficients corresponding to the current pixel into a coding prefix and a coding suffix according to the Golomb-Rice parameter m. The coding prefix is unary encoded according to a unary coding table, and the coding suffix is binary encoded. S4: Repeat steps S2 to S3 until all pixel blocks are encoded.
2. The lossless encoding method as described in claim 1, characterized in that, Starting from the first pixel, follow steps S2 to S3 to complete the encoding of all pixel blocks.
3. The lossless encoding method as described in claim 1, characterized in that, Encode all pixel blocks in row order.
4. The lossless encoding method as described in claim 1, characterized in that, Each pixel block includes 9 prediction modes.
5. The lossless encoding method as described in claim 1, characterized in that, One method to calculate the average quantization coefficient of all forward pixels is to sum the quantization coefficients of all pixels and divide by the total number of pixels.
6. The lossless encoding method as described in claim 1, characterized in that, Methods for predicting the Golomb-Rice parameter m include: m = [log 2 [(N+1)]; where m is the Golomb-Rice parameter m value, and N is the average quantization coefficient of all forward pixels.
7. The lossless encoding method as described in claim 1, characterized in that, Methods for dividing the quantization coefficients corresponding to the current pixel into a coding prefix and a coding suffix according to the Golomb-Rice parameter m include: q = M / m; r = M%m; where q is the encoding prefix, M is the quantization coefficient, m is the Golomb-Rice parameter m value, and r is the encoding suffix.
8. The lossless encoding method as described in claim 7, characterized in that, The method for unary encoding the encoding prefix according to the unary encoding table includes: querying the row with the same value as the Golomb-Rice parameter m, entering the unary encoding table from the row; and using the value of the row and the value of the next row as the encoding result of the encoding prefix.
9. The lossless encoding method as described in claim 1, characterized in that, The unary encoding table is a table with Y+1 rows and 6 columns, where Y is an integer greater than or equal to 0. When Y is 0, the Y+1 rows are numbered from 0 to Y, and the value of each row is the same as the number of that row.
10. The lossless encoding method as described in claim 1, characterized in that, The quantization coefficient and Golomb-Rice parameter m value of a pixel are stored in the form of an index. The index value is a combination of the encoding prediction mode of the pixel block to which the pixel is located and the position of the pixel. The pixel corresponding to the index value, as well as the corresponding quantization coefficient and Golomb-Rice parameter m value, can be retrieved based on the index value.
Citation Information
Patent Citations
Method of encoding and decoding video data, and video data encoder and decoder
CN111083476A
Wavelet transform coding method and apparatus
JP2011029982A