Factor decoding method, device, image decoder, and electronic device
By analyzing the bitstream acquisition coefficient group information in image encoding and decoding, and adjusting the decoding range using boundary symbols and encoding lengths, the problems of excessively long and low efficiency of semi-fixed length coding in the prior art are solved, and more efficient encoding and decoding are achieved.
Patent Information
- Application Number
- JP2025004940
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-01-19
- Filing Date
- 2025-01-14
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2043-01-05
AI Technical Summary
Prior Art In image encoding and decoding, semi-fixed length coding technology has problems such as excessive encoding length and low encoding efficiency.
By analyzing the bit stream to obtain coefficient group information, the coefficients to be decoded are divided into one or more coefficient groups, each coefficient group contains at least one coefficient code, and the coefficient codes of the same coefficient group are fixed-length codes and the encoding length is the same. The positive and negative nature of the coefficient value is determined using boundary symbols, and the decoding range is adjusted according to the encoding length and pixel bit width to improve encoding and decoding efficiency.
By adjusting the decoding range and using boundary symbols, the problem of excessive encoding length is avoided, and the encoding and decoding efficiency is improved, especially in the presence of extreme values.
Smart Images

Figure 2025039821000001_ABST
Abstract
Description
[Technical field]
[0001] FIELD OF THE DISCLOSURE The embodiments of the present invention relate to the technical field of image encoding and decoding, and in particular to a coefficient decoding method, apparatus, image decoder, and electronic device. [Background technology]
[0002] Lossless compression is a technique that compresses redundant information in an original image and reconstructs the original image without distortion. If there is an error between the reconstructed image and the original image, but the error is within a certain range, it can be called near lossless compression. In the compression encoding process, the residual values between pixels in the original image are predicted, and the residual values are used to indicate the difference between the pixels. Semi-fixed-length codes are used to code the residual values to further reduce the coding length. However, existing semi-fixed-length code technologies still have problems such as a long coding length and low coding efficiency. Summary of the Invention
[0003] SUMMARY OF THE DISCLOSURE The embodiments of the present invention provide a coefficient decoding method, an apparatus, an image decoder, and an electronic device that can improve image decoding performance.
[0004] In order to achieve the above objectives, the embodiments of the present invention adopt the following technical solutions.
[0005] In a first aspect, an embodiment of the present invention provides a coefficient decoding method including the steps of: parsing a bitstream to obtain coefficient group information of a unit to be decoded, where coefficients of the unit to be decoded are divided into one or more coefficient groups, each coefficient group including at least one coefficient code, the coefficient codes in the same coefficient group being fixed-length codes with the same coding length, the at least one coefficient group including a first coefficient group, and the coefficient group information including a boundary symbol of the first coefficient group; parsing the coefficient code of the first coefficient group into coefficient values; and determining, based on the boundary symbol, that the coefficient values in the first coefficient group are positive values or negative values.
[0006] In the coefficient decoding method provided by the embodiment of the present invention, compared with the prior art, the decoding range of a fixed-length code without introducing a boundary symbol is [0, 2^bit_depth-1]. When a boundary symbol is introduced to perform fixed-length decoding of the coefficient code of the coefficient group, the positive or negative of the coefficient group is determined based on the boundary symbol of the coefficient group, and the analysis range of the fixed-length code is changed from [0, 2^bit_depth-1] to [-2^(coding length-1)-1, 2^(coding length-1)]. When a coefficient value of 2^bit_depth-1 exists in the coefficient group, there is no need to lengthen the coding length corresponding to the coefficient group, thereby improving the coding and decoding efficiency.
[0007] In one possible implementation, the coefficient group information further includes an encoding length and an image bit width of the first coefficient group, the encoding length is used to represent a length of a fixed-length code corresponding to the first coefficient group, and the step of parsing the coefficient code of the first coefficient group into coefficient values includes: if the encoding length is equal to or greater than the image bit width, parsing the coefficient code of the first coefficient group into coefficient values using a fixed-length code having a length equal to the image bit width; and if the encoding length is smaller than the image bit width, parsing the coefficient code of the first coefficient group into coefficient values using a fixed-length code having a length equal to the encoding length.
[0008] The image bit width corresponding to the coefficient group is used to represent the range of coefficient values in the coefficient group, and the fixed-length code corresponding to the coefficient group and the analysis range of coefficient values are determined based on the fixed-length code having a preset coding length corresponding to the coefficient group and the analysis range of coefficient values in the coefficient group, so as to ensure the accuracy of the judgment method. The image bit width corresponding to the coefficient group can be obtained by analyzing the bit stream, and the data required for judgment can be extracted easily and quickly, improving the judgment efficiency. In the two cases, the coefficient code is analyzed using fixed-length codes with different coding lengths, improving the decoding efficiency.
[0009] In one possible implementation, the coding length of the coefficient group includes a coefficient group coding length and a coefficient bit coding length, and the coefficient bit coding length is used to represent the length of a fixed-length code corresponding to a coefficient code at a specific position in the first coefficient group, where the specific position is obtained based on the consistency of encoding and decoding or derived from a context. The step of parsing the coefficient code of the first coefficient group into coefficient values using a fixed-length code having a length of the coding length includes the steps of parsing the coefficient code at a specific position in the first coefficient group into coefficient values using a fixed-length code having a length of the coefficient bit coding length, and parsing the coefficient code at a position other than the specific position in the first coefficient group into coefficient values using a fixed-length code having a length of the coefficient group coding length. When the coefficients are distributed unevenly, the coefficient codes in the same coefficient group are parsed using fixed-length codes with different lengths for the coefficient codes at some specific positions, thereby avoiding the overall coding length of the coefficient group being long due to the large difference between the coefficient codes at some specific positions and the coefficient codes at other positions in the coefficient group, and improving the decoding efficiency.
[0010] In one possible implementation, during code sorting, coefficient codes with the same or similar corresponding coding length are put into the same coefficient group based on the magnitude of the coefficient value, so that if the coefficient value in the same coefficient group has an analytical extreme value of the fixed-length code corresponding to the coding length, the other coefficient values and the analytical extreme value in the same coefficient group are all positive or all negative. Therefore, if an absolute extreme value exists in the first coefficient group, it is determined based on the boundary symbol that all coefficient values in the coefficient group are all positive or all negative, and the absolute extreme value is the maximum absolute value of the code value range of the fixed-length code of the coding length corresponding to the coefficient group. The same coefficient group uses one boundary symbol to represent the positive and negative of the coefficients, thereby improving the coding efficiency.
[0011] In one possible implementation, the same coefficient group is divided into multiple coefficient blocks, and if an absolute extreme value exists in any of the coefficient blocks, it is determined that all the coefficient values in any of the coefficient blocks are all positive or all negative based on the boundary symbol of the any of the coefficient blocks, thereby further improving the indication accuracy of the boundary symbol for the positive and negative of the coefficient values.
[0012] In one possible implementation form, in the encoding process, if the predicted value and the residual value are quantized, compared with the case where the predicted value and the residual value are quantized after the coefficient transformation, if the image transmission quality and the encoding / decoding efficiency are the same or better, the predicted value and the residual value are quantized to obtain the residual coefficients without performing the step of coefficient transformation.
[0013] Therefore, the coefficient code in the unit to be decoded obtained by the decoding device by analyzing the bitstream can be a semi-fixed-length code result of the residual coefficient or a semi-fixed-length code result of the transform coefficient. The coefficient decoding method in any of the above implementations can be applied to decoding the residual coefficient or the transform coefficient, improving the applicability of the coefficient decoding method.
[0014] In one possible implementation, the DC coefficient group and the AC coefficient group included in the transform coefficient are divided into different coefficient groups. In the coefficient group information, the coding length of each coefficient group is in the form of a coding length code, and in the coefficient group information, the boundary symbol is in the form of a boundary symbol code. If the coefficients in the coefficient group are transform coefficients and the coefficient group is a DC coefficient group, a DC coefficient decoding method (e.g., a fixed-length code) is used to analyze the coding length code of the coefficient group to obtain the coding length corresponding to the coefficient group, and a fixed-length code whose length is the coding length corresponding to the coefficient group is used to analyze the boundary symbol. In another example, if the coefficients in the coefficient group are transform coefficients and the coefficient group is a DC coefficient group, a fixed-length code may be used to analyze the coding length code of the coefficient group to obtain the coding length corresponding to the coefficient group, a fixed-length code whose length is the coding length corresponding to the coefficient group is used to analyze the DC coefficient value, and a fixed coding length 1 may be used to analyze the boundary symbol.
[0015] In one possible implementation, if 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 analyze the coding length code corresponding to the coefficient group to obtain the coding length corresponding to the coefficient group, and a fixed-length code whose length corresponds to the coding length of the coefficient group is used to analyze the boundary symbol code of the coefficient group to obtain the boundary symbol.
[0016] Since DC and AC coefficients are generated when coefficient conversion is performed on residual values and predicted values, when dividing the DC and AC coefficients into coefficient groups, the coding length code of the DC coefficient group is analyzed using a DC coefficient decoding method, and the coding length code of the AC coefficient group is analyzed using a fixed length decoding method. This makes it possible to perform coefficient coding and decoding on the DC and AC coefficients, respectively. This avoids the problem that there is a large difference in coefficient values in the same coefficient group, and it is necessary to use a fixed length code with a long coding length for coding and analysis, and improves decoding efficiency.
[0017] In one possible implementation form, determining a first coefficient group in a unit to be decoded includes the steps of determining a scanning scheme and a grouping scheme of the unit to be decoded from a bitstream, scanning the unit to be decoded based on the scanning scheme to obtain a scanning result, and dividing the scanning result into one or more coefficient groups based on the grouping scheme, where the first coefficient group is any one of the one or more coefficient groups.
[0018] In the encoding and decoding process, decoding may be the reverse step of encoding, and the scanning scheme, grouping scheme, fixed-length code, etc. used by the encoding side and the decoding side are all agreed to be the same in advance, and conformity between encoding and decoding is followed. When a scanning scheme and grouping scheme are used to sort and group residual coefficients or transform coefficients during semi-fixed-length coding, and coefficient values to be coded by fixed-length codes with different coding lengths are set in different groups, the scanning scheme and grouping scheme are transmitted to a decoding device in a bit stream, and the decoding device uses fixed-length codes with the same coding length according to the coefficient groups determined by the scanning scheme and grouping scheme, thereby ensuring the consistency between encoding and decoding and ensuring the accuracy of encoding and decoding.
[0019] In one possible implementation form, the coefficient group information includes a coding length threshold and a coefficient addition value for each coefficient group, and when the coding length corresponding to the coefficient group is greater than the coding length threshold of the coefficient group, the step of obtaining the coefficient value by a fixed length decoding method, and then adding the coefficient addition value of the coefficient group to the coefficient value to obtain the coefficient value of the coefficient group is further included.
[0020] The decoding device determines, based on the coding length threshold, whether the same coefficient addition value is subtracted from all coefficient values in the coefficient group when the coefficient group is coded, and can restore the coefficient values in the coefficient group by adding the coefficient addition value after decoding the values in the coefficient group at the decoding side, and the coding device transmits a predetermined average value to the decoding device, and the decoding device restores the coefficient values based on the coefficient addition value, thereby avoiding transmitting a long code corresponding to the original large coefficient values in the coefficient group, and improving the coding and decoding efficiency.
[0021] In one possible implementation, the coefficient group information may further include a coefficient compensation value for each coefficient group in addition to a sign bit for representing the positive or negative of the extreme value. The coefficient compensation value is used to compensate the extreme value in the coefficient group. After determining that the coefficient value in the coefficient group is a positive value or a negative value based on the boundary symbol, the method further includes adding the coefficient compensation value to the absolute extreme value in the coefficient value to obtain the coefficient value at the absolute extreme value position in the coefficient group. By obtaining the analysis range of the sum of the extreme value and the coefficient compensation value with a short coding length, the coding and decoding efficiency is improved.
[0022] In one possible implementation, the coefficient group is divided into multiple coefficient blocks, and the coefficient compensation value of each coefficient group includes the coefficient compensation value of all the coefficient blocks in the coefficient group, and further includes adding the absolute extreme value in each coefficient block to the coefficient compensation value of the same coefficient block after determining that the coefficient value in the coefficient group is positive or negative according to the boundary symbol to obtain the coefficient value of the absolute extreme value position of each coefficient block.By allowing the coefficient compensation value to compensate the extreme value in each coefficient block, the coding efficiency is further improved.
[0023] In a second aspect, an embodiment of the present invention provides a coefficient decoding method, comprising: parsing a bitstream to obtain coefficient group information of a unit to be decoded, where coefficients of the unit to be decoded are divided into at least one coefficient group, where each coefficient group includes at least one coefficient code, where the coefficient codes in a same coefficient group are fixed-length codes having the same coding length, where the at least one coefficient group includes a first coefficient group, where the coefficient group information includes a boundary symbol of the first coefficient group, a coding length, and an image bit width, where the coding length is used to represent a length of the fixed-length code corresponding to the first coefficient group; parsing the coefficient code of the first coefficient group into coefficient values, where if the coding length is equal to or greater than the image bit width, the coefficient code of the first coefficient group is parsed into coefficient values using a fixed-length code having a length equal to the image bit width, and if the coding length is smaller than the image bit width, the coefficient code of the first coefficient group is parsed into coefficient values using a fixed-length code having a length equal to the coding length; and determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol.
[0024] In one possible implementation form, the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol includes a step of determining, if an absolute extreme value exists in the first coefficient group, based on the boundary symbol, that the symbols of coefficients in the first coefficient group whose absolute values are equal to the absolute extreme value are all positive or all negative, where the absolute extreme value is the maximum absolute value of a fixed-length code value range of the coding length.
[0025] In one possible implementation, the first coefficient group includes one or more coefficient blocks, and the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol includes a step of determining, for any coefficient block, if an absolute extreme value exists in the coefficient block, based on the boundary symbol of the coefficient block, that the symbols of coefficients in the coefficient block whose absolute values are equal to the absolute extreme value are all positive or all negative.
[0026] In one possible implementation, the coefficients in the first group of coefficients are residual coefficients, transform coefficients, or original pixel values.
[0027] In one possible implementation, the method further comprises parsing the bitstream using a fixed coding length of 1 to obtain the boundary symbols.
[0028] In a third aspect, an embodiment of the present invention includes a step of analyzing a bitstream to obtain coefficient group information of a unit to be decoded, a grouping scheme of the unit to be decoded, and a prediction mode of the unit to be decoded, where coefficients of the unit to be decoded are divided into at least one coefficient group, each coefficient group includes at least one coefficient code, the coefficient codes in the same coefficient group are fixed-length codes with the same coding 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; and deriving a first coefficient group from the scanning result based on a scanning scheme, scanning the unit to be decoded based on the scanning scheme to obtain a scanning result, and extracting the first coefficient group from the scanning result based on the grouping scheme, where if the prediction mode is a point-by-point prediction mode, the scanning scheme is a vertical-first scanning scheme, and the vertical-first scanning scheme is a top-to-bottom and then a left-to-right scanning scheme; parsing coefficient signs of the first coefficient group into coefficient values; and determining, based on the boundary symbol, that the coefficient values in the first coefficient group are positive or negative.
[0029] In one possible implementation form, the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol includes a step of determining, if an absolute extreme value exists in the first coefficient group, based on the boundary symbol, that the symbols of coefficients in the first coefficient group whose absolute values are equal to the absolute extreme value are all positive or all negative, where the absolute extreme value is the maximum absolute value of a fixed-length code value range of the coding length.
[0030] In one possible implementation, the first coefficient group includes one or more coefficient blocks, and the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol includes a step of determining, for any coefficient block, if an absolute extreme value exists in the coefficient block, based on the boundary symbol of the coefficient block, that the symbols of coefficients in the coefficient block whose absolute values are equal to the absolute extreme value are all positive or all negative.
[0031] In one possible implementation, the coefficients in the first group of coefficients are residual coefficients, transform coefficients, or original pixel values.
[0032] In one possible implementation, the method further comprises parsing the bitstream using a fixed coding length of 1 to obtain the boundary symbols.
[0033] In a fourth aspect, an embodiment of the present invention provides a coefficient decoding device, including an analysis module and a decoding module, the analysis module is used for analyzing a bitstream to obtain coefficient group information of a unit to be decoded, where 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 coding 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. The decoding module is used for analyzing the coefficient code of the first coefficient group into coefficient values, and is further used for determining that the coefficient values in the first coefficient group are positive or negative values according to the boundary symbol.
[0034] In a fifth aspect, an embodiment of the present invention provides an analysis module for analyzing a bitstream to obtain coefficient group information of a unit to be decoded, wherein coefficients of the unit to be decoded are 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 coding length, the at least one coefficient group includes a first coefficient group, the coefficient group information includes a boundary symbol, a coding length, and an image bit width of the first coefficient group, and the coding length is used to represent the length of the fixed-length code corresponding to the first coefficient group; and a decoding module for analyzing the coefficient code of the first coefficient group into coefficient values, the decoding module being configured to analyze the coefficient code of the first coefficient group into coefficient values using a fixed-length code having the same length as the image bit width when the coding length is equal to or greater than the image bit width, and to analyze the coefficient code of the first coefficient group into coefficient values using a fixed-length code having the same length as the coding length when the coding length is smaller than the image bit width, wherein the decoding module is further configured to be used for determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol.
[0035] In a sixth aspect, an embodiment of the present invention analyzes a bitstream to obtain coefficient group information of a unit to be decoded, a grouping scheme of the unit to be decoded, and a prediction mode of the unit to be decoded, wherein coefficients of the unit to be decoded are 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 having the same coding length, and 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; deriving a scanning scheme based on the prediction mode; and determining a grouping scheme of the unit to be decoded based on the scanning scheme. and a decoding module for analyzing coefficient signs of the first coefficient group into coefficient values, the decoding module being further used for determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol.
[0036] In a seventh aspect, an embodiment of the present invention provides an image decoder for performing the coefficient decoding method according to the first aspect, the second aspect, the third aspect and any one of their possible implementations.
[0037] In an eighth aspect, an embodiment of the present invention provides an electronic device comprising an image decoder, a communication interface and a memory, the image decoder being adapted to perform the coefficient decoding method according to any one of the first, second and third aspects and possible realisations thereof.
[0038] In a ninth aspect, an embodiment of the present invention provides a computer readable storage medium comprising computer instructions which, when executed on an electronic device, causes the electronic device to perform the coefficient decoding method according to any one of the first, second and third aspects and possible implementations thereof.
[0039] In a tenth aspect, an embodiment of the present invention provides a computer program product which, when executed on a computer, performs the coefficient decoding method according to the first aspect, the second aspect, the third aspect and any one of their possible implementations.
[0040] In an eleventh aspect, an embodiment of the present invention provides an apparatus including a memory and a processor. The memory is used for storing computer instructions. The processor is used for retrieving and executing the computer instructions from the memory to cause an electronic device to perform the coefficient decoding method according to any one of the first aspect, the second aspect, the third aspect, and possible implementations thereof.
[0041] In a twelfth aspect, an embodiment of the present invention provides an image encoding / decoding system including an image encoding device and an image decoding device, wherein the image decoding device is used to receive an image bitstream from the image encoding device, perform coefficient decoding on the image bitstream by executing a coefficient decoding method described in any one of the first aspect, the second aspect, the third aspect, and possible implementation forms thereof, and perform image reconstruction based on a result of the coefficient decoding to obtain a decoded image.
[0042] In addition, the beneficial effects obtained by the technical solutions of the second to twelfth aspects of the present invention and the corresponding possible implementation forms thereof can be referred to the technical effects described above for the first aspect and its corresponding possible implementation forms, so they will not be repeated here. [Brief description of the drawings]
[0043] [Figure 1] FIG. 2 is a schematic architecture diagram of an encoding / decoding system provided by an embodiment of the present invention; [Diagram 2] 2 is an exemplary block diagram of an encoder provided by an embodiment of the present invention; [Diagram 3] FIG. 2 is an exemplary block diagram of a decoder provided by an embodiment of the present invention; [Figure 4] 4 is a schematic flowchart of encoding / decoding provided by an embodiment of the present invention; [Diagram 5] FIG. 2 is a schematic diagram of a coefficient encoding method provided by an embodiment of the present invention; [Figure 6] FIG. 2 is a schematic diagram of a coefficient decoding method provided by an embodiment of the present invention; [Figure 7] FIG. 1 is a schematic diagram of a scanning scheme provided by an embodiment of the present invention. [Figure 8] FIG. 1 is a schematic diagram of a grouping scheme provided by an embodiment of the present invention. [Figure 9] FIG. 2 is a schematic diagram of a scanning scheme provided by an embodiment of the present invention. [Figure 10] FIG. 2 is a schematic diagram of a grouping scheme provided by an embodiment of the present invention. [Figure 11] FIG. 1 is a schematic diagram of a scanning and grouping scheme provided by an embodiment of the present invention. [Figure 12] FIG. 2 is a schematic diagram of a scanning and grouping scheme provided by an embodiment of the present invention. [Figure 13] FIG. 2 is a schematic structural diagram of a coefficient decoding device provided by an embodiment of the present invention; [Figure 14] FIG. 2 is a hardware structural diagram of an electronic device provided by an embodiment of the present invention; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0044] The term "and / or" used herein is merely intended to describe a relationship between related objects and indicates that three types of relationships may exist. For example, A and / or B can represent three cases: A exists alone, A and B exist simultaneously, and B exists alone.
[0045] The terms "first", "second", etc. in the description and claims of the embodiments of the present invention are intended to distinguish between different objects, and are not intended to represent a particular order of the objects. For example, the terms "first prediction mode" and "second prediction mode" are intended to distinguish between different prediction modes, and are not intended to represent a particular order of the prediction modes.
[0046] In describing embodiments of the invention, terms such as "exemplary" or "for example" are used to denote an example, illustration, or explanation. Any embodiment or design described in the embodiments of the invention as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Strictly speaking, use of terms such as "exemplary" or "for example" is intended to present the related concept in a concrete manner.
[0047] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more. For example, a plurality of prediction units means two or more prediction units, and a plurality of coding blocks means two or more coding blocks.
[0048] The coefficient decoding method provided by the embodiment of the present invention may be used for video decoding, image decoding, etc., and as long as there exists a method for encoding predicted values, residual values, coefficient values, etc. with semi-fixed-length codes, the coefficient decoding method provided in the present invention is applicable.
[0049] Conventional image encoding / decoding techniques and semi-fixed length coding techniques will be described below.
[0050] Take the Joint Photographic Experts Group (JPEG) image compression method as an example: first, convert the image from RGB (Red-Green-Blue) format to YUV (Y is luminance, U and V are chromaticity) format. Then, sample the YUV format image according to a predetermined sampling format, and divide the image into multiple data blocks, where the three components (Y, U, V) of each point in the source image alternate, so the three components must first be separated and stored in three tables. During encoding, after reading one data block from the source data, it undergoes Discrete Cosine Transform (DCT), quantization, and encoding, and then reads and processes the next data block. Here, encoding may include steps of binarization and entropy encoding. Here, binarization is also called binarization, in which symbols or coefficients that need to be encoded are binarized, and the binarized symbols or coefficients are converted into binary strings. The binary strings obtained by encoding the same coefficients with different binarization methods may have different binary probability models and different string lengths. Entropy coding is a lossless coding method that follows the principle of information entropy, converting a series of element symbols for representing an image sequence into a binary bit stream for transmission or storage, and the output data after entropy coding is the final bit stream after compression of the original image. DCT transform converts the image from a time domain signal to a frequency domain. Since most image energy is mainly concentrated in the low frequency region and the human eye is sensitive to low frequencies, quantization can be used to zero out high frequency coefficients, which can reduce the dynamic range of image coding based on the transform module. The transform coefficients in the high frequency region are removed, reducing the bit rate overhead and not causing large distortion. Here, the residual values are organized into residual blocks, and the coefficients of the residual blocks after transformation and quantization are called transform coefficients.
[0051] The encoding and decoding processes are reversed. For example, when encoding, the image undergoes color gamut conversion, sampling, DCT transformation, quantization, and encoding in that order. However, when decoding, the received bit stream must be decoded, inverse quantized, and inverse discrete cosine transform in that order. The results of the inverse discrete cosine transform are then sorted in inverse sampling order, and finally the image data is converted from YUV format to RGB format.
[0052] In lossless and near-lossless video compression algorithms, for example when encoding using the JPEG image compression method, after performing a quantization step, the quantized data is often encoded using a semi-fixed length code method, and the coefficients to be encoded are grouped according to the prediction direction and the magnitude of the residual, each group corresponds to one coding length code, and the coefficients in the same group are encoded by a fixed length code of the same coding length.
[0053] For example, if the data obtained by quantizing one data block includes (-4, -4, -3, -2, -1, 0, 1, 2, 3, 7), it may be divided into (-1, 0, 1), (-3, -2, 2, 3), and (-4, -4, 7), where the coding length of the coding length code corresponding to (-1, 0, 1) is 2, the coding length of the coding length code corresponding to (-3, -2, 2, 3) is 3, and the coding length of the coding length code corresponding to (-4, -4, 7) is 4, or the coding length of the coding length code corresponding to (-1, 0, 1) is 1, the coding length of the coding length code corresponding to (-3, -2, 2, 3) is 2, and the coding length of the coding length code corresponding to (-4, -4, 7) is 3, and each data symbol is encoded using a coding length of 1, or the non-zero data symbol is encoded using a coding length of 1.
[0054] By using conventional semi-fixed-length codes to group data in a quantized group into fixed-length code groups, lossless coding can be performed to a certain extent. However, if an extreme value of the analysis range of the fixed-length code of a certain coding length exists in a group corresponding to the coding length, it is necessary to lengthen the coding lengths of all the coefficient groups, so the coding lengths of such codes are still large. In order to further improve the coding performance, an embodiment of the present invention provides a coefficient decoding method.
[0055] The following describes a system architecture to which the coefficient decoding method of the embodiment of the present invention is applied. Referring to FIG. 1, a schematic architecture diagram of an encoding / decoding system (which may also be called an encoding and decoding system) 10 to which the embodiment of the present invention is applied is shown. As shown in FIG. 1, the encoding / decoding system 10 may include a source device 11 and a destination device 12. The source device 11 is used to encode images, so the source device 11 may also be called a video encoding device. The destination device 12 is used to decode encoded image data generated by the source device 11, so the destination device 12 may also be called a video decoding device.
[0056] The source device 11 and the destination device 12 may include a variety of devices including, for example, 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, and the like.
[0057] In one example, the source device 11 and the destination device 12 in FIG. 1 may be two separate devices, or the source device 11 and the destination device 12 may be the same device, i.e., the source device 11 or a corresponding function and the destination device 12 or a corresponding function may be integrated into the same device.
[0058] Communication may be possible between source device 11 and destination device 12, for example, destination device 12 may receive encoded image data from source device 11. In one example, the source device 11 and destination device 12 may include one or more communication media, and the encoded image data may be transmitted over one or more communication media, which may include routers, switches, base stations, or other devices that facilitate communication from source device 11 to destination device 12.
[0059] As shown in FIG. 1, the source device 11 includes an encoder 112. In one example, the source device 11 may further include an image preprocessor 111 and a communication interface 113. Here, 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 cropping, color format conversion (e.g., converting from RGB format to YUV format), toning, or noise removal, etc. The encoder 112 is used to receive the preprocessed image and process the preprocessed image using an associated prediction mode (e.g., a prediction mode in each embodiment of the present specification) to provide encoded image data. In some embodiments, the encoder 112 may be used to perform the image encoding process in each embodiment described below. The communication interface 113 may be used to transmit the encoded image data to the destination device 12, or any other device (e.g., a memory) for storage or direct reconstruction, and the other device may be any device for decoding or storage. The communication interface 113 may encapsulate the encoded image data into a suitable format before transmitting it.
[0060] In one example, the image pre-processor 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, and the embodiment of the present invention is not limited in this respect.
[0061] As shown in FIG. 1, the destination device 12 includes a decoder 122. In one example, the destination device 12 may further include a communication interface 121 and an image post-processor 123. Here, the communication interface 121 may be used to receive encoded image data from the source device 11 or any other source device, which may be, for example, a storage device. The communication interface 121 may also decapsulate data transmitted by the communication interface 113 to obtain encoded image data. The decoder 122 is used to receive the encoded image data and output 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 a coefficient decoding process in each embodiment described below.
[0062] 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 (e.g., converting from YUV format to RGB format), toning, cropping, or resampling, or any other processing, and may be used to transmit the post-processed image data to a display device for display.
[0063] Similarly, in one example, the communication interface 121, the decoder 122 and the image post-processor 123 may be hardware components in the destination device 12 or may be software programs in the destination device 12, and embodiments of the present invention are not limited in this regard.
[0064] The structures of the encoder and decoder in FIG. 1 will be briefly explained below.
[0065] Referring to FIG. 2, FIG. 2 shows an exemplary block diagram of an example of an encoder 20 for implementing an embodiment of the present invention. In FIG. 2, the encoder includes a prediction processing unit 201, a residual calculation unit 202, a transform processing unit 203, a quantization unit 204, and an encoding unit 205. In one example, the encoder further includes an inverse quantization unit, an inverse transform processing unit, a reconstruction unit, and a filter unit. In one example, the encoder 20 may further include a buffer and a decoded picture buffer (DPB), where the buffer is used to buffer the reconstructed image block output by the reconstruction unit, and the decoded picture buffer is used to buffer the filtered image block output by the filter unit.
[0066] The input of the encoder 20 is an image block of an image (which may be called an image to be encoded), which may be called a current image block or an image block to be encoded, and the encoder 20 may further include a division unit (not shown in Fig. 2) for dividing the image to be encoded into multiple image blocks. The encoder 20 is used to encode the image to be encoded block by block, e.g., performs an encoding process for each image block.
[0067] The prediction processing unit 201 is used to receive or acquire an image block (which is a current image block to be coded of a current image to be coded, which may also be referred to as a current image block, which may also be understood as the true value of the image block) and reconstructed image data, and to predict the current image block based on associated data in the reconstructed image data to obtain a prediction block of the current image block.
[0068] The residual calculation unit 202 is used to calculate the residual between the true value of the image block and the predicted block of the image block to obtain a residual block, for example, by subtracting the pixel values of the predicted block from the pixel values of the image block for each pixel.
[0069] The transform processing unit 203 is used to perform coefficient transform such as discrete cosine transform or discrete sine transform (DST) on the residual block to obtain transform coefficients in the transform domain. Note that, in this embodiment, the transform processing unit 203 may perform coefficient transform on the residual block, and may not perform coefficient transform on the residual block when the coding efficiency difference between the residual block and the transform coefficient is small.
[0070] 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 be referred to as quantized residual coefficients. The quantization process may reduce the bit depth for some or all of the transform coefficients. For example, during quantization, an n-bit transform coefficient may be truncated to an m-bit transform coefficient, where n is greater than m. The degree of quantization may be changed by adjusting a Quantization Parameter (QP). For example, in the case of scalar quantization, fine and coarse quantization may be achieved by applying different scales. A small quantization step corresponds to fine quantization, and a large quantization step corresponds to coarse quantization. The quantization parameter may indicate an appropriate quantization step.
[0071] The encoding unit 205 is used to encode the quantized residual coefficients or transform coefficients, arrange the coefficient codes into units to be decoded in a scanning and grouping manner, and output the encoded image data (i.e., units to be decoded) in the form of an encoded bitstream. The encoded bitstream may then be transmitted to a decoder, or stored for later transmission to a decoder or retrieval. The encoding unit 205 may also be used to encode other syntax elements of the current image block, such as encoding a prediction mode into the bitstream. Optionally, in this embodiment, the coefficients may be coded using one or a combination of coding schemes such as unary code, truncated unary code, truncated binary code, fixed length code, semi-fixed length code, run-length coding, k-order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, adaptive variable length coding, etc.
[0072] Specifically, in an embodiment of the present invention, encoder 20 is used to implement an image encoding method as described in the following embodiment.
[0073] 3, which illustrates an exemplary block diagram of an example of a decoder 30 for implementing an embodiment of the present invention. The decoder 30 is used, for example, to receive encoded image data (i.e., an encoded bitstream, e.g., including an encoded bitstream of 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 transform processing unit 303, a prediction processing unit 304, a reconstruction unit 305, and a filter unit 306. In some examples, the decoder 30 may perform a decoding path that is approximately the reverse of the encoding path described for the encoder 20 of FIG. 2. In one example, the decoder 30 may further include a buffer and a decoded image buffer, where the buffer is used to buffer the reconstructed image block output by the reconstruction unit 305, and the decoded image buffer is used to buffer the filtered image block output by the filter unit 306.
[0074] The decoding unit 301 is used to perform decoding on the encoded image data to obtain quantized coefficients (e.g., residual coefficients or transform coefficients). The decoding unit 301 is further used to forward the decoded encoding parameters to the prediction processing unit 304, so that the prediction processing unit 304 performs a prediction process based on the encoding parameters.
[0075] The inverse quantization unit 302 is used to inverse quantize the quantized coefficients to obtain inverse quantized coefficients, which is an inverse application of the quantization unit 204. For example, it applies an inverse quantization scheme of the quantization scheme applied by the quantization unit 204 based on or using the same quantization step as the quantization unit 204. The inverse quantized coefficients may also be referred to as inverse quantized residual coefficients or inverse quantized transform coefficients.
[0076] The inverse transform processing unit 303 is used to inverse transform the inverse quantized coefficients, which is an inverse application of the transform processing unit 203, e.g., 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 (also called the sample domain). The inverse transform block may be called an inverse transformed inverse quantized block or an inverse transformed residual block.
[0077] A reconstruction unit 305 (e.g., an adder) 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 quantized coefficients to obtain an inverse transform block (which may also be called an inverse transform residual block), which is the residual block of the current image block in the pixel domain.
[0078] The prediction processing unit 304 is used to receive or obtain encoded image data (e.g., the encoded bitstream of the current image block) and reconstructed image data, and the prediction processing unit 304 may further receive or obtain, for example, prediction-related parameters and / or information regarding the selected prediction mode (i.e., the decoded encoding parameters) from the decoding unit 301, and predict the current image block based on the associated data in the reconstructed image data and the decoded encoding parameters to obtain a prediction block of the current image block.
[0079] The reconstruction unit 305 is used to add an inverse transformed block (i.e., an inverse transformed residual block) to a prediction block to obtain a reconstructed block in the sample domain, for example by adding sample values of the inverse transformed residual block to sample values of the prediction block.
[0080] The filter unit 306 is used to filter the reconstructed block to obtain a filtered block, which is the decoded image block.
[0081] Specifically, in the embodiment of the present invention, the decoding unit 301 is used to implement a coefficient decoding method described in the following embodiment.
[0082] It should be noted that in the encoder 20 and the decoder 30 according to the embodiment of the present invention, the processing result of one process may be further processed before being output to the next process.
[0083] Hereinafter, based on the encoding / decoding system, encoder and decoder shown in Figures 1 to 3, an embodiment of the present invention provides a possible implementation form of encoding / decoding, as shown in Figure 4, Figure 4 is a schematic flowchart of the encoding / decoding provided by the embodiment of the present invention, and the implementation form of the encoding / decoding includes processes (1) to (5), and the processes (1) to (5) may be performed by any one or more of the source device 11, the encoder 20, the destination device 12, or the decoder 30.
[0084] Process (1): Divide one frame of an image into one or more non-overlapping parallel encoding units, which are not dependent on each other and can be encoded and decoded completely in parallel / independently, such as parallel encoding unit 1 and parallel encoding unit 2 shown in Figure 4.
[0085] Process (2): For each parallel coding unit, it may be further divided into one or more non-overlapping independent coding units, each of which may be independent of each other but may share some parallel coding unit header information.
[0086] For example, the width of an independent coding unit is w_lcu and the height is h_lcu. If a parallel coding unit is split into one 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 must be greater than the height (except for edge regions).
[0087] 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), for example, 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, etc.
[0088] As one possible example, the independent coding units may be fixed at 128×4. If the size of the parallel coding units is 256×8, the parallel coding units may be divided evenly into four independent coding units, and if the size of the parallel coding units is 288×10, the parallel coding units are divided into two 128×4+one 32×4 independent coding units in the first / second row and two 128×2+one 32×2 independent coding units in the third row.
[0089] It should be noted that the independent coding unit may include three components of luminance Y, chrominance Cb, and chrominance Cr, or three components of red (R), green (G), and blue (B), or may include only one of these components. When the independent coding unit includes three components, the sizes of these three components may be completely the same or different, which is specifically related to the input format of the image.
[0090] Process (3): For each independent coding unit, it may be further divided into one or more non-overlapping coding units, and each coding unit within the independent coding unit may be dependent on each other, for example, multiple coding units may refer to each other to perform pre-encoding and pre-decoding.
[0091] If the size of the coding unit and the independent coding unit is the same (i.e., the independent coding unit is divided into only one coding unit), the size may be any size described in process (2).
[0092] When an independent coding unit is divided into multiple non-overlapping coding units, possible examples of division include equal horizontal division (where the height of the coding unit is the same as the independent coding unit but the width is different, which may be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), equal vertical division (where the width of the coding unit is the same as the independent coding unit but the height is different, which may be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), equal horizontal and vertical division (quadtree division), etc., with equal horizontal division being preferred.
[0093] If the coding unit has a width w_cu and a height h_cu, the width must be greater than the height (except for edge regions). In general, the coding unit may be a fixed w_cu×h_cu, where w_cu and h_cu are both 2 to the power of N (N is 0 or greater), such as 16×4, 8×4, 16×2, 8×2, 8×1, 4×1, etc.
[0094] As one 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 divided evenly into four coding units, and if the size of the independent coding unit is 72x4, it is divided into four 16x4 + one 8x4 coding units.
[0095] Note that the coding unit may include three components of luminance Y, chrominance Cb, and chrominance Cr (or three components of red R, green G, and blue B), or may include only one of these components. When including three components, the sizes of these components may be completely the same or different, and are specifically related to the input format of the image.
[0096] Note that process (3) is an optional step in the encoding / decoding method, and the encoder / decoder may perform encoding / decoding on the residual coefficients (or transform coefficients) of the independent coding unit obtained in process (2).
[0097] Process (4): For the coding unit, it may be further divided into one or more non-overlapping prediction groups (PG), where PG may be abbreviated as Group, and each PG is encoded and decoded according to a selected prediction mode, and a predicted value of the PG is obtained to form a predicted value of the entire coding unit, and a residual value of the coding unit is obtained based on the predicted value and the original value of the coding unit.
[0098] Here, in process (4), the coding units are grouped according to a selected scanning manner, which may include, but is not limited to, any one or more of raster scanning, block scanning, horizontal scanning, vertical scanning, reciprocating (horizontal / vertical) scanning, diagonal (upper left, upper right, lower left, lower right) scanning, anti-diagonal scanning, inverse horizontal scanning, inverse vertical scanning, or scanning based on one fixed scanning template, etc.
[0099] Process (5): Based on the residual values of the coding units, group the coding units, obtain one or more non-overlapping residual blocks (RBs), and encode and decode the residual coefficients or transform coefficients of each RB according to a selected mode to form a residual coefficient stream or transform coefficient stream.
[0100] The selected mode of encoding and decoding the residual coefficients or transform coefficients in the above process (5) may include, but is not limited to, any one or more of unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, run-length coding, kth order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, adaptive variable length coding, etc.
[0101] For example, the encoder may directly encode the coefficients in the RB.
[0102] As another example, the encoder may perform a transform, such as a DCT, DST, or Hadamard transform, on the residual block and then encode the transformed coefficients.
[0103] As one possible example, when the RB is relatively small, the encoder may directly perform uniform quantization on each coefficient in the RB and then perform binary coding. When the RB is relatively large, the encoder may further divide the RB into multiple coefficient groups (Coefficient Groups, CGs), and perform uniform quantization on each CG and then perform binary coding. In some embodiments of the present invention, the coefficient groups and the quantization groups may be the same.
[0104] Hereinafter, the coding of the residual coefficient in the semi-fixed length coding method will be described as an example. First, the maximum value of the residual absolute value in one RB block is defined as a modified maximum (mm). Next, the number of coding bits of the residual coefficient in the RB block is determined (the number of coding bits of the residual coefficient in the same RB block is the same). For example, if the critical limit (CL) of the current RB block is 2 and the current residual coefficient is 1, 2 bits are required to code the residual coefficient 1, which may be represented as 01. If the CL of the current RB block is 7, this represents coding 7 bits of the residual coefficient and 1 bit of the code bit. The determination of CL is to find the minimum coding length value that satisfies that all the residuals of the current sub-block are within the range of [-2^(coding length-1)-1, 2^(coding length-1)] and a boundary value, and the boundary value may be -2^(coding length-1) or 2^(coding length-1). If there is a coefficient value whose absolute value is 2^(coding length-1) in the current RB block, one boundary symbol code is added to the bit stream, i.e., it is necessary to determine the positive or negative of the coefficient value 2^(coding length-1) in the current RB block based on the boundary symbol represented by the boundary symbol code, and if neither -2^(coding length-1) nor 2^(coding length-1) exists in all residuals, there is no need to code the boundary symbol bit. If there is a coefficient value whose absolute value is 2^(coding length-1) in a coefficient group, the positive and negative of all coefficients in the coefficient group can be represented by one boundary symbol code.
[0105] Also, for some special cases, the encoder may directly encode the original values of the image rather than the residual values.
[0106] In addition, the prediction unit in the embodiment of the present invention may be the coding unit obtained by the division in the above process (3), or may be a prediction group obtained by further dividing the coding unit.
[0107] The image coding method and coefficient decoding method according to the present invention will be described in detail below with reference to the coding / decoding system shown in FIG. 1, the encoder shown in FIG. 2, and the decoder framework shown in FIG.
[0108] First, an embodiment of the present invention provides a coefficient encoding method applicable to the encoding unit 205, and as shown in FIG. 5, the coefficient encoding method may include S501 to S504.
[0109] S501: The encoding unit 205 determines a scanning manner and an optimal grouping manner of the unit to be encoded.
[0110] The scanning manner and grouping manner of the units to be encoded may be obtained based on the consensus between the encoding unit 205 and the decoding unit 301 in the consistency of encoding and decoding.
[0111] The optimal grouping scheme may be determined based on the coding cost of each grouping scheme. The coding cost may be obtained by calculating in a manner such as rate distortion optimization, rate distortion cost minimization, etc. The grouping scheme with the smallest coding cost is the optimal grouping scheme, i.e., the high frequency code is made as short as possible, and the low frequency code is made as long as possible. Optionally, the optimal grouping scheme may be obtained based on the agreement between the encoding unit 205 and the decoding unit 301 in the consistency of coding and decoding, or may be derived by the decoding unit 301 based on the context (derived based on the coded data, derived based on the residual coefficients or coded parameters), or may be obtained by the parameter transmission by the encoding unit 205.
[0112] S502: The encoding unit 205 divides a unit to be encoded into multiple coefficient groups based on an optimal grouping scheme.
[0113] The above scanning method may be any of the scanning methods listed in process (5) in the above-mentioned encoding / decoding implementation method, and the explanation thereof will be omitted here.
[0114] S503: The encoding unit 205 determines coefficient group information for each coefficient group.
[0115] Optionally, the coefficient group information may include a coding length corresponding to the coefficient group, a boundary symbol, and an image bit width, and the coding length corresponding to the coefficient group is used to indicate that the coefficient code in the coefficient group is obtained by coding with a fixed-length code whose length is the coding length.
[0116] Here, the image bit width (bit_depth) represents the maximum bit of the original data or the reconstructed data, and it can be determined whether the coefficient group includes a coefficient value that exceeds the fixed-length code value range of the coding length based on the coding length and the image bit width corresponding to the coefficient group. If the coefficient group includes no coefficient value that exceeds the fixed-length code value range of the coding 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 the coefficient group includes a coefficient value that exceeds the fixed-length code value range of the coding 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)].
[0117] Optionally, if a boundary symbol is present within a coefficient group, the same boundary symbol may be used for that coefficient group to represent all coefficient values within the coefficient group being simultaneously positive or simultaneously negative, i.e., the coefficient group shares one boundary symbol.
[0118] In another embodiment, if a boundary symbol is present in a coefficient group, for coefficient values in the coefficient group whose absolute values are absolute extreme values, i.e., equal to 2^(coding length-1), the same boundary symbol may be used to represent that these coefficient values are simultaneously positive or simultaneously negative, i.e., the coefficient values whose absolute values are equal to 2^(coding length-1) share one boundary symbol.
[0119] S504: For each coefficient group, the encoding unit 205 encodes the coefficient value, the coding length, the boundary symbol, and the image bit width of the coefficient group based on the fixed-length code of the coding length corresponding to the coefficient group to obtain a coefficient fixed-length code and coefficient group information.
[0120] It should be noted that, when performing coefficient coding, there are different scanning methods according to different prediction modes, and different grouping methods exist for different scanning methods, and therefore there are different coefficient grouping situations, so corresponding to different coefficient coding methods. Therefore, in addition to the coefficient coding method of S501-S504 above, one or more steps of adaptive improvement or modification can be performed on the coefficient coding method of S501-S504 above according to different coefficient grouping situations, and the specific embodiment of the coefficient coding method is not illustrated here, and the coding steps can be inferred inversely by referring to the specific embodiment of the coefficient decoding method below.
[0121] For the coefficient encoding method shown in Fig. 5, after the encoding unit 205 completes coefficient encoding, it transmits a bitstream to the decoding unit 301. Correspondingly, an embodiment of the present invention provides a coefficient decoding method applied to the decoding unit 301, and as shown in Fig. 6, the coefficient decoding method may include S601 to S603.
[0122] S601: The decoding unit 301 analyzes the bitstream to obtain units to be decoded and coefficient group information.
[0123] The 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 a boundary symbol of each coefficient group, and the coefficient code in each coefficient group is decoded by a fixed-length code having the same coding length.
[0124] It should be noted that before analyzing a certain coefficient group, the coefficient group needs to be extracted from the unit to be decoded. In this embodiment, the bitstream can be analyzed 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, and the unit to be decoded can be divided into at least one prediction group according to the scanning result.Then, the scanning result is divided into at least one coefficient group according to the grouping mode, and a first coefficient group is selected from the scanning result.
[0125] In another embodiment, before analyzing a coefficient group, the coefficient group needs to be extracted from the unit to be decoded, and in this embodiment, the bitstream may be analyzed to obtain a grouping scheme corresponding to the unit to be decoded, a prediction mode of the current coding unit is obtained from the bitstream, a scanning scheme is derived according to the prediction mode, and the unit to be decoded is scanned according to the scanning scheme to obtain a scanning result, and the unit to be decoded is divided into at least one prediction group according to the scanning result.Then, the scanning result is divided into at least one coefficient group according to the grouping scheme, and a first coefficient group is selected therefrom.
[0126] S602: Parse the coefficient signs of the first coefficient group into coefficient values.
[0127] Optionally, in this embodiment, the coefficient code may be analyzed by selecting fixed length codes with different coding lengths based on whether the coding length of the first coefficient group is smaller than the image bit width of the coefficient group. If the coding length is equal to or greater than the image bit width, the coefficient code of the first coefficient group is analyzed into coefficient values using a fixed length code with a length equal to the image bit width. If the coding length is smaller than the image bit width, the coefficient code of the first coefficient group is analyzed into coefficient values using a fixed length code with a length equal to the coding length.
[0128] The coding length, boundary symbol, and image bit width of the first coefficient group can be obtained from the coefficient group information, and may be in the form of fixed-length code, i.e., coding length code, boundary symbol code, and image bit width code, in the coefficient group information transmitted in the bitstream. The decoding unit 301 analyzes the coding length code, boundary symbol code, and image bit width code of the first coefficient group using a fixed-length code decoding manner or other decoding manner to obtain the coding length, boundary symbol, and image bit width of the first coefficient group.
[0129] In addition, in this embodiment, in the process of analyzing the coefficient code in the coefficient group in S602, a run-length coding method may be introduced to analyze the continuous 0 value in the coefficient group, and the specific analysis method is the same as the conventional run-length coding method, so the description is omitted here. At the same time, a coefficient skip method may be introduced, for example, when it is determined that the coefficient skip mode is on after analyzing the bit stream, there is no need to code the coefficients for the entire group, and the reconstruction value of the decoding unit 301 is directly equal to the predicted value.
[0130] S603: Determine whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol.
[0131] If no boundary symbol is used, the analysis range of the fixed-length code of the first coefficient group with the same length as the image bit width is [0, 2^bit_depth-1]. If a boundary symbol is used, the analysis range of the fixed-length code with the coding length corresponding to the first coefficient group and the boundary symbol is [-2^(coding length-1)-1, 2^(coding length-1)].
[0132] Furthermore, if there is an absolute extreme value in the first coefficient group, i.e., if there is a coefficient value in the first coefficient group whose absolute value is equal to 2^(coding length-1), the first coefficient group may share one boundary symbol, which represents the positive and negative of all coefficient values in the first coefficient group.
[0133] In another embodiment, if the analyzed coefficient values are equal to the absolute extreme values, these coefficients are boundary coefficients, and their symbols may be determined by boundary symbols. For example, if there are absolute extreme values in the first coefficient group, i.e., if there are coefficients in the first coefficient group whose absolute values are equal to 2^(coding length-1), these coefficients may share one boundary symbol, i.e., the boundary symbol represents the positive and negative of the coefficients whose absolute values are equal to 2^(coding length-1).
[0134] Compared with the prior art, in an embodiment of the present invention, when boundary symbols are introduced, the analysis range of coefficient values of semi-fixed-length codes is changed 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 coding and decoding efficiency.
[0135] In one example, the first coefficient group may be further divided into multiple coefficient blocks, and the coefficient codes in different coefficient blocks cannot share one boundary symbol, and the boundary symbols in the bitstream data may be multiple, that is, the bitstream includes a boundary symbol corresponding to each coefficient block, and each coefficient block shares one boundary symbol. For the same coefficient block, if the boundary symbol code analyzed in S603 represents negative, the coefficient value whose absolute value of the analysis value in the coefficient block is equal to 2^(coding length-1) is -2^(coding length-1), and if the boundary symbol code analyzed in S603 represents positive, the coefficient value whose absolute value of the analysis value in the coefficient block is equal to 2^(coding length-1) is 2^(coding length-1). Optionally, the analyzed value of the boundary symbol code may be 0 representing negative or 1 representing positive, where 0 represents positive and 1 represents negative, and the boundary symbol code is represented by 1 bit.
[0136] In this embodiment, after one coefficient group in the unit to be decoded is analyzed in S602 to S603, other coefficient groups in the unit to be decoded must be analyzed in the same manner as S602 to S603. After analysis of all coefficient groups in the unit to be decoded is completed, the decoding of the coefficients of the unit to be decoded is completed.
[0137] In addition, the coefficient decoding method provided by this embodiment can not only analyze the encoding of transform coefficients or residual coefficients, but also analyze the encoding of original pixel values based on the analysis step when no boundary symbols are introduced.
[0138] The embodiment of the present invention provides a coefficient decoding method, which is applied to the decoding unit 301, for residual coefficients in point-by-point prediction mode.
[0139] First, how the decoding unit 301 determines the scanning mode and grouping mode will be described. For the residual coefficient obtained by predicting luminance Y using the point-by-point prediction mode, for example, in the case of a 16*2 pixel block, the scanning mode may be the point-by-point prediction mode 1 shown in FIG. 7(a), the point-by-point prediction mode 2 shown in FIG. 7(b), the point-by-point prediction mode 3 shown in FIG. 7(c), the point-by-point prediction mode 4 shown in FIG. 7(d), etc. Here, Group 1 and Group 2 are different. In the point-by-point prediction mode 1, both Group 1 and Group 2 adopt a vertical-first scanning order, that is, a top-to-bottom scanning order, and then a left-to-right scanning order. In the point-by-point prediction mode 2, both Group 1 and Group 2 adopt a horizontal-first scanning order, that is, a left-to-right scanning order. In the point-by-point prediction mode 3, both Group 1 and Group 2 adopt a left-to-right scanning order, and then a top-to-bottom scanning order. In point-by-point prediction mode 4, Group 1 and Group 2 both adopt a vertical-first scanning order, that is, a top-to-bottom, then left-to-right scanning order.
[0140] Scan the unit to be decoded according to any of the above scanning methods to obtain prediction groups Group1 and Group2, and group each prediction group. The grouping method can be as shown in FIG. 8, where each cell represents one coefficient fixed-length code, and different gray values represent different coefficient groups. (a) of FIG. 8 represents that when the coding index is 0, the entire prediction group is one 16*1 coefficient group; (b) of FIG. 8 represents that when the coding index is 100, one prediction group is divided into two 8*1 coefficient groups. 8. (c) of FIG. 8 represents a sequential division of one prediction group into one 8*1 coefficient group and two 4*1 coefficient groups when the coding index is 101, (d) of FIG. 8 represents a sequential division of one prediction group into two 4*1 coefficient groups and one 8*1 coefficient group when the coding index is 110, and (e) of FIG. 8 represents a sequential division of one prediction group into four 4*1 coefficient groups when the coding index is 111.
[0141] Step S602 will be described for the residual coefficients obtained by predicting chrominance Cb and chrominance Cr in point-by-point prediction mode. For example, in the case of an 8*2 pixel block, when the scanning method is horizontal scanning, that is, when scanning from left to right, as shown in (a) of FIG. 9, when the coding index of the scanning method is 0, the unit to be decoded may be divided into two different prediction groups, and as shown in (b) of FIG. 9, when the coding index of the scanning method is 1, the unit to be decoded may be divided into four different prediction groups. Here, each cell represents one coefficient fixed-length code, different gray values represent different prediction groups, and 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 in (b) have different gray shades.
[0142] According to the above scanning method, the unit to be decoded is scanned to obtain prediction groups, and each prediction group is grouped, and the grouping method may be as shown in FIG. 10, where each cell represents one coefficient fixed-length code, and different gray values represent different coefficient groups. (a) of FIG. 10 represents that when the coding index is 0, the entire prediction group is one 8*1 coefficient group, and (b) of FIG. 10 represents that when the coding index is 1, one prediction group is sequentially divided into two 4*1 coefficient groups, and the first 4 cells and the last 4 cells have different gray shades.
[0143] After the division of the coefficient group is realized according to the above scanning manner and grouping manner, the manner in which the decoding unit 301 determines the coding length corresponding to the coefficient group may be to first use a fixed-length code decoding manner to analyze the coding length code corresponding to the coefficient group to obtain the coding length. Optionally, the coding length may be analyzed using a mixed manner of the fixed-length code and the truncated unary code or other coding.
[0144] In S602, the decoding unit 301 analyzes the coefficient code one by one according to the fixed-length code corresponding to the coding length. If the coding length corresponding to the coefficient group is equal to or larger than the image bit width of the coefficient group, the coefficient code is analyzed using the fixed-length code corresponding to the coding length of the image bit width, and the analysis range is [0, 2^bit_depth-1]. If the coding length corresponding to the coefficient group is smaller than the image bit width of the coefficient group, the coefficient code is analyzed using the fixed-length code corresponding to the coding length.
[0145] In S603, the decoding unit 301 determines whether the coefficient values in the coefficient group are positive or negative based on the boundary symbol, so that the analysis range of the coefficient values 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 the coefficient values in the coefficient group have one common boundary symbol.
[0146] In another embodiment, if there are absolute extreme values in the coefficient group, i.e., if there are coefficients in the coefficient group whose absolute value is equal to 2^(coding length-1), these coefficients may share one boundary symbol, i.e., the boundary symbol indicates that the symbols of the coefficients whose absolute value is equal to 2^(coding length-1) are all positive or all negative.
[0147] Compared with the prior art, the embodiment of the present invention improves the applicability of coefficient decoding by flexibly performing different coefficient grouping methods for luminance and chrominance, and improves the coding and decoding efficiency by introducing boundary symbols representing the positive and negative analytical extremes of the fixed-length code of the coding length corresponding to the coefficient group. At the same time, the scanning and grouping methods take into account the distribution of data, so that coefficients with similar amplitudes are distributed in adjacent regions, and the correlation of each coefficient value of the divided coefficient group is maintained, thereby improving the accuracy of decoding.
[0148] The embodiment of the present invention further provides a coefficient decoding method, applied to the decoding unit 301, for residual coefficients in a non-point-by-point prediction mode.
[0149] First, the scanning method and grouping method will be described. For residual coefficients obtained in non-point-by-point prediction mode, for example, in the case of a 16*2 pixel block, the scanning order can be as shown in the arrow direction in (a) and (b) of Figure 11, and the division of coefficient groups can be as shown in different gray shades in (a) and (b) of Figure 11, and each gray shade represents the same coefficient group.
[0150] After the division of the coefficient groups is realized based on the above scanning manner and grouping manner, the manner of determining the coding length corresponding to the coefficient groups may be to analyze the coding length code corresponding to the coefficient groups using a Huffman code.
[0151] In S602, when the coding length corresponding to the coefficient group is equal to or greater than the image bit width of the coefficient group, the decoding unit 301 analyzes the coefficient code using a fixed-length code corresponding to the coding length of the image bit width, and the analysis range is [0, 2^bit_depth-1].When the coding length corresponding to the coefficient group is smaller than the image bit width of the coefficient group, the decoding unit 301 analyzes the coefficient code using a fixed-length code corresponding to the coding length.
[0152] In S603, the decoding unit 301 uses the boundary symbol to determine the positive and negative of the coefficient values in the coefficient group, so that the analysis range of the coefficient values 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), one common boundary symbol is encoded in the coefficient group.
[0153] In another embodiment, if there are absolute extreme values in the coefficient group, i.e., if there are coefficients in the coefficient group whose absolute value is equal to 2^(coding length-1), these coefficients may share one boundary symbol, i.e., the boundary symbol indicates that the symbols of the coefficients whose absolute value is equal to 2^(coding length-1) are all positive or all negative.
[0154] The embodiment of the present invention further provides a coefficient decoding method, applied to the decoding unit 301, for transform coefficients in a non-point-by-point prediction mode.
[0155] First, the scanning method and grouping method are described.For the transform coefficients obtained in non-point-by-point prediction mode, for example, in the case of a 16*2 pixel block, the scanning order can be as shown in the arrow direction in Fig. 12(a) and (b), and the division of coefficient groups can be as shown in different gray shades in Fig. 12(a) and (b), where each gray shade represents the same coefficient group, the part containing dots represents DC coefficients, and all DC coefficients are divided into one DC coefficient group, and the part not containing dots is divided into one or more AC coefficients.
[0156] After the division of the coefficient groups is realized based on the above scanning manner and grouping manner, a manner of determining the coding length of the fixed-length code corresponding to the coefficient groups may be to analyze the coding length corresponding to the AC coefficient groups using a Huffman code, and to analyze the coding length corresponding to the DC coefficient groups using a fixed-length code manner.
[0157] In S602, the decoding unit 301 analyzes the coefficient code using a fixed-length code corresponding to the coding length of the coding length when the coding length corresponding to the coefficient group is smaller than 7. When the coding length corresponding to the coefficient group is 7 or more, the decoding unit 301 analyzes the coefficient code using a fixed-length code corresponding to the image bit width bit_depth+3.
[0158] In S603, the decoding unit 301 uses the boundary symbol to determine the positive and negative of the coefficient values in the coefficient group, so that the analysis range of the coefficient values 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), one common boundary symbol is encoded in the coefficient group.
[0159] In another embodiment, if there are absolute extreme values in the coefficient group, i.e., if there are coefficients in the coefficient group whose absolute value is equal to 2^(coding length-1), these coefficients may share one boundary symbol, i.e., the boundary symbol indicates that the symbols of the coefficients whose absolute value is equal to 2^(coding length-1) are all positive or all negative.
[0160] Compared with the prior art, in an embodiment of the present invention, when encoding transform coefficients in a non-point-by-point prediction mode, the DC coefficients and AC coefficients in the transform coefficients are divided into different coefficient groups before encoding the coefficient values, and fixed-length codes with the same encoding length are avoided for the DC coefficients with relatively low frequencies and the AC coefficients with relatively high frequencies in the same coefficient group, thereby improving encoding efficiency.
[0161] In the same coefficient group, there may be some (for example, one or two) coefficient values that are much higher than the average value of the coefficient group according to the grouping manner or coefficient type, for example, when DC coefficients and AC coefficients are divided into the same coefficient group, the difference between the DC coefficients and AC coefficients may be large, or when the predicted value is outside the predicted group obtained by scanning, the difference between the predicted value and the current pixel value may be large. Therefore, the embodiment of the present invention further provides a coefficient decoding method applied to the decoding unit 301, which can adjust the coding length of the fixed-length code corresponding to the coefficient value in the coefficient group, and use the fixed-length code with different coding lengths to analyze the coefficient values at different positions. Compared with S601 to S603, the coefficient decoding method only differs in the step of determining the coding length corresponding to the coefficient group and the step of analyzing the coefficient based on the fixed-length code with the coding length corresponding to the coefficient group, and the description of the same part is omitted here.
[0162] In one example, the step of determining the coding length corresponding to the coefficient group in S601 may be as follows.
[0163] First, the decoding unit 301 analyzes the coding length and the coding length additional value A of the fixed-length code corresponding to the coefficient group from the bitstream.
[0164] The coding length additional value A may be a value A set for a specific position in a coefficient group where the coefficient value is significantly greater than the average value of the coefficient group when the coding unit 205 codes the coefficient value, and the value A is equal to the difference between the coding length of the fixed-length code corresponding to the coefficient value at the specific position and the coding length of the fixed-length code corresponding to the coefficient group. For example, for the coding unit 205, if 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.
[0165] Next, the decoding unit 301 determines a particular position in the group of coefficients.
[0166] The specific position may be agreed upon by the encoding unit 205 and the decoding unit 301 in terms of encoding and decoding consistency, or may be derived by the decoding unit 301 based on context information, for example, determining that if a certain position in the previous unit to be decoded is a specific position, then the corresponding position in the current unit to be decoded is a specific position.
[0167] Then, the decoding unit 301 determines that the coding length of the fixed-length code corresponding to the specific position in the coefficient group is coding length+A, and the coding length of the fixed-length code corresponding to the coefficients other than the specific position is coding length.
[0168] The step of analyzing the coefficients based on a fixed-length code having a coding length corresponding to the coefficient group may include analyzing coefficient codes at a specific position using a fixed-length code having a coding length of coding length+A, and analyzing other coefficient codes other than the specific position using a fixed-length code having a coding length of coding length.
[0169] In one example, the present embodiment may perform an operation when the coding length corresponding to a coefficient group is relatively short, for example, the encoding unit 205 and the decoding unit 301 agree on a coding length threshold B according to the consistency between encoding and decoding, and add coefficient value range data C to the bitstream, which indicates whether the absolute value of the coefficient value is smaller than 2^(coding length-3).
[0170] The step of determining a coding length corresponding to a coefficient group in S601 may include: if the coding length is smaller than a coding length threshold B, the decoding unit 301 determines that the coding length corresponding to all coefficient codes of the coefficient group is the coding length.
[0171] In S602, if the coding length is greater than or equal to the coding length threshold B, the decoding unit 301 determines whether the absolute value of each coefficient code is smaller than 2^(coding length-3) based on the coefficient value range data C. If it is smaller, the coefficient code is analyzed using the fixed-length code corresponding to the coding length-3; if it is not smaller, the coefficient code is analyzed using the fixed-length code corresponding to the coding length.
[0172] In one example, the embodiment may further convert the coding length of the coefficient group into k-th order exponential-Golomb coding, for example, the encoding unit 205 and the decoding unit 301 agree on a coding length threshold D according to the consistency of the encoding and decoding.
[0173] The step of determining the coding length corresponding to the coefficient group in S601 may include the following: If the coding length of the coefficient group is smaller than the coding length threshold D, the decoding unit 301 determines that the coding length corresponding to all coefficient codes of the coefficient group is the coding length; If the coding length of the coefficient group is equal to or larger than the coding length threshold D, the decoding unit 301 introduces k-th order Golomb coding with degree k=(coding length 5) to obtain the coding length corresponding to the coefficient code, where the value of k can be derived from the coding length by using other conversion methods. The coefficient code analysis method in the following S602 still uses a fixed-length code with a coding length corresponding to the coefficient code to perform analysis, and therefore is not described here.
[0174] In one example, when there are many coefficient codes in a coefficient group, for example, the number of coefficient codes is greater than N, the step of determining the coding length corresponding to the coefficient group in S601 may include the following: the decoding unit 301 analyzes that the coding length of the coefficient group is coding length through a fixed length decoding manner, and if the coding length is not equal to a preset value E, determines that the coding length corresponding to all coefficient codes in the coefficient group is coding length; if the coding length is equal to a preset value E, determines that the coefficients in the coefficient group whose coefficient values are not greater than 0 are 0, and determines that the coding length corresponding to the coefficient codes at positions greater than 0 in the coefficient group is coding length; Optionally, the preset value E may be 2, 3, etc., and the value of N may be greater than 4.
[0175] In this embodiment, the coding length of a fixed-length code corresponding to a coefficient code at one or more positions in a coefficient group may be regarded as the coefficient bit coding length, and the coding length of a common fixed-length code corresponding to other positions in the coefficient group may be regarded as the coefficient group coding length.
[0176] Compared with the prior art, by changing the coding length corresponding to the coefficients in the coefficient group and analyzing different coefficient signs in the coefficient values using fixed-length codes corresponding to different coding lengths, the coefficient signs at certain positions are analyzed using fixed-length codes with special coding lengths, and the other positions can still be analyzed using fixed-length codes with shorter coding lengths, thereby shortening the overall coding length and improving the coding efficiency.
[0177] In addition to adjusting the coding length of the fixed-length code of the coefficient group, this embodiment further provides a coefficient decoding method applied to the decoding unit 301, adjusts the coefficient values in the coefficient group during encoding, restores the coefficient values during decoding, and shortens the overall coding length of the coefficient values. Compared with S601 to S603, the coefficient decoding method is only different in the step of analyzing the coefficients based on the fixed-length code with the coding length corresponding to the coefficient group, and the description of the same part is omitted here.
[0178] In one example, in the step of analyzing the coefficients based on the fixed-length code with the coding length corresponding to the coefficient group, the decoding unit 301 first analyzes all the coefficient values using the fixed-length code with the coding length corresponding to the coefficient group, and for a specific position, shifts the coefficient value, that is, coefficient = coefficient << F. Analyze F using the fixed-length code decoding method to obtain delda_coefficient, and add delda_coefficient to the coefficient values obtained by analyzing all specific positions in the coefficient group. The above specific position may be agreed upon by the encoding unit 205 and the decoding unit 301 in terms of the consistency of encoding and decoding, or may be derived by the decoding unit 301 based on context information. For example, if a certain position of the previous unit to be decoded is a specific position, it is determined that the corresponding position of the current unit to be decoded is a specific position.
[0179] In one example, the coefficient group information obtained by the decoding unit 301 in S601 includes the coding length threshold and the coefficient addition value G of the coefficient group. The following describes the setting of the coding length threshold and the coefficient addition value G. In the process of the coding unit 205 performing coefficient coding, if the coding length of the fixed-length code corresponding to a certain coefficient value is greater than the coding length threshold of the coefficient group, the coding length threshold and the coefficient addition value G are subtracted from the coefficient value, and the result of subtracting the coefficient addition value G from the coefficient value is coded, and the coding length threshold and the coefficient addition value G may be flexibly set according to the specific magnitude of the coefficient value of the coefficient group. In the step of analyzing the coefficient based on the fixed-length code of the coding length corresponding to the coefficient group, if the fixed-length code coding length is greater than the coding length threshold, the decoding unit 301 first analyzes the code of the coefficient addition value G using the fixed-length code of the coding length to obtain the coefficient addition value G, then analyzes all the coefficient values in the coefficient group using the fixed-length code of the coding length, and adds the coefficient addition value G to all the coefficient values to restore the coefficient values.
[0180] Compared with the prior art, by adjusting coefficient values in a coefficient group during encoding, and then restoring a coefficient at a specific position in the coefficient group based on parameters transmitted in the bitstream during decoding, it is not necessary to transmit a relatively long complete coefficient code when transmitting the bitstream, thereby improving coding efficiency.
[0181] In addition to adjusting the coding length of the fixed-length code of the coefficient group and the coefficient values in the coefficient group, this embodiment further provides a coefficient decoding method applied to the decoding unit 301, which adjusts the boundary symbols of the coefficient group during coding, and further expands the decoding range by the boundary symbols.
[0182] In one example, the boundary symbol of the coefficient group information can not only represent the positive and negative absolute extreme values in the coefficient group with 1 bit, but also represent the coefficient compensation value with n bits. After analyzing the coefficient code based on the fixed-length code with the coding length of coding length in S603, for the coefficient code position where the analysis value is equal to the absolute extreme value 2^(coding length-1), the coefficient compensation value is analyzed from the boundary symbol, and the coefficient compensation value is added to the absolute extreme value in the coefficient group to obtain the coefficient value at the absolute extreme value position. Optionally, the boundary symbol can be used to represent the positive and negative coefficient compensation value. Note that, when there are multiple absolute extreme values in the same coefficient group, the coefficient compensation value may be multiple, and the compensated coefficient value can be obtained by adding the coefficient compensation values corresponding to the absolute extreme values. Note that, in this embodiment, the decoding unit 301 needs to analyze the boundary symbol code to obtain the boundary symbol, and the analysis method may adopt fixed-length decoding, truncated unary code, Huffman decoding, or a mixed decoding method of several common decoding methods, etc.
[0183] Correspondingly, the embodiment of the present invention provides a coefficient decoding device, which may be, for example, any coefficient decoding device in a call, and may perform functional module division for the coefficient decoding device according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The above integrated module may be realized in the form of hardware or software functional module. It should be noted that the module division in the embodiment of the present invention is illustrative and is merely a division of logical functions, and may have a different division method when actually realized.
[0184] When the functional modules are divided according to the functions, a possible schematic structural diagram of the coefficient decoding device in the above embodiment is shown in FIG. 13. As shown in FIG. 13, the coefficient decoding device 13 includes an analysis module 131 and a decoding module 132.
[0185] In one embodiment, the parsing module 131 is used to obtain coefficient group information of a unit to be decoded, where 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 coding 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. The decoding module 132 is used to parse the coefficient code of the first coefficient group into coefficient values, and further to determine that the coefficient values in the first coefficient group are positive or negative based on the boundary symbol.
[0186] Each module of the coefficient decoding device may be used to perform other operations in the above method embodiments, and all relevant contents of each step in the above method embodiments can be cited in the functional description of the corresponding functional module, so the description will be omitted here.
[0187] Figure 14 is a hardware structural diagram of an electronic device provided by an embodiment of the present invention. As shown in Figure 14, the electronic device may include an image decoder 141, a memory 142, and a communication interface (not shown). The memory 142 stores computer instructions executable by the image decoder 141, and the image decoder 141 is used to execute the computer instructions to implement the method disclosed in any of the above embodiments of the present invention.
[0188] In the above embodiments, all or part of the invention may be realized by software, hardware, firmware, or any combination thereof. When the invention is realized using a software program, all or part of the invention may be realized in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the process or function in the embodiment of the present invention is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or may be transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, radio, microwave, etc.). The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device such as a server or data center that collects one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, magnetic disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid state drives (SSD)).
[0189] From the above description of the embodiment, it is understood by those skilled in the art that for convenience and simplification of the description, only the division of the above functional modules is described as an example, but in actual application, the above functions may be allocated to different functional modules as necessary, that is, the internal structure of the device may be divided into different functional modules to achieve all or part of the above-described functions. For the specific operation processes of the above systems, devices, and units, reference may be made to the corresponding processes in the above method embodiments, and the description will be omitted here.
[0190] In some embodiments provided by the present invention, it should be understood that the disclosed system, device, and method may be realized in other ways. For example, the above device embodiments are merely examples, and the division of modules or units is merely a division of logical functions, and other division methods may be used in actual implementation, for example, multiple units or components may be combined or integrated into another system, and some features may be ignored or not implemented. In addition, the shown or described couplings, direct couplings, or communication connections may be indirect couplings or communication connections via some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0191] 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, i.e., they may be located in one place or distributed across multiple network units. In order to achieve the purpose of the technical solution of this embodiment, some or all of the units therein may be selected according to actual needs.
[0192] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically alone, or two or more units may be integrated into one unit. The integrated unit may be realized in the form of hardware or a software functional unit.
[0193] When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it may be stored in one computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be essentially or the part contributing to the prior art, or the whole or part of the technical solution may be embodied in the form of a software product, and the computer software product is stored in one storage medium and includes some instructions for making a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor execute all or part of the steps of the method according to each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a flash memory, a removable hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk.
[0194] The above are only specific embodiments of the present invention, and the protection scope of the present invention is not limited thereto, and any changes or replacements within the scope of the technology disclosed in the present invention shall be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims described herein.
Claims
1. A step of analyzing a bitstream to obtain coefficient group information of a unit to be decoded, where coefficients of the unit to be decoded are 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 having the same coding 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 signs of the first group of coefficients into coefficient values; determining whether coefficient values in the first group of coefficients are positive or negative based on the boundary symbols; 4. A coefficient decoding method comprising:
2. The coefficient group information further includes an encoding length and an image bit width of the first coefficient group, the encoding length being used to represent a length of a fixed-length code corresponding to the first coefficient group, and the step of parsing the coefficient code of the first coefficient group into a coefficient value includes: if the coding length is equal to or greater than the image bit width, parsing the coefficient codes of the first coefficient group into coefficient values using a fixed length code having a length equal to the image bit width; if the coding length is less than the image bit width, parsing coefficient codes of the first coefficient group into coefficient values using a fixed length code whose length is the coding length; 2. The coefficient decoding method according to claim 1 .
3. The step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbol comprises: determining, based on the boundary symbols, that the symbols of coefficients in the first coefficient group whose absolute values are equal to the absolute extreme value are all positive or all negative, if an absolute extreme value exists in the first coefficient group, the absolute extreme value being a maximum absolute value in a fixed-length code value range of the coding length; 2. The coefficient decoding method according to claim 1 .
4. The first coefficient group includes one or more coefficient blocks, and the boundary symbols include a boundary symbol for each of the coefficient blocks, and the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbols includes: For any one of the coefficient blocks, if an absolute extreme value exists in the coefficient block, determining based on a boundary symbol of the coefficient block that the symbols of the coefficients whose absolute values are equal to the absolute extreme value in the coefficient block are all positive or all negative; 4. The coefficient decoding method according to claim 3.
5. the coefficients in the first group of coefficients are residual coefficients, transform coefficients, or original pixel values; The coefficient decoding method according to any one of claims 1 to 4.
6. the at least one coefficient group includes a DC coefficient group and an AC coefficient group, and the first coefficient group is a DC coefficient group or an AC coefficient group; 6. The coefficient decoding method according to claim 5,
7. In the coefficient group information, the coding length is in the form of a coding length code, and in the coefficient group information, the boundary symbol is in the form of a boundary symbol code; If the coefficient signs in the first coefficient group represent transform coefficients and the first coefficient group is a DC coefficient group, analyzing the coded length code using a fixed length code to obtain the coded length; analyzing a DC coefficient value using a fixed-length code having a length of the coding length, and analyzing the boundary symbol code using a fixed coding length of 1 to obtain the boundary symbol.
7. The coefficient decoding method according to claim 6.
8. determining a grouping scheme of the units to be decoded based on the bitstream; obtaining a prediction mode of a current coding unit from the bitstream, and deriving a scanning scheme based on the prediction mode; scanning the unit to be decoded according to the scanning scheme to obtain a scanning result; extracting the first group of coefficients from the scanning result based on the grouping scheme.
6. The coefficient decoding method according to claim 5,
9. An analysis module for analyzing a bitstream to obtain coefficient group information of a unit to be decoded, wherein coefficients of the unit to be decoded are 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 having the same coding 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 for parsing coefficient signs of the first group of coefficients into coefficient values; The decoding module is further adapted to determine whether the coefficient values in the first group of coefficients are positive or negative based on the boundary symbol. A coefficient decoding device comprising:
10. A method for performing the coefficient decoding method according to any one of claims 1 to 8, 1. An image decoder comprising:
11. 1. An electronic device including an image decoder, a communications interface, and a memory, the image decoder being adapted to perform operations, the operations comprising: A step of analyzing a bitstream to obtain coefficient group information of a unit to be decoded, where coefficients of the unit to be decoded are 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 having the same coding 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 signs of the first group of coefficients into coefficient values; determining whether coefficient values in the first group of coefficients are positive or negative based on the boundary symbols; 1. An electronic device comprising:
12. The coefficient group information further includes an encoding length and an image bit width of the first coefficient group, the encoding length being used to represent a length of a fixed-length code corresponding to the first coefficient group, and the step of parsing the coefficient code of the first coefficient group into a coefficient value includes: if the coding length is equal to or greater than the image bit width, parsing the coefficient codes of the first coefficient group into coefficient values using a fixed length code having a length equal to the image bit width; if the coding length is less than the image bit width, parsing coefficient codes of the first coefficient group into coefficient values using a fixed length code whose length is the coding length; 12. The electronic device according to claim 11.
13. the first coefficient group includes a plurality of coefficient blocks, the boundary symbols include a boundary symbol for each of the coefficient blocks, and the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbols comprises: For any one of the coefficient blocks, if an absolute extreme value exists in the coefficient block, determining based on a boundary symbol of the coefficient block that the symbols of the coefficients whose absolute values are equal to the absolute extreme value in the coefficient block are all positive or all negative; 12. The electronic device according to claim 11.
14. the first coefficient group includes a plurality of coefficient blocks, the boundary symbols include a boundary symbol for each of the coefficient blocks, and the step of determining whether the coefficient values in the first coefficient group are positive or negative based on the boundary symbols comprises: For any one of the coefficient blocks, if an absolute extreme value exists in the coefficient block, determining based on a boundary symbol of the coefficient block that the symbols of the coefficients whose absolute values are equal to the absolute extreme value in the coefficient block are all positive or all negative; 14. The electronic device of claim 13.
15. the coefficients in the first group of coefficients are residual coefficients, transform coefficients, or original pixel values; The electronic device according to any one of claims 11 to 14.
16. the at least one coefficient group includes a DC coefficient group and an AC coefficient group, and the first coefficient group is a DC coefficient group or an AC coefficient group; 16. The electronic device of claim 15.
17. In the coefficient group information, the coding length is in the form of a coding length code, and in the coefficient group information, the boundary symbol is in the form of a boundary symbol code; If the coefficient signs in the first group of coefficients represent transform coefficients and the first group of coefficients is a DC coefficient group, the operation includes: analyzing the coded length code using a fixed length code to obtain the coded length; analyzing a DC coefficient value using a fixed-length code having a length of the coding length, and analyzing the boundary symbol code using a fixed coding length of 1 to obtain the boundary symbol.
17. The electronic device of claim 16.
18. The operation includes: determining a grouping scheme of the units to be decoded based on the bitstream; obtaining a prediction mode of a current coding unit from the bitstream, and deriving a scanning scheme based on the prediction mode; scanning the unit to be decoded according to the scanning scheme to obtain a scanning result; extracting the first group of coefficients from the scanning result based on the grouping scheme.
16. The electronic device of claim 15.
19. A computer readable storage medium comprising computer instructions, which when executed on an electronic device, cause the electronic device to perform the coefficient decoding method of any one of claims 1 to 8. A computer-readable storage medium comprising:
Citation Information
Patent Citations
Compressor, decompressor and image processing apparatus
JP2015005903A
Coefficient decoding method, apparatus, image decoder, and electronic device
JP7622302B1