Video encoding / decoding method and apparatus

The video encoding/decoding method optimizes coefficient grouping and decoding through flexible encoding schemes and scanning methods, addressing high complexity and poor performance issues in existing methods, resulting in improved encoding efficiency.

JP7739618B2Active Publication Date: 2025-09-16HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024527664
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-11-11
Filing Date
2022-11-09
Publication Date
2025-09-16
Estimated Expiration
2042-11-09

AI Technical Summary

Technical Problem

Current lossless (including near-lossless) encoding/decoding methods, such as context-based adaptive binary arithmetic coding (CABAC) and Golomb-Rice coding, suffer from high complexity and poor performance due to redundant calculations during the encoding process.

Method used

A video encoding/decoding method that employs flexible encoding schemes like unary coding, truncated unary coding, truncated binary coding, fixed-length coding, semi-fixed length coding, k-th order exponential Golomb coding, truncated Rice coding, and Golomb-Rice coding, combined with various scanning methods like raster scan, block scan, and Hilbert scan, to optimize coefficient grouping and decoding processes.

Benefits of technology

The method improves encoding performance by making encoding more flexible and compatible with semi-fixed-length coding methods, reducing complexity and enhancing compatibility with different binarization techniques.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007739618000008
    Figure 0007739618000008
  • Figure 0007739618000009
    Figure 0007739618000009
  • Figure 0007739618000010
    Figure 0007739618000010
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and provides a video coding and decoding method and device for solving the problem of low performance of video coding and decoding or high complexity of coding and decoding algorithm in the prior art. The method includes the steps of: obtaining a bitstream of a unit to be decoded at a decoding side; determining a scanning method, a grouping method, and a coding method corresponding to each group of the unit to be decoded; decoding according to the coding method of each group to obtain a coefficient block corresponding to the unit to be decoded; and recovering coefficients in the coefficient block of each group one by one according to the scanning method of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded.
Need to check novelty before this filing date? Find Prior Art

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, video compression is typically performed using video coding to effectively store and transmit video. Image compression primarily includes lossy and lossless compression. Lossless compression exploits the statistical redundancy of image data, allowing the original image to be completely restored without distortion. When there is an error between the reconstructed image and the original image, and this error is limited to a certain range, it is called near-lossless compression. While near-lossless compression introduces some distortion, it is negligible for visual images, so near-lossless compression can also be considered lossless compression.

[0003] Current lossless (including near-lossless) encoding / decoding methods, such as the context-based adaptive binary arithmetic coding (CABAC) compression method, involve many algorithms, such as probability models, context modeling, and binary arithmetic coding, resulting in a complex processing process. Furthermore, the Golomb-Rice coding method, based on Golomb coding, requires redundant calculations during the encoding process, resulting in poor performance. Therefore, there is an urgent need to develop a video encoding / decoding method with high encoding / decoding efficiency and low algorithm complexity. Summary of the Invention

[0004] The present invention provides a video encoding / decoding method and apparatus for solving the problems of low performance or high complexity of the video encoding / decoding algorithm 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 in which a decoding side obtains 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 unit to be decoded; decoding the data based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit; and 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 unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, k-th order exponential Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.

[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 vertical scanning.

[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 units 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 unit 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 a coding 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 unit to be decoded; or The method includes a step of determining a scanning method, a grouping method, and a coding method corresponding to each group for at least one type of unit to be decoded based on a prior agreement between the encoding side and the decoding side, and analyzing the bitstream based on the scanning method, the grouping method, and the coding method corresponding to each group for the at least one type of unit to be decoded to obtain at least one of the scanning method, the grouping method, and the coding method corresponding to each group for the unit to be decoded.

[0015] In one embodiment, the step of decoding based on the coding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded includes: decoding according to an encoding algorithm to obtain group parameters for each group; and decoding the data in accordance with the semi-fixed length coding algorithm based on the group parameters of each group 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 of the groups.

[0016] In one embodiment, the step of decoding according to the encoding algorithm to obtain group parameters for each group comprises: The method includes a step of obtaining group parameters for each group by decoding based on a decoding method corresponding to at least one of unary coding, truncated unary coding, truncated binary coding, fixed-length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.

[0017] In one embodiment, the step of decoding based on the coding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded 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 data according to the group Rice parameters of each group according to a 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 of the groups.

[0018] In one embodiment, the step of decoding based on the coding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded 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 data according to the group parameters of each group according to a 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 of the groups.

[0019] In one embodiment, the step of decoding based on the coding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded includes: Decoding according to a fixed-length coding algorithm to obtain the degree k of each group, or obtaining the degree k of each group based on a context model; and decoding the k-th order exponential-Golomb coding algorithm based on the order k of each group 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 of the groups.

[0020] In one embodiment, the step of decoding based on the coding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded 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 order k of each group 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.

[0021] In one embodiment, the step of decoding based on the coding scheme of each group to obtain a coefficient block corresponding to the unit to be decoded includes: determining a coding scheme for the current group based on at least one of coefficients, prediction schemes, quantization schemes, and transformation schemes of the one or more groups obtained by decoding; and decoding the current group of coefficients based on a decoding scheme corresponding to the encoding scheme of the current group, to obtain the current group of coefficients; 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 kth order exponential-Golomb coding, determining the grouping method of the unit to be decoded includes: The method includes obtaining 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.

[0024] According to the above embodiment of the present invention, the decoding side can derive different scanning methods and 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 variations for encoding, thereby making the encoding method more flexible and improving encoding performance. In addition, by designing multiple fixed grouping methods, it can be more compatible with semi-fixed-length coding methods, and a better binarization method can be flexibly selected for each coding block, resulting in a low complexity encoding algorithm.

[0025] According to a second aspect, a video image sign How to change A method is provided, the method comprising: A step in which an encoding side scans a data block to be encoded in an original image using a first scanning method to obtain a coefficient sequence; grouping the coefficient sequence according to a first grouping scheme to obtain a plurality of groups of subsequences to be coded; determining a coefficient coding method 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 unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and 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 coded is a data block consisting of one of original pixel values ​​of the image to be coded, 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.

[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 method, a grouping method, and an encoding method corresponding to each group of the units to be decoded; Decoding the data based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit; and a processing module used to reconstruct the coefficients in the coefficient blocks of each group one by one based on the scanning method 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 unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and 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 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 method is obtained based on the prediction method, quantization method, and / or transformation method 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 is performed according to the semi-fixed length coding algorithm based on the group parameters of each group 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 of the groups.

[0037] In one embodiment, the processing module specifically: The group parameters of each group are obtained by decoding the data based on a decoding method corresponding to at least one of unary coding, truncated unary coding, truncated binary coding, fixed-length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.

[0038] In one embodiment, the processing module specifically: 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; Decoding the Rice parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values ​​for each group; The 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 the fixed-length coding algorithm or 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 data in accordance with a Golomb-Rice coding algorithm based on the group parameters of each group 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 of the groups.

[0040] In one embodiment, the processing module specifically: Decoding according to a fixed-length coding algorithm to obtain the degree k of each group, or obtaining the degree k of each group based on a context model; Decoding the k-th order exponential-Golomb coding algorithm based on the order k of each group 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 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 the fixed-length coding algorithm or 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 is performed according to the updated order 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.

[0042] In one embodiment, the processing module specifically: determining an encoding method for the current group based on at least one of the coefficients, prediction method, quantization method, and transformation method of the one or more groups obtained by decoding; is used to obtain coefficients of the current group by decoding according to a decoding scheme corresponding to the coding 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: The grouping method is used to obtain the grouping method of the unit to be decoded based on the prediction method, quantization method and / or transformation method of 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 to scan a data block to be coded in an original image using a first scanning method to obtain a coefficient sequence, group the coefficient sequence using a first grouping method to obtain a plurality of groups of sub-sequences to be coded, determine a coefficient coding method corresponding to each group of the sub-sequence to be coded, and code the sub-sequences one by one to obtain a coded bitstream; The transceiver module is used to transmit the coded 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 unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and 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 coded is a data block consisting of one of original pixel values ​​of the image to be coded, 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.

[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 There is provided a decoding apparatus, 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, the apparatus including 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 containing 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 processor causes the computer or processor to perform the method of the first aspect.

[0060] According to a fifteenth aspect, there is provided a computer application program, which when run on a computer or processor causes the computer or processor to perform the method of 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 method of the unit to be decoded based on the bitstream; decoding based on the bitstream to obtain group parameters for each group; decoding the plurality of coefficient values ​​for each group based on the group parameters; 、 and reconstructing coefficients in the coefficient block corresponding to the unit to be decoded based on the scanning method of the unit to be decoded to obtain a reconstructed data block corresponding to the unit to be decoded; The 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 vertical scanning.

[0063] In one embodiment, the grouping method includes a fixed-length grouping method or a grouping method based on the array position of the coefficients, and 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, and 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.

[0064] In one embodiment, the step of decoding based on the bitstream and obtaining group parameters for each group comprises: The method includes a step of decoding the bitstream by combining a fixed-length code and a truncated unary code based on the magnitude of the coefficient values, and obtaining group parameters 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 comprises: The method includes a step of decoding using a fixed-length code based on the group parameters of 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 using a first scanning method to obtain a coefficient sequence; grouping the coefficient sequence according to a first grouping scheme to obtain a plurality of groups of subsequences to be coded; determining a coefficient coding method 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 vertical scanning, and the first grouping method includes a fixed-length grouping method or a grouping method based on the arrangement position of coefficients, where the fixed-length grouping method includes grouping the entire data block to be coded into one group, or grouping every four coefficients in the entire data block to be coded into one group, and the grouping method based on the arrangement 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.

[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 to obtain group parameters for each group, decode based on the group parameters for each group to obtain multiple 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, The 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 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 sub-sequences to be coded, determining a coefficient coding method corresponding to each group of the sub-sequence to be coded, and coding the sub-sequences one by one to obtain a coded bitstream; a transceiver module used to transmit the encoded bitstream to a decoding side; The first scanning method includes vertical scanning, and the first grouping method includes a fixed-length grouping method or a grouping method based on the arrangement position of coefficients, where the fixed-length grouping method includes grouping the entire data block to be coded into one group, or grouping every four coefficients in the entire data block to be coded into one group, and the grouping method based on the arrangement 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.

[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 and 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 of the corresponding methods provided above, and description thereof will be omitted here. [Brief explanation of the drawings]

[0072] [Figure 1] 1 is an architecture diagram of an encoding / decoding system according to an embodiment of the present invention. [Figure 2] FIG. 2 is a diagram illustrating the internal architecture of an encoder according to an embodiment of the present invention. [Figure 3] FIG. 2 is a diagram illustrating the internal architecture of a decoder according to an embodiment of the present invention. [Figure 4A] 1 is a flowchart of video encoding and 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. [Figure 5] 1 is a schematic diagram of a unit to be decoded in a video encoding / decoding method according to an embodiment of the present invention. [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] 1 is a schematic diagram of a data portion in a unit to be decoded in a video encoding / decoding method according to an embodiment of the present invention. [Figure 8] 1 is a schematic diagram of a grouping method of units to be decoded 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 of units to be decoded in a video encoding / decoding method according to an embodiment of the present invention. [Figure 10] 1 is a schematic diagram illustrating the configuration of a video encoding / decoding device according to an embodiment of the present invention. [Figure 11] 1 is a hardware configuration diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0073] In the following, the terms "first" and "second" are for explanatory purposes only and should not be understood as indicating or implying relative importance or the number of technical features shown. Therefore, a feature qualified as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this embodiment, "plurality" means two or more unless otherwise specified.

[0074] It should be noted that, in the present invention, the terms "exemplary" or "for example" are 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 terms "exemplary" or "for example" is intended to specifically present a related concept.

[0075] Hereinafter, the technical solutions in the embodiments of the present invention will be clearly and completely described 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 work fall within the scope of protection 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 series is called a video sequence or may also be called an image sequence.

[0077] Video coding technology: Video sequences contain a series of redundant information, including 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 from video sequences and reduce the amount of data representing the video, video coding technology has been proposed, achieving the effects of reducing storage capacity and saving transmission bandwidth. Video coding technology is also known as video compression technology.

[0078] The video coding process generally includes processes such as prediction, transformation, quantization, and entropy coding, and the quantized transform coefficients can be coded by entropy coding. The specific processes will be described later, so the description is omitted here.

[0079] In the internationally applicable range, there are video compression coding 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 known as the High Efficiency Video Coding standard, HEVC) formulated by the International Telecommunication Union-Telecommunication Standardization Sector (ITU-T).

[0080] In addition, in a coding algorithm based on a hybrid coding architecture, the above compression coding methods may be mixed.

[0081] Residual: In the video coding process, spatial and temporal redundancies need to be removed through prediction. The encoder obtains predicted values ​​through prediction and subtracts the predicted values ​​from the original pixel values ​​to obtain residual values. 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 format 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 and slowly changing regions. A suitable transform process can convert the image energy from a scattered distribution in the spatial domain to a relatively concentrated distribution in the transform domain, eliminating the frequency-domain correlation between signals. Combined with the quantization process, this can effectively compress the bitstream. The transform process can convert pixel values ​​in the time domain into the frequency domain. Since low-frequency components account for a large proportion of the actual residual block, the transform concentrates the energy in the low-frequency region. That is, after the transform, the low-frequency coefficients have large values ​​and the high-frequency coefficients have small values.

[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. After the residual is transformed, the upper left one is the low-frequency coefficient, and the lower right one is the high-frequency coefficient. The frequency increases from the upper left to the lower right.

[0084] Binarization: Also known as binarization, the code or coefficient to be coded is binarized, and the binarized code or coefficient is converted into a binary string. The binary strings obtained by coding the same coefficient using 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 property. Therefore, based on the theory of conditional entropy, constrained coding using other coded syntax elements can further improve coding performance compared to independent coding or memoryless coding. The coded symbol information used as a condition 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 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. It is the final processing module in video compression, converting a series of element symbols representing a video sequence into a binary bitstream for transmission or storage. The output data of the entropy coding module is the final bitstream after the original video is compressed. Entropy coding can effectively remove the statistical redundancy of these video element symbols, making it an important tool for ensuring video coding compression efficiency.

[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] Right-upper diagonal scan: Scanning starts from the last coefficient in the bottom right of the coefficient block and ends with the first coefficient in the top left of the coefficient block. The scan order within each small block is bottom-right-top-bottom-left-top, and the same order is used for other small blocks. The scan order between blocks is the same as the scan order between coefficients, which is bottom-right-top-bottom-left-top-top-left.

[0090] Horizontal back-and-forth scanning: refers to mapping a 2D rectangle into a 1D column. The entry point 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, and 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: Scanning starts from the last coefficient in the bottom right corner of a coefficient block and ends with the first coefficient in the top left corner of the coefficient block. Scanning is done from right to left and bottom to top within each coefficient block, and the scanning order between blocks is bottom right block - top right block - bottom left block - top left block.

[0092] Reverse vertical scan: Scanning starts from the last coefficient in the bottom right corner of the coefficient block and ends with the first coefficient in the top left corner of the coefficient block. Scans from bottom to top and right to left within each small block.

[0093] Z-scan: Scanning any square with even side lengths in the order of top left, top right, bottom left, and bottom right.

[0094] Unary code: A simple binarization method. Specifically, for a non - negative integer N, its unary code is represented by N 1s and 1 0.

[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 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 number of consecutive occurrences of each value as the code value. For example: 0001110011010100001100, the compressed output: 33221111422.

[0098] Fixed - length encoding: Encodes the coefficient to be encoded using a fixed code length. For example, the ASCII code that encodes using 8 - bit binary numbers.

[0099] Half - 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 Coding: k-th Exponential-Golomb Coding includes two parts: prefix and suffix. The coding method includes the following steps: 1) write the number X in binary form, remove the k least significant bits, add 1 to get T; 2) calculate the number of bits in T, and add T-1 zeros in front of it; and 3) add the removed k least significant bits to the end of the bit string.

[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 bound cMax and a known Rice parameter cRice.

[0102] Huffman coding: Calculates the frequency of occurrence of all coefficients, constructs a Huffman tree, and assigns short code words to coefficients with high probability and long code words 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 parameter m must be a power of 2. Specifically, parameter m is initialized, m must be a power of 2, and q and r are calculated, where q = N / m and r = N(m-1). 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.

[0104] Below, we present 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 can be calculated using surrounding reconstructed pixel values, one gradient value can be calculated based on the predicted direction of the current pixel, or the horizontal gradient value or the vertical gradient value can be calculated based on experience, and the gradient can be quantized.

[0106] Calculate the gradient threshold parameters T1, T2 and T3 according to JPEG-LS.

number

[0107] where 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] where D i represents the gradient calculation value, and 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), adaptive error correction is performed (correcting the predicted 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 smaller 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 values ​​of all prediction error Errval values ​​must not 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) is used to calculate the context reconstruction residual accumulator (i.e., the sum of the first n coded reconstruction values), a prediction error correction parameter C[Q]. N is a counter corresponding to the context environment, storing the number of occurrences of that context environment. The value of C[Q] increases by 1 whenever the value of B / N (the average value of the correction residual) increases by 0.5 or more, and decreases by 1 whenever the value of B / N decreases by 0.5 or more. On the other hand, to make the calculation more consistent with local features, a threshold N0 can be set. 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 the expected value derived under the assumption that the current residual distribution fits a geometric distribution. Golomb coding for n, where m is a positive integer, is divided into two parts: a binary code of n / m and a unary code of n / m. For a variable being coded with a geometric distribution, there exists a single m such that the average code length after coding is the shortest. When m is 2^k, Golomb coding is called Golomb-Rice coding. Here, K=min{k1|2k1N>=A}.

[0117] The original range of the residual is ±(range+1) / 2, and it is mapped.

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. When adjacent pixels a=b=c=d are detected, i.e., g1=g2=g3=0, it indicates that 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 determines whether the difference with x is within an acceptable range), and if this is satisfied, it continues to detect later, and the number of the same value (including x) is recorded as the run length.

[0120] In the prior art, Scan Region-based Coefficient Coding (SRCC) coding technology is primarily intended for lossy coding, where coefficients with many zero residual values ​​are used. It is not applicable to lossless or near-lossless coding. Context-based Adaptive Binary Arithmetic Coding (CABAC) has a relatively complex process, which increases the coding / decoding complexity and makes it unsuitable for near-lossless compression. Existing Golomb-Rice coding and semi-fixed-length coding are relatively effective for lossless and near-lossless coding. However, the code length of Golomb coding depends on the selected order k. If the k value is inaccurate, the code length after binarization becomes very long. Therefore, it is generally only applicable to pointwise coding, which rapidly updates the k value. Semi-fixed-length coding can effectively control the code length within a certain range, but because the code length of each coefficient must be coded before coding the coefficients, this method is generally applied to grouped coding. If 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. Since each coefficient in a group uses the same code length, the average code length increases as the maximum value in the group increases. Since both of these methods have some shortcomings, we propose a coefficient coding method based on lossless coding and near-lossless coding, combining these two coding methods.

[0121] Next, the implementation environment and application scenario of the embodiment of the present invention will be briefly described. The video encoding / decoding method provided by 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 also 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 because it is used to encode images. The destination device 12 may be referred to as a video decoding device because 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, and the encoded image data is transmitted 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. 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 this 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 in an appropriate format before transmission.

[0127] Optionally, the above image preprocessor 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 decoder 122, and may optionally further include communication interface 121 and 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. The any other source device may be, for example, a storage device. Communication interface 121 may also decapsulate data transmitted by communication interface 113 to obtain the 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 the decoding processes 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 embodiments of the present invention are not limited thereto.

[0131] The configuration 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 also 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 multiple image blocks. The encoder 20 is used for block-by-block encoding to complete the encoding of the target image, for example, by performing an encoding process on each image block.

[0134] The prediction processing unit 201 is used to receive or obtain an image block (which may be referred to as 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 the image block) and reconstructed image data, and to predict the current image block based on associated data in the reconstructed image data to obtain a 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. When the intra prediction mode is selected, the prediction processing is performed by the intra prediction unit. When 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 the residual between the true value of an image block and a predicted block of the image block to obtain a residual block, for example, by subtracting the pixel value of the predicted block from the pixel value 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 quantization 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, a different scale may be applied to scalar quantization to achieve finer or coarser quantization. A smaller quantization step corresponds to finer quantization, and a larger quantization step corresponds to coarser quantization. The appropriate quantization step may be indicated by the 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. Entropy coding algorithms include, but are 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 the 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 also be called inverse quantized residual coefficients.

[0140] The inverse transform processor 207 is used to perform an inverse transform on the dequantized coefficients. It should be understood that the inverse transform is the 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), to obtain an inverse transformed block in the pixel domain (also called the sample domain). The inverse transformed block may also be called an inverse transformed dequantized block or an inverse transformed 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 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 the pixel transformation or improve the 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 in an inter-prediction mode.

[0143] Specifically, in the embodiment of the present invention, the encoder 20 is used to perform the video encoding and decoding methods described in the following examples.

[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, for example, to receive coded image data (i.e., a coded bitstream, e.g., a coded bitstream including image blocks and associated syntax elements) coded 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 blocks output by the reconstruction unit 305, and the decoded image buffer is used to buffer the filtered image blocks 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 quantized coefficients and / or decoded coding 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 coding parameters to the prediction processing unit 304 so that the prediction processing unit performs prediction processing based on the coding parameters.

[0146] The function of the inverse quantization unit 302 may be the same as the function 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 referred to as 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 coded image data (e.g., a coded bitstream of a 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 a selected prediction mode (i.e., decoded coding parameters) from the entropy decoding unit 302, and predict the current image block based on related data in the reconstructed image data and the decoded coding 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 an intra prediction mode is selected, the intra prediction unit performs the prediction process. When an inter prediction mode is selected, the inter prediction unit performs the 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 decoder 30 according to the embodiment of the present invention, the processing result of a certain part may be further processed before being 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 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 laptop, 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, the present invention provides possible embodiments of video encoding / decoding based on the video encoding / decoding systems shown in Figures 1 to 3. As shown in Figure 4A, Figure 4A is a flowchart of video encoding / decoding according to the present invention, and the embodiment of video encoding / decoding includes steps [1](1) to [5], and steps [1] to [5] can be performed by any one or more of the encoder 20, decoder 30, source device 11, or destination device 12.

[0155] Step [1]: Divide one frame of 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, it may be divided into one or more non-overlapping independent coding units, each of which may be independent of the others, but may share header information with 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 size of w_lcu×h_lcu, where w_lcu and h_lcu are both 2 to the power N (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 may be divided into two 128x4 independent coding units + one 32x4 independent coding unit in the first / second row, and two 128x2 independent coding units + one 32x2 independent coding unit in the third row.

[0160] It should be noted that the independent coding unit may include three components of luminance Y, chromaticity Cb, and chromaticity Cr, or three components of red (R), green (G), and blue (B), or may include only one of these components. When the independent coding unit includes three components, the sizes of these three components may be completely the same or different, which is specifically related to the input format of the image.

[0161] Step [3]: For each independent coding unit, it may be divided into one or more non-overlapping coding units, and each coding unit within the independent coding unit may be dependent on each other, for example, multiple coding units may reference each other for precoding and predecoding.

[0162] If the coding unit and the independent coding unit have the same size (i.e., the independent coding unit is split into only one coding unit), the size may be any of the sizes 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 (the height of the coding unit is the same as that of the independent coding unit, but the width is different, which may be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), vertical equal division (the width of the coding unit is the same as that of the independent coding unit, but the height is different, which may be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), horizontal and vertical equal division (quadtree division), etc., with horizontal equal division being preferred.

[0164] If the width of a coding unit is w_cu and the height is h_cu, the width must be greater than the height (unless it is an edge region). Typically, the coding unit may be a fixed w_cu x h_cu. Both w_cu and h_cu may be a power of 2 (N is 0 or greater), such as 16x4, 8x4, 16x2, 8x2, 8x1, 4x1, 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] Note that a coding unit may include three components: luma Y, chroma Cb, and chroma Cr (or three components: red R, green G, and blue B), or only one of these components. If a coding unit includes three components, the sizes of these three components may be exactly the same or different, which is 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 is coded and decoded according to the selected prediction mode to obtain a predicted value for the PG, which constitutes a predicted value for the entire coding unit. A residual value for the coding unit is obtained based on the predicted value and the original value of the coding unit.

[0169] Step [5]: Based on the residual values ​​of the coding units, the coding units are grouped to obtain one or more non-overlapping residual blocks (RBs). 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.

[0170] Here, the selected mode of encoding / decoding the residual coefficients in step [5] may include, but is not limited to, a semi-fixed length encoding method, an exponential Golomb encoding method, a Golomb-Rice encoding method, a truncated unary code encoding method, a run-length encoding method, or directly encoding the original residual values.

[0171] For example, the video encoder may directly encode the coefficients within the RBs.

[0172] Also, for example, the video encoder may perform a transform such as DCT, DST, or Hadamard transform on the residual block, and then encode the transformed coefficients.

[0173] As a possible example, when an RB is small, the video encoder may directly perform collective quantization on each coefficient in the RB and then perform binarization encoding. When an RB is large, the RB may be further divided into multiple coefficient groups (CGs), and each CG may be collective quantized and then performed binarization encoding. In some embodiments of the present invention, the coefficient group (CG) and the quantization group (QG) may be the same.

[0174] The following describes an example of coding residual coefficients in a semi-fixed-length coding scheme. First, the maximum value of the residual absolute value within one RB block is defined as the modified maximum (mm). Next, the number of coding bits for the residual coefficients within the RB block is determined (the number of coding bits for residual coefficients within the same RB block is the same). For example, if the critical limit (CL) of the current RB block is 2 and the current residual coefficient is 1, 2 bits are required to code the 1 residual coefficient, which is represented as 01. If the CL of the current RB block is 7, this indicates that 8 bits of residual coefficients and 1 sign bit are coded. The CL is determined by finding the smallest M value that satisfies the condition that all 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 code all residuals of the current RB block. If only one of the two boundary values, -2^(M-1) and 2^(M-1), exists, 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), the trailing bit does not need to be coded.

[0175] Also, in some special cases, the video encoder may directly encode the original values ​​of the image rather than the residual values.

[0176] Based on the above-mentioned problems, the present invention provides a video encoding / decoding method for a lossless compression coding framework and a near-lossless compression coding framework, which can encode original pixel (quantized / unquantized) values, predicted residual coefficients (quantized / unquantized), or transformed transform coefficients (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 should take into account the distribution of the data, so that coefficients with similar amplitudes are distributed as closely as possible.

[0178] (3) The scanned data may be grouped, and the grouping method may be irregular grouping based on the data distribution, 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 derived based on the encoded data, based on the prediction coefficients, and 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 whether or not to further transmit the parameter correction value may be selected to make the estimated parameters 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 method 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 method for the next group of coefficients may be selected based on the numerical range. Different coding methods or coding schemes may be selected based on different ranges of the coefficients.

[0182] (7) The data distribution in the time domain is different from that in the frequency domain. 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. Therefore, the coding of the transform coefficients may be specially grouped considering the position of the coefficients after transformation.

[0183] (8) When encoding the coefficients, 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 may be selected. The coefficients may be encoded using one or a combination of these coding methods.

[0184] In a specific embodiment, the scanning method for the coding coefficients may be selected from raster scanning, block scanning, horizontal scanning, vertical scanning, round trip (horizontal / vertical) scanning, diagonal (top left, top right, bottom left, bottom right) scanning, reverse diagonal scanning, reverse horizontal scanning, reverse vertical scanning, or scanning based on one fixed scanning template, etc.

[0185] Generally, 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) on the encoding side or by estimation. The video encoding / decoding process provided in the embodiment of the present invention mainly includes a grouping encoding process and a grouping no-encoding process.

[0186] 1. Group coding process: First, the coefficients are converted into 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 coefficients, and coefficients with similar amplitudes are grouped together. One-dimensional coefficients are grouped based on some fixed grouping scheme and specific grouping information is coded, or the grouping scheme for one-dimensional coefficients is derived based on the prediction or transformation scheme. Coefficients in the same group may use a single parameter (group_param), which can guide the coding of all subsequent coefficients. The parameter (group_param) may be coded using a fixed-length code, unary code, or truncated unary code. Each coefficient in the group is then coded using a specific coding scheme 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, the 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 an 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, or predicted residual coefficient); c) Determine a coefficient coding method; d) Based on the coding method, decode the parameters required for each coefficient or each group of coefficients from the bitstream; e) Based on the coefficient coding method, determine whether prediction parameters need to be derived based on context information; f) If prediction parameters exist, perform corresponding decoding based on the coefficient coding method based on the prediction parameters and parameters analyzed in the bitstream; otherwise, derive prediction parameters based on context information; g) If groups exist, based on the bitstream, sequentially return the decoded coefficients in each group to their original coefficient positions; otherwise, directly decode to obtain all coefficient values.

[0190] The methods 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 method, the transformation method, etc.).

[0191] 1. The grouped decoding process mainly includes: first, determining the scanning method for the block, then determining the grouping method for the scanned coefficients, then using a decoding method to decode the parameters (group_param) of each group, and using a decoding method to decode each coefficient value in the group based on the group_param, and finally restoring the coefficients in the coded block to their original arrangement based on the scanning method.

[0192] 2. The grouped decoding-free process mainly includes the following steps: first, determine the scanning method for the block, predict the range of the current coding coefficients based on the context, and then select a decoding method based on the range of coefficient values ​​to perform 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 / decoding method provided in an embodiment of the present invention. In the method, the encoding process may be performed by an encoder, and the decoding process may be performed by a decoder. The method may include the following steps:

[0195] In 401, the encoding side scans the encoding target unit in the original image data using a first scanning method to obtain a coefficient sequence.

[0196] In one embodiment, the encoding side may scan the original data block to obtain coefficients to be coded based on 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 a fixed scanning template. Here, for specific scanning processes of each scanning method, reference may be made 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 methods based on the prediction method, transformation method, etc. of the current coefficient. Alternatively, the encoding side may select one scanning method 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 method based on the prior agreement.

[0198] In one embodiment, the video coding / decoding method in the embodiment of the present invention can be applied to coding of original pixels, coding of residual values ​​obtained by predicting original pixel values, coding of coefficients obtained by quantizing residual values ​​obtained by predicting original pixel values, coding of transform coefficients obtained by transforming predicted residual values, or coding of coefficients obtained by quantizing transform coefficients obtained by transforming predicted residual values, etc. Any of the above data coding methods can be coded and compressed using the embodiments provided by the present invention.

[0199] That is, the original data block, the unit to be coded, or the reconstructed data block obtained by decoding referred to in the embodiments of the present invention may be a data block consisting of original pixel values ​​of the image to be coded, a data block consisting of residual values ​​obtained by predicting the original pixel values, a data block consisting of coefficients obtained by quantizing the residual values, a data block consisting of transform coefficients obtained by transforming the residual values, or a data block consisting of coefficients obtained by further quantizing the transform coefficients obtained by transforming the residual values.The description of this will not be repeated in the following embodiments.

[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, and the unit to be coded may be, for example, 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 in the multiple groups may be the same or different. Specific grouping methods will be described below based on specific examples, and will not be described here.

[0203] In 403, the encoding side determines a coefficient encoding method corresponding to the subsequence to be encoded in 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 unary code, truncated unary code, truncated binary code, fixed-length code, semi-fixed-length code, k-th order exponential-Golomb code, truncated Rice code, Huffman code, and Golomb-Rice code. Alternatively, the encoding method may be a combination of multiple encoding methods. The following description will be given based on specific examples, and a detailed 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 will not be described again here.

[0206] In 404, the encoding side transmits the bitstreams one by one to the decoding side.

[0207] In 405, the decoding side acquires the bitstream and determines the scanning method of the unit to be decoded, the grouping method, and the coding method corresponding to each group.

[0208] The decoding side may obtain the coded bitstream and decode it segment by segment, where the unit to be decoded may be a data unit in the coded 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 a 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 a 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 a detailed description will be omitted here.

[0210] In 406, the decoding side decodes each group one by one based on 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 performs decoding according to an encoding algorithm to obtain group parameters for each group. In one example, in one embodiment, the decoding method for the group parameters may specifically include the decoding side performing decoding based on a decoding method corresponding to at least one encoding method among unary coding, truncated unary coding, truncated binary coding, fixed-length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding to obtain group parameters for 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 multiple coefficient values ​​in each group, and the coefficient block corresponding to the unit to be decoded includes multiple coefficient values ​​in each group.

[0213] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side performs decoding according to a fixed-length coding algorithm to obtain group Rice parameters for each group, or obtains group Rice parameters for each group based on a context model; 2. The decoding side performs decoding according to the group parameters for each group based on a Golomb-Rice coding algorithm to obtain multiple coefficient values ​​for each group; and the coefficient block corresponding to the unit to be decoded includes multiple coefficient values ​​for each group.

[0214] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side obtains group Rice parameters for each group based on a context model; 2. The decoding side decodes according to a fixed-length coding algorithm or a truncated unary code to obtain group parameter deviations for each group, and obtains group parameters for each group based on the group Rice parameters and group parameter deviations for each group; In one example, the group parameters for each group may be updated based on the group Rice parameters and group parameter deviations, specifically, group parameters = group Rice parameters + group parameter deviations.

[0215] 3. The decoding side decodes the data according to the group parameters of each group using the Golomb-Rice coding algorithm to obtain multiple coefficient values ​​for each group. The coefficient block corresponding to the unit to be decoded contains multiple coefficient values ​​for each group.

[0216] In one embodiment, the decoding process may specifically include the following steps: 1. The decoding side performs decoding 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 performs decoding according to the degree k of each group based on the k-th order exponential-Golomb coding algorithm to obtain multiple coefficient values ​​in each group; The coefficient block corresponding to the unit to be decoded includes multiple 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 based on 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. Decode the kth order exponential-Golomb coding algorithm based on the updated degree k of each group to obtain a plurality of coefficient values ​​in each group, and a coefficient block corresponding to the unit to be decoded includes the 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 of one or more groups obtained by decoding, the prediction method, the quantization method, and the transformation method. 2. The decoding side performs decoding based on 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 a combination of Golomb-Rice coding, k-th order exponential-Golomb coding, and semi-fixed-length coding. The following description will be given based on a specific example, and further description will be omitted here.

[0220] In one embodiment, in any of the above encoding and decoding methods, the encoding methods 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 blocks of the unit to be decoded based on the scanning method of the unit to be decoded to obtain a reconstructed data block.

[0222] The decoding side restores the coefficients in the coefficient blocks of each group one by one to obtain a reconstructed data block corresponding to the unit to be decoded.

[0223] In one embodiment, the scanning methods applicable to the embodiments of the present invention may include at least one of raster scanning, block scanning, horizontal scanning, vertical scanning, reciprocating scanning, diagonal scanning, inverse horizontal scanning, inverse vertical scanning, or Hilbert scanning.

[0224] According to the above embodiment of the present invention, the decoding side can derive different scanning methods and 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 codewords to coefficients with small changes for encoding, thereby making the encoding method flexible and improving encoding performance. In addition, by designing multiple fixed grouping methods, it can be more compatible with semi-fixed-length coding methods, and a better binarization method can be flexibly selected for each coding block, resulting in a low complexity encoding algorithm.

[0225] The following describes the technical solutions of the embodiments of the present invention with reference to some specific examples.

[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 unit to be coded as one group, or treat every four coefficients in the entire unit to be decoded as one group, or treat every three coefficients in the entire unit to be coded as one group. For example, the unit to be coded is a data unit with 12 rows and 4 columns, i.e., a 12×4 unit to be coded. In the grouping method where every four coefficients are treated as one group, the 12×4 unit to be coded can be divided into 12 groups. In the grouping method where every three coefficients are treated as one group, the 12×4 unit to be coded can be divided into 16 groups. In the grouping method where the entire unit to be coded as one group, the 12×4 unit to be coded can be treated as one group.

[0230] In one example, the grouping method may be a method of grouping based on the array position of the coefficients. Specifically, each coefficient of the entire unit to be coded may be evenly divided into two groups, three groups, four groups, etc. according to the array position. For example, the coefficients are evenly divided into two groups according to a ratio. For example, for a 12×4 unit to be coded, the number of coefficients of the entire unit to be decoded is N=48, and the coefficients are evenly divided into two groups according to a 1:1 ratio. In this case, the first 24 coefficients of the 12×4 unit to be coded are grouped into one group, and the remaining last 24 coefficients are grouped into another group.

[0231] In one example, the coefficients in the entire unit to be coded may be unevenly divided into two, three, four, or other groups according to their positions. For example, the coefficients may be unevenly divided 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 12x4 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 coefficients based on the number of coefficients in each group, such as one group for every two adjacent coefficients in the entire unit to be coded, 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 number of points into groups at intervals based on the arrangement positions of the coefficients in the entire unit to be coded. For example, if a is 1, the coefficients at every other coefficient position in the entire unit to be coded may be divided into two groups. If a is 2, the coefficients at 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 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 ​​generally varies, and therefore, such a division scheme may be referred to as a semi-fixed length grouping scheme in the present invention.

[0235] For example, the grouping by coefficient magnitude may determine whether each coefficient in the unit to be coded is greater than n. Coefficients equal to or greater than n may be grouped together in one group, and coefficients less than n may be grouped together in another group. Alternatively, coefficients greater than n may be grouped together in one group, and coefficients less than or equal to n may be grouped together in another group.

[0236] Here, the value of n can be agreed upon in advance by the encoding side and the decoding side, or can be determined by information exchange, or can 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 the 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, after grouping the coefficients in the unit to be coded in the above-mentioned multiple grouping methods, if the number of coefficients in a group is large, secondary grouping may be performed. For example, coefficients in the unit to be coded greater than n may be divided into one group, and if the number of coefficients in that group is greater than a predetermined number of coefficients, secondary grouping may be performed on that group. Specifically, the secondary grouping method may be based on any one of the above-mentioned 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 a 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 grouping methods in advance. During the video encoding / decoding process, the encoding side selects one or more grouping methods based on the coefficient status of the unit to be encoded and performs grouping encoding. The decoding side may determine the grouping method through bitstream analysis, signaling interaction with the encoding side, or context prediction or derivation, and perform grouping analysis on the bitstream based on the determined grouping method. In addition, the decoding side may derive the grouping method for the coefficients of the current unit to be decoded based on the prediction direction, prediction mode, or transform mode of different pixels in the unit to be decoded. Specific examples will be described later, and will not be repeated here.

[0244] In one embodiment, based on the fixed-length grouping encoding method or the 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 binary conversion 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, it is 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 before it; 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. The maximum upper limit value cMax and the Rice parameter cRice are known, and the symbol cVal to be coded is coded.

[0251] The specific coding process includes the following steps. (1) Calculate the prefix, 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, and the number of bits is 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 on parameter m must be a power of 2. Specifically, parameter m is initialized, m must be a power of 2, and q and r are calculated, where q = N / m and r = N(m-1). 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 combined decoding schemes:

[0255] Scheme 1: Use a scheme similar to truncated unary codes, 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 truncated unary codes, where prefixes greater than (N-1)>>1 are represented as truncated unary codes starting with 0 and ending with 1, and prefixes less than (N-1)>>1 are represented 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 Example 1, the encoding side and the decoding side may set n types of grouping methods, and then the encoding side may encode the unit to be encoded using one of the encoding methods based on the setting, and the decoding side may derive the grouping method used by the unit to be decoded based on the bitstream, and perform decoding based on the grouping method.

[0262] In one embodiment, a predicted value may be derived based on the semi-fixed length grouping decoding in Example 1 above 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 a decoding algorithm to obtain all coefficients of each group.

[0263] In one embodiment, when fixed-length coding is required for semi-fixed-length coded coefficients, the coding side may directly code the original pixel values ​​with fixed-length coding for large coefficients, or may 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 more, or if the coding bit width of the coefficient group, group_param, is 7, the original pixel value can be directly coded using a fixed-length code of 8, or the reconstructed pixel value can be coded, thereby improving the coding / decoding performance.

[0265] In one embodiment, the decoding side may determine the grouping method of the unit to be decoded by deriving the grouping method of the coefficients in the current unit to be decoded based on the prediction direction, prediction mode, or 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 the 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 be predicted by the reconstructed value of the previous block. As shown in FIG. 5, taking a 16x4 decoding target unit as an example, after predicting the residuals using the current prediction method, all residual values ​​in the first column are grouped together as shown in FIG. 5 below. The residual values ​​of each row in the remaining 15x4 coefficient block are grouped together. Since the number of coefficients in the first group is small, the grouping is not continued, and the remaining coefficients are allowed to be grouped into smaller groups within each group.

[0268] Therefore, the entire block is scanned in the following order: first, vertically scanning to obtain the first group of coefficients and encoding them, then horizontally scanning to obtain the second group of coefficients. The second group of coefficients may be divided into smaller subgroups from left to right, each of which may use a different encoding scheme. The first subgroup within the second group is 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 certain threshold, the coefficients of the subsequent group are coded using Golomb-Rice. If the prefix is ​​larger than a certain threshold, the coefficients of the subsequent 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 the grouping method and coding method for the coefficients in the unit to be decoded based on the transform mode.

[0270] For example, the encoding side may encode the transform coefficients based on the specific positions of the DC coefficients. 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 groups may be further divided into subgroups. If the number of AC coefficients is large, the AC coefficient groups may be further divided into subgroups.

[0271] Specifically, since 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. If the amplitude values ​​of 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. For the remaining DC coefficients, the signs of the DC coefficients and the differences from the first DC coefficient may be coded. Semi-fixed length coding may be used to code the differences between the DC coefficients.

[0272] Specifically, since AC coefficients generally have small values, all AC coefficients may be grouped together and coded using a semi-fixed length, or AC coefficients may be divided into two groups (for example, the upper right and lower left may be grouped together, and the lower right may be grouped together) and each group may be coded using a semi-fixed length. However, if the amplitude of AC coefficients is large, two or three coefficients may be grouped together for the upper right and lower left AC coefficients, coded using Golomb-Rice, and the lower right may be coded using a semi-fixed length.

[0273] Here, the scan order for the unit to be coded may be as follows: First, the entire large block may be divided into DC coefficients and AC coefficients. Taking a 16x4 unit to be coded as an example, as shown in FIG. 6, the coefficient distribution after conversion may be as shown in FIG. 6. For DC coefficients, if all DC coefficients are coded as one group, raster scan is used for the DC coefficients; otherwise, Hilbert scan is used to code coefficients that are close to each other. For AC coefficients, if all AC coefficients are grouped together, raster scan is used directly for the AC coefficients; otherwise, scanning is performed first in the order of top right, bottom left, and bottom right, and then the coefficients in the top right, bottom left, and bottom right are scanned using the raster scan order.

[0274] In another embodiment, taking a 16x4 coding target unit as an example, the coefficient distribution after transformation may be as shown in Figure 7. The coefficients are divided into two blocks, and transformation is performed within each block. As shown in Figure 7, if there are only two DC coefficients, the following groupings exist: 1. Two DC coefficients are grouped together, and all AC coefficients are grouped together. The scan order uses raster scan within each 8x4.

[0275] 2. Two DC coefficients are grouped together, and all AC coefficients are divided into two groups, each consisting of 8x4 pixels (except for the DC coefficient). The scan order is raster scan within each 8x4 pixel.

[0276] 3. Divide two DC coefficients into one group, and divide all AC coefficients into four groups, each 4x4 into one group (except DC coefficient). Use raster scanning within each 4x4.

[0277] 4. Two DC coefficients are grouped together, and all AC coefficients are divided into eight groups (8x4, with one group for every two columns), and vertical scanning is used.

[0278] Based on any of the above grouping methods, in one embodiment, the encoding side may use k-th order Exponential-Golomb coding for DC coefficients and semi-fixed length coding for AC coefficients.

[0279] Embodiment 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 bitstream.

[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 within 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 bitstream.

[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] Fourth Embodiment: 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 bitstream.

[0289] In step 3, the decoder estimates the Rice parameter CRice for each group based on the context, then decodes the parameter deviation C for each group using a fixed-length code, updates the original Rice parameter CRice+C to the Rice parameter CRice, i.e., CRice+=C, and decodes each coefficient value in the group using Golomb-Rice.

[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] Embodiment 5: 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 bitstream.

[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 bitstream, and the specific decoding method can be any one of the decoding methods described in the above-mentioned embodiment 1, such as unary coding, truncated unary coding, truncated binary coding, fixed-length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, or Golomb-Rice coding. The decoding side can also combine decoding using fixed-length coding and truncated unary coding based on the magnitude of the coefficient values ​​to decode the bitstream and obtain group parameters for each group, which will not be described 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 bitstream.

[0298] In step 3, the decoding side estimates the Rice parameter CRice for each group based on the context, then decodes the parameter deviation C for each group using a fixed-length code, where CRice is equal to 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 those described in the first embodiment, such as unary coding, truncated unary coding, truncated binary coding, 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 using the fixed-length code and the truncated unary coding based on the magnitude of the coefficient value to decode the bit stream and obtain the group parameters of each group, and the description thereof will be 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] Embodiment 7: 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 bitstream.

[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] Embodiment 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 bitstream.

[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] Embodiment 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 bitstream.

[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 algorithm 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] Embodiment 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 bitstream.

[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 bitstream, and the specific decoding method may be any one of the decoding methods described in the above-mentioned embodiment 1, such as unary coding, truncated unary coding, truncated binary coding, fixed-length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, or Golomb-Rice coding. The decoding side may combine decoding using fixed-length coding and truncated unary coding based on the magnitude of the coefficient value to decode the bitstream and obtain group parameters for each group, and the description thereof will be 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 predicted 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 absolute values ​​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 using Golomb-Rice coding. 5 If it is less than k, estimate the exponential-golomb k value and encode the current coefficient with exponential-golomb coding.

[0323] Or, in one example, the range of the absolute values ​​of the estimated coefficients is 2 5 If it is greater than 2, estimate the k value of the exponential-golomb coding and encode the current coefficient with exponential-golomb coding. 5 If it is less than or equal to, estimate the Golomb-Rice k value and encode the current coefficient using Golomb-Rice coding.

[0324] Furthermore, the range of the coefficient value can 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 1; otherwise, code 0. Here, 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, the k value of Exponential-Golomb coding is estimated based on the context, and the current coefficient is coded using Exponential-Golomb coding. If the coding value is 0, the k value of Golomb-Rice is estimated, and the current coefficient is coded using Golomb-Rice coding.

[0329] Alternatively, in one example, if the encoding value is 0, the k value of Golomb-Rice encoding is estimated based on the context; otherwise, the k value of Exponential-Golomb encoding is estimated and the current coefficient is encoded using 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 coding side encodes coefficients smaller than n using a fixed-length code, and for coefficients larger than n, estimates one k value, decodes it using Exponential Golomb or Golomb-Rice, and adds n to the decoded value.

[0332] Embodiment 15: In step 1, when the encoding side performs group coding of residual coefficients, it derives one estimated value n based on the context, and divides the coefficients to be coded into two groups based on the estimated value n.

[0333] In step 2, for coefficients smaller than n, the coding 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] Alternatively, 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] Alternatively, 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 residual coefficients, it derives an estimated value n based on the context, reads 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, coefficients smaller than n are decoded using a fixed-length code, and for coefficients larger than n, one k value is estimated, decoded using the Exponential-Golomb or Golomb-Rice algorithm, and n is added to the decoded value.

[0338] Alternatively, 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] Alternatively, 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 coding coefficients or if there are multiple consecutive equal values ​​in the reconstructed data, the run-length coding mode is turned on; otherwise, the run-length coding mode is turned off and one of the aforementioned coding methods is used directly.

[0342] Illustratively, the context information may include one of: a) the magnitude of the gradient or gradient sum in each direction of the decoded reconstructed pixel value; b) the magnitude of the gradient or gradient sum in each direction of the neighboring predicted pixel value; c) the magnitude of the gradient or gradient sum in each direction of the decoded coefficient; d) a weighted combination of the magnitudes of the gradient sums of two of a, b, or c; or e) a 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, such as 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 fixed division method may be decoded. The following description will be given with reference to the drawings and specific embodiments.

[0345] For example, the unit to be coded may be divided into multiple 2x2 small blocks, which are grouped together. Taking a 16x4 unit to be coded as an example, one CL is shared within the group. The coding is performed using a semi-fixed length, and the first CL value is coded using a fixed length, with a code length of 3 or 4 (related to the image bit width N). The second CL value is the difference between the CL values ​​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 unit to be coded is grouped into 16 small blocks as shown in Fig. 8(1) according to a grouping method that divides the unit into fixed 2x2 small blocks. Scanning may be performed between each 2x2 small block using a Hilbert scan method, and for example, the order in which the coding side scans the unit to be coded may be 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 numerical order of 0 to 3 as shown in FIG. 8(3).

[0348] Between CLs, context prediction may be used, CL0 is directly coded using a fixed-length code, CL1 = (CL1 - CL0), and CL2 is coded using a truncated unary code. n =(CL n -(CL n-2 +CL n-1 *3>>2)) and may be encoded using truncated unary code.

[0349] CL n-2 and CL n-1 Find the reconstructed value of CL n-2 and CL n-1 If all the reconstruction values ​​inside are equal or nearly equal, the current 2x2 sub-block is equal to the previous CL n-2 and CL n-1 The method determines whether to directly multiplex the reconstructed values ​​within the current coding block. In one example, run-length coding may be used to encode the current coding block, and the number of 2x2 small blocks of encoded reconstructed values ​​may be directly used. A fixed-length code may be used to encode this number. The length of the fixed-length code is determined based on the number of uncoded CLs in the current coding unit. Since there are a maximum of 15 uncoded units, the length of the fixed-length code is a maximum of 4 bits.

[0350] In another embodiment, the unit to be coded may be divided into a plurality of 4×1 small blocks as shown in Fig. 9. Taking a 16×4 unit to be coded as an example, the 16×4 unit to be coded may be grouped into 16 small blocks as shown in Fig. 9 according to a grouping scheme that fixedly divides the 16×4 unit to be coded 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 unit to be coded by the coding side may be 2x1, 1x2, 1x4, 2x4, 4x2, 2x8, 2x16, 4x4, 8x4, or 16x4, etc. The present invention does not particularly limit the division method.

[0353] Illustratively, taking 2x2 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 the previous blocks are equal or 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, namely, whether the current block directly uses the previous coefficient values ​​or reconstructed values. If the current block directly uses the previous coefficient values ​​or reconstructed values, 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, the truncated unary code is used 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 the fixed-length code is used to decode the four coefficient values ​​in the block. Each 2x2 small block is stored in order according to the Hill-bit scan order.

[0357] Note that a 16x4 encoding target unit needs to analyze a total of 16 2x2 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] Embodiment 19: A case where decoding is performed using a non-fixed size block division method will be described below in combination with specific embodiments.

[0359] In step 1, the prediction method 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 is predicted by grouping pixels, the current block is grouped according to a prediction grouping method. Otherwise, if the current block is predicted by point-by-point direct prediction, 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 grouped coefficients are decoded in the same order; if the prediction order is from left to right, the grouped coefficients are decoded in the same order.

[0362] In step 4, it is determined 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, the order k is derived based on the empirical value or the previous coding block, and the DC coefficient is decoded using k-th order Golomb; if the current group is not the first group, the DC coefficient k of the current group is estimated based on the value of the DC coefficient of the previous group, and the DC coefficient is decoded using k-th 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 in the current group other than the DC coefficient and the 0 coefficient as the number of coefficients that need to be coded.

[0365] 2) If the number of coefficients is less than three, the remaining coefficients are coded using Golomb-Rice, and 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. For subsequent coefficients, the Rice coefficient C is derived based on the magnitude of the previous coefficient value, and decoded using Golomb-Rice. If the number of coefficients is more than three, they are coded using semi-fixed length, and if there are any non-zero coefficients in the latter half of the previous group (i.e., the coefficients in the high-frequency part), they are 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 the 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 the 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. Based on the comparison result, perform secondary grouping, with those greater than the average value as one group and those less 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 less than the average value is 4 or more, decode using semi-fixed length; otherwise, decode using Golomb-Rice for the group less than the average value.

[0369] For the coefficients in the group greater than the average value, if the number of coefficients is greater than 4 and the estimated average value is less than the threshold, the decoding is performed using a semi-fixed length, otherwise the decoding is performed using k-th order exponential Golomb algorithm. Here, 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] Embodiment 20: In step 1, after determining the grouping method, the decoding side determines whether the number x of coefficients in the current group is greater than the threshold m. For example, if m=30 and x=32, the decoding side determines that the number x of coefficients in the current group is greater than the threshold m.

[0371] In step 2, the decoding side analyzes up to n positions from the bitstream, where these n positions represent the positions of the n outlier points (coefficients with large amplitude within the group) 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 example, if x=32, the code length is 5).

[0372] In step 3, the decoding side decodes the coefficient values ​​at other positions in the current group.

[0373] Here, the method for decoding coefficient values ​​at other positions in the current group may be the aforementioned semi-fixed length decoding, exponential Golomb decoding, Golomb-Rice decoding, or Huffman decoding.

[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] In step 1, after determining the grouping method, the decoding side determines whether the number x of coefficients in the current group is greater than the threshold m. For example, if m=30 and x=32, the decoding side determines that the number x of coefficients in the current group is greater than the threshold m.

[0376] In step 2, the decoding side decodes the maximum amplitude in the current group using a fixed-length code, decodes the minimum amplitude in the current group using a fixed-length code based on the value of the maximum amplitude, and decodes all coefficients in the current group based on the range of the values ​​of the maximum and minimum amplitudes.

[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 fixed-length codes. For example, if n=15, they may be decoded using 4-bit fixed-length codes.

[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 k-th order Exponential Golomb to decode the coefficients in the current group.

[0379] It should be noted that the above-described embodiments of the present invention may be combined with each other, for example, the different grouping methods in embodiment 1 may be applied to other embodiments, the different encoding / decoding algorithms in embodiment 2 may be applied to other embodiments, and the different encoding / decoding algorithms may be used in combination as needed.

[0380] Based on the above embodiments, the present invention further provides a video encoding device and a corresponding video decoding device, which is called a video encoding / decoding device. Referring to the above-mentioned Figures 1 to 3, as shown in Figure 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 method, a grouping method, and an encoding method corresponding to each group of the unit to be decoded, decode based on the encoding method of each group to obtain a coefficient block corresponding to the unit to be decoded, and reconstruct coefficients in the coefficient block of each group one by one based on the scanning method 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 unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and 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 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 method is obtained based on the prediction method, quantization method, and / or transformation method 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 is performed according to the semi-fixed length coding algorithm based on the group parameters of each group 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 of the groups.

[0389] In one embodiment, the processing module 1002 specifically: The group parameters of each group are obtained by decoding the data based on a decoding method corresponding to at least one of unary coding, truncated unary coding, truncated binary coding, fixed-length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and Golomb-Rice coding.

[0390] In one embodiment, the processing module 1002 specifically: 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; Decoding the Rice parameters of each group according to a Golomb-Rice coding algorithm to obtain a plurality of coefficient values ​​for each group; The 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 the fixed-length coding algorithm or 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 data in accordance with a Golomb-Rice coding algorithm based on the group parameters of each group 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 of the groups.

[0392] In one embodiment, the processing module 1002 specifically: Decoding according to a fixed-length coding algorithm to obtain the degree k of each group, or obtaining the degree k of each group based on a context model; Decoding the k-th order exponential-Golomb coding algorithm based on the order k of each group 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 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 the fixed-length coding algorithm or 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 is performed according to the updated order 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.

[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, prediction method, quantization method, and transformation method of the one or more groups obtained by decoding; is used to obtain coefficients of the current group by decoding according to a decoding scheme corresponding to the coding 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 unit to be decoded is either Golomb-Rice coding or k-th order exponential-Golomb coding, the processing module 1002 specifically: The grouping method is used to obtain the grouping method of the unit to be decoded based on the prediction method, quantization method and / or transformation method of the unit to be decoded.

[0397] Correspondingly, the present invention provides a video encoding device, and 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 using a first scanning method to obtain a coefficient sequence, group the coefficient sequence using a first grouping method to obtain multiple groups of subsequences to be coded, determine a coefficient coding method corresponding to the subsequences to be coded in each group, and code them one by one to obtain an encoded bitstream.

[0399] The transmitting and receiving module 1001 is used to transmit the coded 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 unary coding, truncated unary coding, truncated binary coding, fixed length coding, semi-fixed length coding, k-th order exponential-Golomb coding, truncated Rice coding, Huffman coding, and 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 coded is a data block consisting of one of original pixel values ​​of the image to be coded, 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.

[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. For the schematic diagram of the internal structure of the device, please refer to Figures 1 to 3, 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] 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 that can be executed 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 unit to be decoded; decoding the data based on the encoding method of each group to obtain a coefficient block corresponding to the decoding target unit; and reconstructing the coefficients in the coefficient blocks of each group one by one based on the scanning method 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 using a first scanning method to obtain a coefficient sequence; grouping the coefficient sequence according to a first grouping scheme to obtain a plurality of groups of subsequences to be coded; determining a coefficient coding method corresponding to the subsequences to be coded in each group, and coding them one by one to obtain a coded bitstream.

[0409] The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, the whole or in part may be implemented in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the procedures or functions according to the present invention are 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 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 via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, radio, microwave, etc.) transmission method. The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device such as a server or data center that integrates one or more available media. The available media 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)), etc.

[0410] From the above description of the embodiments, it is clear to those skilled in the art that for convenience and simplicity of explanation, only the division of each functional module above is described as an example, and in actual application, the above functions can be assigned to different functional modules to complete them as needed, 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 by the present invention, the disclosed system, device, and method may be realized in other forms. The above-described device embodiments are merely exemplary. For example, the division of modules or units described above is merely a logical division of functions. 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 omitted or not implemented. Furthermore, the mutual couplings or direct couplings or communication connections shown or discussed 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 in multiple network units. To achieve the objectives of the technical solution of this embodiment, some or all of the above units may be selected according to actual needs.

[0413] Furthermore, with regard 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 independently, 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 in the form of software functional units.

[0414] The above-mentioned integrated units may be realized in the form of software functional units 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 part of the technical solution, may be embodied in the form of a software product, and the computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) or a processor to execute all or part of the steps of the methods described in each embodiment of the present invention. The 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 are only specific embodiments of the present invention, and the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be consistent with the scope of protection of the claims.

Claims

1. A video image decoding method 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 method of the unit to be decoded based on the bitstream; decoding based on the bitstream to obtain group parameters for each group; a step of decoding each group based on the group parameters to obtain a plurality of coefficient values ​​in each group, wherein a coefficient block corresponding to the unit to be decoded includes a plurality of coefficient values ​​in each group; and reconstructing coefficients in the coefficient block corresponding to the unit to be decoded based on the scanning 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: a step of decoding the bitstream 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 plurality of coefficient values ​​in each group using a fixed-length code based on the group parameters of each group; 10. 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 using 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 coefficient array position, 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 coefficient array position 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 encoding 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 based on 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-encoded subsequences based on group parameters of the to-be-encoded subsequences to obtain an encoded bitstream, encoding a plurality of coefficient values ​​in each group of to-be-encoded subsequences using a fixed length code based on a group parameter of the to-be-encoded subsequences in each group to obtain a coded bitstream; wherein a group parameter of each group of subsequences to be coded is coded, and the coded bitstream includes the coded group parameter; Encoding the group parameters of the subsequence to be encoded for 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; 1. A video image encoding 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 used to determine a scan method for the unit to be decoded, analyze a grouping method for the unit to be decoded based on the bitstream, decode based on the bitstream to obtain group parameters for each group, decode based on the group parameters for each group to obtain a plurality of coefficient values ​​in each group, and reconstruct coefficients in a coefficient block corresponding to the unit to be decoded based on the scan method for 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 bitstream based on the magnitude of the coefficient values, and a group parameter for each group is obtained; 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; 1. A video image decoding device comprising:

6. An image encoding device, 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 subsequences to be coded in each group, and encoding coefficient values ​​in each group of the subsequences to be coded one by one to obtain a coded bitstream, wherein the first scanning method includes vertical scanning, and the first grouping method includes a fixed-length grouping method or a grouping method based on coefficient array position, wherein 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 coefficient array position includes grouping coefficients of the entire data block to be coded unevenly according to position, or grouping coefficients of the entire data block to be coded evenly according to position; a transceiver module used to transmit the encoded bitstream to a decoding side; the processing module is used to encode a plurality of coefficient values ​​in each group of to-be-encoded subsequences based on a group parameter of each group of to-be-encoded subsequences to obtain an encoded bitstream; When the processing module encodes the coefficient values ​​in each group of to-be-encoded subsequences based on the group parameters of the to-be-encoded subsequences of each group to obtain a coded bitstream, encoding a plurality of coefficient values ​​in each group of to-be-encoded subsequences using a fixed-length code based on group parameters of the to-be-encoded subsequences in each group to obtain an encoded bitstream; the processing module is used to encode group parameters of the subsequence to be encoded of each group, and the encoded bitstream includes the encoded group parameters; When encoding the group parameters of the encoding target subsequences of each group, the processing module: a fixed-length code and a truncated unary code are combined based on the magnitude of the coefficient values ​​to encode the group parameters of the subsequences to be encoded in each group; 1. A video image encoding device comprising:

7. An electronic device including a processor and 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. An electronic device characterized by:

8. A readable storage medium for storing a computer program or instruction, comprising: 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.

Citation Information

Patent Citations

  • Method and apparatus for entropy-coding / entropy-decoding video data

    US20080310503A1

  • Method and apparatus for encoding image, method and apparatus for decoding image, electronic device, and system

    US20210168369A1