Coefficient decoding method, device, image decoder and electronic equipment
By introducing boundary symbols and fixed-length codes of different lengths into image coding, and adjusting the coding range of the coefficient group, the problem of too long coding length in the existing semi-fixed-length coding technology is solved, and the image decoding performance and coding efficiency are improved.
Patent Information
- Application Number
- CN202210062532.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-19
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-01-19
AI Technical Summary
The existing semi-fixed length coding technology has a long coding length during the image coding process, low coding efficiency, and is difficult to effectively compress redundant information in the image.
By introducing boundary symbols, the coding range of the coefficient group is adjusted from [-2^(coding length–1)-1,2^(coding length–1)], and fixed lengths of different lengths are adopted according to the code length and image bit width. Encoding, analyzing the coefficient code to improve encoding and decoding efficiency.
The encoding length is shortened, image decoding performance and encoding efficiency are improved, and encoding accuracy and efficiency are enhanced.
Smart Images

Figure CN116074525B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image coding and decoding technology, and in particular, to a coefficient decoding method, device, image decoder and electronic device. Background Art
[0002] Lossless compression refers to the technology of compressing the redundant information in the original image and reconstructing the original image without causing any distortion. If there is an error between the reconstructed image and the original image, and the error is limited to a certain range, it can be called near-lossless compression. In the compression coding process, the residual value between the pixels in the original image is predicted, and the residual value is used to indicate the difference between the pixels. The residual value is encoded using semi-fixed-length code to further reduce the code length. However, the existing semi-fixed-length coding technology still has the problem of long code length and low coding efficiency. Summary of the invention
[0003] The embodiments of the present application provide a coefficient decoding method, device, image decoder and electronic device, which can improve image decoding performance.
[0004] In order to achieve the above purpose, the embodiment of the present application adopts the following technical solution:
[0005] In a first aspect, an embodiment of the present application provides a coefficient decoding method, comprising: parsing a bit stream to obtain coefficient group information of a unit to be decoded, wherein the coefficients of the unit to be decoded are divided into one or more coefficient groups, each coefficient group includes at least one coefficient code, the coefficient codes in the same coefficient group are fixed-length codes with the same code length, at least one coefficient group includes a first coefficient group, and the coefficient group information includes a boundary symbol of the first coefficient group; parsing the coefficient code of the first coefficient group into coefficient values; and determining whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary symbol.
[0006] In the coefficient decoding method provided in the embodiment of the present application, compared with the prior art, the decoding range of the fixed-length coding without introducing boundary symbols is [0, 2^bit_depth-1]. When the boundary symbol is introduced to perform fixed-length decoding on the coefficient code of the coefficient group, the positive and negative signs of the coefficient group are determined according to the boundary symbol of the coefficient group, and the parsing range of the fixed-length coding is changed from [0, 2^bit_depth-1] to [-2^(coding length–1)-1, 2^(coding length-1)]. There is no need to increase the code length corresponding to the coefficient group when there is a coefficient value equal to 2^bit_depth-1 in the coefficient group, thereby improving the encoding and decoding efficiency.
[0007] In a possible implementation, the coefficient group information also includes a code length and an image bit width of the first coefficient group, the code length is used to indicate the length of the fixed-length code corresponding to the first coefficient group, and the coefficient code of the first coefficient group is parsed into a coefficient value, including: if the code length is greater than or equal to the image bit width, a fixed-length code having a length equal to the image bit width is used to parse the coefficient code of the first coefficient group into a coefficient value; if the code length is less than the image bit width, a fixed-length code having the code length is used to parse the coefficient code of the first coefficient group into a coefficient value.
[0008] The image bit width corresponding to the coefficient group is used to represent the value range of the coefficient value in the coefficient group. According to the fixed-length coding of the preset code length corresponding to the coefficient group and the analytical value range of the coefficient value in the coefficient group, the fixed-length coding corresponding to the coefficient group and the analytical range of the coefficient value are determined to ensure the accuracy of the judgment method. The image bit width corresponding to the coefficient group can be obtained by bit stream analysis, which can simply and quickly extract the data required for judgment and improve the judgment efficiency. According to the two situations, the coefficient code is analyzed by using fixed-length coding with different code lengths to improve the decoding efficiency.
[0009] In a possible implementation, the code length of the coefficient group includes the coefficient group code length and the coefficient bit code length, and the coefficient bit code length is used to indicate the length of the fixed-length code corresponding to the coefficient code at a specific position in the first coefficient group, wherein the specific position is obtained according to the coding consistency or derived from the context. Then, the coefficient code of the first coefficient group is parsed into the coefficient value by using the fixed-length code with the length of the code length, including: parsing the coefficient code at the specific position in the first coefficient group into the coefficient value by using the fixed-length code with the length of the coefficient bit code length; parsing the coefficient code except the specific position in the first coefficient group into the coefficient value by using the fixed-length code with the length of the coefficient group code length. When the coefficients are unevenly distributed, for the coefficient codes at some specific positions, the coefficient codes in the same coefficient group are parsed using fixed-length codes of different lengths, so as to avoid increasing the overall code length of the coefficient group due to the large difference between the coefficient codes at a few specific positions in the coefficient group and the coefficient codes at other positions, thereby improving the decoding efficiency.
[0010] In a possible implementation, when coding and sorting, coefficient codes with the same or similar code lengths are placed in the same coefficient group according to the size of the coefficient values. Therefore, when the coefficient values in the same coefficient group have an analytic extreme value of the fixed-length code of the corresponding code length, the other coefficient values in the same coefficient group and the analytic extreme value are both positive or negative. Therefore, when there is an absolute extreme value in the first coefficient group, all coefficient values in the coefficient group are determined to be all positive or all negative according to the boundary symbol, and the absolute extreme value is the maximum absolute value of the coding value range of the fixed-length code of the corresponding code length of the coefficient group. The same coefficient group uses a boundary symbol to indicate the positive and negative of the coefficients, which improves the coding efficiency.
[0011] In one possible implementation, the same coefficient group is divided into multiple coefficient blocks. When an absolute extreme value exists in any coefficient block, all coefficient values in any coefficient block are determined to be all positive or all negative according to the boundary sign of any coefficient block, which further improves the accuracy of indicating the positive and negative nature of the coefficient value by the boundary sign.
[0012] In one possible implementation, during the encoding process, if the prediction value and the residual value are quantized, and compared with the prediction value and the residual value being coefficient-transformed and then quantized, the same or better image transmission quality and encoding and decoding efficiency are achieved, then the prediction value and the residual value are quantized to obtain the residual coefficient, and the coefficient transformation step is not performed.
[0013] Therefore, the coefficient code in the unit to be decoded obtained by parsing the code stream by the decoding device may be the semi-fixed length coding result of the residual coefficient, or the semi-fixed length coding result of the transform coefficient. The coefficient decoding method in any of the above implementations can be applied to the decoding of residual coefficients or transform coefficients, thereby improving the applicability of the coefficient decoding method. In a possible implementation, the DC coefficient group and AC coefficient group included in the transform coefficient are respectively divided into different coefficient groups. The code length of each coefficient group is in the code length coding form in the coefficient group information, and the boundary symbol is in the boundary symbol coding form in the coefficient group information. In the case where the coefficients in the coefficient group are transform coefficients and the coefficient group is a DC coefficient group, the code length coding of the coefficient group is analyzed by the DC coefficient decoding method to obtain the code length corresponding to the coefficient group, and the boundary symbol of the coefficient group is analyzed by the fixed length coding of the code length corresponding to the coefficient group to obtain the boundary symbol.
[0014] In one possible implementation, when the coefficients in the coefficient group are transform coefficients and the coefficient group is an AC coefficient group, a fixed-length decoding method is used to parse the code length encoding corresponding to the coefficient group to obtain the code length corresponding to the coefficient group; the fixed-length encoding corresponding to the code length of the coefficient group is used to parse the boundary symbols of the coefficient group to obtain the boundary symbols.
[0015] Since DC coefficients and AC coefficients are generated when the coefficients of residual values and predicted values are transformed, the DC coefficients and AC coefficients are divided into coefficient groups respectively, and the DC coefficient decoding method is used to parse the code length coding of the DC coefficient group, and the fixed-length decoding method is used to parse the code length coding of the AC coefficient group. The DC coefficients and AC coefficients can be encoded and decoded separately, avoiding the problem of large differences in coefficient values in the same coefficient group requiring fixed-length coding with a longer code length for encoding and parsing, thereby improving decoding efficiency.
[0016] In a possible implementation, determining the first coefficient group in the unit to be decoded includes: determining a scanning method and a grouping method of the unit to be decoded from a bit stream; scanning the unit to be decoded according to the scanning method to obtain a scanning result; dividing the scanning result into one or more coefficient groups according to the grouping method, the first coefficient group being any coefficient group among the one or more coefficient groups.
[0017] In the encoding and decoding process, decoding can be the reverse step of encoding. The scanning mode, grouping mode, fixed-length coding, etc. used by the encoding end and the decoding end are all pre-agreed and consistent, following the consistency of encoding and decoding. In semi-fixed-length encoding, a scanning mode and a grouping mode are used to sort and group the residual coefficients or transform coefficients, and the coefficient values encoded by fixed-length coding of different code lengths are set to different groups respectively. Then, the scanning mode and the grouping mode are transmitted to the decoding device through the code stream. The decoding device uses the fixed-length coding of the same code length for the coefficient group determined by the scanning mode and the grouping mode, which ensures the consistency of encoding and decoding, thereby ensuring the accuracy of encoding and decoding.
[0018] In one possible implementation, the coefficient group information includes a code length threshold and a coefficient additional value for each coefficient group. When the code length corresponding to the coefficient group is greater than the code length threshold of the coefficient group, after obtaining the coefficient value through fixed-length decoding, it also includes: adding the coefficient value to the coefficient additional value of the coefficient group to obtain the coefficient value of the coefficient group.
[0019] The decoding device determines whether the coefficient group subtracts the same coefficient additional value from all coefficient values in the coefficient group during encoding based on the code length threshold, and can add the coefficient additional value after decoding the value in the coefficient group at the decoding end to restore the coefficient value in the coefficient group. The encoding device transmits a preset mean value to the decoding device, and the decoding device restores the coefficient value based on the coefficient additional value, thereby avoiding the transmission of the long code corresponding to the original larger coefficient value in the coefficient group, thereby improving the encoding and decoding efficiency.
[0020] In a possible implementation, in addition to the sign bit for indicating the positive or negative extreme value, the coefficient group information may also include a coefficient compensation value for each coefficient group. The coefficient compensation value is used to compensate for the extreme value in the coefficient group. After determining whether the coefficient value in the coefficient group is positive or negative according to the boundary sign, the following further includes: adding the absolute extreme value in the coefficient value to the coefficient compensation value to obtain the coefficient value at the absolute extreme value position in the coefficient group. The analysis range of the sum of the extreme value plus the coefficient compensation value is obtained through a shorter coding length, thereby improving the coding and decoding efficiency.
[0021] In a possible implementation, the coefficient group is divided into a plurality of coefficient blocks, and the coefficient compensation value of each coefficient group includes the coefficient compensation values of all coefficient blocks in the coefficient group. Then, after determining whether the coefficient value in the coefficient group is a positive value or a negative value according to the boundary sign, the method further includes: adding the absolute extreme value in each coefficient block to the coefficient compensation value of the same coefficient block to obtain the coefficient value at the absolute extreme value position of each coefficient block. The coefficient compensation value can compensate for the extreme value in each coefficient block, further improving the coding efficiency.
[0022] In a second aspect, an embodiment of the present application provides a coefficient decoding device, including a parsing module and a decoding module, wherein the parsing module is used to parse a code stream to obtain coefficient group information of a unit to be decoded, the coefficient of the unit to be decoded is divided into one or more coefficient groups, each coefficient group includes at least one coefficient code, the coefficient codes in the same coefficient group are fixed-length codes with the same code length, at least one coefficient group includes a first coefficient group, and the coefficient group information includes a boundary symbol of the first coefficient group. The decoding module is used to parse the coefficient code of the first coefficient group into a coefficient value, and is also used to determine whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary symbol.
[0023] In a third aspect, an embodiment of the present application provides an image decoder, which is used to execute the coefficient decoding method described in the first aspect and any one of its possible implementation methods.
[0024] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising the image decoder, communication interface and memory described in the third aspect; the image decoder is used to execute the coefficient decoding method described in the first aspect and any one of its possible implementation methods.
[0025] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the coefficient decoding method described in any one of the above-mentioned first aspect and its possible implementation methods.
[0026] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when running on a computer, executes the coefficient decoding method described in the first aspect and any one of its possible implementation methods.
[0027] In a seventh aspect, an embodiment of the present application provides a chip, including a memory and a processor. The memory is used to store computer instructions. The processor is used to call and execute the computer instructions from the memory, so that the electronic device performs the coefficient decoding method described in any one of the first aspect and its possible implementation methods.
[0028] In an eighth aspect, an embodiment of the present application provides an image encoding and decoding system, comprising an image encoding device and an image decoding device, the image decoding device being used to receive an image code stream from the image encoding device, and execute the coefficient decoding method described in the first aspect and any one of its possible implementation methods to perform coefficient decoding on the image code stream, and reconstruct an image according to the coefficient decoding result to obtain a decoded image.
[0029] It should be understood that the beneficial effects achieved by the technical solutions of the second to eighth aspects of the embodiments of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic diagram of the architecture of a coding and decoding system provided in an embodiment of the present application;
[0031] Figure 2 A schematic block diagram of an encoder provided in an embodiment of the present application;
[0032] Figure 3 A schematic block diagram of a decoder provided in an embodiment of the present application;
[0033] Figure 4 A schematic diagram of an encoding / decoding process provided in an embodiment of the present application;
[0034] Figure 5 A schematic diagram of a coefficient encoding method provided in an embodiment of the present application;
[0035] Figure 6 A schematic diagram of a coefficient decoding method provided in an embodiment of the present application;
[0036] Figure 7 One of the schematic diagrams of a scanning method provided in an embodiment of the present application;
[0037] Figure 8 One of the schematic diagrams of a grouping method provided in an embodiment of the present application;
[0038] Fig. 9 A second schematic diagram of a scanning method provided in an embodiment of the present application;
[0039] Fig.10 A second schematic diagram of a grouping method provided in an embodiment of the present application;
[0040] Fig.11 This is one of the schematic diagrams of a scanning and grouping method provided in an embodiment of the present application;
[0041] Fig.12 A second schematic diagram of a scanning and grouping method provided in an embodiment of the present application;
[0042] Fig.13 A schematic diagram of the structure of a coefficient decoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0044] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of the objects. For example, the first prediction mode and the second prediction mode are used to distinguish different prediction modes rather than to describe a specific order of the prediction modes.
[0045] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0046] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more. For example, multiple prediction units refer to two or more prediction units, and multiple coding blocks refer to two or more coding blocks.
[0047] The coefficient decoding method provided in the embodiment of the present application can also be used for video decoding, image decoding, etc. It should be understood that as long as there is a coding method for semi-fixed-length coding of prediction values, residual values or coefficient values, the coefficient decoding method provided in the present application is applicable.
[0048] The existing image coding and decoding technology and semi-fixed length coding technology are described below.
[0049] Taking the JPEG (Joint Photographic Experts Group) image compression method as an example, the image is first converted from RGB (Red-Green-Blue) format to YUV (Y represents brightness, U and V represent chrominance) format. Then the YUV format image is sampled according to a certain sampling format, and the image is divided into multiple data blocks, where the three components (Y, U, V) of each point in the source image appear alternately. First, these three components must be separated and stored in three tables. When encoding, after reading a data block from the source data, discrete cosine transform (Discrete Cosine Transform, DCT) transformation, quantization and encoding are performed, and then the next data block is read and processed. Among them, encoding can include binarization and entropy coding steps. Among them, binarization is also called binaryization. The symbols or coefficients to be encoded are binarized, and the binarized symbols or coefficients are converted into binary strings. Different binarization methods may encode the same coefficients to obtain binary strings with different binary probability models and different string lengths. Entropy coding refers to a lossless coding method based on the principle of information entropy, which converts a series of element symbols used to represent an image sequence into a binary code stream for transmission or storage. The output data after entropy coding is the final code stream after the original image is compressed. DCT transform transforms the image from the time domain signal to the frequency domain. Since the energy of most images is mainly concentrated in the low-frequency area, and the human eye is more sensitive to low frequencies, the dynamic range of image coding can be reduced on the basis of the transform module by quantizing the high-frequency coefficients to zero. Removing the transform coefficients in the high-frequency area reduces the bit rate overhead and does not cause much distortion. Among them, the residual values are combined into residual blocks, and the coefficients of the residual blocks after transformation and quantization are called transform coefficients.
[0050] It should be understood that the encoding and decoding processes are opposite. For example, when encoding, the image is subjected to color gamut conversion, sampling, DCT transformation, quantization and encoding in sequence. When decoding, the received code stream needs to be decoded, dequantized, and inverse discrete cosine transformed in sequence. The results of the inverse discrete cosine transform are then arranged in reverse sampling order, and finally the image data is converted from YUV format back to RGB format.
[0051] In lossless and near-lossless video compression algorithms, such as the JPEG image compression method, when encoding, after performing the quantization step, the semi-fixed-length coding method is often used to encode the quantized data. The coefficients to be encoded are grouped according to the prediction direction and the residual size. Each group corresponds to a code length code, and the coefficients in the same group are encoded using the same fixed-length code. For example, the quantized data of a data block includes (-4, -4, -3, -2, -1, 0, 1, 1, 2, 3, 7), which can be divided into (-1, 0, 1), (-3, -2, 2, 3), (-4, -4, 7). Among them, the code length corresponding to (-1, 0, 1) is 1, the code length corresponding to (-3, -2, 2, 3) is 2, and the code length corresponding to (-4, -4, 7) is 3.
[0052] The existing semi-fixed-length coding groups the quantized data in the group into fixed-length codes of fixed length. Although lossless coding can be performed to a certain extent, when there is an extreme value of the parsing range of the fixed-length code of a certain code length in the group corresponding to the code length, it is necessary to increase the coding length of all the coefficient groups. Therefore, the code length of such coding is still relatively large. In order to further improve the coding performance, an embodiment of the present application provides a coefficient decoding method.
[0053] The following describes the system architecture used by the coefficient decoding method of the embodiment of the present application. Figure 1 , a schematic diagram of the architecture of a coding and decoding system (also referred to as a coding and decoding system) 10 used in an embodiment of the present application is given. Figure 1 As shown, the coding and decoding system 10 may include a source device 11 and a destination device 12. The source device 11 is used to encode an image, so the source device 11 may be referred to as a video encoding device. The destination device 12 is used to decode the encoded image data generated by the source device 11, so the destination device 12 may be referred to as a video decoding device.
[0054] The source device 11 and the destination device 12 may include various devices, such as desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, mobile phones, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, wireless communication devices, etc.
[0055] In one example, Figure 1 The source device 11 and the destination device 12 may be two separate devices, or the source device 11 and the destination device 12 may be the same device, that is, the source device 11 or the corresponding function and the destination device 12 or the corresponding function may be integrated on the same device.
[0056] The source device 11 and the destination device 12 may communicate with each other, for example, the destination device 12 may receive the encoded image data from the source device 11. In one example, one or more communication media may be included between the source device 11 and the destination device 12, and the encoded image data is transmitted through the one or more communication media, and the one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from the source device 11 to the destination device 12.
[0057] like Figure 1 As shown, the source device 11 includes an encoder 112. In one example, the source device 11 may also include an image preprocessor 111 and a communication interface 113. The image preprocessor 111 is used to perform preprocessing on the received image to be encoded. For example, the preprocessing performed by the image preprocessor 111 may include refurbishment, color format conversion (for example, from RGB format to YUV format), color adjustment or denoising, etc. The encoder 112 is used to receive the preprocessed image and process the preprocessed image using a related prediction mode (such as the prediction mode in each embodiment of this article) to provide encoded image data. In some embodiments, the encoder 112 can be used to perform the image encoding process in each embodiment described below. The communication interface 113 can be used to transmit the encoded image data to the destination device 12 or any other device (such as a memory) for storage or direct reconstruction. The other device can be any device for decoding or storage. The communication interface 113 can also encapsulate the encoded image data into a suitable format before transmission.
[0058] In an example, the image preprocessor 111 , the encoder 112 , and the communication interface 113 may be hardware components in the source device 11 , or may be software programs in the source device 11 , which is not limited in the embodiment of the present application.
[0059] Continue as Figure 1 As shown, the destination device 12 includes a decoder 122. In one example, the destination device 12 may also include a communication interface 121 and an image post-processor 123. The communication interface 121 may be used to receive encoded image data from the source device 11 or any other source device, such as a storage device. The communication interface 121 may also decapsulate the data transmitted by the communication interface 113 to obtain the encoded image data. The decoder 122 is used to receive the encoded image data and output the decoded image data (also referred to as reconstructed image data or reconstructed image data). In some embodiments, the decoder 122 may be used to perform the coefficient decoding process described in the various embodiments described below.
[0060] The image post-processor 123 is used to perform post-processing on the decoded image data to obtain post-processed image data. The post-processing performed by the image post-processor 123 may include: color format conversion (for example, from YUV format to RGB format), color adjustment, repair or resampling, or any other processing, and may also be used to transmit the post-processed image data to a display device for display.
[0061] Similarly, in one example, the communication interface 121, decoder 122 and image post-processor 123 may be hardware components in the destination device 12, or may be software programs in the destination device 12, which is not limited in the embodiment of the present application.
[0062] Below Figure 1 The structure of the encoder and decoder in is briefly introduced.
[0063] See also Figure 2 , Figure 2 1 is a schematic block diagram of an example of an encoder 20 for implementing an embodiment of the present application. Figure 2 In the embodiment, the encoder includes a prediction processing unit 201, a residual calculation unit 202, a transformation processing unit 203, a quantization unit 204, and an encoding unit 205.
[0064] The input of the encoder 20 is an image block of an image (which may be referred to as an image to be encoded), and the image block may also be referred to as a current image block or an image block to be encoded. The encoder 20 may also include a segmentation unit ( Figure 2 The encoder 20 is used for encoding the image to be encoded block by block, for example, performing the encoding process on each image block.
[0065] The prediction processing unit 201 is used to receive or obtain an image block (the current image block to be encoded of the current image to be encoded, which may also be referred to as the current image block, and the image block may be understood as the true value of the image block) and reconstructed image data, and predict the current image block based on relevant data in the reconstructed image data to obtain a prediction block of the current image block.
[0066] The residual calculation unit 202 is used to calculate the residual between the real value of the image block and the prediction block of the image block to obtain the residual block, for example, by subtracting the pixel value of the prediction block from the pixel value of the image block pixel by pixel.
[0067] The transform processing unit 203 is used to perform coefficient transforms such as discrete cosine transform and discrete sine transform (DST) on the residual block to obtain transform coefficients in the transform domain. It should be understood that in this embodiment, the transform processing unit 203 can perform coefficient transform on the residual block, and when the coding efficiency difference between the residual block and the transform coefficient is small, the coefficient transform may not be performed on the residual block.
[0068] The quantization unit 204 is used to quantize the transform coefficients by applying scalar quantization or vector quantization to obtain quantized transform coefficients, which may also be referred to as quantized residual coefficients. The quantization process may reduce the bit depth associated with some or all of the transform coefficients. For example, an n-bit transform coefficient may be rounded down to an m-bit transform coefficient during quantization, where n is greater than m. The degree of quantization may be modified by adjusting a quantization parameter (QP). For example, for scalar quantization, different scales may be applied to achieve finer or coarser quantization. A smaller quantization step size corresponds to finer quantization, while a larger quantization step size corresponds to coarser quantization. A suitable quantization step size may be indicated by a quantization parameter.
[0069] The coding unit 205 is used to encode the above-mentioned quantized residual coefficients or transform coefficients, and then arrange the coefficient encoding into units to be decoded in a scanning manner and a grouping manner, and output the encoded image data (i.e., units to be decoded) in the form of a coded bit stream, and then the coded bit stream can be transmitted to a decoder, or stored, and subsequently transmitted to a decoder or used for retrieval. The coding unit 205 can also be used to encode other syntax elements of the current image block, such as encoding a prediction mode into a bit stream, etc. Optionally, in this embodiment, unary code, truncated unary code, truncated binary code, fixed length coding, semi-fixed length coding, run-length coding, k-order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, adaptive variable length coding, etc., one of which or a combination of multiple coding methods, can be used to encode the coefficients.
[0070] Specifically, in the embodiment of the present application, the encoder 20 is used to implement the image encoding method described in the embodiments below.
[0071] See also Figure 3 , Figure 3A schematic block diagram of an example of a decoder 30 for implementing an embodiment of the present application is shown. The decoder 30 is used to receive, for example, encoded image data (i.e., an encoded bit stream, for example, an encoded bit stream including an image block and associated syntax elements) encoded by the encoder 20 to obtain a decoded image. The decoder 30 includes a decoding unit 301, an inverse quantization unit 302, an inverse transformation unit 303, a prediction processing unit 304, a reconstruction unit 305, and a filter unit 306. In some examples, the decoder 30 may perform operations substantially similar to those of the decoder 301. Figure 2 The decoding pass is the inverse of the encoding pass described by the encoder 20. In one example, the decoder 30 may further include a buffer and a decoded image buffer, wherein the buffer is used to cache the reconstructed image block output by the reconstruction unit 305, and the decoded image buffer is used to cache the filtered image block output by the filter unit 306.
[0072] The decoding unit 301 is used to decode the encoded image data to obtain quantized coefficients (such as residual coefficients or transform coefficients). The decoding unit 301 is also used to forward the decoded encoding parameters to the prediction processing unit 304 so that the prediction processing unit performs a prediction process according to the encoding parameters.
[0073] The inverse quantization unit 302 is used to inversely quantize the quantized coefficients to obtain inversely quantized coefficients, where the inverse quantization is a reverse application of the quantization unit 204, for example, based on or using the same quantization step size as the quantization unit 204, and applying an inverse quantization scheme of the quantization scheme applied by the quantization unit 204. The inversely quantized coefficients may also be referred to as inversely quantized residual coefficients or quantized transform coefficients.
[0074] The inverse transform unit 303 is used to perform an inverse transform on the inverse quantized coefficients. It should be understood that the inverse transform is the reverse application of the transform processing unit 203. For example, the inverse transform may include an inverse discrete cosine transform or an inverse discrete sine transform to obtain an inverse transform block in the pixel domain (or sample domain). The inverse transform block may also be called an inverse transform inverse quantized block or an inverse transform residual block.
[0075] The reconstruction unit 305 (e.g., a summer) is used to perform an inverse transform (e.g., an inverse DCT, an inverse integer transform, or a conceptually similar inverse transform process) on the above-mentioned quantized coefficients to obtain an inverse transform block (also referred to as an inverse transform residual block), which is the residual block of the current image block in the pixel domain.
[0076] The prediction processing unit 304 is used to receive or obtain encoded image data (for example, the encoded bit stream of the current image block) and reconstructed image data. The prediction processing unit 304 can also receive or obtain prediction-related parameters and / or information about the selected prediction mode (that is, decoded encoding parameters) from, for example, the decoding unit 301, and predict the current image block based on the relevant data in the reconstructed image data and the decoded encoding parameters to obtain a prediction block of the current image block.
[0077] The reconstruction unit 305 is used to add the inverse transform block (ie, the inverse transform residual block) to the prediction block to obtain a reconstructed block in the sample domain, for example, adding the sample values of the inverse transform residual block to the sample values of the prediction block.
[0078] The filter unit 306 is configured to filter the reconstructed block to obtain a filtered block, where the filtered block is a decoded image block.
[0079] Specifically, in the embodiment of the present application, the decoding unit 301 is used to implement the coefficient decoding method described in the embodiments below.
[0080] It should be understood that, in the encoder 20 and the decoder 30 of the embodiment of the present application, the processing result of a certain link can also be output to the next link after further processing.
[0081] Below Figure 1 to Figure 3 Based on the coding / decoding system, encoder and decoder shown in the figure, the embodiment of the present application provides a possible coding / decoding implementation method, such as Figure 4 As shown, Figure 4 A schematic diagram of an encoding / decoding process is provided for an embodiment of the present application. The encoding / decoding implementation method includes process ① to process ⑤. Process ① to process ⑤ can be executed by any one or more of the above-mentioned source device 11, encoder 20, destination device 12 or decoder 30.
[0082] Process ①: Divide a frame of image into one or more non-overlapping parallel coding units. The one or more parallel coding units have no dependencies and can be completely parallel / independently encoded and decoded, such as Figure 4 A parallel encoding unit 1 and a parallel encoding unit 2 are shown.
[0083] Process ②: Each parallel coding unit can be further divided into one or more non-overlapping independent coding units. The independent coding units may not depend on each other, but may share some parallel coding unit header information.
[0084] For example, the width of an independent coding unit is w_lcu and the height is h_lcu. If a parallel coding unit is divided into an independent coding unit, the size of the independent coding unit is exactly the same as the parallel coding unit; otherwise, the width of the independent coding unit should be greater than the height (unless it is an edge area).
[0085] Typically, the independent coding unit may be a fixed w_lcu×h_lcu, where w_lcu and h_lcu are both 2 to the power of N (N≥0), such as the size of the independent coding unit is 128×4, 64×4, 32×4, 16×4, 8×4, 32×2, 16×2 or 8×2.
[0086] As a possible example, the independent coding unit may be fixed to 128×4. If the size of the parallel coding unit is 256×8, the parallel coding unit may be equally divided into 4 independent coding units; if the size of the parallel coding unit is 288×10, the parallel coding unit is divided into: the first / second row is 2 128×4 + 1 32×4 independent coding units; the third row is 2 128×2 + 1 32×2 independent coding units.
[0087] It is worth noting that the independent coding unit can include three components of brightness Y, chrominance Cb, and chrominance Cr, or three components of red (R), green (G), and blue (B), or only one of them. If the independent coding unit contains three components, the sizes of the three components can be exactly the same or different, which is related to the input format of the image.
[0088] Process ③: Each independent coding unit can be further divided into one or more non-overlapping coding units. The coding units within the independent coding unit can be interdependent, such as multiple coding units can perform mutual reference pre-coding and decoding.
[0089] If the coding unit and the independent coding unit have the same size (ie, the independent coding unit is divided into only one coding unit), the size thereof can be any size described in process ②.
[0090] If the independent coding unit is divided into multiple non-overlapping coding units, feasible division examples include: horizontal equal division (the height of the coding unit is the same as that of the independent coding unit, but the width is different, which can be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), vertical equal division (the width of the coding unit is the same as that of the independent coding unit, but the height is different, which can be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), horizontal and vertical equal division (quadtree division), etc., preferably horizontal equal division.
[0091] The width of the coding unit is w_cu and the height is h_cu, so its width should be greater than its height (unless it is an edge area). Usually, the coding unit can be a fixed w_cu x h_cu, where w_cu and h_cu are both 2N powers (N is greater than or equal to 0), such as 16x4, 8x4, 16x2, 8x2, 8x1, 4x1, etc.
[0092] As a possible example, the coding unit may be a fixed 16x4. If the size of the independent coding unit is 64x4, the independent coding unit may be equally divided into 4 coding units; if the size of the independent coding unit is 72x4, the coding unit may be divided into: 4 16x4 + 1 8x4.
[0093] It is worth noting that the coding unit can include three components of brightness Y, chrominance Cb, and chrominance Cr (or three components of red R, green G, and blue B), or only one of them. If it includes three components, the sizes of the components can be exactly the same or different, which is related to the image input format.
[0094] It is worth noting that process ③ is an optional step in the encoding and decoding method, and the encoder / decoder can encode / decode the residual coefficients (or transform coefficients) of the independent coding unit obtained in process ②.
[0095] Process ④: For the coding unit, it can be further divided into one or more non-overlapping prediction groups (Prediction Group, PG), PG can also be referred to as Group, each PG is encoded and decoded according to the selected prediction mode to obtain the prediction value of PG, which constitutes the prediction value of the entire coding unit, and the residual value of the coding unit is obtained based on the prediction value and the original value of the coding unit.
[0096] Among them, in process ④, the coding units are grouped by a selected scanning method, and the scanning method may include, but is not limited to, any one or more of the following: raster scanning, block scanning, horizontal scanning, vertical scanning, round-trip (horizontal / vertical) scanning, diagonal (upper left, upper right, lower left, lower right) scanning, reverse diagonal scanning, reverse horizontal scanning, reverse vertical scanning, or scanning based on a fixed scanning template, etc.
[0097] Process ⑤: Based on the residual value of the coding unit, the coding units are grouped to obtain one or more non-overlapping residual blocks (RBs), and the residual coefficients or transform coefficients of each RB are encoded and decoded according to the selected mode to form a residual coefficient stream or a transform coefficient stream.
[0098] The selected modes of the encoding and decoding methods of the residual coefficients or transform coefficients in the above process ⑤ may include, but are not limited to any one or more of the following: unary code, truncated unary code, truncated binary code, fixed-length coding, semi-fixed-length coding, run-length coding, k-order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, adaptive variable-length coding, etc.
[0099] For example, the encoder may directly encode the coefficients within the RB.
[0100] For another example, the encoder may also transform the residual block, such as DCT, DST, Hadamard transform, etc., and then encode the transformed coefficients.
[0101] As a possible example, when the RB is small, the encoder can directly quantize each coefficient in the RB and then perform binary encoding. If the RB is large, it can be further divided into multiple coefficient groups (Coefficient Groups, CGs), and then each CG is quantized and then binarized. In some embodiments of the present application, the coefficient group and the quantization group can be the same.
[0102] The following is an exemplary description of the residual coefficient encoding part in a semi-fixed length coding method. First, the maximum value of the absolute value of the residual in an RB block is defined as the modified maximum value (modified maximum, mm). Secondly, the number of coding bits for the residual coefficient in the RB block is determined (the number of coding bits for the residual coefficient in the same RB block is consistent). For example, if the critical limit (Critica Llimit, CL) of the current RB block is 2 and the current residual coefficient is 1, then 2 bits are required to encode the residual coefficient 1, which is expressed as 01. If the CL of the current RB block is 7, it means encoding a 7-bit residual coefficient and a 1-bit sign bit. The determination of CL is to find the minimum coding length value that satisfies that all residuals of the current sub-block are within the range of [-2^(coding length-1)-1,2^(coding length-1)] and the boundary value. The boundary value can be -2^(coding length-1) or 2^(coding length-1). If there is a value whose absolute value is 2^(coding length-1), a boundary sign code is added to the bitstream, that is, the positive or negative value of the coefficient value 2^(codinglength-1) in the current RB block needs to be determined according to the boundary sign represented by the boundary sign code; if all residuals do not contain any of -2^(coding length-1) and 2^(coding length-1), there is no need to encode the boundary sign bit; if there is a coefficient value whose absolute value is 2^(coding length-1) in the coefficient group, a boundary sign code can be used to represent the positive or negative value of all coefficients in the coefficient group.
[0103] In addition, for some special cases, the encoder can also directly encode the original value of the image instead of the residual value.
[0104] It should be noted that the prediction unit in the embodiment of the present application can be a coding unit obtained by division through the above process ③, or it can be a prediction group after the coding unit is further divided.
[0105] Combined with the above Figure 1 The codec system shown, Figure 2 The encoder shown and Figure 3 The schematic diagram of the decoder framework is shown, and the image encoding method and coefficient decoding method involved in the present application are described in detail below.
[0106] First, the embodiment of the present application provides a coefficient encoding method, which is applied to the encoding unit 205, such as Figure 5 As shown, the coefficient encoding method may include S501-S504.
[0107] S501: The encoding unit 205 determines a scanning method and an optimal grouping method for units to be encoded.
[0108] The scanning method and grouping method of the above-mentioned units to be encoded can be obtained according to the agreement between the encoding unit 205 and the decoding unit 301 in the codec consistency.
[0109] The optimal grouping method can be determined based on the coding cost of each grouping method. The coding cost can be calculated using methods such as rate distortion optimization (Rate Distortion Optimization), minimizing the rate distortion cost (Rate Distortion Cost), etc. The grouping method with the lowest coding cost is the optimal grouping method, that is, make the high-frequency coding as short as possible and the low-frequency coding longer. Optionally, the optimal grouping method can be determined based on the agreement between the encoding unit 205 and the decoding unit 301 in the coding and decoding consistency, or the decoding unit 301 can be derived based on the context (derived from the encoded data, residual coefficients or encoded parameters), or the encoding unit 205 can pass the parameters to obtain it.
[0110] S502: The encoding unit 205 divides the unit to be encoded into multiple coefficient groups according to the optimal grouping method.
[0111] The above scanning method can select any scanning method listed in process ⑤ of the encoding / decoding implementation method provided above, which will not be described in detail here.
[0112] S503: The encoding unit 205 determines coefficient group information for each coefficient group.
[0113] Optionally, the coefficient group information may include a code length, a boundary symbol and an image bit width corresponding to the coefficient group, and the code length corresponding to the coefficient group is used to indicate that the coefficient code in the coefficient group is obtained by encoding with a fixed-length encoding of the code length.
[0114] Among them, the image bit width (bit_depth) represents the maximum bit of the original data or reconstructed data. According to the code length and image bit width corresponding to a coefficient group, it is possible to determine whether there are coefficient values in the coefficient group that exceed the fixed-length coding value range of the code length. If there are no coefficient values in the coefficient group that exceed the fixed-length coding value range of the code length, there is no need to set a boundary symbol for the coefficient group, that is, the coding range of the coefficient group is [0,2^bit_depth-1]. If there are coefficient values in the coefficient group that exceed the fixed-length coding value range of the code length, it is necessary to set a boundary symbol for the coefficient group so that the coding range of the coefficient group is [-2^(coding length–1)-1,2^(coding length-1)].
[0115] Optionally, if a boundary symbol exists in a coefficient group, and the coefficient group uses the same boundary symbol to indicate that all coefficient values in the coefficient group are simultaneously positive or simultaneously negative, then the coefficient group shares a boundary symbol.
[0116] S504: The encoding unit 205 encodes the coefficient value, code length, boundary symbol and image bit width of each coefficient group according to the fixed-length encoding of the code length corresponding to the coefficient group, and obtains the coefficient fixed-length encoding and coefficient group information.
[0117] It should be understood that when performing coefficient encoding, there are different scanning methods according to different prediction modes, and there are different grouping methods for different scanning methods, and there are different coefficient grouping situations, corresponding to different coefficient encoding methods. Therefore, in addition to the above-mentioned coefficient encoding method of S501-S504, the above-mentioned coefficient encoding method of S501-S504 can also be adaptively refined or changed in one or more steps according to different coefficient grouping situations. The specific implementation of the coefficient encoding method is no longer illustrated here. The encoding steps can be reversely inferred by referring to the specific embodiment of the coefficient decoding method below.
[0118] for Figure 5 The coefficient encoding method shown in FIG. 2 is a method for encoding coefficients. After the encoding unit 205 completes the coefficient encoding, the code stream is transmitted to the decoding unit 301. Accordingly, the embodiment of the present application provides a coefficient decoding method, which is applied to the decoding unit 301. Figure 6 As shown, the coefficient decoding method includes S601-S603.
[0119] S601: The decoding unit 301 parses the bitstream to obtain information about the unit to be decoded and the coefficient group.
[0120] The above-mentioned unit to be decoded includes at least one coefficient group, each coefficient group includes at least one coefficient fixed-length code, the coefficient group information includes the boundary symbol of each coefficient group, and the coefficient code in each coefficient group is decoded using fixed-length coding with the same code length.
[0121] It should be understood that before parsing a coefficient group, the coefficient group needs to be extracted from the unit to be decoded. In this embodiment, the code stream can be parsed to obtain the scanning mode and grouping mode corresponding to the unit to be decoded, and the unit to be decoded can be scanned according to the scanning mode to obtain a scanning result, which divides the unit to be decoded into at least one prediction group. Then, the scanning result is divided into at least one coefficient group according to the grouping mode, and the first coefficient group is selected from them.
[0122] S602: Parse the coefficient codes of the first coefficient group into coefficient values.
[0123] Optionally, this embodiment can select fixed-length coding with different code lengths to parse the coefficient code according to whether the code length of the first coefficient group is less than the image bit width of the coefficient group. If the code length is greater than or equal to the image bit width, the coefficient code of the first coefficient group is parsed into coefficient values by using fixed-length coding with a length equal to the image bit width. If the code length is less than the image bit width, the coefficient code of the first coefficient group is parsed into coefficient values by using fixed-length coding with the code length.
[0124] The code length, boundary symbol and image bit width of the first coefficient group can be obtained from the coefficient group information, which is in a fixed-length coding form, namely, a code length code, a boundary symbol code and an image bit width code in the code stream. The decoding unit 301 uses a fixed-length coding decoding method or other decoding methods to parse the code length code, the boundary symbol code and the image bit width code of the first coefficient group to obtain the code length, the boundary symbol and the image bit width of the first coefficient group.
[0125] It should be understood that in the process of parsing the coefficient code in the coefficient group in S602 of this embodiment, the run-length coding method can also be introduced to parse the continuous 0 values in the coefficient group. The specific parsing method is the same as the existing run-length coding method, which will not be repeated here. At the same time, the skip coefficient method can also be introduced. If the skip coefficient mode is turned on when parsing from the bit stream, the entire group does not need to encode any coefficients, and the reconstructed value of the decoding unit 301 is directly equal to the predicted value.
[0126] S603: Determine whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary sign.
[0127] When the boundary symbol is not used, the parsing range of the fixed-length coding of the image bit width of the first coefficient group is [0, 2^bit_depth-1]. When the boundary symbol is used, the parsing range of the fixed-length coding of the code length corresponding to the first coefficient group and the boundary symbol is [-2^(coding length–1)-1, 2^(coding length-1)].
[0128] Furthermore, when there is an absolute extreme value in the first coefficient group, that is, when there is a coefficient value in the first coefficient group whose absolute value is equal to 2^(coding length-1), the first coefficient group can share a boundary symbol, and the boundary symbol represents the positive and negative values of all coefficient values in the first coefficient group.
[0129] Compared with the prior art, the embodiment of the present application introduces boundary symbols to change the coefficient value parsing range of semi-fixed-length coding from [0, 2^bit_depth-1] to [-2^(coding length–1)-1, 2^(coding length-1)], thereby further shortening the overall coding length and improving the encoding and decoding efficiency.
[0130] In one example, the first coefficient group can be further divided into multiple coefficient blocks, and the coefficient codes in different coefficient blocks cannot share a boundary symbol. Then, there can be multiple boundary symbols in the code stream data, that is, the code stream includes boundary symbols corresponding to each coefficient block, and each coefficient block shares a boundary symbol. For the same coefficient block, if the boundary symbol code parsed in S603 indicates a negative, then the coefficient value whose absolute value of the parsed value in the coefficient block is equal to 2^(coding length-1) is -2^(coding length-1); if the boundary symbol code parsed in S603 indicates a positive, then the coefficient value whose absolute value of the parsed value in the coefficient block is equal to 2^(coding length-1) is 2^(coding length-1). Optionally, the parsed value of the boundary symbol code can be 0 for negative or 1 for positive, or 0 for positive and 1 for negative, and the boundary symbol code is represented by one bit.
[0131] It should be noted that, in this embodiment, after S602-S603 completes the parsing of one coefficient group in the unit to be decoded, it is necessary to use the same method as S602-S603 to parse other coefficient groups in the unit to be decoded, and the coefficient decoding of the unit to be decoded is completed only after all coefficient groups in the unit to be decoded are parsed.
[0132] It should be understood that the coefficient decoding method provided in this embodiment can not only parse the encoding of the transform coefficient or the residual coefficient, but also parse the encoding of the original pixel value according to the parsing steps without introducing the boundary symbol.
[0133] The embodiment of the present application provides a coefficient decoding method for residual coefficients in a point-by-point prediction mode, which is applied to the decoding unit 301 .
[0134] First, how the decoding unit 301 determines the scanning mode and the grouping mode is described. For the residual coefficient obtained by predicting the brightness Y using the point-by-point prediction mode, for example, a 16*2 pixel block, the scanning mode can be Figure 7 Point-by-point prediction mode 1 shown in (a) Figure 7 Point-by-point prediction mode 2 shown in (b), Figure 7 Point-by-point prediction mode 3 shown in (c) Figure 7Point-by-point prediction mode 4 shown in (d) above. Group1 and Group2 are represented differently. In point-by-point prediction mode 1, both Group1 and Group2 adopt a scanning order that prioritizes the vertical direction, i.e., a scanning order from top to bottom and then from left to right. In point-by-point prediction mode 2, Group1 and Group2 successively adopt a scanning order that prioritizes the horizontal direction, i.e., from left to right. In point-by-point prediction mode 3, Group1 and Group2 adopt a scanning order that prioritizes the left to right and then from top to bottom. In point-by-point prediction mode 4, both Group1 and Group2 adopt a scanning order that prioritizes the vertical direction, i.e., a scanning order that prioritizes the top to bottom and then from left to right.
[0135] The unit to be decoded is scanned according to any of the above scanning modes to obtain prediction groups Group1 and Group2, and each prediction group is grouped. The grouping mode can be as follows: Figure 8 As shown, each small grid represents a fixed-length coding of a coefficient, and different gray values represent different coefficient groups. Figure 8 (a) indicates that when the coding index is 0, the entire prediction group is treated as a 16*1 coefficient group. Figure 8 (b) indicates that when the coding index is 100, a prediction group is divided into two 8*1 coefficient groups in sequence. Figure 8 (c) indicates that when the coding index is 101, a prediction group is divided into an 8*1 coefficient group and two 4*1 coefficient groups. Figure 8 (d) indicates that when the coding index is 110, a prediction group is divided into two 4*1 coefficient groups and one 8*1 coefficient group. Figure 8 (e) indicates that when the coding index is 111, one prediction group is divided into four 4*1 coefficient groups in sequence.
[0136] Step S602 is described for the residual coefficients obtained by predicting the chrominance Cb and chrominance Cr in the point-by-point prediction mode. For example, for an 8*2 pixel block, the scanning mode is horizontal scanning, that is, scanning row by row from left to right, then Fig. 9 As shown in (a), when the coding index of the scanning mode is 0, the unit to be decoded is divided into two different prediction groups, or Fig. 9 As shown in (b), when the coding index of the scanning mode is 1, the unit to be decoded is divided into four different prediction groups. Each small grid represents a fixed-length coding of a coefficient, and different gray values represent different prediction groups. Fig. 9 In (b), the first four cells of the first row, the last four cells of the first row, the first four cells of the second row, and the last four cells of the second row are of different grayscales.
[0137] The to-be-decoded unit is scanned according to the above scanning method to obtain prediction groups, and each prediction group is grouped. The grouping method can be as follows: Fig.10 As shown, each small grid represents a fixed-length coding of a coefficient, and different gray values represent different coefficient groups. Fig.10 (a) indicates that when the coding index is 0, the entire prediction group is treated as an 8*1 coefficient group. Fig.10 (b) in the middle indicates that when the coding index is 1, a prediction group is divided into two 4*1 coefficient groups in sequence, where the first four grids and the last four grids are different grayscales.
[0138] After the division of the coefficient groups is realized according to the above scanning mode and grouping mode, the decoding unit 301 determines the code length corresponding to the coefficient group by first using a fixed-length coding decoding mode to parse the code length code corresponding to the coefficient group to obtain the code length codinglength. Optionally, the code length can also be parsed by a hybrid mode of fixed-length coding and truncated unary code or other coding.
[0139] In S602, the decoding unit 301 parses the coefficient codes one by one according to the fixed-length coding corresponding to the coding length. If the coding length corresponding to the coefficient group is greater than or equal to the image bit width of the coefficient group, the coefficient code is parsed using the fixed-length coding corresponding to the code length of the image bit width, and the parsing range is [0, 2^bit_depth-1]. If the coding length corresponding to the coefficient group is less than the image bit width of the coefficient group, the coefficient code is parsed using the fixed-length coding corresponding to the coding length.
[0140] In S603, the decoding unit 301 determines the sign of the coefficient value in the coefficient group according to the boundary sign, so that the coefficient value resolution range is [-2^(coding length–1)-1, 2^(coding length-1)]. If there is a coefficient value in the coefficient group whose absolute value is equal to 2^(coding length-1), all coefficient values of the coefficient group share a common boundary sign.
[0141] Compared with the prior art, the embodiment of the present application improves the applicability of coefficient decoding by flexibly grouping the coefficients of brightness and chrominance in different ways, and introduces boundary symbols to indicate the positive and negative extreme values of the analytic length of the fixed-length coding of the coefficient group corresponding to the code length, thereby improving the encoding and decoding efficiency. At the same time, the scanning method and grouping method take into account the distribution of data, so that coefficients with similar amplitudes are distributed in adjacent areas, so that the correlation between each coefficient value of the divided coefficient group is retained, and the decoding accuracy is improved.
[0142] The embodiment of the present application further provides a coefficient decoding method for residual coefficients in a non-point-by-point prediction mode, which is applied to the decoding unit 301 .
[0143] First, the scanning method and grouping method are described. For the residual coefficients obtained using the non-point-by-point prediction mode, such as a 16*2 pixel block, the scanning order can be as follows: Fig.11 Middle (a), Fig.11 As shown in the direction of the arrow in (b), the coefficient groups can be divided as follows Fig.10 Middle (a), Fig.10 As shown in different grayscales in (b), each grayscale represents the same coefficient group.
[0144] After the division of the coefficient groups is realized according to the above scanning method and grouping method, the method for determining the code length corresponding to the coefficient group can be to obtain the code length code corresponding to the coefficient group by using Huffman coding.
[0145] In S602, when the coding length corresponding to the coefficient group is greater than or equal to the image bit width of the coefficient group, the decoding unit 301 uses the fixed-length coding corresponding to the code length of the image bit width to parse the coefficient code, and the parsing range is [0, 2^bit_depth-1]. When the coding length corresponding to the coefficient group is less than the image bit width of the coefficient group, the fixed-length coding corresponding to the coding length is used to parse the coefficient code.
[0146] In S603, the decoding unit 301 uses the boundary symbol to determine the positive and negative values of the coefficients in the coefficient group, so that the coefficient value resolution range is [-2^(coding length–1)-1, 2^(coding length-1)]. If there is a coefficient value in the coefficient group whose absolute value is equal to 2^(coding length-1), a common boundary symbol is encoded for the coefficient group.
[0147] The embodiment of the present application further provides a coefficient decoding method for transform coefficients in a non-point-by-point prediction mode, which is applied to the decoding unit 301 .
[0148] First, the scanning method and grouping method are described. For the transform coefficients obtained using the non-point-by-point prediction mode, such as a 16*2 pixel block, the scanning order can be as follows: Fig.12 Middle (a), Fig.12 As shown in the direction of the arrow in (b), the coefficient groups can be divided as follows Fig.12 Middle (a), Fig.12 In (b), different grayscales, each grayscale represents the same coefficient group, the part containing dots represents the DC coefficient, all DC coefficients are divided into one DC coefficient group, and the part not containing dots is divided into one or more AC coefficients.
[0149] After the coefficient groups are divided according to the above scanning method and grouping method, the method for determining the code length of the fixed-length coding corresponding to the coefficient group can be to use Huffman coding to parse the coding length corresponding to the AC coefficient group, and to use fixed-length coding to parse the coding length corresponding to the DC coefficient group.
[0150] In S602, the decoding unit 301 parses the coefficient code using a fixed-length code corresponding to a code length equal to the coding length when the coding length corresponding to the coefficient group is less than 7. When the coding length corresponding to the coefficient group is greater than or equal to 7, the coefficient code is parsed using a fixed-length code corresponding to a length equal to the image bit width bit_depth+3.
[0151] In S603, the decoding unit 301 uses the boundary symbol to determine the positive and negative values of the coefficients in the coefficient group, so that the coefficient value resolution range is [-2^(coding length–1)-1, 2^(coding length-1)]. If there is a coefficient value in the coefficient group whose absolute value is equal to 2^(coding length-1), a common boundary symbol is encoded for the coefficient group.
[0152] Compared with the prior art, when encoding the transform coefficients in a non-point-by-point prediction mode, the embodiment of the present application divides the DC coefficients and AC coefficients in the transform coefficients into different coefficient groups, and then encodes the coefficient values, thereby avoiding the use of fixed-length encoding with the same code length for relatively low-frequency DC coefficients and relatively high-frequency AC coefficients in the same coefficient group, thereby improving the encoding efficiency.
[0153] In the same coefficient group, due to the grouping method or coefficient type, there may be a few (such as one or two) coefficient values that exceed the average value of the coefficient group. For example, when the DC coefficient and the AC coefficient are divided into the same coefficient group, the difference between the DC coefficient and the AC coefficient is large, or when the predicted value is outside the prediction group obtained by scanning, the predicted value may be different from the current pixel value. Therefore, the embodiment of the present application also provides a coefficient decoding method, which is applied to the decoding unit 301. The coefficient decoding method adjusts the code length (coding length) of the fixed-length coding corresponding to the coefficient value in the coefficient group, and the coefficient values at different positions can be parsed using fixed-length coding of different code lengths. Compared with S601-S603, the coefficient decoding method only differs in the steps of determining the code length (coding length) corresponding to the coefficient group and parsing the coefficient according to the fixed-length coding corresponding to the code length of the coefficient group, and the same parts are not repeated here.
[0154] In one example, the step of determining the code length corresponding to the coefficient group in S601 may be as follows:
[0155] First, the decoding unit 301 analyzes the coding length and the additional code length A of the fixed-length coding corresponding to the coefficient group from the code stream.
[0156] The additional code length value A may be a value A set by the coding unit 205 for a specific position in the coefficient group where the coefficient value exceeds the average value of the coefficient group when coding the coefficient value, and the value A is equal to the difference between the fixed-length coding code length corresponding to the coefficient value at the specific position and the fixed-length coding code length corresponding to the coefficient group. For example, for the coding unit 301, the largest coefficient value in the coefficient group is 9, the second largest coefficient value is 3, the coding length corresponding to the coefficient value 3 is 2, and the coding length corresponding to the coefficient value 9 is 4, then A=4-2=2.
[0157] Next, the decoding unit 301 determines a specific position in the coefficient group.
[0158] The specific position can be agreed upon by the encoding unit 205 and the decoding unit 301 in the encoding consistency, or it can be derived by the encoding unit 301 according to context information. For example, if a certain position of the previous unit to be decoded is a specific position, then the corresponding position of the current unit to be decoded is determined to be the specific position.
[0159] Then, the decoding unit 301 determines that the code length of the fixed-length coding corresponding to the specific position in the coefficient group is coding length+A, and the code length of the fixed-length coding corresponding to the coefficients other than the specific position is coding length.
[0160] The step of parsing the coefficients according to the fixed-length coding corresponding to the code length of the coefficient group can be to use a fixed-length coding with a code length of coding length+A to parse the coefficient code of a specific position, and to use a fixed-length coding with a code length of coding length to parse the coefficient codes other than the specific position.
[0161] In one example, this embodiment can also be implemented when the coding length corresponding to the coefficient group is shorter, for example, the encoding unit 205 and the decoding unit 301 agree on a code length threshold B through coding consistency, and carry coefficient value range data C in the bitstream, and the coefficient value range data C is used to indicate whether the absolute value of the coefficient value is less than 2^(coding length-3).
[0162] The step of determining the code length corresponding to the coefficient group in S601 may include: when the coding length is less than the code length threshold B, the decoding unit 301 determines that the code length corresponding to all coefficient codes of the coefficient group is the coding length.
[0163] In S602, when the coding length is greater than or equal to the code length threshold B, the decoding unit 301 determines whether the absolute value of each coefficient code is less than 2^(coding length-3) according to the coefficient value range data C. If so, the coefficient code is parsed using the fixed-length code corresponding to the coding length-3; if not, the coefficient code is parsed using the fixed-length code corresponding to the coding length.
[0164] In an example, this embodiment may also transform the coding length of the coefficient group into k-order exponential Golomb decoding, for example, the encoding unit 205 and the decoding unit 301 agree on a code length threshold D through coding consistency.
[0165] The step of determining the code length corresponding to the coefficient group in S601 may include: when the coding length of the coefficient group is less than the code length threshold D, the decoding unit 301 determines that the code length corresponding to all coefficient codes of the coefficient group is the coding length. When the coding length of the coefficient group is greater than or equal to the code length threshold D, the decoding unit 301 introduces k-order Golomb decoding with order k=(coding length-5) to obtain the code length corresponding to the coefficient code. Among them, the value of k can be derived from the coding length using other transformation methods. The subsequent coefficient code parsing method of S602 still uses the fixed-length coding corresponding to the code length of the coefficient code for parsing, which will not be repeated here.
[0166] In one example, if the number of coefficient codes in the coefficient group is large, for example, the number of coefficient codes is greater than N, the step of determining the code length corresponding to the coefficient group in S601 may include: the decoding unit 301 parses the code length of the coefficient group by fixed-length decoding as coding length, and when coding length is not equal to a preset value E, the code length corresponding to all coefficient codes in the coefficient group is coding length. When coding length is equal to the preset value E, the coefficients in the coefficient group whose coefficient values are not greater than 0 are determined to be 0, and the code length corresponding to the coefficient codes at positions greater than 0 in the coefficient group is determined to be coding length. In an optional example, the preset value E may be 2, 3, etc., and the value of N may be greater than 4.
[0167] It should be understood that, in this embodiment, the fixed-length coding code length corresponding to the coefficient code of one or more positions in a coefficient group can be regarded as the coefficient bit code length, and the shared fixed-length coding code length corresponding to other positions in the coefficient group can be regarded as the coefficient group code length.
[0168] Compared with the prior art, by changing the code lengths corresponding to the coefficients in the coefficient group and parsing different coefficient codes in the coefficient values using fixed-length encodings with different code lengths, it is possible to use a fixed-length encoding with a special code length to parse the coefficient code at a certain position, and still use fixed-length encodings with shorter code lengths to parse at other positions, reducing the overall encoding length and improving the encoding efficiency.
[0169] In addition to adjusting the code lengths of the fixed-length encodings of the coefficient group, this embodiment also provides a coefficient decoding method, which is applied to the decoding unit 301. During encoding, the coefficient values in the coefficient group are adjusted, and during decoding, the coefficient values are restored, reducing the overall encoding length of the coefficient values. Compared with S601 - S605, the coefficient decoding method only differs in the step of parsing the coefficients using the fixed-length encoding corresponding to the code length of the coefficient group. The same parts will not be elaborated here.
[0170] In an example, in the step of parsing the coefficients using the fixed-length encoding corresponding to the code length of the coefficient group, the decoding unit 301 first parses all the coefficient values using the fixed-length encoding corresponding to the code length of the coefficient group. For a specific position, the coefficient value is shifted, that is, coefficient = coefficient << F. The fixed-length encoding decoding method is used to parse F to obtain delda_coefficient, and delda_coefficient is added to the coefficient values obtained by parsing all the special positions in the coefficient group. The above specific position can be agreed upon by the encoding unit 205 and the decoding unit 301 in encoding consistency, or can be derived by the encoding unit 301 according to the context information. For example, if a certain position of the previous unit to be decoded is a specific position, then the corresponding position of the current unit to be decoded is determined as the specific position.
[0171] In an example, the coefficient group information obtained by the decoding unit 301 through S601 includes the code length threshold of the coefficient group and the coefficient additional value G. The settings of the code length threshold and the coefficient additional value G are described below. During the coefficient encoding process of the encoding unit 205, if the code length of the fixed-length encoding corresponding to a certain coefficient value is greater than the code length threshold of the coefficient group, then the coefficient value is subtracted by the coefficient additional value G, and the result of subtracting the coefficient additional value G from the coefficient value is encoded. The code length threshold and the coefficient additional value G can be flexibly set according to the specific magnitudes of the coefficient values in the coefficient group. In the step of parsing the coefficients using the fixed-length encoding corresponding to the code length of the coefficient group, if the fixed-length code coding length is greater than the code length threshold, then first parse the encoding of the coefficient additional value G using the fixed-length encoding with the code length of coding length to obtain the coefficient additional value G, then parse all the coefficient values in the coefficient group using the fixed-length encoding with the code length of coding length, and add all the coefficient values to the coefficient additional value G, so as to restore the coefficient values.
[0172] Compared with the prior art, the coefficient values in the coefficient group are adjusted during encoding, and then the coefficients at specific positions in the coefficient group are restored based on the parameters transmitted by the bitstream during decoding. There is no need to carry a long complete coefficient code during bitstream transmission, thereby improving the encoding efficiency.
[0173] In addition to adjusting the code length of the fixed-length coding of the coefficient group and the coefficient value in the coefficient group, this embodiment also provides a coefficient decoding method, which is applied to the decoding unit 301, and adjusts the boundary symbols of the coefficient group during encoding, so as to further expand the decoding range through the boundary symbols.
[0174] In one example, the boundary symbol of the coefficient group information can not only use 1 bit to represent the positive and negative absolute extreme values in the coefficient group, but also use n bits to represent the coefficient compensation value. Then S603, after parsing the coefficient code according to the fixed-length coding with a code length of coding length, parses the coefficient compensation value from the boundary symbol for the coefficient code position where the parsed value is equal to the absolute extreme value 2^(coding length-1), and adds the absolute extreme value in the coefficient group to the coefficient compensation value as the coefficient value of the absolute extreme value position. Optionally, the boundary symbol can also be used to represent the positive and negative coefficient compensation value. It should be understood that if there are multiple absolute extreme values in the same coefficient group, the coefficient compensation value can also be multiple, and the absolute extreme values are respectively added to the corresponding coefficient compensation values to obtain the compensated coefficient value. It should be understood that in this embodiment, the decoding unit 301 needs to parse the boundary symbol code to obtain the boundary symbol, and the parsing method can adopt fixed-length decoding, truncated unary code, Huffman decoding, or a hybrid decoding method of several common decoding methods.
[0175] Accordingly, an embodiment of the present application provides a coefficient decoding device, which can be any coefficient decoding device during a call. According to the above method example, the coefficient decoding device can be divided into functional modules. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic, which is only a logical function division, and there may be other division methods in actual implementation.
[0176] In the case of dividing each functional module into corresponding functional modules, Fig.13 A possible structural diagram of the coefficient decoding device involved in the above embodiment is shown. Fig.13 As shown, the coefficient decoding device includes a parsing module 131 and a decoding module 132.
[0177] In one embodiment, the above-mentioned parsing module 131 is used to obtain the coefficient group information of the unit to be decoded, the coefficients of the unit to be decoded are divided into one or more coefficient groups, each coefficient group includes at least one coefficient code, the coefficient codes in the same coefficient group are fixed-length codes with the same code length, at least one coefficient group includes a first coefficient group, and the coefficient group information includes a boundary symbol of the first coefficient group. The decoding module 132 is used to parse the coefficient code of the first coefficient group into coefficient values, and is also used to determine whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary symbol.
[0178] The various modules of the above-mentioned coefficient decoding device can also be used to perform other actions in the above-mentioned method embodiment. All relevant contents of each step involved in the above-mentioned method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0179] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) mode or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).
[0180] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0181] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0182] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0183] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0184] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, or all or part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk, and other media that can store program codes.
[0185] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A coefficient decoding method, It is characterized in that include: Parsing a bitstream to obtain coefficient group information of a unit to be decoded, wherein the coefficient of the unit to be decoded is divided into at least one coefficient group, each coefficient group includes at least one coefficient code, and the coefficient codes in the same coefficient group are fixed-length codes with the same code length, the at least one coefficient group includes a first coefficient group, and the coefficient group information includes a boundary symbol of the first coefficient group; parsing coefficient codes of the first coefficient group into coefficient values; Determine whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary sign; The step of determining whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary sign includes: In the case where there is an absolute extreme value in the first coefficient group, the absolute values of the coefficient values in the first coefficient group are determined according to the boundary signs, and the signs of the coefficients equal to the absolute extreme value are all positive or all negative, and the absolute extreme value is the maximum absolute value of the fixed-length code value range of the code length.
2. The coefficient decoding method according to claim 1, It is characterized in that The first coefficient group includes one or more coefficient blocks, the boundary symbol includes a boundary symbol of each coefficient block, and determining whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary symbol includes: For any coefficient block, when there is an absolute extreme value in the coefficient block, the signs of the coefficients whose absolute values in the coefficient block are equal to the absolute extreme value are determined to be all positive or all negative according to the boundary signs of the coefficient block.
3. The coefficient decoding method according to claim 1 or 2, It is characterized in that The coefficients in the first coefficient group are residual coefficients, transformation coefficients or original pixel values.
4. The coefficient decoding method according to claim 1, It is characterized in that The boundary symbol is in the form of a boundary symbol code in the coefficient group information; the coefficient decoding method further includes: parsing the boundary symbol code with a fixed code length of 1 to obtain the boundary symbol.
5. A coefficient decoding device, It is characterized in that include: A parsing module, configured to parse a bitstream to obtain coefficient group information of a unit to be decoded, wherein the coefficients of the unit to be decoded are divided into one or more coefficient groups, each coefficient group includes at least one coefficient code, and the coefficient codes in the same coefficient group are fixed-length codes with the same code length, the at least one coefficient group includes a first coefficient group, and the coefficient group information includes a boundary symbol of the first coefficient group; A decoding module, configured to parse the coefficient codes of the first coefficient group into coefficient values; The decoding module is further used to determine whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary sign; Among them, when the decoding module determines whether the coefficient values in the first coefficient group are positive or negative according to the boundary sign, it is specifically used: when there is an absolute extreme value in the first coefficient group, the signs of the coefficients whose absolute values of the coefficient values in the first coefficient group are equal to the absolute extreme value are all positive or all negative according to the boundary sign, and the absolute extreme value is the maximum absolute value of the fixed-length code value range of the code length.
6. An electronic device, It is characterized in that It includes an image decoder, a communication interface and a memory; The image decoder is used to perform an operation, the operation comprising: Parsing a bitstream to obtain coefficient group information of a unit to be decoded, wherein the coefficient of the unit to be decoded is divided into at least one coefficient group, each coefficient group includes at least one coefficient code, and the coefficient codes in the same coefficient group are fixed-length codes with the same code length, the at least one coefficient group includes a first coefficient group, and the coefficient group information includes a boundary symbol of the first coefficient group; parsing coefficient codes of the first coefficient group into coefficient values; Determine whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary sign; The step of determining whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary sign includes: In the case where there is an absolute extreme value in the first coefficient group, the absolute values of the coefficient values in the first coefficient group are determined according to the boundary signs, and the signs of the coefficients equal to the absolute extreme value are all positive or all negative, and the absolute extreme value is the maximum absolute value of the fixed-length code value range of the code length.
7. The electronic device according to claim 6, It is characterized in that The first coefficient group includes a plurality of coefficient blocks, the boundary symbol includes a boundary symbol of each coefficient block, and determining whether the coefficient value in the first coefficient group is a positive value or a negative value according to the boundary symbol comprises: For any coefficient block, when there is an absolute extreme value in the coefficient block, the signs of the coefficients whose absolute values in the coefficient block are equal to the absolute extreme value are determined to be all positive or all negative according to the boundary signs of the coefficient block.
8. The electronic device according to claim 6 or 7, It is characterized in that The coefficients in the first coefficient group are residual coefficients, transformation coefficients or original pixel values.
9. A computer-readable storage medium, It is characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the coefficient decoding method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Image decoding apparatus, image encoding apparatus, and data structure of encoded data
CN103493494A
Coding method and device of transformation coefficients and decoding method and device of transformation coefficients
CN104093020A
