Video encoding / decoding method and apparatus
Patent Information
- Application Number
- JP2024527664
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-11-11
- Filing Date
- 2022-11-09
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-11-09
AI Technical Summary
Current video encoding/decoding methods, such as Context-based Adaptive Binary Arithmetic Coding (CABAC) and Golomb-Rice encoding, suffer from high complexity and low efficiency, particularly in lossless and near-lossless compression scenarios.
A video encoding/decoding method that employs various scanning and grouping techniques, including fixed and semi-fixed length grouping, unary, truncated unary, and Golomb-Rice encoding, to improve encoding/decoding efficiency and reduce algorithmic complexity.
The proposed method enhances encoding/decoding performance by allowing flexible encoding of coefficients based on their characteristics, resulting in improved flexibility and reduced complexity while maintaining high compression efficiency.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to the technical field of image processing, and in particular to a video encoding / decoding method and apparatus. [Background technology]
[0002] In the field of computer vision, in order to effectively store and transmit video, it is usually necessary to perform image compression by video coding. Image compression mainly includes lossy compression and lossless compression. Among them, lossless compression is image compression that utilizes the statistical redundancy of image data, and can completely restore the original image data without generating distortion. In addition, when there is an error between the reconstructed image and the original image, and the error is limited within a certain range, it is called near-lossless compression. Although near-lossless compression generates a certain degree of distortion, it is negligible in visual images, so near-lossless compression can be considered as lossless compression.
[0003] In the current lossless compression (including near-lossless compression) coding / decoding methods, for example, the Context-based Adaptive Binary Arithmetic Coding (CABAC) compression method involves many algorithms such as probability models, context modeling, and binary arithmetic coding, and the processing process is complicated. In addition, the Golomb-Rice coding method based on Golomb coding generates redundant calculations in the coding process, resulting in low coding / decoding performance. Therefore, there is an urgent need to propose a video coding / decoding method with high coding / decoding efficiency and low algorithm complexity. Summary of the Invention
[0004] The present invention provides a video encoding / decoding method and apparatus to solve the problem of low performance or high complexity of the encoding / decoding algorithm of video encoding / decoding in the prior art.
[0005] To achieve the above objectives, the present invention adopts the following technical solutions:
[0006] In a first aspect, there is provided a video image decoding method, the method comprising: A step of a decoder obtaining a bit stream of a unit to be decoded; determining a scanning method, a grouping method, and an encoding method corresponding to each group of the units to be decoded; Decoding the units according to the encoding scheme of each group to obtain coefficient blocks corresponding to the units to be decoded; Reconstructing the coefficients in the coefficient blocks of each group one by one according to the scanning manner of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded.
[0007] In one embodiment, the grouping scheme includes at least one of a fixed length grouping scheme, a semi-fixed length grouping that groups based on the magnitude of the coefficient values, and a grouping based on the array position of the coefficients.
[0008] In one embodiment, the encoding scheme includes at least one of a unary code, a truncated unary code, a truncated binary code, a fixed length code, a semi-fixed length code, a k-th exponential Golomb code, a truncated Rice code, a Huffman code, and a Golomb-Rice code.
[0009] In one embodiment, the scanning scheme includes at least one of a raster scan, a block scan, a horizontal scan, a vertical scan, a reciprocating scan, a diagonal scan, an inverse horizontal scan, an inverse vertical scan, and a Hilbert scan.
[0010] In one embodiment, the scanning method includes a vertical scan.
[0011] In one embodiment, the reconstructed data block is a data block consisting of one of original pixel values of the image to be decoded, residual values obtained by predicting the original pixel values, coefficients obtained by quantizing the residual values, or transform coefficients obtained by transforming the residual values.
[0012] In one embodiment, the reconstructed data block is a data block consisting of one of original pixel values of the image to be decoded, residual values obtained by predicting the original pixel values, and coefficients obtained by quantizing the residual values.
[0013] In one embodiment, the step of determining a scanning method, a grouping method, and an encoding method corresponding to each group of the unit to be decoded includes: Determining at least one of a scanning method, a grouping method, and a coding method corresponding to each group for the unit to be decoded based on a prior agreement between the encoding side and the decoding side or context information; or Analyzing the bitstream to obtain at least one of a scanning method, a grouping method, and a coding method corresponding to each group of the units to be decoded; or The method includes obtaining the grouping scheme based on a prediction scheme, a quantization scheme, and / or a transformation scheme of the unit to be decoded.
[0014] In one embodiment, the step of determining a scanning method, a grouping method, and an encoding method corresponding to each group of the unit to be decoded includes: A step of determining at least one of a scanning method, a grouping method, and an encoding method corresponding to each group of the units to be decoded based on a prior agreement between the encoding side and the decoding side; or Analyzing the bitstream to obtain at least one of a scanning method, a grouping method, and a coding method corresponding to each group of the units to be decoded; or The method includes a step of determining a scanning scheme, a grouping scheme, and a coding scheme corresponding to each group of at least one type of unit to be decoded based on a prior agreement between the encoding side and the decoding side, and analyzing based on the bitstream based on the scanning scheme, grouping scheme, and coding scheme corresponding to each group of the at least one type of unit to be decoded to obtain at least one of the scanning scheme, grouping scheme, and coding scheme corresponding to each group of the unit to be decoded.
[0015] In one embodiment, the step of decoding based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit includes: decoding according to an encoding algorithm to obtain group parameters for each group; and decoding the plurality of coefficient values in each group according to the semi-fixed length coding algorithm based on the group parameters of each group, A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0016] In one embodiment, the step of decoding according to the encoding algorithm to obtain group parameters for each group includes: The method includes a step of obtaining group parameters for each group by decoding based on a decoding scheme corresponding to at least one of unary code, truncated unary code, truncated binary code, fixed length coding, kth exponential Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.
[0017] In one embodiment, the step of decoding based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit includes: Decoding according to a fixed-length coding algorithm to obtain group Rice parameters for each group, or obtaining group Rice parameters for each group based on a context model; and decoding the Rice parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0018] In one embodiment, the step of decoding based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit includes: obtaining group Rice parameters for each group based on the context model; Decoding according to a fixed length coding algorithm or a truncated unary code to obtain group parameter deviations for each group; obtaining a group parameter for each group based on the group Rice parameter and the group parameter deviation for each group; and decoding the group parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0019] In one embodiment, the step of decoding based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit includes: Decoding according to a fixed-length coding algorithm to obtain a degree k of each group, or obtaining a degree k of each group based on a context model; and decoding the k-th order exponential-Golomb coding algorithm according to the order k of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0020] In one embodiment, the step of decoding based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit includes: obtaining a degree k of each group based on the context model; Decoding according to a fixed length coding algorithm or a truncated unary code to obtain group parameter deviations for each group; updating the order k of each group based on the group parameter deviation; and decoding the k-th order exponential-Golomb coding algorithm based on the updated degree k of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the current unit to be decoded includes a plurality of coefficient values in each group.
[0021] In one embodiment, the step of decoding based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit includes: determining an encoding scheme for a current group based on at least one of coefficients, a prediction scheme, a quantization scheme, and a transformation scheme of one or more groups obtained by decoding; and decoding the current group of coefficients according to a decoding scheme corresponding to the encoding scheme of the current group to obtain coefficients of the current group; The coding schemes in the current group are some combination of Golomb-Rice coding, k-th order exponential-Golomb coding, and semi-fixed length coding schemes.
[0022] In one embodiment, the coding schemes of at least two of the multiple groups of coding units are different.
[0023] In one embodiment, when the decoding method of the unit to be decoded is either Golomb-Rice coding or k-th order exponential-Golomb coding, determining the grouping method of the unit to be decoded includes: The method includes obtaining a grouping scheme for the unit to be decoded based on a prediction scheme, a quantization scheme, and / or a transformation scheme for the unit to be decoded.
[0024] According to the above embodiment of the present invention, the decoding side can derive different scanning methods and derive coefficient grouping methods based on different prediction methods, and such coefficient grouping can combine predicted information and make grouped coefficients more uniform. The encoding side can assign smaller codewords to coefficients with small changes for encoding, so that the encoding method is flexible and the encoding performance can be improved. In addition, by designing multiple fixed grouping methods, it can be more compatible with the semi-fixed length encoding method, and a better binarization method can be flexibly selected for each coding block, and the complexity of the encoding algorithm is low.
[0025] According to a second aspect, a video image sign How to change A method is provided, the method comprising: A coding side scans a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence; grouping the coefficient sequence according to a first grouping scheme to obtain a plurality of groups of to-be-coded subsequences; determining a coefficient coding scheme corresponding to the subsequences to be coded in each group, and coding the subsequences one by one to obtain a coded bitstream.
[0026] In one embodiment, the grouping scheme includes at least one of a fixed length grouping scheme, a semi-fixed length grouping that groups based on the magnitude of the coefficient values, and a grouping based on the array position of the coefficients.
[0027] In one embodiment, the encoding scheme includes at least one of a unary code, a truncated unary code, a truncated binary code, a fixed length code, a semi-fixed length code, a k-th order exponential Golomb coding, a truncated Rice coding, a Huffman coding, and a Golomb-Rice coding.
[0028] In one embodiment, the scanning scheme includes at least one of a raster scan, a block scan, a horizontal scan, a vertical scan, a reciprocating scan, a diagonal scan, an inverse horizontal scan, an inverse vertical scan, and a Hilbert scan.
[0029] In one embodiment, the data block to be encoded is a data block consisting of one of original pixel values of the image to be encoded, residual values obtained by predicting the original pixel values, coefficients obtained by quantizing the residual values, or transformation coefficients obtained by transforming the residual values.
[0030] According to a third aspect, a video image A decoding device is provided, the device comprising: a transceiver module used to obtain a bitstream of a unit to be decoded; determining a scanning scheme, a grouping scheme, and an encoding scheme corresponding to each group for the unit to be decoded; Decoding the coefficient blocks according to the encoding scheme of each group to obtain coefficient blocks corresponding to the decoding target units; and a processing module used to reconstruct the coefficients in the coefficient blocks of each group one by one based on the scanning manner of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded.
[0031] In one embodiment, the grouping scheme includes at least one of a fixed length grouping scheme, a semi-fixed length grouping that groups based on the magnitude of the coefficient values, and a grouping based on the array position of the coefficients.
[0032] In one embodiment, the encoding scheme includes at least one of a unary code, a truncated unary code, a truncated binary code, a fixed length code, a semi-fixed length code, a k-th order exponential Golomb coding, a truncated Rice coding, a Huffman coding, and a Golomb-Rice coding.
[0033] In one embodiment, the scanning scheme includes at least one of a raster scan, a block scan, a horizontal scan, a vertical scan, a reciprocating scan, a diagonal scan, an inverse horizontal scan, an inverse vertical scan, and a Hilbert scan.
[0034] In one embodiment, the reconstructed data block is a data block consisting of one of original pixel values of the image to be decoded, residual values obtained by predicting the original pixel values, coefficients obtained by quantizing the residual values, or transform coefficients obtained by transforming the residual values.
[0035] In one embodiment, the processing module specifically: Determine at least one of a scanning method, a grouping method, and a coding method corresponding to each group for the unit to be decoded based on a prior agreement between the encoding side and the decoding side or context information; or Analyzing based on the bitstream to obtain at least one of a scanning method, a grouping method, and a coding method corresponding to each group of the unit to be decoded; or The grouping scheme is obtained based on a prediction scheme, a quantization scheme and / or a transformation scheme of the unit to be decoded.
[0036] In one embodiment, the processing module specifically: Decoding according to the encoding algorithm to obtain group parameters for each group; Decoding the semi-fixed length coding algorithm based on the group parameters of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0037] In one embodiment, the processing module specifically: The group parameters of each group are obtained by decoding based on a decoding method corresponding to at least one of the encoding methods of unary code, truncated unary code, truncated binary code, fixed-length coding, k-th exponential-Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.
[0038] In one embodiment, the processing module specifically: Decode according to a fixed-length coding algorithm to obtain group Rice parameters for each group, or obtain group Rice parameters for each group based on a context model; Decoding the Rice parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0039] In one embodiment, the processing module specifically: Obtain group Rice parameters for each group based on the context model; Decode according to a fixed-length coding algorithm or a truncated unary code to obtain the group parameter deviation of each group; obtaining a group parameter for each group based on the group Rice parameter and the group parameter deviation for each group; decoding the group parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0040] In one embodiment, the processing module specifically: Decode according to a fixed-length coding algorithm to obtain the degree k of each group, or obtain the degree k of each group based on a context model; Decoding according to a k-th order exponential-Golomb coding algorithm based on the degree k of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0041] In one embodiment, the processing module specifically: Obtain the degree k of each group based on the context model; Decode according to a fixed-length coding algorithm or a truncated unary code to obtain the group parameter deviation of each group; updating the order k of each group based on the group parameter deviation; Decoding the k-th order exponential-Golomb coding algorithm according to the updated order k of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the current unit to be decoded includes a plurality of coefficient values in each group.
[0042] In one embodiment, the processing module specifically: determining an encoding method for the current group based on at least one of the coefficients, the prediction method, the quantization method, and the transformation method of the one or more groups obtained by decoding; used to obtain coefficients of the current group by decoding according to a decoding scheme corresponding to the encoding scheme of the current group; The coding schemes in the current group are some combination of Golomb-Rice coding, k-th order exponential-Golomb coding, and semi-fixed length coding schemes.
[0043] In one embodiment, the coding schemes of at least two of the multiple groups of coding units are different.
[0044] In one embodiment, when the decoding method of the unit to be decoded is either Golomb-Rice coding or k-th order exponential-Golomb coding, the processing module specifically includes: The grouping method is used to obtain a grouping method for the unit to be decoded based on a prediction method, a quantization method, and / or a transformation method for the unit to be decoded.
[0045] According to a fourth aspect, a video image An encoding device is provided, the device including a transceiver module and a processing module, The processing module is used for scanning a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence, grouping the coefficient sequence in a first grouping manner to obtain a plurality of groups of subsequences to be coded, determining a coefficient coding manner corresponding to each group of the subsequences to be coded, and coding the subsequences one by one to obtain a coded bitstream; The transceiver module is used for transmitting the encoded bitstream to the decoding side.
[0046] In one embodiment, the grouping scheme includes at least one of a fixed length grouping scheme, a semi-fixed length grouping that groups based on the magnitude of the coefficient values, and a grouping based on the array position of the coefficients.
[0047] In one embodiment, the encoding scheme includes at least one of a unary code, a truncated unary code, a truncated binary code, a fixed length code, a semi-fixed length code, a k-th order exponential Golomb coding, a truncated Rice coding, a Huffman coding, and a Golomb-Rice coding.
[0048] In one embodiment, the scanning scheme includes at least one of a raster scan, a block scan, a horizontal scan, a vertical scan, a reciprocating scan, a diagonal scan, an inverse horizontal scan, an inverse vertical scan, and a Hilbert scan.
[0049] In one embodiment, the data block to be encoded is a data block consisting of one of original pixel values of the image to be encoded, residual values obtained by predicting the original pixel values, coefficients obtained by quantizing the residual values, or transformation coefficients obtained by transforming the residual values.
[0050] According to a fifth aspect, there is provided a coding / decoding system, the coding / decoding system comprising the apparatus according to the third aspect and the apparatus according to the fourth aspect.
[0051] According to a sixth aspect, a video image A decoding apparatus is provided, the apparatus comprising a processor connected to a memory, the memory being adapted to store computer programs or instructions, the processor being adapted to execute the computer programs or instructions stored in the memory to cause the apparatus to perform the method of the first aspect.
[0052] According to a seventh aspect, a video image sign disguiseThere is provided an apparatus comprising a processor connected to a memory, the memory being adapted to store computer programs or instructions, the processor being adapted to execute the computer programs or instructions stored in the memory to cause the apparatus to perform the method of the second aspect.
[0053] According to an eighth aspect, there is provided an electronic device for performing the method according to the first aspect.
[0054] According to a ninth aspect, there is provided an electronic device for performing the method according to the second aspect.
[0055] According to a tenth aspect, there is provided a readable storage medium containing a program or instructions which, when executed by a processor, performs the method of the first aspect.
[0056] According to an eleventh aspect, there is provided a readable storage medium comprising a program or instructions which, when executed by a processor, performs the method of the second aspect.
[0057] According to a twelfth aspect, there is provided a circuit for use in carrying out the method according to the first aspect.
[0058] According to a thirteenth aspect, there is provided a circuit for use in carrying out the method according to the second aspect.
[0059] According to a fourteenth aspect, there is provided a computer application program, which when run on a computer or a processor causes the computer or the processor to perform a method according to the first aspect.
[0060] According to a fifteenth aspect, there is provided a computer application program, which when executed on a computer or a processor causes the computer or the processor to perform a method according to the second aspect.
[0061] According to a sixteenth aspect, there is provided a video image decoding method, the method comprising: obtaining a bitstream of a unit to be decoded; determining a scanning mode for the unit to be decoded; Analyzing a grouping manner of the decoding target unit based on the bitstream; Decoding based on the bitstream to obtain group parameters for each group; and decoding the plurality of coefficient values in each group based on the group parameters of the plurality of groups, and recovering coefficients in the coefficient block corresponding to the unit to be decoded based on the scan method of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0062] In one embodiment, the scanning method includes a vertical scan.
[0063] In one embodiment, the grouping scheme includes a fixed-length grouping scheme or a grouping scheme based on the array position of the coefficients, the fixed-length grouping scheme includes grouping the entire unit to be decoded into one group, or grouping every four coefficients in the entire unit to be decoded into one group, and the grouping scheme based on the array position of the coefficients includes grouping the coefficients of the entire unit to be decoded unevenly according to their positions, or grouping the coefficients of the entire unit to be decoded evenly according to their positions.
[0064] In one embodiment, the step of decoding based on the bitstream and obtaining group parameters for each group includes: The method includes a step of decoding the bit stream by combining a fixed-length code and a truncated unary code based on the magnitude of the coefficient values to obtain a group parameter for each group.
[0065] In one embodiment, the step of decoding based on the group parameters of each group to obtain a plurality of coefficient values in each group includes: The method includes decoding, using a fixed-length code, based on the group parameters for each group to obtain a plurality of coefficient values in each group.
[0066] According to a seventeenth aspect, there is provided a video image encoding method, the method comprising: Scanning a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence; grouping the coefficient sequence according to a first grouping scheme to obtain a plurality of groups of to-be-coded subsequences; determining a coefficient coding scheme corresponding to each group of subsequences to be coded, and coding the subsequences one by one to obtain a coded bitstream; The first scanning method includes a vertical scan, and the first grouping method includes a fixed-length grouping method or a grouping method based on the array position of the coefficients, the fixed-length grouping method including treating the entire data block to be coded as one group, or treating every four coefficients in the entire data block to be coded as one group, and the grouping method based on the array position of the coefficients includes grouping the coefficients of the entire data block to be coded unevenly according to their positions, or grouping the coefficients of the entire data block to be coded evenly according to their positions.
[0067] According to an eighteenth aspect, there is provided a video image decoding apparatus, the apparatus comprising: a transceiver module used to obtain a bitstream of a unit to be decoded; a processing module used to determine a scan mode of the unit to be decoded, analyze a grouping mode of the unit to be decoded based on the bitstream, decode based on the bitstream, obtain a group parameter for each group, decode based on the group parameter for each group to obtain a plurality of coefficient values in each group, and reconstruct coefficients in the coefficient block corresponding to the unit to be decoded based on the scan mode of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0068] According to a nineteenth aspect, there is provided a video image encoding apparatus, the apparatus comprising: a processing module for scanning a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence, grouping the coefficient sequence in a first grouping manner to obtain a plurality of groups of subsequences to be coded, determining a coefficient coding manner corresponding to each group of the subsequences to be coded, and coding the subsequences one by one to obtain a coded bitstream; a transceiver module for transmitting the encoded bitstream to a decoding side; The first scanning method includes a vertical scan, and the first grouping method includes a fixed-length grouping method or a grouping method based on the array position of the coefficients, the fixed-length grouping method including treating the entire data block to be coded as one group, or treating every four coefficients in the entire data block to be coded as one group, and the grouping method based on the array position of the coefficients includes grouping the coefficients of the entire data block to be coded unevenly according to their positions, or grouping the coefficients of the entire data block to be coded evenly according to their positions.
[0069] According to a twentieth aspect, there is provided an electronic device including a processor and a memory, the memory is used to store computer instructions; The processor is adapted to call the computer instructions from the memory to perform the methods according to the fifteenth to sixteenth aspects.
[0070] According to a twenty-first aspect, there is provided a computer readable storage medium storing a computer program or instructions, comprising: When the computer program or instructions are executed by an electronic device, the methods according to the fifteenth to sixteenth aspects are performed.
[0071] As can be understood, the video encoding / decoding apparatus, video encoding / decoding system, computer-readable storage medium, or computer program product provided above can all be implemented by the corresponding methods provided above, so the beneficial effects that can be achieved thereby can refer to the beneficial effects in the corresponding methods provided above, and description thereof will be omitted here. [Brief description of the drawings]
[0072] [Figure 1] FIG. 1 is an architecture diagram of an encoding / decoding system according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a diagram showing the internal architecture of an encoder according to an embodiment of the present invention; [Diagram 3] FIG. 2 is an internal architecture diagram of a decoder according to an embodiment of the present invention; [Figure 4A] 2 is a flowchart of video encoding / decoding according to an embodiment of the present invention; [Figure 4B] 1 is a flowchart of a video encoding / decoding method according to an embodiment of the present invention. [Diagram 5] 2 is a schematic diagram of a decoding target unit in a video encoding / decoding method according to an embodiment of the present invention. FIG. [Figure 6] FIG. 2 is a schematic diagram of grouping and scanning in a video encoding / decoding method according to an embodiment of the present invention; [Figure 7] 2 is a schematic diagram of a data portion in a unit to be decoded in a video encoding / decoding method according to one embodiment of the present invention. FIG. [Figure 8] 1 is a schematic diagram of a grouping method for decoding target units in a video encoding / decoding method according to an embodiment of the present invention. [Figure 9] 1 is a schematic diagram of a grouping method for decoding target units in a video encoding / decoding method according to an embodiment of the present invention. [Figure 10] 1 is a schematic diagram illustrating a configuration of a video encoding / decoding device according to an embodiment of the present invention. [Figure 11] FIG. 2 is a hardware configuration diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0073] In the following, the terms "first" and "second" are merely for explanatory purposes and should not be understood as indicating or implying a relative importance or the number of technical features indicated. Thus, a feature qualified as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0074] It should be noted that in the present invention, the term "exemplary" or "for example" is used to indicate an example, illustration, or explanation. Any embodiment or design solution described in the present invention as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or design solutions. Specifically, the use of the term "exemplary" or "for example" is intended to specifically present the related concept.
[0075] Hereinafter, the technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and are not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative labor belong to the protection scope of the present invention.
[0076] First, technical terms related to the embodiments of the present invention will be explained. Video Sequence / Image Sequence: A complete image in a video is generally called a "frame", and a video consisting of multiple frames arranged in time is called a Video Sequence or may be called an Image Sequence.
[0077] Video coding technology: A video sequence has a series of redundant information, such as spatial redundancy, temporal redundancy, visual redundancy, information entropy redundancy, structural redundancy, knowledge redundancy, and importance redundancy. In order to remove as much redundant information as possible in a video sequence and reduce the amount of data representing the video, video coding technology has been proposed, which achieves the effects of reducing storage capacity and saving transmission bandwidth. Video coding technology is also called video compression technology.
[0078] The process of video coding generally includes processes such as prediction, transformation, quantization, and entropy coding, and the quantized transform coefficients can be coded by entropy coding. The specific process will be described later, and therefore will not be described here.
[0079] In the internationally applicable range, there are video compression encoding standards such as Advanced Video Coding (AVC) in Part 10 of the MPEG 2 and MPEG 4 standards formulated by the Motion Picture Experts Group (MPEG), and H.263, H.264, and H.265 (also called High Efficiency Video Coding standard, HEVC) formulated by the International Telecommunication Union-Telecommunication Standardization Sector (ITU-T).
[0080] In addition, in an encoding algorithm based on a hybrid encoding architecture, the above compression encoding methods may be mixed.
[0081] Residual: In the video coding process, it is necessary to remove the spatial and temporal redundancies through a prediction process, and the encoder obtains the predicted value through prediction, and subtracts the predicted value from the original pixel value to obtain the residual value. The residual block is the basic unit of transformation, quantization, and entropy coding.
[0082] Transform: In the video coding process, transform refers to converting an image described in pixel form in the spatial domain into an image in the transform domain and expressing it in the form of transform coefficients. Most images contain many flat areas and slowly changing areas, and a suitable transform process can transform the image energy from a scattered distribution in the spatial domain to a relatively concentrated distribution in the transform domain, remove the frequency domain correlation between signals, and effectively compress the bitstream together with the quantization process. The transform process can transform the pixel values in the time domain into the frequency domain, and in the actual residual block, low-frequency components account for a large proportion, and the transform concentrates the energy in the low-frequency region. That is, the value of the low-frequency coefficients after transformation is large, and the value of the high-frequency coefficients is small.
[0083] Transform Coefficients: The coefficients of the residual block after transformation and quantization are called transform coefficients. The pixel values in the residual block are called coefficients, and after the residual is transformed, the upper left one is the low-frequency coefficient and the lower right one is the high-frequency coefficient. From the upper left to the lower right, the frequency increases.
[0084] Binarization: Also called binarization, the code or coefficient that needs to be encoded is binarized, and the binarized code or coefficient is converted into a binary string. The binary strings obtained by encoding the same coefficient with different binarization methods may have different binary probability models and different string lengths.
[0085] Context: Generally, different syntax elements are not completely independent, and the same syntax element itself has a certain memory. Therefore, based on the theory of conditional entropy, by performing conditional coding using other coded syntax elements, the coding performance can be further improved compared to independent coding and memoryless coding. The coded symbol information used as these conditions is called context.
[0086] Context Model: In video coding and decoding, the process of updating symbol probabilities based on context is called a context model. Depending on the specific application conditions, multiple context models can be used in the same syntax element to adaptively update the symbol probabilities in the current conditions, thereby further compressing the bit rate.
[0087] Entropy coding: refers to a lossless coding method based on the principle of information entropy, which is the last processing module of video compression, converting a series of element symbols for representing a video sequence into a binary bit stream for transmission or storage, and the output data of the entropy coding module is the final bit stream after the original video is compressed. Entropy coding can effectively remove the statistical redundancy of these video element symbols, and is one of the important tools for ensuring the efficiency of video coding compression.
[0088] Raster Scan: Refers to mapping a 2D rectangular raster onto a 1D raster. The entry point for the 1D raster starts at the first row of the 2D raster, then scans the second row, the third row, etc. The rows of the raster are scanned from left to right.
[0089] Top-right diagonal scan: refers to starting the scan from the last coefficient in the bottom-right of the coefficient block and ending with the first coefficient in the top-left of the coefficient block. The scan order within each small block is bottom-right-top-right-bottom-left-top, and the order is the same for other small blocks. The scan order between blocks is the same as the scan order between coefficients, which is bottom-right-top-right-bottom-left-top-left.
[0090] Horizontal round-trip scanning: refers to mapping a 2D rectangle into a 1D column. The entry of the 1D column starts from the starting row of the 2D rectangle, and scans the entire 2D rectangle row by row. The row scanning direction of the starting row is from left to right, the row scanning direction of the adjacent rows of the starting row is from right to left, and any two adjacent rows have opposite row scanning directions.
[0091] Reverse horizontal scan: refers to starting the scan from the last coefficient in the bottom right of the coefficient block and ending with the first coefficient in the top left of the coefficient block. Within each coefficient block, scanning is from right to left and bottom to top, and the scanning order between blocks is bottom right block - top right block - bottom left block - top left block.
[0092] Reverse vertical scan: refers to starting the scan from the last coefficient in the bottom right of the coefficient block and ending with the first coefficient in the top left of the coefficient block, scanning from bottom to top and right to left within each small block.
[0093] Z-scan: For any square whose sides are even, scanning begins at the top left, then top right, then bottom left, then bottom right.
[0094] Unary code: A simple binarization method. Specifically, for a non-negative integer N, its unary code is represented by N ones and one zero.
[0095] Truncated unary code: A variation of the unary code. Specifically, when the maximum value of the symbol to be encoded is known to be N_max, assuming the current symbol to be encoded is a non-negative integer N, if N < N_max, the truncated unary code is the unary code, and if N = N_max, the truncated unary code is N 1s.
[0096] Truncated binary code: Calculate the correlation variables (such as stage, num0, num1, and thd) of val. For 0 to (thd - 1), the length of its binary symbol sequence is a fixed-length code of stage, and for thd to val, the length of its binary symbol sequence is a fixed-length code of (stage + 1).
[0097] Run-length encoding: Record the consecutive occurrence times of each value as the code value. For example: 0001110011010100001100, the compressed output: 33221111422.
[0098] Fixed-length encoding: Encode the coefficient to be encoded using a fixed code length. For example, the ASCII code encoded using 8-bit binary numbers.
[0099] Semi-fixed-length encoding: Group the coefficients to be encoded according to the prediction direction and the magnitude of the residual, encode the grouping method, each group encodes one code length, and the coefficients within the same group are encoded using the same fixed length.
[0100] k-th exponential Golomb encoding: The k-th exponential Golomb encoding includes two parts, a prefix and a suffix. The encoding method includes step 1) writing the number X in binary form, removing the least significant k bits, adding 1 to obtain T; step 2) calculating the number of bits of T and adding T - 1 zeros in front; step 3) adding the removed least significant k bits to the end of the bit sequence.
[0101] Truncated Rice Coding: Truncated Rice coding includes two parts, a prefix and a suffix, and encodes the target symbol cVal with a known maximum upper limit cMax and a known Rice parameter cRice.
[0102] Huffman coding: Calculate the frequency of occurrence of all coefficients, build a Huffman tree, and assign short codewords to coefficients with high probability and long codewords to coefficients with low probability.
[0103] Golomb-Rice coding: Golomb-Rice is a variation of Golomb coding. The difference from Golomb coding is that the restriction condition of parameter m is that m must be a power of 2. Specifically, parameter m is initialized, m must be a power of 2, q and r are calculated, where q=N / m and r=N(m-1), and q is encoded using a unary code, and the lowest log2(m) bits of the binary bits of r are the codeword of r.
[0104] In the following, we introduce the Golomb-Rice coding algorithm in combination with the JPEG-LS coding model.
[0105] In the JPEG-LS encoding algorithm, the pixel gradient in a certain direction may be calculated using surrounding reconstructed pixel values, one gradient value may be calculated based on the predicted direction of the current pixel, or the horizontal gradient value or the vertical gradient value may be calculated based on experience, and the gradient may be quantized.
[0106] Calculate the gradient threshold parameters T1, T2 and T3 according to JPEG-LS.
number
[0107] Here, n is the image bit width and Near is the quantization distortion parameter. The gradient is quantized according to the threshold parameters T1, T2, and T3 as follows:
number
[0108] Here, D i represents the gradient calculation value, i represents multiple directions. Based on the quantized gradient, the corresponding context index
number
[0109] Based on the sign of the index value Q and the residual correction value C[Q] (obtained by accumulating the residuals of the context reconstruction pixels), perform adaptive error correction (correct the prediction value, like SAO):
number
[0110] To further reduce the amplitude of the residual value Errval, the quantization formula for near-lossless compression is as follows:
number
[0111] Here, sign represents the sign of the index value Q, and the range of the prediction error value at this time is ±(range-1). Range0 = (2n-1) original pixel range, Range0 = ±range prediction residual range, range1 = -(range0 - Near) / (2Near + 1) the minimum value after quantization, range2 = (range0 + Near) / (2Near + 1) the maximum value after quantization, range=range2+1.
[0112] To compress the error value range again, if the prediction error Errval is less than -range / 2, the range value is added to the prediction error Errval. After this process is completed, if the prediction error Errval is greater than or equal to (1+range) / 2, the range value must be subtracted from the prediction error Errval. After this process, the absolute value of all the prediction error Errval values cannot be greater than (range+1) / 2. The formula for modulo subtraction is as follows:
number
[0113] Finally, we estimate the k value for Golomb coding based on the context.
[0114] A context residual magnitude accumulator (i.e., the sum of the absolute values of the first n coded residual values)
[0115] B+=Errval*(2Near+1) context reconstruction value residual accumulator (i.e., the sum of the first n coded reconstruction values), is used to calculate the prediction error correction parameter C[Q]. N is a counter corresponding to the context environment, which stores the number of occurrences of the context environment. The value of C[Q] increases by 1 every time the value of B / N (the average value of the correction residual) increases by 0.5 or more, and decreases by 1 every time the value of B / N decreases by 0.5 or more. Meanwhile, in order to make the calculation more consistent with local features, a threshold N0 can be set, and when N is greater than N0, the values of N and A are halved, and at the same time, the values of B and C[Q] are also halved.
[0116] Here, K is calculated as an expected value derived under the assumption that the current residual distribution fits the geometric distribution. Golomb coding for n, with a parameter m, is divided into two parts: a binary code of n%m and a unary code of n / m. For a variable to be coded with a geometric distribution, there exists one m such that the average code length after coding is the shortest. Golomb coding when the value of m is 2^k is called Golomb-Rice coding. Here, K=min{k1|2k1N>=A}.
[0117] The original range of the residual is ±(range+1) / 2, and we map it.
number
[0118] Use Golomb-Rice coding for Merval.
[0119] On the other hand, for flat regions, i.e. Di=0, run-length coding is used directly. If the adjacent pixels a=b=c=d are found, i.e. g1=g2=g3=0, it indicates that the coding has progressed to a very flat region, and enters run-length coding mode. In run-length mode, it continues to detect whether the pixel after the current pixel x is equal to x (in near-lossless mode, it judges whether the difference with x is within the allowable range), and when it is satisfied, it continues to detect later, and records the number of the same value (including x) as the run length.
[0120] In the prior art, the SRCC (Scan Region-based Coefficient Coding) coding technology is mainly intended for coding coefficients with many residual values of 0 in lossy coding, and cannot be applied to lossless coding or near-lossless coding. The technical process of the context-based adaptive binary arithmetic coding (CABAC) is relatively complicated, and the coding / decoding complexity increases, so it is not suitable for use in near-lossless compression. The existing Golomb-Rice coding and semi-fixed length coding have relatively good effects on lossless coding and near-lossless coding, but the code length of Golomb coding depends on the selected degree k, and if the value of k is inaccurate, the code length after binarization becomes very long, so it is generally only applied to pointwise coding, which quickly updates the k value. Although the semi-fixed length coding can effectively control the code length within a certain range, it is generally applied to grouped coding, because the code length of each coefficient needs to be coded before coding these coefficients. When the number of coefficients in a group is too small, this method increases the average code length, but increasing the number of coding coefficients often results in an increase in the range of coefficient values. When the maximum value in a group is large, the average code length increases because each coefficient in the group uses the same code length. Since both of these two methods have some shortcomings, we propose a coefficient coding method based on lossless coding and near-lossless coding by combining these two coding methods.
[0121] Next, an implementation environment and application scenario of the embodiment of the present invention will be briefly described. The video encoding / decoding method provided in the present invention can be applied to the video encoding / decoding system shown in FIG.
[0122] A system architecture to which an embodiment of the present invention is applied will now be described. Fig. 1 is a schematic diagram of the architecture of an encoding / decoding system (which may be referred to as an encoding and decoding system) 10 to which an embodiment of the present invention is applied. 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 may be referred to as a video encoding device since it is used to encode images. The destination device 12 may be referred to as a video decoding device since it is used to decode encoded image data generated by the source device 11.
[0123] Source device 11 and destination device 12 may include a variety of devices, such as, for example, desktop computers, mobile computing devices, laptop (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.
[0124] Optionally, source device 11 and destination device 12 in FIG. 1 may be two separate devices, or source device 11 and destination device 12 may be the same device, i.e., source device 11 or a corresponding function and destination device 12 or a corresponding function may be integrated into the same device.
[0125] Communication may occur 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, one or more communication media may be included between source device 11 and destination device 12, transmitting the encoded image data over the one or more communication media. The one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from source device 11 to destination device 12.
[0126] As shown in FIG. 1, the source device 11 includes an encoder 112, and may optionally 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 retouching, color format conversion (e.g., conversion from RGB format to YUV format), color adjustment, or noise removal, etc. The encoder 112 is used to receive the preprocessed image, process the preprocessed image using a correlation prediction mode (e.g., a prediction mode in each embodiment of the present specification), and provide encoded image data. In some embodiments, the encoder 112 may be used to perform the image encoding process in the following embodiments. 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. The other device may be any device for decoding or storage. The communication interface 113 may also encapsulate the encoded image data into a suitable format before transmitting it.
[0127] Optionally, the above image pre-processor 111, encoder 112, and 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 thereto.
[0128] Continuing with FIG. 1, destination device 12 includes a decoder 122, and may optionally further include a communication interface 121 and an image post-processor 123. Here, communication interface 121 may be used to receive encoded image data from source device 11 or any other source device, such as a storage device. Communication interface 121 may also decapsulate data transmitted by communication interface 113 to obtain encoded image data. 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, decoder 122 may be used to perform a decoding process described in the following embodiments.
[0129] 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., conversion from YUV format to RGB format), color adjustment, retouching, or resampling, or any other processing, and the post-processed image data may be transmitted to a display device for display.
[0130] Similarly, optionally, the above communication interface 121, decoder 122, and image post-processor 123 may be hardware components in the destination device 12, or may be software programs in the destination device 12, and the embodiments of the present invention are not limited thereto.
[0131] The configurations of the encoder and decoder in FIG. 1 will be briefly explained below.
[0132] Referring to Fig. 2, Fig. 2 is a schematic 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, an entropy coding unit 205, an inverse quantization unit 206, an inverse transform processing unit 207, a reconstruction unit 208, and a filter unit 209. Optionally, the encoder 20 may further include a buffer and a decoded image buffer. The buffer is used to buffer the reconstructed image block output by the reconstruction unit 208, and the decoded image buffer is used to buffer the filtered image block output by the filter unit 209.
[0133] The input to the encoder 20 is an image block of an image (which may be referred to as a target image), which may be referred to as a current image block or a target image block. The encoder 20 may further include a division unit (not shown in FIG. 2) used to divide the target image into a number of image blocks. The encoder 20 is used for block-by-block encoding to complete the encoding of the target image, e.g., performing an encoding process for each image block.
[0134] The prediction processing unit 201 is used to receive or obtain an image block (which may be called a current image block to be coded of a current image to be coded or a current image block, and may be understood as a true value of an image block) and reconstructed image data, and to predict the current image block based on related data in the reconstructed image data to obtain a predicted block of the current image block. Optionally, the prediction processing unit 201 may include an inter prediction unit, an intra prediction unit, and a mode selection unit. The mode selection unit is used to select an intra prediction mode or an inter prediction mode. If the intra prediction mode is selected, the prediction processing is performed by the intra prediction unit. If the inter prediction mode is selected, the prediction processing is performed by the inter prediction unit.
[0135] The residual calculation unit 202 is used to calculate a residual between a true value of an image block and a predicted block of the image block to obtain a residual block, for example, by subtracting pixel values of the predicted block from pixel values of the image block for each pixel.
[0136] The transform processor 203 is used to perform a transform, such as a discrete cosine transform (DCT) or a discrete sine transform (DST), on the residual block to obtain transform coefficients in a transform domain. The transform coefficients may also be called transform residual coefficients. The transform residual coefficients can represent the residual block in the transform domain.
[0137] The quantization unit 204 is used to quantize the transform coefficients by applying scalar or vector quantization to obtain quantized transform coefficients. The quantized transform coefficients may be referred to as quantized residual coefficients. The quantization process reduces the bit depth associated with some or all of the transform coefficients. For example, an n-bit transform coefficient may be truncated to an m-bit transform coefficient during quantization, where n is greater than m. The degree of quantization may be changed by adjusting a quantization parameter (QP). For example, for scalar quantization, different scales may be applied to achieve finer or coarser quantization. A smaller quantization step corresponds to a finer quantization, and a larger quantization step corresponds to a coarser quantization. The appropriate quantization step may be indicated by a quantization parameter (QP).
[0138] The entropy coding unit 205 performs entropy coding on the quantized residual coefficients and outputs coded image data (i.e., the coding result of the current image block to be coded) in the form of a coded bitstream, which is then used to transmit to a decoder or store for subsequent transmission to a decoder or retrieval. The entropy coding unit 205 may further be used to entropy code other syntax elements of the current image block, for example, entropy coding a prediction mode into the bitstream. The entropy coding algorithm includes, but is not limited to, a Variable Length Coding (VLC) algorithm, a Context Adaptive VLC (CAVLC) algorithm, an arithmetic coding algorithm, a Context-based Adaptive Binary Arithmetic Coding (CABAC) algorithm, a Syntax-based Context-adaptive Binary Arithmetic Coding (SBAC) algorithm, and a Probability Interval Partitioning Entropy (PIPE) algorithm.
[0139] The inverse quantization unit 206 is used to inverse quantize the quantized coefficients to obtain inverse quantized coefficients. The inverse quantization is an inverse application of the quantization unit 204, for example, applying 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 be called inverse quantized residual coefficients.
[0140] The inverse transform processor 207 is used to perform an inverse transform on the inverse quantized coefficients. It should be understood that the inverse transform is an inverse application of the transform processor 203, for example, the inverse transform includes an inverse discrete cosine transform (DCT) or an inverse discrete sine transform (DST), and obtains an inverse transform block in the pixel domain (also called the sample domain). The inverse transform block may be called an inverse transform dequantized block or an inverse transform residual block.
[0141] The reconstruction unit 208 is used to add the inverse transformed block (i.e., the inverse transformed residual block) to the prediction block to obtain a reconstructed block in the sample domain. The reconstruction unit 208 may be an adder, for example, adding sample values (i.e., pixel values) of the residual block and sample values of the prediction block. The reconstructed block output by the reconstruction unit 208 may then be used to predict other image blocks, such as being used in an intra prediction mode.
[0142] The filter unit 209 (or simply "filter") is used to filter the reconstructed block to obtain a filtered block in order to smooth pixel transformation or improve image quality. The filter unit may be one or more loop filters, such as a deblocking filter, a sample-adaptive offset (SAO) filter, or a loop filter unit intended to represent other filters, such as a bilateral filter, an adaptive loop filter (ALF), a sharpening filter or a smoothing filter, or a collaborative filter. Optionally, the filtered block output by the filter unit 209 may then be used to predict other image blocks, such as being used in an inter-prediction mode.
[0143] Specifically, in the embodiment of the present invention, encoder 20 is used to perform the video encoding and decoding methods described in the following embodiments.
[0144] Referring to FIG. 3, FIG. 3 is a schematic block diagram of an example of a decoder 30 for implementing an embodiment of the present invention. The video decoder 30 is used to receive, for example, encoded image data (i.e., an encoded bitstream, e.g., an encoded bitstream including image blocks and related syntax elements) encoded by the encoder 20 to obtain a decoded image. The decoder 30 includes an entropy 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 substantially inverse to the encoding path described for the encoder 20 of FIG. 2. Optionally, the decoder 30 may further include a buffer and a decoded image buffer. 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.
[0145] The entropy decoding unit 301 is used to perform entropy decoding on the encoded image data to obtain quantization coefficients and / or decoded encoding parameters (e.g., the decoding parameters may include any one or all of inter prediction parameters, intra prediction parameters, filter parameters, and / or other syntax elements). The entropy decoding unit 301 is further used to transfer the decoded encoding parameters to the prediction processing unit 304 so that the prediction processing unit performs a prediction process based on the encoding parameters.
[0146] The function of the inverse quantization unit 302 may be the same as that of the inverse quantization unit 206 of the encoder 20. The inverse quantization unit 302 is used to inverse quantize the quantized coefficients decoded by the entropy decoding unit 301.
[0147] The functionality of the inverse transform processor 303 may be the same as that of the inverse transform processor 207 of the encoder 20. The functionality of the reconstruction unit 305 (e.g., an adder) may be the same as that of the reconstruction unit 208 of the encoder 20. The inverse transform processor 303 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 transformed block (which may also be called an inverse transformed residual block), which is the residual block of the current image block in the pixel domain.
[0148] 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. The prediction processing unit 304 may, for example, receive or obtain prediction-related parameters and / or information on the selected prediction mode (i.e., the decoded encoding parameters) from the entropy decoding unit 302, and predict the current image block based on the related data in the reconstructed image data and the decoded encoding parameters to obtain a predicted block of the current image block. Optionally, the prediction processing unit 304 may include an inter prediction unit, an intra prediction unit, and a mode selection unit. The mode selection unit is used to select an intra prediction mode or an inter prediction mode. When the intra prediction mode is selected, the intra prediction unit performs a prediction process. When the inter prediction mode is selected, the inter prediction unit performs a prediction process.
[0149] The reconstruction unit 305 is used to add the inverse transform block (i.e., the inverse transform residual block) to the prediction block to obtain a reconstructed block in the sample domain, for example, by adding the sample values of the inverse transform residual block and the sample values of the prediction block.
[0150] The filter unit 306 is used to filter the reconstructed block to obtain a filtered block, which is the decoded image block.
[0151] Specifically, in an embodiment of the present invention, decoder 30 is used to perform a video decoding method as described in the following embodiment.
[0152] In the encoder 20 and the decoder 30 according to the embodiment of the present invention, the processing result of a certain part may be further processed and then output to the next part. For example, after a part such as interpolation filtering, motion vector derivation, or filtering, the processing result of the corresponding part may be further subjected to an operation such as Clip or shift.
[0153] The video decoding method and the video encoding method provided in the embodiments of the present invention may be performed by an electronic device having a function of compressing and encoding or decoding any image or video image. In some embodiments, the electronic device may be a notebook computer, a tablet computer, a desktop computer, a portable computer, etc., and the embodiments of the present invention are not limited thereto.
[0154] In the following, based on the video encoding / decoding system shown in Figures 1 to 3, the present invention provides a possible embodiment of video encoding / decoding. As shown in Figure 4A, Figure 4A is a flowchart of video encoding / decoding according to the present invention, and the embodiment of the video encoding / decoding includes step [1](1) to step [5], and the step [1] to step [5] can be performed by any one or more of the above-mentioned encoder 20, decoder 30, source device 11, or destination device 12.
[0155] Step [1]: Divide one frame of an image into one or more non-overlapping parallel coding units (CUs). The one or more parallel coding units have no dependency on each other, like parallel coding unit 1 and parallel coding unit 2 shown in Figure 4A, and can be coded and decoded completely in parallel / independently.
[0156] Step [2]: For each parallel coding unit, we may split it into one or more non-overlapping independent coding units, which may be independent of each other but may share header information of some of the parallel coding units.
[0157] For example, the width of an independent coding unit is w_lcu and its 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 its height (unless it is an edge region).
[0158] Typically, the independent coding unit may be a fixed w_lcu×h_lcu, where w_lcu and h_lcu are both the Nth power of 2 (N≧0). For example, the size of the independent coding unit may be 128×4, 64×4, 32×4, 16×4, 8×4, 32×2, 16×2, or 8×2.
[0159] As one possible example, the independent coding units may be a fixed 128x4. If the size of the parallel coding units is 256x8, the parallel coding units may be divided evenly into four independent coding units. If the size of the parallel coding units is 288x10, the parallel coding units are divided into two 128x4 independent coding units + one 32x4 independent coding unit first / second row, two 128x2 independent coding units + one 32x2 independent coding unit third row.
[0160] 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 only include 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, specifically related to the input format of the image.
[0161] Step [3]: For each independent coding unit, it may be divided into one or more non-overlapping coding units, each coding unit within the independent coding unit may be dependent on each other, for example, multiple coding units may reference each other for precoding and predecoding.
[0162] If the size of the coding unit and the independent coding unit are the same (i.e., the independent coding unit is split into only one coding unit), the size may be any size described in step [2].
[0163] When an independent coding unit is divided into multiple non-overlapping coding units, possible examples of division include horizontal equal 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.), vertical equal 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.), horizontal and vertical equal division (quadtree division), etc., of which horizontal equal division is preferred.
[0164] If the coding unit has a width w_cu and a height h_cu, the width must be greater than the height (unless it is an edge region). In general, the coding unit may be a fixed w_cu×h_cu. Both w_cu and h_cu may be a power of 2 (N is 0 or greater), such as 16×4, 8×4, 16×2, 8×2, 8×1, 4×1, etc.
[0165] 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. If the size of the independent coding unit is 72x4, the coding unit is divided into four 16x4 independent coding units plus one 8x4 independent coding unit.
[0166] It should be noted that the coding unit may include three components of luma Y, chroma Cb, and chroma Cr (or three components of red R, green G, and blue B), or may include only one of these components. If the coding unit includes three components, the sizes of these three components may be completely the same or different, specifically related to the input format of the image.
[0167] Note that step [3] is an optional step in the video encoding / decoding method, and the video encoder / decoder may encode / decode the residual coefficients (or residual values) of the independent coding units obtained in step [2].
[0168] Step [4]: The coding unit may be divided into one or more non-overlapping prediction groups (PGs). PGs may be abbreviated as Groups. Each PG performs coding and decoding according to a selected prediction mode to obtain a prediction value of the PG, which constitutes a prediction value of the entire coding unit. A residual value of the coding unit is obtained based on the prediction value and the original value of the coding unit.
[0169] Step [5]: Based on the residual value of the coding unit, the coding unit is grouped, one or more non-overlapping residual blocks (RBs) are obtained, and the residual coefficients of each RB are coded and decoded according to the selected mode to form a residual coefficient stream. Specifically, there are two types: one in which the residual coefficients are transformed and the other in which they are not transformed.
[0170] Here, the selected mode of the residual coefficient encoding / decoding method in step [5] may include, but is not limited to, any of the following: semi-fixed length encoding method, exponential Golomb encoding method, Golomb-Rice encoding method, truncated unary code encoding method, run-length encoding method, directly encoding the original residual value, etc.
[0171] For example, the video encoder may directly encode the coefficients in the RB.
[0172] Also, for example, the video encoder may perform a transform such as DCT, DST, or Hadamard transform on the residual block, and perform coding on the transformed coefficients.
[0173] As a possible example, when the RB is small, the video encoder may directly perform global quantization on each coefficient in the RB and then perform binarization coding. When the RB is large, the RB may be further divided into multiple coefficient groups (CGs), and each CG may be globally quantized and then performed binarization coding. In some embodiments of the present invention, the coefficient group (CG) and the quantization group (QG) may be the same.
[0174] Hereinafter, the part of encoding 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 encoding bits of the residual coefficient in the RB block is determined (the number of encoding 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 encode the residual coefficient 1, which is represented as 01. If the CL of the current RB block is 7, it represents that 8 bits of the residual coefficient and 1 sign bit are encoded. The determination of CL is to find the minimum M value that satisfies the condition that all the residuals of the current sub-block are within the range of [-2^(M-1), 2^(M-1)]. If the two boundary values of -2^(M-1) and 2^(M-1) exist simultaneously, M needs to be increased by 1, i.e., M+1 bits are required to encode all the residuals of the current RB block. If only one of the two boundary values, -2^(M-1) and 2^(M-1), exists, then one trailing bit needs to be coded to determine whether the boundary value is -2^(M-1) or 2^(M-1). If all residuals are not -2^(M-1) or 2^(M-1), then there is no need to code the trailing bit.
[0175] Also, in some special cases, the video encoder may directly encode the original values of the image instead of the residual values.
[0176] Based on the above problems, the present invention provides a video encoding / decoding method for lossless and near-lossless compression coding frameworks, which can encode the values of original pixels (quantized / unquantized), residual coefficients after prediction (quantized / unquantized), or transform coefficients after transformation (quantized / unquantized) as follows: (1) Considering the difference in data distribution among original pixels, residual coefficients and transform coefficients, different encoding methods are used for different data according to their distribution characteristics.
[0177] (2) At the same time, different scanning methods can be designed for the data, and the scanning method needs to take into account the distribution of the data, and coefficients with similar amplitudes should be distributed together as much as possible.
[0178] (3) The scanned data may be grouped, and the grouping method may be irregular grouping based on the distribution of data, or fixed grouping directly. The specific grouping situation of the data may be agreed upon by the encoding and decoding, or may be derived based on the context (including derivation based on the encoded data, derivation based on the prediction coefficient, and derivation based on the encoded parameters), or may be obtained by transmitting parameters from the encoding side.
[0179] (4) For different data distributions, coding may be performed directly based on the data to be coded, or parameters may be estimated based on the context, and the coding range of the coefficients to be coded may be estimated, or the values of the relevant coefficients to be coded may be directly estimated. Then, a parameter correction value may be calculated based on the range of the estimated value, and it may be selected whether to further transmit the parameter correction value to make the estimated parameter more accurate.
[0180] (5) For different data distributions, parameter estimation may be performed based on the context, the numerical range of the coding coefficients of the next group (the number of coefficients in each group may be one or more) may be estimated, and the coding scheme of the coefficients of the next group may be selected based on the estimated value.
[0181] (6) For different data distributions, parameter estimation may be performed based on the context, and one parameter correction value may be analyzed from the bitstream to obtain the numerical range of the coding parameters of the next group, and the coding scheme of the coefficients of the next group may be selected based on the numerical range. Different coding schemes or coding methods may be selected based on different ranges of the coefficients.
[0182] (7) Since the data distribution in the time domain is different from the data distribution in the frequency domain, and the data distribution in the time domain is relatively uniform, and the large energy of the data in the frequency domain is distributed in low-frequency information, the encoding of the transform coefficients may be specially grouped in consideration of the position of the coefficients after transformation.
[0183] (8) When encoding the coefficients, one may select unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, run-length coding, k-th order exponential Golomb coding, truncated Rice coding, Golomb-Rice coding, Huffman coding, arithmetic coding, or adaptive variable length coding, etc. The coefficients may be encoded using one or a combination of these coding schemes.
[0184] In a specific embodiment, the scanning method for the coding coefficients may be selected from raster scan, block scan, horizontal scan, vertical scan, round trip (horizontal / vertical) scan, diagonal (top left, top right, bottom left, bottom right) scan, reverse diagonal scan, reverse horizontal scan, reverse vertical scan, or a scan based on one fixed scan template, etc.
[0185] In general, the overall encoding process provided in the embodiment of the present invention is consistent with the procedure of the decoding process, and the parameters that need to be written into the bitstream can be obtained by bitrate distortion optimization (RDO) at the encoding side, or can be obtained by estimation. The video encoding and decoding process provided in the embodiment of the present invention mainly includes a grouping encoding process and a grouping encoding-free process.
[0186] 1. Group coding process: First, the coefficients are changed to one-dimensional vectors. If the region to be coded is a three-dimensional image, the three-dimensional image is divided into one or more two-dimensional coefficient blocks. If the region to be coded is a two-dimensional coefficient block, the block to be coded is scanned in a certain scanning order, and the two-dimensional coefficient block is scanned to become a one-dimensional coefficient vector.
[0187] Next, the coefficient vector is grouped based on the magnitude of the coefficient, and coefficients with similar amplitudes are grouped into the same group. Based on some fixed grouping method, the 1D coefficients are grouped and specific grouping information is coded, or the grouping method of the 1D coefficients is derived based on the prediction method and the transformation method. Coefficients in the same group may use one parameter (group_param), and this parameter can guide the coding of all subsequent coefficients. The parameter (group_param) may be coded with a fixed-length code, or may be coded with a unary code or a truncated unary code. Then, each coefficient in the group is coded with a coding method based on the group_param.
[0188] 2. Grouping coding unnecessary process: Similar to the grouping method, the grouping method can be eliminated, and coding can be performed for each coefficient. For each coefficient to be coded, a range of the value of the coefficient to be coded is derived based on the context, and one coding method can be selected based on this range to perform coding.
[0189] The overall decoding process of the embodiment of the present invention is briefly described below: a) determine a scanning method for coefficients; b) determine the type of coefficient (original value, transform coefficient, residual coefficient after prediction); c) determine the coding method of coefficients; d) decode the required parameters for each coefficient or each group of coefficients from the bitstream based on the coding method; e) determine whether it is necessary to derive prediction parameters based on the coding method of coefficients based on the context information; f) if prediction parameters exist, perform corresponding decoding based on the coding method of coefficients based on the prediction parameters and the parameters analyzed in the bitstream; otherwise, derive prediction parameters based on the context information; g) if groups exist, return the decoded coefficients in each group to the original coefficient positions in sequence based on the bitstream; otherwise, directly decode to obtain all coefficient values.
[0190] The schemes determined in steps a), b) and c) on the decoding side may be analyzed by the bitstream, may be agreed upon by the encoding side and the decoding side, or may be derived by the decoding side (based on parameters such as the size of the current block or the prediction scheme, the transformation scheme, etc.).
[0191] 1. The grouping decoding process mainly includes: firstly, determine the scanning mode of the block, then determine the grouping mode of the scanned coefficients, then use a decoding mode to decode the parameters (group_param) of each group, and according to group_param, use a decoding method to decode each coefficient value in the group, and finally, restore the coefficients in the coding block to their original array according to the scanning mode.
[0192] 2. The grouped decoding unnecessary process mainly includes: firstly, determine the scanning method of the block, predict the current coding coefficient range according to the context, and select a decoding method according to the coefficient value range for decoding.
[0193] Hereinafter, a video decoding method and a video encoding method provided in an embodiment of the present invention will be described in detail with reference to the accompanying drawings.
[0194] The present invention provides a video decoding method. Figure 4B is a flowchart of a video encoding and decoding method provided in an embodiment of the present invention. The encoding process in the method may be performed by the above-mentioned encoder, and the decoding process may be performed by the above-mentioned decoder. The method may include the following steps:
[0195] In 401, the encoding side scans a unit to be encoded in original image data in a first scanning manner to obtain a coefficient sequence.
[0196] In one embodiment, the encoding side may scan the original data block to obtain the coefficients to be encoded according to different scanning methods. Specifically, the first scanning method may include any one of raster scanning, block scanning, horizontal scanning, vertical scanning, round trip (horizontal / vertical) scanning, diagonal (upper left, upper right, lower left, lower right) scanning, inverse horizontal scanning, inverse vertical scanning, Hilbert scanning, or scanning based on one fixed scanning template. Here, the specific scanning process of each scanning method can be referred to the description of the related art, and the present invention is not limited thereto.
[0197] The encoding side may derive one or more scanning schemes based on the prediction scheme, transformation scheme, etc. of the current coefficients. Alternatively, the encoding side may select one scanning scheme for all coefficients based on a prior agreement between the encoding side and the decoding side, and the decoding side may then determine the scanning scheme based on the prior agreement.
[0198] In one embodiment, the video encoding / decoding method in the embodiment of the present invention can be applied to encoding of original pixels, encoding of residual values obtained by predicting original pixel values, encoding of coefficients obtained by quantizing residual values obtained by predicting original pixel values, encoding of transform coefficients obtained by transforming predicted residual values, or encoding of coefficients obtained by quantizing transform coefficients obtained by transforming predicted residual values, etc. Any of the above-mentioned data encodings may be encoded and compressed by the embodiment provided by the present invention.
[0199] That is, the original data block, the encoding target unit, or the reconstructed data block obtained by decoding referred to in the embodiments of the present invention may be a data block composed of original pixel values of the encoding target image, a data block composed of residual values obtained by predicting the original pixel values, a data block composed of coefficients obtained by quantizing the residual values, a data block composed of transform coefficients obtained by transforming the residual values, or a data block composed of coefficients obtained by further quantizing the transform coefficients obtained by transforming the residual values. The following examples will not repeat the description of this.
[0200] In one embodiment, the data sequence to be coded in the embodiment of the present invention may be coefficient blocks of various sizes, for example, m×n data blocks, where both m and n are less than or equal to 64, for example, the unit to be coded is a 16×4 coefficient block, a 16×1 coefficient block, an 8×4 coefficient block, an 8×2 coefficient block, or a 4×2 coefficient block.
[0201] In 402, the encoding side groups the coefficient sequence according to a first grouping scheme to obtain multiple groups of subsequences to be encoded.
[0202] In one embodiment, the grouping method includes at least one of a fixed-length grouping method, a semi-fixed-length grouping method that performs grouping based on the magnitude of coefficient values, and a grouping method based on the array position of coefficients. Here, the number of coefficients in the subsequences to be coded of the multiple groups may be the same or different. Hereinafter, a specific grouping method will be described based on a specific example, and the description will be omitted here.
[0203] In 403, the encoding side determines a coefficient encoding method corresponding to the encoding target subsequence of each group, and encodes them one by one to obtain an encoded bitstream.
[0204] In one embodiment, the encoding method may include at least one of the above-mentioned unary code, truncated unary code, truncated binary code, fixed length coding, semi-fixed length coding, k-th order exponential Golomb coding, truncated Rice coding, Huffman code, and Golomb-Rice coding. It may also be a combination of a plurality of the above-mentioned encoding methods. Hereinafter, a description will be given based on a specific embodiment, and the description will be omitted here.
[0205] In one embodiment, the encoding methods determined for the subsequences to be encoded may be the same or different, and the specific encoding methods will be described below based on specific examples, and the description will be omitted here.
[0206] In 404, the encoding side transmits the bitstreams one by one to the decoding side.
[0207] In 405, the decoding side obtains a bitstream and determines a scanning method for the unit to be decoded, a grouping method, and a coding method corresponding to each group.
[0208] The decoding side may obtain the encoded bitstream and decode it for each segment, where the unit to be decoded may be a data unit in the encoded bitstream that is subjected to decoding processing by the decoding side.
[0209] In one embodiment, the decoding side may determine at least one of the scanning method, grouping method, and coding method corresponding to each group used by the unit to be decoded based on the prior agreement between the encoding side and the decoding side or context information. Alternatively, the decoding side may analyze at least one of the scanning method, grouping method, and coding method corresponding to each group used by the unit to be decoded based on the bitstream. Alternatively, the decoding side may obtain the grouping method corresponding to each group based on the prediction method, quantization method, and / or transformation method of the unit to be decoded. Below, a description will be given based on a specific example, and the description will be omitted here.
[0210] In 406, the decoding side decodes each group one by one according to the coding method to obtain a coefficient block corresponding to the unit to be decoded.
[0211] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side decodes according to the encoding algorithm to obtain group parameters of each group. In one example, in one embodiment, the decoding method of the group parameters may specifically include the decoding side decodes according to a decoding method corresponding to at least one encoding method among unary code, truncated unary code, truncated binary code, fixed length encoding, kth order exponential Golomb encoding, truncated Rice encoding, Huffman encoding, and Golomb-Rice encoding to obtain group parameters of each group.
[0212] 2. The decoding side performs decoding according to the group parameters of each group according to the semi-fixed length coding algorithm to obtain a plurality of coefficient values in each group, and the coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each group.
[0213] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side decodes according to a fixed-length coding algorithm to obtain group Rice parameters of each group, or obtains group Rice parameters of each group based on a context model; 2. The decoding side decodes according to the group parameters of each group according to a Golomb-Rice coding algorithm to obtain multiple coefficient values of each group; The coefficient block corresponding to the unit to be decoded includes multiple coefficient values of each group.
[0214] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side obtains the group Rice parameter of each group according to the context model; 2. The decoding side decodes according to a fixed-length coding algorithm or a truncated unary code to obtain the group parameter deviation of each group, and obtains the group parameter of each group according to the group Rice parameter and the group parameter deviation of each group; In one example, the group parameter of each group may be updated according to the group Rice parameter and the group parameter deviation, specifically, group parameter=group Rice parameter+group parameter deviation.
[0215] 3. The decoding side performs decoding according to the group parameters of each group according to the Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group. The coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each group.
[0216] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side decodes according to a fixed-length coding algorithm to obtain the degree k of each group, or obtains the degree k of each group based on a context model; 2. The decoding side decodes according to the degree k of each group according to a k-th order exponential-Golomb coding algorithm to obtain a plurality of coefficient values in each group; The coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each group.
[0217] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side obtains the degree k of each group according to the context model; 2. The decoding side decodes according to a fixed-length coding algorithm or a truncated unary code to obtain the group parameter deviation of each group, and updates the degree k of each group according to the group parameter deviation.
[0218] 3. According to the updated degree k of each group, decode according to a k-th order exponential Golomb coding algorithm to obtain a plurality of coefficient values in each group, and a coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each group.
[0219] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side determines the coding method of the current group based on at least one of the coefficients, prediction method, quantization method, and transformation method of one or more groups obtained by decoding. 2. The decoding side decodes according to a decoding method corresponding to the coding method of the current group to obtain the coefficients of the current group. The coding method of the current group may be some combination of Golomb-Rice coding, k-th order exponential Golomb coding, and semi-fixed length coding methods. The following will be described based on a specific example, and the description will be omitted here.
[0220] In one embodiment, in any of the above encoding and decoding schemes, the encoding schemes of at least two groups of the multiple groups of coding units are different.
[0221] In 407, the decoding side reconstructs the coefficients in the coefficient block of the unit to be decoded based on the scanning manner of the unit to be decoded to obtain a reconstructed data block.
[0222] On the decoding side, the coefficients in the coefficient blocks of each group are restored one by one to obtain a reconstructed data block corresponding to the unit to be decoded.
[0223] In one embodiment, the scanning scheme applicable to the embodiment of the present invention may include at least one of raster scan, block scan, horizontal scan, vertical scan, reciprocating scan, diagonal scan, inverse horizontal scan, inverse vertical scan, or Hilbert scan.
[0224] According to the above embodiment of the present invention, the decoding side can derive different scanning methods and derive coefficient grouping methods based on different prediction methods, and such coefficient grouping can combine predicted information and make grouped coefficients more uniform. The encoding side can assign small code words to coefficients with small changes for encoding, so that the encoding method is flexible and the encoding performance can be improved. In addition, by designing multiple fixed grouping methods, it can be more compatible with the semi-fixed length encoding method, and a better binarization method can be flexibly selected for each coding block, and the complexity of the encoding algorithm is low.
[0225] The technical solutions of the embodiments of the present invention will be described below with reference to some specific embodiments.
[0226] Example 1: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0227] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of grouping methods preset by the encoding side and the decoding side, or based on the bitstream.
[0228] Here, the grouping method may include at least one of a fixed-length grouping method, a semi-fixed-length grouping method that performs grouping based on the magnitude of coefficient values, and a grouping method that performs grouping based on the array position of coefficients.
[0229] Specifically, the fixed-length grouping method may, for example, treat the entire encoding target unit as one group, or treat every four coefficients in the entire decoding target unit as one group, or treat every three coefficients in the entire encoding target unit as one group. For example, the encoding target unit is a data unit with 12 rows and 4 columns, that is, a 12×4 encoding target unit, and in the case of a grouping method in which every four coefficients are treated as one group, the 12×4 encoding target unit can be divided into 12 groups. In the case of a grouping method in which every three coefficients are treated as one group, the 12×4 encoding target unit can be divided into 16 groups. In the case of a grouping method in which the entire encoding target unit is treated as one group, the 12×4 encoding target unit can be treated as one group as it is.
[0230] In one example, the grouping method may be a method of grouping based on the array position of the coefficient. Specifically, each coefficient of the whole encoding target unit may be evenly divided into two groups, three groups, four groups, etc. according to the array position. For example, evenly divided into two groups according to a ratio, for example, for a 12×4 encoding target unit, the number of coefficients of the whole decoding target unit is N=48, and evenly divided into two groups according to a 1:1 ratio, the first 24 coefficients in the 12×4 encoding target unit are one group, and the remaining last 24 coefficients are another group.
[0231] In one example, coefficients in the entire unit to be coded may be divided unevenly into two groups, three groups, four groups, etc. according to their positions. For example, they may be divided unevenly into three groups at a division ratio of 2:1:1. That is, according to the arrangement positions of the coefficients, coefficients 1 to 24 in a 12×4 unit to be coded may be group 1, coefficients 25 to 36 may be group 2, and coefficients 37 to 48 may be group 3.
[0232] In one example, the grouping scheme may group based on the number of coefficients in each group, such as one group for every two adjacent coefficients in the entire unit, or one group for every three adjacent coefficients, or one group for every four adjacent coefficients.
[0233] In one example, the grouping scheme may divide a points into groups at intervals based on the array positions of the coefficients in the entire unit to be coded. For example, when a is 1, the coefficients in every other coefficient position in the entire unit to be coded may be divided into two groups. When a is 2, the coefficients in every third coefficient position in the entire unit to be coded may be divided into three groups.
[0234] In one example, the grouping scheme may be grouped based on the magnitude of coefficient values in the unit to be coded. Since the magnitude of coefficient values in the unit to be coded is unpredictable, the number of coefficients in each group after grouping based on the magnitude of coefficient values is generally different, so this type of division scheme may be referred to as a semi-fixed length grouping scheme in the present invention.
[0235] For example, the grouping according to the magnitude of coefficient values may determine whether each coefficient in the current unit is greater than n. There may be one group of coefficients equal to or greater than n and one group of coefficients less than n. Alternatively, there may be one group of coefficients greater than n and one group of coefficients less than or equal to n.
[0236] Here, the value of n may be agreed upon in advance by the encoding side and the decoding side, or may be determined by information exchange, or may be determined by decoding the bitstream.
[0237] For example, the encoding side and the decoding side are n=2 3 Alternatively, the decoding side may predict and determine the value n based on the decoded reconstruction values or predicted values. Alternatively, the decoding side may predict and determine the value n based on the decoded coefficient values.
[0238] For example, the decoding side may predict based on the decoded reconstruction value or the predicted value, determine a value n, and then analyze from the bitstream whether each coefficient value in each group of the currently decoded unit is greater than this predicted value n, and then group the coefficients greater than n into one group and the coefficients less than or equal to n into another group.
[0239] Furthermore, in the above-mentioned multiple grouping methods, after the coefficients in the unit to be coded are grouped, if the number of coefficients in a group is large, secondary grouping may be performed. For example, coefficients in the unit to be coded that are greater than n may be divided into one group, and if the number of coefficients in the group is greater than a preset number of coefficients, secondary grouping may be performed on the group. Specifically, the secondary grouping method may be based on any one of the above grouping methods or a combination of multiple grouping methods.
[0240] In one example, when the coefficients in the unit to be coded are transform coefficients, the grouping scheme may be such that the direct current component DC coefficients of the transform system in the entire unit to be coded are grouped into one group, and the alternating current component AC coefficients are grouped according to any one of the grouping schemes described above or a combination of multiple grouping schemes.
[0241] In step 3, the decoding side decodes the parameters (group_param) of each group using a fixed-length code, and then decodes each coefficient value in each group one by one using the fixed-length code based on the parameters (group_param) of each group to obtain a coefficient block corresponding to the unit to be decoded.
[0242] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0243] In one embodiment, the encoding side and the decoding side may agree or set one or more of the above several grouping methods in advance, and in the process of video encoding and decoding, the encoding side selects one or more grouping methods based on the coefficient status of the encoding target unit to perform grouping encoding. The decoding side may determine the grouping method by a method such as analysis by bitstream, signaling interaction with the encoding side, or context prediction, derivation, and perform grouping analysis on the bitstream based on the determined grouping method. In addition, the decoding side may derive the grouping method of the coefficients in the current decoding target unit based on the prediction direction, prediction mode, or transformation mode of different pixels in the decoding target unit. Specific examples will be described later, so they will not be repeated here.
[0244] In one embodiment, based on the fixed-length grouping encoding method or semi-fixed-length grouping encoding method in Example 1, encoding and decoding of the parameters (group_param) of each group may be performed using any one of the following encoding methods, or a combination of multiple encoding methods.
[0245] 1. Unary code: A simple binarization method. Specifically, for a non-negative integer N, its unary code is represented by N 1s and 1 0.
[0246] 2. Truncated unary code: A variation of the unary code. Specifically, when it is known that the maximum value of the symbol to be encoded is N_max, assuming that the current symbol to be encoded is a non-negative integer N, if N < N_max, the truncated unary code is the unary code, and if N = N_max, the truncated unary code is N 1s.
[0247] 3. Truncated binary code: Calculate correlation variables (such as stage, num0, num1, and thd) of val. For 0 to (thd - 1), the length of its binary symbol sequence is a fixed-length code of stage, and for thd to val, the length of its binary symbol sequence is a fixed-length code of (stage + 1).
[0248] 4. Fixed-length encoding: Encoding the coefficient to be encoded using a fixed code length. For example, the ASCII code that encodes using 8-bit binary numbers.
[0249] 5. k-th Exponential Golomb Coding: k-th Exponential Golomb coding consists of two parts, a prefix and a suffix. The coding method includes: Step 1) writing the number X in binary form, removing the least significant k bits, adding 1 to obtain T; Step 2) calculating the number of bits of T and appending T - 1 zeros in front; Step 3) appending the removed least significant k bits to the end of the bit sequence.
[0250] 6. Truncated Rice Coding: Truncated Rice coding consists of two parts, a prefix and a suffix. Given the maximum upper limit value cMax and the Rice parameter cRice, it encodes the symbol cVal to be encoded.
[0251] The specific coding process includes the following steps. (1) Calculate the prefix, where prefix = cVal >> cRice, and binarize prefix using truncated unary code with cMax >> cRice as the upper limit. (2) Calculate the suffix. When cVal < cMax, suffix = cVal - prefix << cRice; when cVal >= cMax, there is no suffix. The suffix is calculated using a fixed-length code with the number of bits being cRice. As can be seen from the calculation process, when cRice = 0, Truncated Rice coding is equal to truncated unary code. Here, the symbol >> represents a right shift operation, and << represents a left shift operation.
[0252] 7. Huffman Coding: Count the occurrence frequencies of all coefficients, construct a Huffman tree, assign short codewords to coefficients with high probabilities, and assign long codewords to coefficients with low probabilities.
[0253] 8. Golomb-Rice coding: Golomb-Rice is a variation of Golomb coding. The difference from Golomb coding is that the restriction condition of parameter m is that m must be a power of 2. Specifically, parameter m is initialized, m must be a power of 2, q and r are calculated, where q=N / m and r=N(m-1), and q is encoded using a unary code, and the lowest log2(m) bits of the binary bits of r are used as the codeword of r.
[0254] We may also combine fixed-length coding with truncated unary coding to obtain several combination decoding schemes:
[0255] Scheme 1: Use a scheme similar to the truncated unary code, where prefixes greater than (N-1)>>1 are represented as truncated unary codes starting with 1 and ending with 0, and prefixes less than (N-1)>>1 are represented as truncated unary codes starting with 0 and ending with 1.
[0256] Method 2: For prefixes greater than (N-1)>>1, represent them as truncated unary codes starting with 1 and ending with 0, and for prefixes less than (N-1)>>1, represent them as fixed-length codes starting with 0.
[0257] Method 3: For prefixes greater than (N-1)>>1, represent them as fixed-length codes starting with 1, and for prefixes less than (N-1)>>1, represent them as truncated unary codes starting with 0 and ending with 1.
[0258] Scheme 4: Use a scheme similar to the truncated unary code, but for prefixes greater than (N-1)>>1, represent them as truncated unary codes starting with 0 and ending with 1, and for prefixes less than (N-1)>>1, represent them as truncated unary codes starting with 1 and ending with 0.
[0259] Method 5: For prefixes greater than (N-1)>>1, represent them as truncated unary codes starting with 0 and ending with 1, and for prefixes less than (N-1)>>1, represent them as fixed-length codes starting with 1.
[0260] Method 6: For prefixes greater than (N-1)>>1, represent them as fixed-length codes starting with 0, and for prefixes less than (N-1)>>1, represent them as truncated unary codes starting with 1 and ending with 0.
[0261] In addition, in one embodiment, the encoding side may encode the grouping method based on some of the above encoding methods. That is, based on the multiple semi-fixed length grouping methods in the first embodiment, the encoding side and the decoding side may set n types of grouping methods, and then the encoding side may encode the encoding target unit using one of the encoding methods based on the setting, and the decoding side may derive the grouping method used by the decoding target unit based on the bitstream, and perform decoding based on the grouping method.
[0262] In one embodiment, based on the semi-fixed length grouping decoding in the above embodiment 1, a predicted value may be derived in combination with a context model, and then decoded. Specifically, for the group parameter (group_param) of each group in the unit to be decoded, a predicted value (group_param_pred) is first derived from the context, and then the difference (group_delta) between the actual group_param and the predicted group_param_pred is derived using the decoding method in the above embodiment, and the group parameter (group_param) of each group in the unit to be decoded is obtained based on group_param=group_param_pred+group_delta. Next, decoding is performed based on the group parameter and the decoding algorithm to obtain all the coefficients of each group.
[0263] In one embodiment, when fixed-length coding needs to be performed on semi-fixed-length coded coefficients, the coding side may directly code the original pixel values with fixed-length coding for large coefficients, or directly code the reconstructed pixel values with fixed-length coding.
[0264] For example, if the bit width of the original pixel value is 8, and the coding bit width of the coefficient group, group_param, is ≥ 6, or the coding bit width of the coefficient group, group_param, is ≥ 7, then the original pixel value may be directly coded using a fixed-length code of 8, or the reconstructed pixel value may be coded, thereby improving the coding / decoding performance.
[0265] In one embodiment, the decoding side may determine a grouping method for a unit to be decoded by deriving a grouping method for coefficients in the current unit to be decoded based on a prediction direction, a prediction mode, or a transformation mode of different pixels in the unit to be decoded, etc.
[0266] Specifically, the decoding side may derive a grouping method and an encoding method for coefficients in a unit to be decoded based on a prediction mode.
[0267] For example, the current first column uses one prediction mode, and all subsequent columns use horizontal prediction mode. The first point may directly transmit the original value, or may be predicted by the reconstructed value of the previous block. As shown in FIG. 5, taking a 16×4 decoding target unit as an example, after predicting the residual by the current prediction method, all the residual values of the first column are grouped together as shown in FIG. 5 below. The residual values of each row in the remaining coefficient block 15×4 are grouped together, and the number of coefficients in the first group is small, so the grouping is not continued, and the remaining are allowed to be grouped smaller in each group.
[0268] Therefore, the whole block is scanned in the following order: first, vertically scan to get the first group of coefficients, which are then coded, then horizontally scan to get the second group of coefficients, which may then be split into smaller groups from left to right, each of which may use a different coding scheme. The first group of coefficients in the second group are coded using a semi-fixed length, and based on the size of the prefix value used in the first group, if the prefix is smaller than a threshold, the coefficients of the later group are coded using Golomb-Rice, and if the prefix is larger than a threshold, the coefficients of the later group are coded using k-th Golomb, where k is derived from the residual value of the previous group.
[0269] Furthermore, the decoding side may derive a grouping method and an encoding method for coefficients in a unit to be decoded based on the transform mode.
[0270] For example, the encoding side may encode the transform coefficients according to the specific position of the DC coefficient. All DC coefficients may be divided into one group, and all AC coefficients may be divided into one group. If the number of DC coefficients is large, the DC coefficient group may be further divided into subgroups, and if the number of AC coefficients is large, the AC coefficient group may be further divided into subgroups.
[0271] Specifically, since the DC coefficients are relatively large in most cases, a relatively flexible coding method may be used for the DC coefficients. For example, k-th order exponential Golomb coding with finer grouping may be used. When the amplitude values of the DC coefficients are close, coefficient prediction may be performed on the DC coefficients, and the first DC coefficient may be coded using k-th order exponential Golomb coding, and the remaining DC coefficients may be coded by coding the sign of the DC coefficient and the difference with the first DC coefficient. Semi-fixed length coding may be used for coding the difference of the DC coefficients.
[0272] Specifically, since the AC coefficients generally have small coefficient values, the entire AC coefficients may be coded as one group using a semi-fixed length, or the AC coefficients may be divided into two groups (for example, the upper right + lower left as one group and the lower right as another group) and each group may be coded using a semi-fixed length. However, if the amplitude of the AC coefficients is large, two or three coefficients may be coded for the upper right and lower left AC coefficients as one group using Golomb-Rice, and the lower right may be coded using a semi-fixed length.
[0273] Here, the scan order for the encoding target unit may be as follows. First, the entire large block may be divided into DC coefficients and AC coefficients. As shown in FIG. 6, taking a 16×4 encoding target unit as an example, the coefficient distribution after conversion may be as shown in FIG. 6. For DC coefficients, if the entire DC coefficients are coded as one group, raster scan is used for the DC coefficients, otherwise Hilbert scan is used to code the coefficients close to each other together. For AC coefficients, if all AC coefficients are one group, raster scan is used directly for the AC coefficients, otherwise scanning is first performed in the order of upper right, lower left, and lower right, and the coefficients in the upper right, lower left, and lower right are scanned using the raster scan order.
[0274] In another embodiment, taking a 16×4 coding target unit as an example, the coefficient distribution after transformation may be as shown in FIG. 7. The coefficients are divided into two blocks, and transformation is performed within each block. As shown in FIG. 7, when there are only two DC coefficients, there are the following groupings: 1, two DC coefficients are one group, and all AC coefficients are one group. The scan order uses raster scan within each 8×4.
[0275] 2. Divide two DC coefficients into one group, divide all AC coefficients into two groups, and divide each 8x4 into one group (except DC coefficient). The scan order uses raster scan within each 8x4.
[0276] 3. Group two DC coefficients into one group, and divide all AC coefficients into four groups, with each 4x4 being a group (except for the DC coefficient). Use raster scan within each 4x4.
[0277] 4. Group two DC coefficients into one group, divide all AC coefficients into eight groups (8×4, one group for every two columns), and use vertical scanning.
[0278] Based on any of the above grouping schemes, in one embodiment, the encoding side may use k-th order Exponential-Golomb coding for the DC coefficients and semi-fixed length coding for the AC coefficients.
[0279] Example 2: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0280] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0281] In step 3, the decoder decodes the Rice parameter CRice for each group using a fixed-length code, and then decodes each coefficient value in the group using Golomb-Rice.
[0282] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0283] Third embodiment: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0284] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0285] In step 3, the decoder estimates the Rice parameter CRice for each group based on the context, and then decodes each coefficient value in the group using Golomb-Rice.
[0286] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0287] Example 4: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0288] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0289] In step 3, the decoder estimates the Rice parameter CRice of each group based on the context, then uses the fixed-length code to decode the parameter deviation C of each group, and updates the original Rice parameter CRice+C to the Rice parameter CRice, i.e., CRice+=C. Then, it uses Golomb-Rice to decode each coefficient value in the group.
[0290] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0291] Fifth embodiment: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0292] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0293] In step 3, the decoder determines the Rice parameter CRice for each group, and then decodes each coefficient value in the group using Golomb-Rice coding.
[0294] Here, the decoding side can derive the Rice parameter CRice based on the bit stream, and the specific decoding method can be any one of the above-mentioned embodiment 1, such as the decoding process of unary code, truncated unary code, truncated binary code, fixed-length coding, k-th exponential Golomb coding, truncated Rice coding, Huffman coding, or Golomb-Rice coding. The decoding side can combine the decoding by the fixed-length code and the truncated unary code based on the magnitude of the coefficient value to decode the bit stream and obtain the group parameter of each group, and the description is omitted here.
[0295] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0296] Sixth embodiment: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0297] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0298] In step 3, the decoding side estimates the Rice parameter CRice of each group based on the context, then decodes the parameter deviation C of each group using a fixed-length code, where the Rice parameter CRice+=C, and decodes each coefficient value in the group using Golomb-Rice coding.
[0299] Here, the decoding method of the parameter deviation C may be any one of the above-mentioned embodiment 1, such as the decoding process of unary code, truncated unary code, truncated binary code, fixed-length coding, k-th order exponential Golomb coding, truncated Rice coding, Huffman coding, or Golomb-Rice coding, etc. The decoding side may combine the decoding by the fixed-length code and the truncated unary code based on the magnitude of the coefficient value to decode the bit stream and obtain the group parameters of each group, and the description is omitted here.
[0300] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0301] Seventh embodiment: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0302] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0303] In step 3, the decoding side decodes the degree k of each group using a fixed-length code, and then decodes each coefficient value in the group using the kth order exponential Golomb algorithm.
[0304] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0305] Example 8: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0306] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0307] In step 3, the decoding side estimates the order k of each group based on the context, and then decodes each coefficient value in the group using the kth order Exponential Golomb Algorithm.
[0308] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0309] Example 9: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0310] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0311] In step 3, the decoding side estimates the degree k of each group based on the context, then uses a fixed-length code to decode the parameter deviation C of each group, and updates the original degree k+C to degree k, i.e., k+=C. Then, it uses the kth order exponential Golomb to decode each coefficient value in the group.
[0312] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0313] Example 10: In step 1, the decoding side determines the scanning method for the unit to be decoded.
[0314] In step 2, the decoding side analyzes the grouping method of the unit to be decoded based on the n kinds of fixed grouping methods preset by the encoding and decoding side, or based on the bit stream.
[0315] In step 3, the decoding side determines the order k of each group, and then decodes each coefficient value in the group using the kth order Exponential Golomb algorithm.
[0316] Here, the decoding side may derive the degree k based on the bit stream, and the specific decoding method may be any one of the above-mentioned embodiment 1, such as the decoding process of unary code, truncated unary code, truncated binary code, fixed-length coding, k-th order exponential Golomb coding, truncated Rice coding, Huffman coding, or Golomb-Rice coding. The decoding side may combine the decoding by the fixed-length code and the truncated unary code based on the magnitude of the coefficient value to decode the bit stream and obtain the group parameters of each group, and the description is omitted here.
[0317] In step 4, the decoding side restores the coefficients in the coefficient block according to the scanning method of the unit to be decoded to obtain the original data block.
[0318] Example 11: In step 1, the decoding side may calculate pixel gradients in a certain direction using surrounding reconstructed pixel values, calculate one gradient value based on the prediction direction of the current pixel, or calculate a horizontal gradient value or a vertical gradient value based on experience, and quantize the gradients.
[0319] In step 2, the decoding side estimates the value range of the current coefficient based on the context, and estimates the Rice coefficient k value of Golomb-Rice or the order k value of Exponential-Golomb based on the value range.
[0320] Example 12: In step 1, the encoding side estimates the value range of the current coefficient based on the context, and selects one encoding method based on the value range.
[0321] In step 2, the encoding side encodes the current coefficient with the corresponding Golomb encoding method.
[0322] For example, the range of the estimated coefficients is 2 5If it is greater than or equal to 2, estimate the k value of Golomb-Rice coding and encode the current coefficient with Golomb-Rice coding. 5 If it is less than k, estimate the exponential-Golomb k value and encode the current coefficient with exponential-Golomb encoding.
[0323] Or, in one example, the range of the absolute values of the estimated coefficients is 2 5 If it is greater than 1, estimate the k value of the exponential-Golomb coding and encode the current coefficient with the exponential-Golomb coding. 5 If it is, estimate the Golomb-Rice k value and encode the current coefficient with Golomb-Rice coding.
[0324] Furthermore, the range of the coefficient values may take other positive integer values based on empirical values, and is not particularly limited in the embodiments of the present invention.
[0325] Example 13: In step 1, the encoding side estimates the value of the current encoding coefficient based on the context.
[0326] Illustratively, if the true value is greater than the current estimate, code a 1, otherwise code a 0, where code values 0 and 1 each correspond to one encoding scheme.
[0327] In step 2, the encoding side encodes the current coefficient with the corresponding Golomb encoding method.
[0328] For example, 1 corresponds to Exponential-Golomb coding and 0 corresponds to Golomb-Rice coding. If the coding value is 1, estimate the k value of Exponential-Golomb coding based on the context and code the current coefficient with Exponential-Golomb coding. If the coding value is 0, estimate the k value of Golomb-Rice coding and code the current coefficient with Golomb-Rice coding.
[0329] Or, in one example, if the encoding value is 0, estimate the k value of Golomb-Rice encoding based on the context, otherwise estimate the k value of Exponential-Golomb and encode the current coefficient with the corresponding Golomb encoding method.
[0330] Example 14: In step 1, when the encoding side encodes a coefficient, it derives an estimate n of the current encoding coefficient based on the context, and reads from the bitstream whether the current encoding coefficient is smaller than n.
[0331] In step 2, the encoding side encodes coefficients smaller than n using a fixed-length code, and for coefficients larger than n, estimates one k value, decodes them using the Exponential Golomb or Golomb-Rice algorithm, and adds n to the decoded value.
[0332] Example 15: In step 1, when the encoding side performs group encoding of residual coefficients, it derives one estimated value n based on the context, and divides the coefficients to be encoded into two groups based on the estimated value n.
[0333] In step 2, for coefficients smaller than n, the encoding side decodes using a fixed-length code, and for coefficients larger than n, estimates one k value, decodes using Exponential Golomb or Golomb-Rice, and adds n to the decoded value.
[0334] Or, for coefficients less than n, estimate one k value and decode using Exponential-Golomb algorithm, and for coefficients greater than n, estimate one k value, decode using Golomb-Rice algorithm and add n to the decoded value.
[0335] Or, for coefficients less than n, estimate one k value and decode using Golomb-Rice, and for coefficients greater than n, estimate one k value, decode using Exponential-Golomb, and add n to the decoded value.
[0336] Example 16: In step 1, when the encoding side performs group coding of the residual coefficients, it derives an estimated value n based on the context, reads out a correction value delta based on the truncated unary code used in the bitstream, and updates the value of n to n + = delta based on delta. Based on the value of n, it divides the coefficients in the unit to be decoded into two groups.
[0337] In step 2, for coefficients smaller than n, decode using a fixed-length code, and for coefficients larger than n, estimate one k value, decode using the Exponential Golomb or Golomb-Rice code, and add n to the decoded value.
[0338] Or, for coefficients less than n, estimate one k value and decode using Exponential-Golomb algorithm, and for coefficients greater than n, estimate one k value, decode using Golomb-Rice algorithm and add n to the decoded value.
[0339] Or, for coefficients less than n, estimate one k value and decode using Golomb-Rice, and for coefficients greater than n, estimate one k value, decode using Exponential-Golomb, and add n to the decoded value.
[0340] Example 17: In step 1, the encoding side analyzes whether to turn on the run-length encoding mode from the bitstream based on the context information.
[0341] Specifically, based on the encoding coefficients or if there are multiple consecutive equal values in the reconstructed data, turn on the run-length encoding mode; otherwise, turn off the run-length encoding mode and directly use any of the aforementioned encoding methods.
[0342] Exemplarily, the context information may include one of: a) the magnitude of the gradient or the sum of the gradients in each direction of the decoded reconstructed pixel value; b) the magnitude of the gradient or the sum of the gradients in each direction of the neighboring predicted pixel values; c) the magnitude of the gradient or the sum of the gradients in each direction of the decoded coefficients; d) a combined and weighted combination of the magnitudes of the gradient sums of two of a, b, or c; e) a combined and weighted combination of the magnitudes of the gradient sums of three of a, b, or c.
[0343] Example 18: Since the code length of semi-fixed length coding is related to the grouping method and the number of coefficients in a group, there is a large difference in compression ratio or coding performance when the coding side performs coding based on different prediction methods or different image contents. Therefore, it is necessary to agree on a relatively good grouping method, for example, a fixed size grouping method, in advance.
[0344] When decoding multiple fixed block divisions, the block division method of the current coding unit may be decoded first, and then the decoding may be performed according to the fixed division method.
[0345] For example, the unit to be coded may be divided into a number of 2×2 small blocks, which are grouped together as one coding group. Taking a 16×4 unit to be coded as an example, one CL is shared within the group. Coding is performed using a semi-fixed length, and the first CL value is coded using a fixed length, with the code length being 3 or 4 (related to the image bit width N). The second CL value is the difference between the CLs predicted based on the context, and is coded using a truncated unary code. The maximum length of the truncated unary code is N-1.
[0346] As shown in Fig. 8, a 16x4 encoding target unit is grouped into 16 small blocks as shown in Fig. 8(1) according to a grouping method for fixedly dividing the unit into 2x2 small blocks. A Hilbert scan method may be used for scanning between each of the 2x2 small blocks, and for example, the encoding side may scan the encoding target unit in numerical order from 0 to 15 as shown in Fig. 8(2).
[0347] Here, raster scanning may be performed within each CL, that is, the scanning order within each 2×2 small block may be in the order of numbers 0 to 3, as shown in FIG. 8(3).
[0348] Between CL, context prediction may be used, CL0 is directly encoded using a fixed-length code, CL1=(CL1-CL0), and CL2 is encoded using a truncated unary code. n =(CL n -(CL n-2 +CL n-1 *3>>2)) and may be encoded using a truncated unary code.
[0349] CL n-2 and C.L. n-1 Find the reconstructed value of CL n-2 and C.L. n-1 If all the reconstruction values inside are equal or nearly equal, the current 2×2 subblock is equal to the previous CL n-2 and C.L. n-1 Determine whether to directly multiplex the reconstructed values inside the current coding unit. In one example, run-length coding may be used to code the current coding block, and the number of 2×2 small blocks of the coded reconstructed values may be directly used. A fixed-length code may be used to code this number. Based on the number of uncoded CLs in the current coding unit, the fixed-length code length is determined, and since there are a maximum of 15 uncoded units, the fixed-length code length is a maximum of 4 bits.
[0350] In another embodiment, the encoding target unit may be divided into a plurality of 4×1 small blocks as shown in Fig. 9. Taking a 16×4 encoding target unit as an example, the 16×4 encoding target unit may be grouped into 16 small blocks as shown in Fig. 9 according to a grouping scheme that fixedly divides the 16×4 encoding target unit into 4×1 small blocks.
[0351] The encoding methods for multiple components (luminance values or chromaticity values) of image data may or may not be the same.
[0352] In one example, the fixed block division method for the encoding target unit by the encoding side may be 2×1, 1×2, 1×4, 2×4, 4×2, 2×8, 2×16, 4×4, 8×4, or 16×4, etc. The present invention does not particularly limit the division method.
[0353] Illustratively, taking 2×2 fixed block division decoding as an example, the decoding process on the decoding side mainly includes the following steps:
[0354] 1) If the current block is the first block, decode the CL value of the 0th block using a fixed-length code, and based on the CL value, decode four coefficient values using a fixed-length code, and store the positions of the four coefficient values in the first 2x2 small block in raster scan order.
[0355] 2) If the current block is not the first block, analyze whether the reconstructed values of previous blocks are equal or not based on the CL values (whether the first one or two cls are 0), if the first two CL values are 0, analyze one flag, i.e., whether the current block uses previous coefficient values or reconstructed values directly. If the current block uses previous coefficient values or reconstructed values directly, do not analyze the current block; otherwise, go to step 3 and continue decoding.
[0356] 3) If the current block is not the first block, use the truncated unary code to decode the residual value between the CL value of the current block and the CL value of the previous block to obtain the CL value of the current block, and decode the four coefficient values in the block using the fixed-length code. Store each 2x2 small block in order according to the Hill-bit scan order.
[0357] Note that a 16×4 encoding target unit needs to analyze a total of 16 2×2 sub-blocks. If the CL value of the current group is equal to or greater than the image bit width, the current group will directly encode the original value or reconstructed value.
[0358] Nineteenth embodiment: A case where decoding is performed using a non-fixed size block division method will be described below in combination with a specific embodiment.
[0359] In step 1, the prediction scheme of the current block is derived, and the prediction mode of each pixel in the current block is obtained and grouped according to the prediction mode.
[0360] In step 2, if the current block groups pixels when predicting, group the current block according to a prediction grouping scheme. Otherwise, if the current block directly predicts points when predicting, the current block may be grouped according to the prediction direction of each point.
[0361] In step 3, the coefficients in each group are decoded based on the prediction order: if the prediction order is from top-left to bottom-right, the coefficients after grouping are decoded in the same order, and if the prediction order is from left to right, the coefficients after grouping are decoded in the same order.
[0362] In step 4, it is derived whether or not transform coding is used in each group.
[0363] In step 5, if transform coding is used in the current group, if the current group is the first group, derive the order k based on the empirical value or the previous coding block, and decode the DC coefficient using kth order Golomb; if the current group is not the first group, estimate the DC coefficient k of the current group based on the value of the DC coefficient of the previous group, and decode it using kth order Golomb.
[0364] 1) For the remaining coefficients, if the value of the DC coefficient is greater than the threshold, analyze from the bitstream whether the last 1 / 2 coefficients (i.e., the coefficients in the high frequency part) of the current group are all 0. If so, determine the number of remaining coefficients other than the DC coefficient and the 0 coefficient in the current group of coefficients as the number of coefficients that need to be coded.
[0365] 2) If the number of coefficients is less than 3, the remaining coefficients are coded using Golomb-Rice, the Rice coefficient C for the first coded coefficient is derived based on the quantization step and the value of the DC coefficient, and decoded using Golomb-Rice, and the Rice coefficient C for the subsequent coefficients is derived based on the magnitude of the previous coefficient value, and decoded using Golomb-Rice. If the number of coefficients is more than 3, they are coded using semi-fixed length, and if there is a non-zero coefficient in the 1 / 2 coefficient after the previous group (i.e., the coefficient in the high frequency part), it is processed according to 2).
[0366] 3) Analyze whether the last 1 / 4 coefficients of the current group (i.e., the coefficients of the high frequency part) are all 0 from the bitstream, and if the last 1 / 4 coefficients of the current group are all 0, process the coefficients other than the DC coefficient and the last 1 / 4 coefficient according to 2), otherwise process all coefficients other than the DC coefficient according to 2. If the value of the DC coefficient is less than a threshold, process according to 3).
[0367] In step 6, if transform coding is not used in the current group, for the coefficients in the group, derive a quantization step for the coefficients in the current group, and perform decoding based on the quantization step and the coefficient values in the time domain of the previous group.
[0368] 1) First, estimate the average value of the absolute values of the coefficients in the current group. 2) Then, decode the comparison result between the absolute values of all coefficients in the current group and the estimated average value, and perform secondary grouping based on the comparison result, with those larger than the average value as one group and those smaller than the average value as another group. 3) After secondary grouping, based on the number of coefficients in the group, if the number of coefficients in the group smaller than the average value is 4 or more, decode using semi-fixed length, otherwise, decode using Golomb-Rice for the group smaller than the average value.
[0369] For the coefficients in the group larger than the average value, if the number of coefficients is larger than 4 and the estimated average value is smaller than the threshold, decode using the semi-fixed length, otherwise decode using the k-th order exponential Golomb method, where the k and C values may be estimated based on the estimated average value, or may be obtained based on the estimated average value and one parameter analyzed on the decoding side.
[0370] Example 20: in step 1, after determining grouping method, the decoding side determines whether the number x of coefficients in the current group is greater than threshold m. For example, when m=30 and x=32, the decoding side determines that the number x of coefficients in the current group is greater than threshold m.
[0371] In step 2, the decoding side analyzes up to n positions from the bitstream, which represent the positions of the n outlier (large amplitude coefficients in the group) points in the current group (e.g., n=2), and the positional encoding is decoded using a fixed length code, where the code length is related to the magnitude of the x value (for x=32, the code length is 5).
[0372] In step 3, the decoding side decodes the coefficient values in other positions of the current group.
[0373] Here, the method for decoding the coefficient values at other positions in the current group may be the aforementioned semi-fixed length decoding, exponential Golomb decoding, Golomb-Rice decoding, Huffman decoding, or the like.
[0374] In step 4, the decoding side decodes the abnormal value using k-th order exponential Golomb decoding, and determines the amplitude of the abnormal point as the sum of the amplitude after decoding and the maximum amplitude of the other position coefficient values.
[0375] Example 21: In step 1, after determining grouping method, the decoding side determines whether the number x of coefficients in the current group is greater than threshold m. For example, when m=30 and x=32, the decoding side determines that the number x of coefficients in the current group is greater than threshold m.
[0376] In step 2, the decoding side decodes the maximum amplitude in the current group using a fixed-length code, and decodes the minimum amplitude in the current group using a fixed-length code based on the value of the maximum amplitude. Based on the range of the values of the maximum and minimum amplitudes, decode all coefficients in the current group.
[0377] Specifically, if the maximum amplitude is equal to the minimum amplitude, the coefficients of the entire group do not need to be decoded; if the difference between the maximum amplitude and the minimum amplitude is 1, each coefficient of the entire group only needs a 1-bit fixed-length code to be decoded; if the difference between the maximum amplitude and the minimum amplitude is less than n (e.g., n=15), the coefficients of the remaining positions in the current group may be decoded using a fixed-length code. For example, if n=15, a 4-bit fixed-length code may be used for decoding.
[0378] If the difference between the maximum and minimum amplitudes is greater than n, select an appropriate order k based on the difference, and use the kth order Exponential Golomb to decode the coefficients in the current group.
[0379] It should be noted that the above-mentioned embodiments of the present invention may be combined with each other, for example, multiple different grouping methods in embodiment 1 may be applied to other embodiments, different encoding / decoding algorithms in embodiment 2 may be applied to other embodiments, and multiple different encoding / decoding algorithms may be used in combination as necessary.
[0380] Based on the above embodiment, the present invention further provides a video encoding device and a corresponding video decoding device, and the present invention is called a video encoding / decoding device. With reference to the above FIG. 1 to FIG. 3, as shown in FIG. 10, the device 1000 may include a transceiver module 1001 and a processing module 1002.
[0381] The transceiver module 1001 may be used to obtain a bitstream of a unit to be decoded.
[0382] The processing module 1002 may be used to determine a scanning scheme, a grouping scheme, and an encoding scheme corresponding to each group of the unit to be decoded, decode based on the encoding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded, and reconstruct coefficients in the coefficient blocks of each group one by one based on the scanning scheme of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded.
[0383] In one embodiment, the grouping scheme includes at least one of a fixed length grouping scheme, a semi-fixed length grouping that groups based on the magnitude of the coefficient values, and a grouping based on the array position of the coefficients.
[0384] In one embodiment, the encoding scheme includes at least one of a unary code, a truncated unary code, a truncated binary code, a fixed length code, a semi-fixed length code, a k-th order exponential Golomb coding, a truncated Rice coding, a Huffman coding, and a Golomb-Rice coding.
[0385] In one embodiment, the scanning scheme includes at least one of a raster scan, a block scan, a horizontal scan, a vertical scan, a reciprocating scan, a diagonal scan, an inverse horizontal scan, an inverse vertical scan, and a Hilbert scan.
[0386] In one embodiment, the reconstructed data block is a data block consisting of one of original pixel values of the image to be decoded, residual values obtained by predicting the original pixel values, coefficients obtained by quantizing the residual values, or transform coefficients obtained by transforming the residual values.
[0387] In one embodiment, the processing module 1002 specifically: Determine at least one of a scanning method, a grouping method, and a coding method corresponding to each group for the unit to be decoded based on a prior agreement between the encoding side and the decoding side or context information; or Analyzing based on the bitstream to obtain at least one of a scanning method, a grouping method, and a coding method corresponding to each group of the unit to be decoded; or The grouping scheme is obtained based on a prediction scheme, a quantization scheme and / or a transformation scheme of the unit to be decoded.
[0388] In one embodiment, the processing module 1002 specifically: Decoding according to the encoding algorithm to obtain group parameters for each group; Decoding the semi-fixed length coding algorithm based on the group parameters of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0389] In one embodiment, the processing module 1002 specifically: The group parameters of each group are obtained by decoding based on a decoding method corresponding to at least one of the encoding methods of unary code, truncated unary code, truncated binary code, fixed-length coding, k-th exponential-Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.
[0390] In one embodiment, the processing module 1002 specifically: Decode according to a fixed-length coding algorithm to obtain group Rice parameters for each group, or obtain group Rice parameters for each group based on a context model; Decoding the Rice parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0391] In one embodiment, the processing module 1002 specifically: Obtain group Rice parameters for each group based on the context model; Decode according to a fixed-length coding algorithm or a truncated unary code to obtain the group parameter deviation of each group; obtaining a group parameter for each group based on the group Rice parameter and the group parameter deviation for each group; decoding the group parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0392] In one embodiment, the processing module 1002 specifically: Decode according to a fixed-length coding algorithm to obtain the degree k of each group, or obtain the degree k of each group based on a context model; Decoding according to a k-th order exponential-Golomb coding algorithm based on the degree k of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each of the groups.
[0393] In one embodiment, the processing module 1002 specifically: Obtain the degree k of each group based on the context model; Decode according to a fixed-length coding algorithm or a truncated unary code to obtain the group parameter deviation of each group; updating the order k of each group based on the group parameter deviation; Decoding the k-th order exponential-Golomb coding algorithm according to the updated order k of each group to obtain a plurality of coefficient values in each group; A coefficient block corresponding to the current unit to be decoded includes a plurality of coefficient values in each group.
[0394] In one embodiment, the processing module 1002 specifically: determining an encoding method for the current group based on at least one of the coefficients, the prediction method, the quantization method, and the transformation method of the one or more groups obtained by decoding; used to obtain coefficients of the current group by decoding according to a decoding scheme corresponding to the encoding scheme of the current group; The coding schemes in the current group are some combination of Golomb-Rice coding, k-th order exponential-Golomb coding, and semi-fixed length coding schemes.
[0395] In one embodiment, the coding schemes of at least two of the multiple groups of coding units are different.
[0396] In one embodiment, when the decoding method of the decoding target unit is either Golomb-Rice coding or k-th order exponential-Golomb coding, the processing module 1002 specifically: The grouping method is used to obtain a grouping method for the unit to be decoded based on a prediction method, a quantization method, and / or a transformation method for the unit to be decoded.
[0397] Correspondingly, the present invention provides a video encoding device, as shown in FIG. 10, the device 1000 includes: a transceiving module 1001 and a processing module 1002 .
[0398] Here, the processing module 1002 is used to scan a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence, group the coefficient sequence in a first grouping manner to obtain multiple groups of subsequences to be coded, determine a coefficient coding manner corresponding to the subsequences to be coded in each group, and code them one by one to obtain a coded bitstream.
[0399] The transceiver module 1001 is used to transmit the encoded bitstream to the decoding side.
[0400] In one embodiment, the grouping scheme includes at least one of a fixed length grouping scheme, a semi-fixed length grouping that groups based on the magnitude of the coefficient values, and a grouping based on the array position of the coefficients.
[0401] In one embodiment, the encoding scheme includes at least one of a unary code, a truncated unary code, a truncated binary code, a fixed length code, a semi-fixed length code, a k-th order exponential Golomb coding, a truncated Rice coding, a Huffman coding, and a Golomb-Rice coding.
[0402] In one embodiment, the scanning scheme includes at least one of a raster scan, a block scan, a horizontal scan, a vertical scan, a reciprocating scan, a diagonal scan, an inverse horizontal scan, an inverse vertical scan, and a Hilbert scan.
[0403] In one embodiment, the data block to be encoded is a data block consisting of one of original pixel values of the image to be encoded, residual values obtained by predicting the original pixel values, coefficients obtained by quantizing the residual values, or transformation coefficients obtained by transforming the residual values.
[0404] Specifically, the video encoding / decoding device provided in the present invention may be realized by the encoder and decoder shown in Figures 2 and 3, forming the encoding / decoding system shown in Figure 1. Please refer to Figures 1 to 3 for the schematic diagram of the internal structure of the device, and the description will be omitted here.
[0405] The electronic device provided in the embodiment of the present invention may be a notebook computer, a tablet computer, a desktop computer, a portable computer, etc., and the embodiment of the present invention is not limited thereto.
[0406] Fig. 11 is a hardware configuration diagram of an electronic device provided in an embodiment of the present invention. As shown in Fig. 11, the electronic device includes a processor 111 and a computer-readable storage medium 112. The computer-readable storage medium 112 stores computer-executable instructions executable by the processor 111, and the processor 111 executes the computer-executable instructions to perform the method disclosed in any of the above embodiments of the present invention.
[0407] For example, the processor 111 may execute computer-executable instructions to obtaining a bitstream of a unit to be decoded; determining a scanning method, a grouping method, and an encoding method corresponding to each group of the units to be decoded; Decoding the units according to the encoding scheme of each group to obtain coefficient blocks corresponding to the units to be decoded; and restoring the coefficients in the coefficient blocks of each group one by one based on the scanning manner of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded.
[0408] For example, the processor 111 may execute computer-executable instructions to Scanning a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence; grouping the coefficient sequence according to a first grouping scheme to obtain a plurality of groups of to-be-coded subsequences; determining a coefficient coding scheme corresponding to the subsequences to be coded in each group, and coding them one by one to obtain a coded bitstream.
[0409] 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 by 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, the procedure or function according to the embodiment of the present invention is generated in whole or in part. 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 a 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.) method. The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be magnetic media (e.g., floppy disks, magnetic disks, or magnetic tapes), optical media (e.g., digital video discs (DVDs)), semiconductor media (e.g., solid state drives (SSDs)), and the like.
[0410] From the above description of the embodiments, it is obvious to those skilled in the art that for convenience and simplicity of description, only the division of each of the above functional modules is described as an example, and in actual application, the above functions can be assigned to different functional modules to be completed as necessary, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. For specific operation processes of the above systems, devices, and units, please refer to the corresponding processes in the above method examples.
[0411] It should be understood that in some embodiments provided in the present invention, the disclosed system, device, and method can be realized in other forms. The above device embodiments are merely exemplary, for example, the division of the above modules or units is merely a division of logical functions, and in actual implementation, other division methods may exist, 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 discussed mutual couplings or 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.
[0412] The units described as separate components may or may not be physically separate, and the components described as units may or may not be physical units, i.e., they may be located in the same place or may be arranged in multiple network units. In order to achieve the purpose of the technical solution of this embodiment, some or all of the above units may be selected according to actual needs.
[0413] In addition, with respect to each functional unit in each embodiment of the present invention, all units 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 above-mentioned integrated units may be realized in the form of hardware or software functional units.
[0414] The above integrated units may be realized in the form of a software functional unit and stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution according to the present invention, in other words the part contributing to the prior art or all or a 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 one computer device (which may be a personal computer, a server, or a network device, etc.) or a processor execute all or a part of the steps in the method described in each embodiment of the present invention. The aforementioned storage medium may include various media capable of storing program code, such as a flash memory, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0415] The above is merely a specific embodiment of the present invention, and the protection scope of the present invention is not limited thereto. Any changes or replacements within the technical scope disclosed in the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for decoding a video image, comprising the steps of: obtaining a bitstream of a unit to be decoded; determining a scanning mode for the unit to be decoded; Analyzing a grouping manner of the decoding target unit based on the bitstream; Decoding based on the bitstream to obtain group parameters for each group; A step of decoding based on the group parameters of each group to obtain a plurality of coefficient values in each group, wherein a coefficient block corresponding to the decoding target unit includes a plurality of coefficient values in each group; and recovering coefficients in the coefficient block corresponding to the unit to be decoded based on the scan method of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded; The step of decoding based on the bitstream and obtaining group parameters for each group includes: Decoding the bit stream by combining a fixed-length code and a truncated unary code based on the magnitude of the coefficient value to obtain a group parameter for each group; The step of decoding based on the group parameters of each group to obtain a plurality of coefficient values in each group includes: Decoding the coefficients of each group using a fixed length code based on the group parameters of each group to obtain a plurality of coefficient values in each group.
13. A video image decoding method comprising:
2. The scanning method includes vertical scanning; 2. The method of claim 1 .
3. The grouping method includes a fixed length grouping method or a grouping method based on an array position of coefficients, The fixed length grouping method includes grouping the entire unit to be decoded into one group, or grouping every four coefficients in the entire unit to be decoded into one group; The grouping method based on the array position of the coefficients includes: grouping the coefficients of the entire unit to be decoded unevenly according to their positions; or grouping the coefficients of the entire unit to be decoded evenly according to their positions.
2. The method of claim 1 .
4. An image encoding method, comprising: scanning a data block to be coded in an original image in a first scanning manner to obtain a coefficient sequence, the first scanning manner including a vertical scan; a step of grouping the coefficient sequence in a first grouping scheme to obtain a plurality of groups of subsequences to be coded, the first grouping scheme including a fixed length grouping scheme or a grouping scheme based on an array position of the coefficients, the fixed length grouping scheme including grouping the entire data block to be coded as one group, or grouping every four coefficients in the entire data block to be coded as one group, and the grouping scheme based on the array position of the coefficients including grouping the coefficients of the entire data block to be coded unevenly according to their positions, or grouping the coefficients of the entire data block to be coded evenly according to their positions; determining a coefficient coding scheme corresponding to each group of to-be-coded subsequences; and coding coefficient values in each group of to-be-coded subsequences one by one to obtain a coded bitstream; Then, encoding a plurality of coefficient values in the to-be-encoded subsequence of each group according to a group parameter of the to-be-encoded subsequence of each group to obtain an encoded bitstream; encoding a plurality of coefficient values in each group of to-be-coded subsequences based on group parameters of the to-be-coded subsequences to obtain a coded bitstream, encoding a plurality of coefficient values in each group of to-be-coded subsequences using a fixed length code based on a group parameter of the to-be-coded subsequences in each group to obtain a coded bitstream; wherein the group parameters of the to-be-coded subsequences of each group are coded, and the coded bitstream includes the coded group parameters; Encoding the group parameters of the encoding target subsequence of each group includes: encoding a group parameter of the encoding target subsequence of each group using a combination of a fixed length code and a truncated unary code based on the magnitude of the coefficient value; 13. A video image coding method comprising:
5. A video image decoding device, comprising: a transceiver module used to obtain a bitstream of a unit to be decoded; a processing module for determining a scan mode of the unit to be decoded, analyzing a grouping mode of the unit to be decoded based on the bitstream, decoding based on the bitstream, obtaining group parameters for each group, decoding based on the group parameters for each group to obtain a plurality of coefficient values in each group, and restoring coefficients in a coefficient block corresponding to the unit to be decoded based on the scan mode of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded, wherein the coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values in each group; The processing module, when decoding based on the bitstream and obtaining group parameters for each group, A fixed-length code and a truncated unary code are combined to decode the bit stream based on the magnitude of the coefficient value, and used to obtain group parameters for each group; When the processing module performs decoding based on the group parameters of each group to obtain a plurality of coefficient values in each group, Decoding the group parameters of each group using a fixed length code to obtain a plurality of coefficient values in each group.
23. A video image decoding device comprising:
6. An image encoding device, comprising: a processing module for scanning a data block to be coded in an original image using a first scanning method to obtain a coefficient sequence, grouping the coefficient sequence using a first grouping method to obtain a plurality of groups of subsequences to be coded, determining a coefficient coding method corresponding to the subsequence to be coded for each group, and coding coefficient values in the subsequence to be coded for each group one by one to obtain a coded bitstream, wherein the first scanning method includes a vertical scan, and the first grouping method includes a fixed-length grouping method or a grouping method based on an array position of coefficients, the fixed-length grouping method includes grouping the entire data block to be coded as one group, or grouping every four coefficients in the entire data block to be coded as one group, and the grouping method based on an array position of coefficients includes grouping the coefficients of the entire data block to be coded unevenly according to their positions, or grouping the coefficients of the entire data block to be coded evenly according to their positions; a transceiver module for transmitting the encoded bitstream to a decoding side; the processing module is adapted to encode coefficient values in each group of to-be-coded subsequences based on group parameters of the to-be-coded subsequences to obtain an encoded bitstream; When the processing module encodes the coefficient values in each group of to-be-coded subsequences according to the group parameters of the to-be-coded subsequences to obtain an encoded bitstream, encoding a plurality of coefficient values in each group of to-be-coded subsequences using a fixed length code based on a group parameter of each group of to-be-coded subsequences to obtain an encoded bitstream; the processing module is adapted to code group parameters of each group of subsequences to be coded, the coded bitstream comprising the coded group parameters; The processing module, when encoding the group parameters of the encoding target subsequences of each group, a combination of fixed length codes and truncated unary codes is used to code group parameters of the subsequences to be coded for each group based on the magnitude of the coefficient values; 1. A video image encoding device comprising:
7. An electronic device including a processor and a memory, the memory is used to store computer instructions; The processor is adapted to retrieve and execute the computer instructions from the memory to perform the method according to any one of claims 1 to 4.
1. An electronic device comprising:
8. A readable storage medium for storing a computer program or instruction, When the computer program or instructions are executed by an electronic device, the method according to any one of claims 1 to 4 is performed. A readable storage medium.