Coding method, decoding method, and related apparatus

WO2026179650A1PCT designated stage Publication Date: 2026-09-03HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/077026
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-02-28
Filing Date
2026-02-04
Publication Date
2026-09-03

Smart Images

  • Figure CN2026077026_03092026_PF_FP_ABST
    Figure CN2026077026_03092026_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a coding method, a decoding method, and a related apparatus. The coding method comprises: acquiring a quantized coefficient of a block to be coded; and using at least one of a truncated Rice code defined by a Rice parameter and an exponential-Golomb code defined by the Rice parameter to code the remaining value of the absolute value of the quantized coefficient, so as to obtain a code stream of an image to be coded, wherein: in the process of coding one remaining value, the value of a Rice parameter used is adjusted on the basis of a coded quantized coefficient, an initial value of the Rice parameter is associated with the number of quantized coefficients, the absolute value of which is greater than a first value, among quantized coefficients of said block, and said image comprises said block. Thus, coding efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Encoding methods, decoding methods and related devices

[0001] This application claims priority to Chinese Patent Application No. 202510257143.9, filed on February 28, 2025, entitled "Encoding Method, Decoding Method and Related Apparatus", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of image processing, and in particular to an encoding method, a decoding method, and related apparatus. Background Technology

[0003] Digital video capabilities can be applied to a wide variety of digital video devices, including digital television, digital live broadcast systems, wireless broadcasting systems, personal digital assistants (PDAs), laptops or desktop computers, tablet computers, e-book readers, digital cameras, digital recording devices, digital media players, video game devices, video game consoles, cellular or satellite radio phones (i.e., "smartphones"), video conferencing devices, video streaming devices, and the like. Digital video devices implement video compression technologies, such as those described in standards defined by MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264 / MPEG-4 Part 10 Advanced Video Coding (AVC), the H.265 / HEVC video coding standard, and extensions to such standards. By implementing such video compression technologies, digital video devices can transmit, receive, encode, decode, and / or store digital video information more efficiently.

[0004] Current encoding and decoding technologies suffer from low encoding efficiency. Summary of the Invention

[0005] This application provides an encoding method, a decoding method, and related apparatus, which can effectively improve encoding efficiency.

[0006] Firstly, this application provides a decoding method, comprising: acquiring a bitstream of an image to be decoded, the image to be decoded including a block to be decoded, the bitstream including residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded; decoding the residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded using at least one of truncated Rice code defined by Rice parameters and exponential Golomb code defined by Rice parameters to obtain the quantization coefficients of the block to be decoded, wherein: in the process of decoding a residual value, the Rice parameter value used is adjusted based on the decoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be decoded whose absolute value is greater than a first value; and acquiring reconstructed data of the block to be decoded based on the quantization coefficients. Thus, this application can determine the initial value of the Rice parameter based on the magnitude and number of quantization coefficients, which can effectively improve the encoding efficiency when using Rice parameter encoding, thereby reducing the complexity of decoding and increasing the decoding speed.

[0007] In one possible implementation, if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is greater than the second value, the initial value of the Rice parameter is the third value; if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is less than or equal to the second value, the initial value of the Rice parameter is the fourth value. Thus, this application can determine the initial value of the Rice parameter based on the number of quantization coefficients greater than the first value, which can effectively improve encoding efficiency, thereby reducing decoding complexity and increasing decoding speed.

[0008] In one possible implementation, the third value is 1 and the fourth value is 0.

[0009] In one possible implementation, the method further includes: decoding a syntax element of at least one quantization coefficient in the quantization coefficients of the block to be decoded, wherein the syntax element is used to indicate that the absolute value of the corresponding quantization coefficient is greater than a first value. Thus, this application can determine the number of quantization coefficients whose absolute value is greater than the first value based on the number of syntax elements used to indicate whether it is greater than the first value, thereby determining the initial value of the Rice parameter.

[0010] In one possible implementation, the first value is 1.

[0011] In one possible implementation, the quantization coefficients of the block to be decoded include a first quantization coefficient, and the residual value includes a first residual value of the absolute value of the first quantization coefficient. Decoding the residual value of the absolute value of the quantization coefficients of the block to be decoded uses at least one of a truncated Rice code defined by a Rice parameter and an exponential Golomb code defined by a Rice parameter. This includes: decoding the first residual value using at least one of a truncated Rice code defined by a first Rice parameter value and an exponential Golomb code defined by a first Rice parameter value to obtain a first quantization coefficient; updating the first Rice parameter value based on the absolute value of the first quantization coefficient to obtain a second Rice parameter value; wherein, if the absolute value of the first quantization coefficient is greater than a variable threshold, the second Rice parameter value is the sum of the first Rice parameter value and a first increment, and the variable threshold is obtained based on the first Rice parameter value; and decoding the second residual value of the second quantization coefficient after the first quantization coefficient using at least one of a truncated Rice code defined by a second Rice parameter value and an exponential Golomb code defined by a second Rice parameter value. Thus, this application can update the value of the Rice parameter based on the magnitude of the quantization coefficient, further improving encoding efficiency and thereby increasing decoding speed.

[0012] In one possible implementation, the second Rice parameter value is less than or equal to the fifth value.

[0013] In one possible implementation, decoding the first remainder value using at least one of a truncated Rice code defined by the first Rice parameter value and an exponential Golomb code defined by the first Rice parameter value includes: if the first remainder value is less than a variable threshold, decoding the first remainder value using either the truncated Rice code defined by the first Rice parameter value or the exponential Golomb code defined by the first Rice parameter value. Thus, this application can use truncated Rice codes to encode remainder values ​​with small absolute values, effectively improving encoding efficiency and reducing decoding complexity and speed during decoding.

[0014] In one possible implementation, decoding the first remainder value using at least one of a truncated Rice code defined by the first Rice parameter value and an exponential Golomb code defined by the first Rice parameter value includes: if the first remainder value is greater than or equal to a variable threshold, using the truncated Rice code defined by the first Rice parameter value to decode the portion of the first remainder value less than or equal to the variable threshold, and using the exponential Golomb code defined by the first Rice parameter value to decode the portion of the remainder value greater than or equal to the variable threshold. Thus, this application can use truncated Rice codes to encode the portion of the remainder value with smaller absolute values ​​and exponential Golomb codes to encode the portion of the remainder value with larger absolute values, which can effectively improve encoding efficiency and reduce decoding complexity and increase decoding speed during decoding.

[0015] In one possible implementation, the first increment is 1.

[0016] In one possible implementation, the reconstructed data of the block to be decoded is obtained based on the quantization coefficients, including: obtaining the reconstructed data of the low-frequency subband of the block to be decoded based on the quantization coefficients of the block to be decoded; and performing an inverse wavelet transform based on the reconstructed data of the low-frequency subband of the block to be decoded to obtain the reconstructed data of the block to be decoded.

[0017] Secondly, this application provides an encoding method, comprising: obtaining the quantization coefficients of a block to be encoded; encoding the residual value of the absolute value of the quantization coefficients using at least one of a truncated Rice code defined by a Rice parameter and an exponential Golomb code defined by a Rice parameter, to obtain a bitstream of an image to be encoded, wherein: in the process of encoding a residual value, the Rice parameter value used is adjusted based on the encoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute value is greater than a first value, and the image to be encoded includes the block to be encoded. Thus, this application can determine the initial value of the Rice parameter based on the magnitude and number of quantization coefficients, which can effectively improve the encoding efficiency when using Rice parameter encoding, thereby reducing the complexity of decoding and increasing the decoding speed.

[0018] In one possible implementation, if the number of quantization coefficients in the block to be encoded whose absolute value is greater than the first value is greater than the second value, the initial value of the Rice parameter is the third value; if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

[0019] In one possible implementation, the third value is 1 and the fourth value is 0.

[0020] In one possible implementation, the method further includes: encoding a syntax element of at least one quantization coefficient among the quantization coefficients of the block to be encoded, wherein the syntax element is used to indicate that the absolute value of the corresponding quantization coefficient is greater than a first value.

[0021] In one possible implementation, the first value is 1.

[0022] In one possible implementation, the quantization coefficients of the block to be encoded include a first quantization coefficient, and the residual value includes a first residual value of the absolute value of the first quantization coefficient. The residual value of the absolute value of the quantization coefficient is encoded using at least one of a truncated Rice code defined by a Rice parameter and an exponential Golomb code defined by a Rice parameter, including: encoding the first residual value using at least one of a truncated Rice code defined by a first Rice parameter value and an exponential Golomb code defined by a first Rice parameter value; updating the first Rice parameter value based on the absolute value of the first quantization coefficient to obtain a second Rice parameter value; wherein, if the absolute value of the first quantization coefficient is greater than a variable threshold, the second Rice parameter value is the sum of the first Rice parameter value and a first increment, and the variable threshold is obtained based on the first Rice parameter; and encoding a second residual value of the second quantization coefficient following the first quantization coefficient using at least one of a truncated Rice code defined by a second Rice parameter and an exponential Golomb code defined by a second Rice parameter.

[0023] In one possible implementation, the second Rice parameter value is less than or equal to the fifth value.

[0024] In one possible implementation, encoding a first residual value using at least one of a truncated Rice code defined by a first Rice parameter value and an exponential Golomb code defined by a first Rice parameter value includes: if the first residual value is less than a variable threshold, encoding the first residual value using either a truncated Rice code defined by a first Rice parameter value or an exponential Golomb code defined by a first Rice parameter value.

[0025] In one possible implementation, encoding a first residual value using at least one of a truncated Rice code defined by a first Rice parameter value and an exponential Golomb code defined by a first Rice parameter value includes: if the first residual value is greater than or equal to a variable threshold, using a truncated Rice code defined by a first Rice parameter value to encode the portion of the first residual value less than or equal to the variable threshold, and using an exponential Golomb code defined by a first Rice parameter value to encode the portion of the first residual value greater than or equal to the variable threshold.

[0026] In one possible implementation, the first increment is 1.

[0027] In one possible implementation, obtaining the quantization coefficients of the block to be encoded includes: performing wavelet transform on the image to be encoded to obtain wavelet coefficients of the low-frequency subband; the wavelet coefficients of the low-frequency subband include the wavelet coefficients of the low-frequency subband of the block to be encoded; and quantizing the wavelet coefficients of the low-frequency subband of the block to be encoded to obtain the quantization coefficients of the block to be encoded.

[0028] Thirdly, this application provides a decoding apparatus, comprising: an acquisition module for acquiring a bitstream of an image to be decoded, the image to be decoded including a block to be decoded, the bitstream including residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded; a decoding module for decoding the residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded using at least one of truncated Rice code defined by a Rice parameter and exponential Golomb code defined by a Rice parameter, to obtain the quantization coefficients of the block to be decoded, wherein: in the process of decoding a residual value, the Rice parameter value used is adjusted based on the decoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be decoded whose absolute values ​​are greater than a first value; and a reconstruction module for acquiring reconstructed data of the block to be decoded based on the quantization coefficients.

[0029] In one possible implementation, if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is greater than the second value, the initial value of the Rice parameter is the third value; if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

[0030] In one possible implementation, the third value is 1 and the fourth value is 0.

[0031] Fourthly, this application provides an encoding apparatus, comprising: an acquisition module for acquiring quantization coefficients of a block to be encoded; and an encoding module for encoding a residual value of the absolute value of the quantization coefficients using at least one of a truncated Rice code defined by a Rice parameter and an exponential Golomb code defined by a Rice parameter, to acquire a bitstream of an image to be encoded, wherein: in the process of encoding a residual value, the Rice parameter value used is adjusted based on the encoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute value is greater than a first value, and the image to be encoded includes the block to be encoded.

[0032] In one possible implementation, if the number of quantization coefficients in the block to be encoded whose absolute value is greater than the first value is greater than the second value, the initial value of the Rice parameter is the third value; if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

[0033] In one possible implementation, the third value is 1 and the fourth value is 0.

[0034] Fifthly, this application provides an encoder, including: a memory and a processor, the memory being coupled to the processor; the memory storing program instructions, which, when executed by the processor, cause the encoder to perform the methods of the second aspect or any possible implementation thereof.

[0035] In a sixth aspect, this application provides a decoder, comprising: a memory and a processor, the memory being coupled to the processor; the memory storing program instructions, which, when executed by the processor, cause the decoder to perform the method of the first aspect or any possible implementation thereof.

[0036] In a seventh aspect, this application provides a chip including one or more interface circuits and one or more processors; the one or more processors receive or transmit data through the one or more interface circuits, and when the one or more processors execute computer instructions, cause the electronic device to perform the method in the first aspect or any possible implementation of the first aspect.

[0037] Eighthly, this application provides a chip including one or more interface circuits and one or more processors; the one or more processors receive or transmit data through the one or more interface circuits, and when the one or more processors execute computer instructions, cause the electronic device to perform the method in the second aspect or any possible implementation of the second aspect.

[0038] Ninthly, this application provides a computer-readable storage medium storing a computer program that, when run on a computer or processor, causes the computer or processor to perform the method of the first aspect or any possible implementation thereof.

[0039] In a tenth aspect, this application provides a computer-readable storage medium storing a computer program that, when run on a computer or processor, causes the computer or processor to perform the method of the second aspect or any possible implementation thereof.

[0040] In one aspect, this application provides a computer program product, which includes computer instructions that, when executed by a computer or processor, cause the computer or processor to perform the method in the first aspect or any possible implementation thereof.

[0041] In a twelfth aspect, this application provides a computer program product including computer instructions that, when executed by a computer or processor, cause the computer or processor to perform the method in the second aspect or any possible implementation thereof.

[0042] In a thirteenth aspect, this application provides a computer-readable storage medium that stores a bitstream from the second aspect or any possible implementation thereof.

[0043] In a fourteenth aspect, this application provides an encoder including processing circuitry that can be used to perform the methods in the second aspect or any possible implementation thereof.

[0044] In a fifteenth aspect, this application provides a decoder including processing circuitry that can be used to perform the methods in the first aspect or any possible implementation thereof.

[0045] In a sixteenth aspect, this application provides a bitstream generated according to the second aspect and any implementation thereof.

[0046] In this embodiment, the electronic device, computer-readable storage medium, computer program product, chip, or codec are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above. Attached Figure Description

[0047] Figure 1A is a schematic block diagram of an exemplary video encoding and decoding system;

[0048] Figure 1B is a schematic block diagram of an exemplary video decoding system;

[0049] Figure 2 is a schematic block diagram of an encoder as an example;

[0050] Figure 3 is a schematic block diagram of an exemplary decoder;

[0051] Figure 4 is a schematic block diagram of an encoder based on wavelet transform, which is an example shown.

[0052] Figure 5 is an exemplary schematic diagram of subgraph partitioning;

[0053] Figure 6 is an exemplary schematic diagram of wavelet transform;

[0054] Figures 7A and 7B are schematic block diagrams of an exemplary decoder;

[0055] Figure 8 is a schematic diagram of the structure of a code stream as an example;

[0056] Figure 9 is a flowchart illustrating an exemplary encoding method;

[0057] Figure 10 is a flowchart illustrating an exemplary encoding method;

[0058] Figure 11 is an exemplary scanning diagram;

[0059] Figure 12 is a schematic diagram illustrating an exemplary encoding sequence;

[0060] Figure 13 is a flowchart illustrating an exemplary encoding method;

[0061] Figure 14 is an exemplary diagram illustrating the remaining value;

[0062] Figures 15A to 15C are exemplary encoding diagrams;

[0063] Figure 16 is an exemplary schematic diagram of the Rice parameter update process;

[0064] Figure 17 is a schematic flowchart illustrating an exemplary decoding method;

[0065] Figure 18 is a schematic diagram of an exemplary decoding process;

[0066] Figure 19 is a schematic diagram of the structure of an exemplary video decoding device;

[0067] Figure 20 is a schematic diagram of the structure of an exemplary device;

[0068] Figure 21 is a schematic diagram of the structure of an exemplary device;

[0069] Figure 22 is a schematic diagram of the structure of an exemplary device. Detailed Implementation

[0070] The following is a brief introduction to some concepts that may be involved in the embodiments of this application. These concepts are only used to explain the specific embodiments of this application and are not intended to limit this application.

[0071] The residual is the difference between the reconstructed value and the predicted value of a sample or data element.

[0072] A residual block is a residual matrix composed of the residuals corresponding to the coded blocks.

[0073] Dequantization is the process of scaling the quantized residual to obtain the reconstructed residual value.

[0074] A partition divides a set into subsets. Each element in the set belongs to one and only one subset.

[0075] Partition type: The way the subsets obtained from the partition are organized.

[0076] A decoded picture is an image reconstructed by the decoder based on the bitstream.

[0077] Prediction is the specific implementation of the prediction process.

[0078] The prediction process uses previously decoded samples to obtain the predicted value for the current sample.

[0079] Syntax element: The result of parsing data units in a bitstream.

[0080] A bitstream is a binary data stream that encodes all or part of an image sample.

[0081] Video coding generally refers to the processing of a sequence of images that form a video or video sequence. In the field of video coding, the terms "picture," "frame," or "image" can be used synonymously. Video coding is performed on the source side and typically involves processing (e.g., by compression) the raw video images to reduce the amount of data required to represent them, thus enabling more efficient storage and / or transmission. Video decoding is performed on the destination side and typically involves inverse processing relative to the encoder to reconstruct the video images. The combination of encoding and decoding is also known as encoding and decoding.

[0082] A video sequence consists of a series of images, which are further divided into slices, and slices into blocks. Video coding is performed on a block-by-block basis. In some newer video coding standards, the concept of a block has been further expanded. For example, the H.264 standard uses macroblocks (MBs), which can be further divided into multiple prediction blocks (partitions) that can be used for predictive coding. In the High Efficiency Video Coding (HEVC) standard, basic concepts such as coding units (CUs), prediction units (PUs), and transform units (TUs) are used to functionally divide various block units, and a new tree-based structure is used for description.

[0083] In this paper, for ease of description and understanding, the image block to be processed in the current image is referred to as the current block. For example, in encoding, it refers to the block currently being encoded; in decoding, it refers to the block currently being decoded. The decoded image block in the reference image used to predict the current block is called the reference block. That is, the reference block is the block that provides a reference signal for the current block, where the reference signal represents the pixel value within the image block. The block in the reference image that provides a prediction signal for the current block is called the prediction block, where the prediction signal represents the pixel value, sampled value, or sampled signal within the prediction block. For example, after traversing multiple reference blocks, an optimal reference block is found. This optimal reference block will provide prediction for the current block; this block is called the prediction block.

[0084] In lossless video coding, the original video image can be reconstructed, meaning the reconstructed video image has the same quality as the original (assuming no transmission loss or other data loss during storage or transmission). In lossy video coding, further compression is performed, for example, through quantization, to reduce the amount of data required to represent the video image. However, the decoder cannot fully reconstruct the video image, meaning the quality of the reconstructed video image is lower or worse than the original video image.

[0085] YUV is a color space model used to represent colors, widely used in image encoding and decoding, video encoding and decoding, digital image processing, television broadcasting, and other fields. YUV separates the luminance information from the chrominance information of an image.

[0086] The three components of YUV:

[0087] Y (luminance) component: Y represents the luminance information of an image, that is, the brightness or darkness of the image. It is obtained by weighting the red, green, and blue color channels according to certain weights. The Y component plays an important role in the sharpness and detail of an image.

[0088] U (chromaticity) component: U represents the chromaticity information of the image, indicating the offset of the blue channel relative to the luminance Y. It measures the change in the blue component.

[0089] V (chromaticity) component: V represents the chromaticity information of the image, indicating the offset of the red channel relative to the luminance Y.

[0090] The encoding / decoding method of this application embodiment encodes and decodes images or videos on a block-by-block basis.

[0091] In some embodiments, the block to be encoded or the block to be decoded may be an image block or a video block obtained from an image or video.

[0092] In some embodiments, the block to be encoded or the block to be decoded may be an image block or video block within a subgraph obtained by dividing the image or video into subgraphs.

[0093] In some embodiments, the block to be encoded or the block to be decoded can be a block obtained from the transformed data of the image or video to be encoded after transformation processing (e.g., wavelet transform (also known as wavelet forward transform, etc., without limitation).

[0094] This application does not restrict the specific division method of the blocks to be encoded or decoded in an image or video, nor does it restrict the method of obtaining the blocks.

[0095] On the encoding side, the image to be encoded can be a frame from an image or video, a sub-image obtained by dividing a frame from an image or video, an image obtained after transformation (such as wavelet transform), or a sub-image from the transformed image; there are no restrictions here. On the encoding side, "current frame" can represent "image to be encoded," and "current block" can represent "block to be encoded." A frame is a frame of image to be displayed.

[0096] Similarly, the decoding side corresponds to the encoding side. On the decoding side, the image to be decoded can be the original image in an image or video, or an image obtained after processing the original image (e.g., left shifting), or a sub-image obtained by dividing the original image or video, or an image obtained after transformation (e.g., wavelet transform), or a sub-image in the transformed image; there are no restrictions here. On the decoding side, "current image" can be used to represent "image to be decoded," and "current block" can be used to represent "block to be decoded."

[0097] Whether on the encoding or decoding side, the reconstructed data (also called the reconstructed value) of a block can be described as a reconstructed block, and the already encoded or decoded block referenced when encoding or decoding the current block can be described as a "reference block".

[0098] Whether on the encoding or decoding side, the reference image, also known as the reference frame, can be an image that has been encoded before the current image in the video sequence, or, when the current image is a sub-image, the reference image is a sub-image that has been encoded before the current image, without any restrictions.

[0099] Whether on the encoding or decoding side, the prediction data for the current block is also referred to as the prediction block or the prediction value for the current block.

[0100] Whether on the encoding or decoding side, reconstruction can also be described as remodeling.

[0101] Whether on the encoding or decoding side, the bitstream is also described as a bitstream, etc.

[0102] Whether on the encoding or decoding side, the residual is also referred to as a residual block.

[0103] The embodiments of this application are described below with reference to the accompanying drawings.

[0104] Referring to Figure 1A, Figure 1A provides an exemplary block diagram of a video encoding and decoding system 10 used in an embodiment of this application. As shown in Figure 1A, the video encoding and decoding system 10 may include a source device 12 and a destination device 14. The source device 12 generates encoded video data; therefore, the source device 12 may be referred to as a video encoding device. The destination device 14 can decode the encoded video data generated by the source device 12; therefore, the destination device 14 may be referred to as a video decoding device. Various embodiments of the source device 12, the destination device 14, or both may include one or more processors and memory coupled to the one or more processors. The memory may include, but is not limited to, RAM, ROM, EEPROM, flash memory, or any other media that can be used to store desired program code in the form of computer-accessible instructions or data structures. The source device 12 and the destination device 14 may include a variety of devices, including desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, handsets, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, wireless communication devices, or the like.

[0105] Source device 12 and destination device 14 can communicate via link 13, through which destination device 14 can receive encoded video data from source device 12. Link 13 may include one or more media or devices capable of transmitting encoded video data from source device 12 to destination device 14. In one example, link 13 may include one or more communication media enabling source device 12 to transmit encoded video data to destination device 14 in real time. In this example, source device 12 may modulate the encoded video data according to a communication standard (e.g., a wireless communication protocol) and transmit the modulated video data to destination device 14. The one or more communication media may include wireless and / or wired communication media, such as radio frequency (RF) spectrum or one or more physical transmission lines. The one or more communication media may form part of a packet-based network, such as a local area network, wide area network, or global network (e.g., the Internet). The one or more communication media may include routers, switches, base stations, or other devices facilitating communication from source device 12 to destination device 14.

[0106] The source device 12 includes an encoder 20. Optionally, the source device 12 may also include an image source 16, an image preprocessor 18, and a communication interface 22. In specific implementations, the encoder 20, image source 16, image preprocessor 18, and communication interface 22 may be hardware components or software programs within the source device 12. These are described below:

[0107] Image source 16 may include or be any type of image capture device for, for example, capturing real-world images, and / or any type of image or commentary (for screen content encoding, some text on the screen is also considered as an image to be encoded or part of an image) generation device, such as a computer graphics processor for generating computer-animated images, or any type of device for acquiring and / or providing real-world images, computer-animated images (e.g., screen content, virtual reality (VR) images), and / or any combination thereof (e.g., augmented reality (AR) images). Image source 16 may be a camera for capturing images or a memory for storing images. Image source 16 may also include any type of (internal or external) interface for storing previously captured or generated images and / or acquiring or receiving images. When image source 16 is a camera, image source 16 may be, for example, a local or integrated camera integrated into a source device; when image source 16 is a memory, image source 16 may be a local or integrated memory integrated into a source device. When the image source 16 includes an interface, the interface may be, for example, an external interface for receiving images from an external video source, such as an external image capture device, like a camera, external storage, or an external image generation device, such as an external computer graphics processor, computer, or server. The interface can be any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, or an optical interface.

[0108] An image can be viewed as a two-dimensional array or matrix of pixels. Pixels in the array are also called sampling points. The number of sampling points in the array or image along the horizontal and vertical directions (or axes) defines the image's size and / or resolution. To represent color, three color components are typically used; that is, an image can be represented as or contain three sampling arrays. For example, in RBG format or color space, an image includes corresponding red, green, and blue sampling arrays. However, in video coding, each pixel is typically represented in a luma / chroma format or color space. For example, for a YUV format image, this includes a luma component indicated by Y (sometimes also indicated by L) and two chroma components indicated by U and V. The luma component Y represents the brightness or grayscale level intensity (e.g., both are the same in a grayscale image), while the two chroma components U and V represent chroma or color information components. Accordingly, a YUV format image includes a luma sampling array of luma sample values ​​(Y) and two chroma sampling arrays of chroma values ​​(U and V). An RGB format image can be converted or transformed to YUV format, and vice versa; this process is also called color transformation or conversion. If the image is black and white, it may only include a luminance sampling array. In this embodiment, the image transmitted from image source 16 to image processor can also be referred to as raw image data 17.

[0109] Image preprocessor 18 is configured to receive raw image data 17 and perform preprocessing on the raw image data 17 to obtain a preprocessed image 19 or preprocessed image data 19. For example, the preprocessing performed by image preprocessor 18 may include retouching, color format conversion (e.g., from RGB format to YUV format), color correction, or noise reduction.

[0110] Encoder 20 (or video encoder 20) is used to receive preprocessed image data 19 and process the preprocessed image data 19 using a relevant prediction mode (such as the prediction mode in the various embodiments herein) to provide encoded image data 21.

[0111] Communication interface 22 can be used to receive encoded image data 21 and transmit the encoded image data 21 via link 13 to destination device 14 or any other device (such as a memory) for storage or direct reconstruction. The other device can be any device used for decoding or storage. Communication interface 22 can, for example, be used to encapsulate the encoded image data 21 into a suitable format, such as data packets, for transmission over link 13.

[0112] Destination device 14 includes decoder 30. Optionally, destination device 14 may also include communication interface 28, image post-processor 32, and display device 34. These are described below:

[0113] Communication interface 28 can be used to receive encoded image data 21 from source device 12 or any other source, such as a storage device, for example, an encoded image data storage device. Communication interface 28 can be used to transmit or receive encoded image data 21 via link 13 between source device 12 and destination device 14 or via any type of network, such as a wired or wireless connection, any type of network, such as a wired or wireless network or any combination thereof, or any type of private and public network, or any combination thereof. Communication interface 28 can be used, for example, to decapsulate data packets transmitted by communication interface 22 to obtain encoded image data 21.

[0114] Both communication interface 28 and communication interface 22 can be configured as unidirectional or bidirectional communication interfaces, and can be used, for example, to send and receive messages to establish connections, acknowledge and exchange any other information related to the communication link and / or data transmission, such as encoded image data transmission.

[0115] Decoder 30 (or video decoder 30) is used to receive encoded image data 21 and provide decoded image data 31 or decoded image 31 (the structural details of decoder 30 will be further described below based on Figure 3, Figure 4 or Figure 5).

[0116] Image post-processor 32 is used to perform post-processing on decoded image data 31 (also known as reconstructed image data) to obtain post-processed image data 33.

[0117] Display device 34 is used to receive post-processed image data 33 to display an image to, for example, a user or viewer. Display device 34 can be or may include any class of displays for presenting reconstructed images, such as integrated or external displays or monitors. For example, displays may include liquid crystal displays (LCDs), organic light emitting diode (OLED) displays, plasma displays, projectors, micro-LED displays, liquid crystal on silicon (LCoS), digital light processors (DLP), or any other class of displays.

[0118] Both encoder 20 and decoder 30 can be implemented as any of a variety of suitable circuits, such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, hardware, or any combination thereof. If the technology is implemented in part in software, the device can store the software instructions in a suitable non-transitory computer-readable storage medium, and one or more processors can be used to execute the instructions in hardware to perform the technology of this disclosure. Any of the foregoing (including hardware, software, combinations of hardware and software, etc.) can be considered as one or more processors.

[0119] Referring to FIG1B, FIG1B is an illustrative diagram of an example of a video decoding system 40 including the encoder 20 of FIG2 and / or the decoder 30 of FIG3 according to an exemplary embodiment. The video decoding system 40 can implement various combinations of technologies of the embodiments of this application. In the illustrated embodiment, the video decoding system 40 may include an imaging device 41, an encoder 20, a decoder 30 (and / or a video encoder / decoder implemented by logic circuitry of a processing unit 46), an antenna 42, one or more processors 43, one or more memories 44, and a display device 45.

[0120] As shown in Figure 1B, the imaging device 41, antenna 42, processing unit 46, logic circuit, encoder 20, decoder 30, processor 43, memory 44, and display device 45 are capable of communicating with each other. As discussed, although encoder 20 and decoder 30 are used as examples to describe the video decoding system 40, in different instances, the video decoding system 40 may contain only encoder 20 or only decoder 30.

[0121] In some instances, antenna 42 can be used to transmit or receive encoded video data streams. Additionally, in some instances, display device 45 can be used to present video data. In some instances, logic circuitry can be implemented using processing unit 46. Processing unit 46 can include an ASIC, graphics processor, general-purpose processor, etc. Video decoding system 40 can also include an optional processor 43, which can similarly include an ASIC, graphics processor, general-purpose processor, etc. In some instances, logic circuitry can be implemented in hardware, such as dedicated video encoding hardware, while processor 43 can be implemented in general-purpose software, operating system, etc. Furthermore, memory 44 can be any type of memory, such as volatile memory (e.g., static random access memory (SRAM), dynamic random access memory (DRAM), etc.) or non-volatile memory (e.g., flash memory, etc.). In a non-limiting instance, memory 44 can be implemented using cache memory. In some instances, logic circuitry can access memory 44 (e.g., for implementing an image buffer). In other instances, the logic circuitry and / or processing unit 46 may include memory (e.g., cache, etc.) for implementing image buffers, etc.

[0122] In some instances, the encoder 20 implemented via logic circuitry may include (e.g., implemented via processing unit 46 or memory 44) an image buffer and (e.g., implemented via processing unit 46) a graphics processing unit. The graphics processing unit may be communicatively coupled to the image buffer. The graphics processing unit may include the encoder 20 implemented via logic circuitry to implement various modules discussed with reference to Figure 2 and / or any other encoder system or subsystem described herein. The logic circuitry may be used to perform various operations discussed herein.

[0123] In some instances, decoder 30 may be implemented via logic circuitry in a similar manner to implement the various modules discussed in reference to decoder 30 of Figure 3 and / or any other decoder system or subsystem described herein. In some instances, the logic circuitry-implemented decoder 30 may include an image buffer (implemented via processing unit 46 or memory 44) and a graphics processing unit (e.g., implemented via processing unit 46). The graphics processing unit may be communicatively coupled to the image buffer. The graphics processing unit may include decoder 30 implemented via logic circuitry to implement the various modules discussed in reference to Figure 3 and / or any other decoder system or subsystem described herein.

[0124] In some instances, antenna 42 can be used to receive an encoded stream of video data. As discussed herein, the encoded stream may contain data related to encoded video frames, indicators, index values, mode selection data, etc., such as data related to code segmentation (e.g., transform coefficients or quantized transform coefficients, optional indicators, and / or data defining code segmentation). Video decoding system 40 may also include a decoder 30 coupled to antenna 42 for decoding the encoded stream. Display device 45 is used to display the video frames.

[0125] It should be understood that, referring to the examples described for encoder 20 in the embodiments of this application, decoder 30 can be used to perform the reverse process. Regarding signaling syntax elements, decoder 30 can be used to receive and parse such syntax elements, and accordingly decode the associated video data. In some examples, encoder 20 can entropy-encode syntax elements into an encoded video stream. In such instances, decoder 30 can parse such syntax elements and accordingly decode the associated video data.

[0126] It should be noted that the encoding and decoding method described in the embodiments of this application is mainly used for the encoding and decoding process of video or images. This process exists in both encoder 20 and decoder 30. The encoder 20 and decoder 30 in the embodiments of this application can be, for example, the encoding / decoder corresponding to video standard protocols such as H.263, H.264, HEVV, MPEG-2, MPEG-4, VP8, VP9, ​​H.266, or next-generation video standard protocols (such as H.267).

[0127] Referring to Figure 2, which is a schematic / conceptual block diagram of an exemplary example of encoder 20, encoder 20 includes a residual calculation unit 204, a transform processing unit 206, a quantization unit 208, an inverse quantization unit 210, an inverse transform processing unit 212, a reconstruction unit 214, a buffer 216, a loop filter unit 220, a decoded picture buffer (DPB) 230, a prediction processing unit 260, and an entropy coding unit 270. Prediction processing unit 260 may include inter-frame prediction unit 244, intra-frame prediction unit 254, and mode selection unit 262. Inter-frame prediction unit 244 may include a motion estimation unit and a motion compensation unit (not shown). Encoder 20 shown in Figure 2 may also be referred to as a hybrid video encoder or a video encoder based on a hybrid video codec.

[0128] Specifically, encoder 20 receives image 201 or image blocks 203 of image 201 via, for example, input 202. Encoder 20 is used to encode image 201 block by block, for example, by performing encoding and prediction for each image block 203.

[0129] The residual calculation unit 204 is used to calculate the residual block 205 based on the image block 203 and the prediction block 265. The transform processing unit 206 is used to apply a transform, such as a discrete cosine transform (DCT) or a discrete sine transform (DST), to the sample values ​​of the residual block 205 to obtain transform coefficients 207 in the transform domain. The transform coefficients 207 can also be called transform residual coefficients.

[0130] The quantization unit 208 is used to quantize the transform coefficients 207, for example, by applying scalar quantization or vector quantization, to obtain the quantized transform coefficients 209.

[0131] The inverse quantization unit 210 is used to apply the inverse quantization of the quantization unit 208 to the quantized coefficients to obtain the inverse quantization coefficients 211.

[0132] The inverse transformation processing unit 212 is used to apply the inverse transformation of the transformation applied by the transformation processing unit 206 to obtain the inverse transformation block 213.

[0133] Reconstruction unit 214 (e.g., summer 214) is used to add inverse transform block 213 (i.e. reconstructed residual block 213) to prediction block 265 to obtain reconstructed block 215.

[0134] The loop filter unit 220 (or simply "loop filter" 220) is used to filter the reconstructed block 215 to obtain the filtered block 221.

[0135] The decoded image buffer 230 can be used as a reference image memory to store reference image data for the encoder 20 to encode video data.

[0136] The prediction processing unit 260, also known as the block prediction processing unit 260, is used to receive or acquire image block 203 (current image block 203 of current image 201) and reconstructed image data, and to process such data to make predictions, i.e., to provide prediction block 265 which can be either inter-frame prediction block 245 or intra-frame prediction block 255.

[0137] The mode selection unit 262 can be used to select a prediction mode (e.g., intra-frame or inter-frame prediction mode) and / or the corresponding prediction block 245 or 255 used as prediction block 265 to compute residual block 205 and reconstructed block 215.

[0138] Specifically, the intra-frame prediction unit 254 can transmit syntax elements to the entropy coding unit 270. The entropy coding unit 270 is used to apply an entropy coding algorithm or scheme (e.g., variable length coding (VLC) scheme, context adaptive VLC (CAVLC) scheme, arithmetic coding scheme, context adaptive binary arithmetic coding (CABAC), syntax-based context-adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) coding, or other entropy coding methods or techniques) to one or all (or not apply) of the quantized residual coefficients 209, inter-frame prediction parameters, intra-frame prediction parameters, and / or loop filter parameters to obtain encoded image data 21 that can be output by output 272 in the form of, for example, an encoded bitstream 21.

[0139] Referring to Figure 3, which is a schematic / conceptual block diagram of an example of a decoder 30, the decoder 30 is used to receive, for example, encoded image data (e.g., encoded bitstream) 21 encoded by encoder 20 to obtain a decoded image 331. During the decoding process, the decoder 30 receives video data from encoder 20, such as encoded video bitstreams representing image blocks of encoded video stripes and associated syntax elements.

[0140] In the example of Figure 3, decoder 30 includes an entropy decoding unit 304, an inverse quantization unit 310, an inverse transform processing unit 312, a reconstruction unit 314 (e.g., a summer 314), a buffer 316, a loop filter 320, a decoded image buffer 330, and a prediction processing unit 360. Prediction processing unit 360 may include an inter-frame prediction unit 344, an intra-frame prediction unit 354, and a mode selection unit 362. In some instances, decoder 30 may perform a decoding process that is generally the inverse of the encoding process described in video encoder 20 of Figure 2.

[0141] Specifically, the entropy decoding unit 304 is used to perform entropy decoding on the encoded image data 21 to obtain, for example, quantization coefficients 309 and / or decoded encoding parameters (not shown in Figure 3).

[0142] The inverse quantization unit 310 can function the same as the inverse quantization unit 110, the inverse transform processing unit 312 can function the same as the inverse transform processing unit 212, the reconstruction unit 314 can function the same as the reconstruction unit 214, the buffer 316 can function the same as the buffer 216, the loop filter 320 can function the same as the loop filter 220, and the decoded image buffer 330 can function the same as the decoded image buffer 230.

[0143] The prediction processing unit 360 is typically used to perform block prediction and / or obtain prediction blocks 365 from the encoded data 21, and to receive or obtain prediction-related parameters and / or information about the selected prediction mode from, for example, the entropy decoding unit 304 (explicitly or implicitly).

[0144] The inverse quantization unit 310 can be used to inverse quantize (i.e., dequantize) the quantized transform coefficients provided in the bitstream and decoded by the entropy decoding unit 304. The inverse transform processing unit 312 is used to apply an inverse transform (e.g., inverse DCT, inverse integer transform, or a conceptually similar inverse transform process) to the transform coefficients to generate a residual block in the pixel domain.

[0145] Reconstruction unit 314 (e.g., summer 314) is used to add inverse transform block 313 (i.e. reconstructed residual block 313) to prediction block 365 to obtain reconstructed block 315 in the sample domain.

[0146] The loop filter unit 320 (during or after the encoding loop) is used to filter the reconstructed block 315 to obtain the filtered block 321.

[0147] Decoder 30 is used, for example, to output decoded image 31 via output 332 for presentation to user or for user viewing.

[0148] For example, commonly used transform methods in image coding include discrete cosine transform and wavelet transform. Wavelet transform is a local transform method that can perform localized, multi-scale analysis of images, focusing on the details of signal changes, making it very suitable for image coding tasks.

[0149] This application provides a wavelet transform-based codec that can independently encode and decode low-frequency and high-frequency sub-bands, effectively reducing encoding and decoding complexity and improving efficiency. For example, an image undergoes wavelet transform to obtain low-frequency and high-frequency sub-bands, which are then encoded to generate low-frequency and high-frequency sub-band bitstreams, respectively. The low-frequency sub-band can be understood as a sub-image representing the low-frequency signal (or low-frequency information) of the original image, and the high-frequency sub-band can be understood as a sub-image representing the high-frequency signal (or high-frequency information) of the original image.

[0150] Referring to Figure 4, which is a schematic / conceptual block diagram of an encoder as an example, the encoder in the example of Figure 4 includes, but is not limited to, a sub-graph partitioning unit 410, a wavelet forward transform unit 420, a low-frequency sub-band processing path 430, and a high-frequency sub-band processing path 440.

[0151] The sub-image partitioning unit 410 is used to acquire the current image and partition it to obtain at least one sub-image. Specifically, the sub-image partitioning unit 410 partitions the current image into N sub-images according to a sub-image partitioning method, where N is an integer greater than 0 (or an integer greater than 1). The sub-image partitioning method can include, but is not limited to, at least one of the following:

[0152] The width and / or height of the subgraph are multiples of 128;

[0153] The maximum width of the subimage is 1024 pixels;

[0154] The minimum height and / or width of the subimage is 256 pixels;

[0155] The original image resolution is less than or equal to 1080p, and N is an integer greater than 1 and less than or equal to 8; or,

[0156] The original image has a length greater than or equal to 4320 pixels, a width greater than or equal to 2160 pixels, and N is an integer greater than 1 and less than or equal to 16; or,

[0157] The original image has a length greater than or equal to 7680 pixels, a width greater than or equal to 4320 pixels, and N is an integer greater than 1 and less than or equal to 32.

[0158] The values ​​mentioned above are merely illustrative examples and can be set according to actual needs.

[0159] Referring to Figure 5, which is an exemplary schematic diagram of sub-image partitioning, in the example of Figure 5, the sub-image partitioning unit 410 can partition the image 401 into m multiplied by n sub-images according to the sub-image partitioning method. Optionally, in this example, the width and height of each sub-image satisfy a multiple of 128.

[0160] The sub-image partitioning unit 410 can partition the image into m multiplied by n sub-images according to the sub-image partitioning method. Among them, for sub-images whose width and height are not multiples of 128, the sub-image partitioning unit 410 can pad these sub-images so that the height and width of each padded sub-image can be multiples of 16.

[0161] The wavelet forward transform unit 420 is used to perform wavelet transform (also called wavelet forward transform) on the subgraph to obtain low-frequency subband and high-frequency subband. The low-frequency subband includes low-frequency signals in the subgraph that satisfy the low-frequency filter coefficients, and the high-frequency subband includes high-frequency signals in the subgraph that have been decomposed by the high-frequency filter in the wavelet transform.

[0162] Referring to Figure 6, which is an exemplary schematic diagram of wavelet transform, in the example of Figure 6, the wavelet forward transform unit 420 acquires the current sub-image, for example, sub-image 1_1. The wavelet forward transform unit 420 performs a wavelet transform on the current sub-image, wherein the wavelet transform includes one horizontal wavelet transform and one vertical wavelet transform to obtain the wavelet coefficients of the low-low (LL) sub-band (abbreviated as LL sub-band), the wavelet coefficients of the low-high (LH) sub-band (abbreviated as LH sub-band), the wavelet coefficients of the high-high (HH) sub-band (abbreviated as HH sub-band), and the wavelet coefficients of the high-low (HL) sub-band (abbreviated as HL sub-band).

[0163] In this embodiment, the low-frequency subband includes an LL subband, and the high-frequency subband includes an LH subband, an HH subband, and an HL subband. Optionally, the LL subband, LH subband, HH subband, and HL subband have the same dimensions (including width and height).

[0164] Referring again to Figure 4, the low-frequency subband processing path 430 is used to obtain the wavelet coefficients 403 of the low-frequency subband to obtain the low-frequency subband encoded data 413. The low-frequency subband processing path 430 includes, but is not limited to: a block partitioning unit 431 (also called a low-frequency subband block partitioning unit 431), a residual calculation unit 432, a prediction unit 437, a control unit 438, a transform / quantization unit (also called a low-frequency subband transform / quantization unit 433), an inverse quantization / inverse transform unit 434 (also called a low-frequency subband inverse quantization / inverse transform unit 434), a low-frequency subband reconstruction unit 435, a low-frequency subband splicing unit 436, and a low-frequency subband entropy coding unit 439, etc.

[0165] The high-frequency subband processing path 440 is used to acquire high-frequency subbands to obtain high-frequency subband encoded data. The high-frequency subband processing path 440 includes, but is not limited to: a block partitioning unit 431 (also referred to as a high-frequency subband block partitioning unit 431 or a second block partitioning unit 431), a transform / quantization unit (also referred to as a transform / quantization unit 442 or a second transform / quantization unit), and a high-frequency subband entropy coding unit 443, etc.

[0166] Alternatively, in some instances, the encoder may include more or fewer units or modules than the structure shown in Figure 4.

[0167] The image 401 encoding method provided in this application will be described in detail below with reference to the encoder shown in Figure 4:

[0168] The codec receives image 401. A description of image 401 can be found above and will not be repeated here.

[0169] Sub-image partitioning unit 410 partitions image 401 into sub-images and outputs N sub-images. N is an integer greater than 0. In this embodiment, each sub-image is encoded and decoded independently. During the encoding process, sub-image 402 can be referred to as the current sub-image or the sub-image to be encoded.

[0170] Wavelet forward transform unit 420 performs wavelet forward transform on the current sub-image to obtain wavelet coefficients 403 (hereinafter referred to as low-frequency sub-band) and wavelet coefficients 414 (hereinafter referred to as high-frequency sub-band) of the current sub-image. The wavelet coefficients 403 of the low-frequency sub-band include the wavelet coefficients of the LL sub-band, and the wavelet coefficients of the LH, HL, and HH sub-bands are included in the high-frequency sub-band. In this embodiment, each sub-image of the image can be independently encoded and decoded, and the high-frequency sub-band and low-frequency sub-band of each sub-image are independently encoded and decoded. The LH, HL, and HH sub-bands in the high-frequency sub-band can also be independently encoded and decoded.

[0171] The block partitioning unit 431 (which may be called the low-frequency sub-band block partitioning unit) is used to obtain the wavelet coefficients 403 of the low-frequency sub-band of the current sub-graph 402, so as to obtain at least one macroblock 404 of the low-frequency sub-band of the sub-graph 402. The macroblock can also be understood as a set of partial coefficients in the wavelet coefficients of the low-frequency sub-band.

[0172] Specifically, the block partitioning unit 431 partitions the wavelet coefficients 403 of the low-frequency sub-band of the current subgraph 402 into blocks based on the block partitioning method, obtaining at least one macroblock 404 of the low-frequency sub-band of the current subgraph, for example, M macroblocks, where M is an integer greater than 0 (or greater than 1). The low-frequency block partitioning unit 431 outputs the macroblocks 404 of the wavelet coefficients 403 of the current low-frequency sub-band one by one to the residual calculation unit 432 and the control unit 438.

[0173] In the embodiments of this application, macroblock 404 is a basic encoding / decoding unit. During the encoding process, macroblock 404 may also be referred to as the current block, current image block 401, macroblock 404 to be encoded, block to be encoded, image block 404 to be encoded, etc.

[0174] Alternatively, the block partitioning method includes, but is not limited to:

[0175] The wavelet coefficients 403 of both the high-frequency subband and the low-frequency subband are divided into basic coding units of 8x8 macroblocks 404 (unit is pixels).

[0176] For example, as described above, each subband uses macroblock 404 as the basic coding unit. The macroblock 404 currently to be encoded is referred to as the current macroblock 404. Specifically, the low-frequency subband processing path 430 encodes each macroblock 404 of the wavelet coefficients 403 of the low-frequency subband block by block. For example, encoding and prediction are performed on each macroblock 404. The encoding process for the current macroblock 404 will be described below; the processing flow for other macroblocks is the same, and will not be illustrated individually in this application. For example, in encoding, it refers to the macroblock currently being encoded; in decoding, it refers to the macroblock currently being decoded. The decoded macroblock in the reference image used for predicting the current macroblock 404 is called the reference block (i.e., the low-frequency subband reconstruction block 409 in the figure). The reference block is the block that provides the reference signal for the current block, where the reference signal represents the pixel value within the macroblock 404. The block in the reference image that provides the prediction signal for the current block can be called prediction block 405, where the prediction signal represents the pixel value, sample value, or sample signal within prediction block 405. For example, after traversing multiple reference blocks, an optimal reference block is found, and this optimal reference block will provide the prediction for the current block; this block is called prediction block 405.

[0177] Specifically, referring to Figure 4, the residual calculation unit 432 is used to obtain the current macroblock 404 and the prediction block 405 (further details of the prediction block 405 are provided below) to obtain the residual block 406. Specifically, the residual calculation unit performs residual calculation on the current macroblock 404 and the prediction block 405 to obtain the residual block 406. The residual calculation unit 432 outputs the residual block 406 to the transform / quantization unit 433.

[0178] The transform / quantization unit 433 is used to obtain the residual block 406 to obtain the residual quantized block 407. Specifically, the transform / quantization unit 433 performs transform and / or quantization processing on the residual block 406 to obtain the residual quantized block 407, which can also be called the quantized residual block. The residual quantized block 407 includes the quantization coefficients of the residual block 406.

[0179] The transform / quantization unit 433 outputs the residual quantization block 407 to the inverse quantization single / inverse transform unit 434 and the low-frequency subband entropy coding unit 439.

[0180] The inverse quantization / inverse transform unit 434, also known as the inverse quantization / inverse transform unit, is used to obtain the residual coefficients 407 to obtain the residual reconstruction block 408. Specifically, the inverse quantization / inverse transform unit 434 performs inverse quantization and / or inverse transform processing on the residual quantization block 407 to obtain the residual reconstruction block 408, which can also be called the inverse quantization residual block, etc. The residual reconstruction block 408 includes the inverse quantization coefficients of the residual block 406. The inverse quantization / inverse transform unit 434 outputs the residual reconstruction block 408 to the low-frequency subband splicing unit 436.

[0181] The dequantization / inverse transform unit 434 may include a dequantization unit and an inverse transform unit (not shown in the figure). The dequantization unit is used to dequantize the input coefficients, and the inverse transform unit is used to inverse transform the input coefficients.

[0182] The low-frequency subband reconstruction unit 435 is used to obtain a low-frequency subband reconstruction block 409 based on the prediction block 405 and the residual reconstruction block 408. Specifically, the low-frequency subband reconstruction unit 435 adds the residual reconstruction block 408 to the prediction block 405 to obtain the low-frequency subband reconstruction block 409, which can also be called a reconstructed low-frequency subband macroblock. Optionally, the low-frequency subband reconstruction unit 435 outputs the low-frequency subband reconstruction block 409 to the prediction unit 437 and the low-frequency subband splicing unit 436. Optionally, the low-frequency subband reconstruction unit 435 outputs the low-frequency subband reconstruction block 409 to the control unit 438.

[0183] The low-frequency subband stitching unit 436 is used to obtain the reconstructed low-frequency subband 411 based on the low-frequency subband reconstruction block 409, which can also be referred to as the reconstructed value of the low-frequency subband or the reconstructed data of the low-frequency subband. Optionally, the low-frequency subband stitching unit 436 outputs the reconstructed low-frequency subband 411 to the prediction unit 437. Optionally, the low-frequency subband stitching unit 436 outputs the reconstructed low-frequency subband 411 to the control unit 438.

[0184] Specifically, as described above, the low-frequency subband uses macroblocks as the basic coding unit, and the low-frequency subband splicing unit 436 can obtain M low-frequency subband reconstruction blocks of a low-frequency subband. The low-frequency subband splicing unit 436 can reconstruct the corresponding low-frequency subband based on the M low-frequency subband reconstruction blocks, that is, obtain the reconstructed low-frequency subband 411.

[0185] The control unit 438 is used to acquire control information 418 and output the control information 418 to the low-frequency subband entropy coding unit 439. For example, the control information 418 may include, but is not limited to, mode information 412. The control unit may determine the mode information 412 based on macroblock 404 (i.e., the current block); or it may determine the mode information 412 based on the current macroblock 404, the low-frequency subband reconstruction block 409, and the reconstructed low-frequency subband 411.

[0186] The mode information, also known as prediction mode information, is used to indicate the prediction mode (or prediction method) of the prediction unit 437, such as inter-frame or intra-frame prediction mode. The control unit 438 can output mode information 412 to the prediction unit 437.

[0187] Prediction unit 437, also known as prediction processing unit, is used to acquire mode information 412 and perform prediction processing based on mode information 412. Specifically, prediction unit 437 can select a prediction mode based on mode information 412. In one example, prediction unit 437 can acquire low-frequency sub-band reconstruction block 409 based on mode information 412 to obtain prediction block 405. Specifically, prediction unit 437 can perform intra-frame prediction based on low-frequency sub-band reconstruction block 409 to obtain prediction block 405. In another example, prediction unit 437 can acquire reconstructed low-frequency sub-band 411 based on mode information 412 to obtain prediction block 405.

[0188] The prediction unit 437 outputs prediction block 405 to the residual calculation unit 432 and the low-frequency sub-band splicing unit 436.

[0189] The low-frequency subband entropy coding unit 439 is used to obtain low-frequency subband encoded data 413, also known as encoded low-frequency subband, based on the residual quantization block 407 and mode information 412. Specifically, the low-frequency subband entropy coding unit 439 uses an entropy coding algorithm or scheme (e.g., variable length coding (VLC), context adaptive VLC (CAVLC), arithmetic coding, context adaptive binary arithmetic coding (CABAC), syntax-based context-adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) coding, or other entropy coding methods or techniques) to entropy code the residual quantization block 407 and mode information 412 to obtain low-frequency subband encoded data 413 output in the form of, for example, an encoded bitstream.

[0190] Referring again to Figure 4, block partitioning unit 441, also known as high-frequency subband block partitioning unit, is used to obtain the high-frequency subband of the current subgraph 402 to obtain at least one macroblock 415 of the high-frequency subband of the subgraph 402. For a detailed description, please refer to the low-frequency subband section; it will not be repeated here. Specifically, block partitioning unit 441 partitions the high-frequency subband 414 of the current subgraph 402 (hereinafter referred to as the current high-frequency subband) into blocks based on the block partitioning method, obtaining at least one macroblock 415 of the current subgraph 402, for example, M macroblocks, where M is an integer greater than 0 (or an integer greater than 1). Other undescribed parts can be referred to the relevant description of block partitioning unit 431; it will not be repeated here.

[0191] Block partitioning unit 441 outputs the macroblocks of the current high-frequency subband one by one to quantization / conversion unit 442.

[0192] The transform / quantization unit 442 is used to transform and / or quantize the macroblock 415 to obtain the quantization coefficients 416 of the high-frequency subband block (i.e., the quantization coefficients of the current macroblock). The transform / quantization unit 442 outputs the quantization coefficients 416 of the high-frequency subband block to the high-frequency subband entropy coding unit 443.

[0193] The high-frequency subband entropy coding unit 443 is used to perform entropy coding on the data to be encoded to obtain high-frequency subband encoded data 417. The data to be encoded may include, but is not limited to, the quantization coefficients and syntax elements of each high-frequency subband block. The high-frequency subband encoded data 417 includes, but is not limited to, HH subband encoded data, HL subband encoded data, and LH subband encoded data.

[0194] The high-frequency subband entropy coding unit 443 uses an entropy coding algorithm or scheme to encode the data to be coded. The aforementioned entropy coding scheme can be, for example, at least one of the following: VLC scheme, CAVLC scheme, arithmetic coding scheme, and CABAC.

[0195] The encoding and decoding method provided in this application supports two scenarios: full I-frame configuration and I / P frame alternating encoding configuration. The encoder architecture shown in Figure 4 adds relevant modules required for the prediction process on the basis of the wavelet transform architecture, which can improve the compression efficiency of I / P frame alternating encoding for scenarios such as fixed camera positions and slow camera movement.

[0196] Optionally, encoder 40 may also include, but is not limited to, a combining unit (not shown in the figure), also known as a multiplexer (MUX). The combining unit is used to generate a bitstream based on low-frequency subband coded data and high-frequency subband coded data.

[0197] Specifically, the combining unit writes low-frequency subband coded data 413 into the bitstream and writes high-frequency subband coded data 417 into the bitstream. In this embodiment, by encoding the low-frequency subband and high-frequency subband separately, the low-frequency subband coded data and high-frequency subband coded data can be decoded independently. That is, at the decoding end, it can independently decode the low-frequency subband coded data and high-frequency subband coded data in the bitstream, thereby improving decoding efficiency.

[0198] Referring to Figure 7A, which is a schematic / conceptual block diagram of an exemplary decoder, in the example of Figure 7A, the decoder receives, for example, a bitstream encoded by an encoder to obtain a decoded image of the original image, also referred to as a decoded image, reconstructed image, etc. During the decoding process, the decoder receives the bitstream from the encoder, including, but not limited to, image header information and image data.

[0199] In the example shown in Figure 7A, the decoder includes, but is not limited to: low-frequency subband processing path 710, high-frequency subband processing path 720, wavelet inverse transform unit 730, image combination unit 740 (also known as image stitching unit), etc.

[0200] For example, the low-frequency subband processing path 710 is used to acquire low-frequency subband encoded data to obtain reconstructed low-frequency subband 706 (also known as decoded low-frequency subband). The low-frequency subband processing path includes, but is not limited to: low-frequency subband entropy decoding unit 711, inverse quantization / inverse transform unit 74 (also known as low-frequency subband inverse quantization / inverse transform unit), low-frequency subband reconstruction unit 713, low-frequency subband splicing unit 715, prediction unit 714, etc.

[0201] The high-frequency subband processing path 720 is used to acquire high-frequency subband encoded data to obtain reconstructed high-frequency subband 731, which can also be called the reconstructed value of high-frequency subband or the reconstructed data of high-frequency subband, including but not limited to: high-frequency subband entropy decoding unit 721, inverse quantization / inverse transform unit 721 (also called high-frequency subband inverse quantization / inverse transform unit), high-frequency subband reconstruction unit 731, etc.

[0202] In some instances, the decoder shown in Figure 7A can perform a decoding process that is largely the reverse of the encoding process described with reference to the encoder in Figure 4.

[0203] The decoding method in the embodiments of this application will be described in detail below with reference to the decoder 70 shown in Figure 7A.

[0204] For example, decoder 70 can obtain high-frequency subband encoded data and low-frequency subband encoded data in the bitstream based on the image header information in the bitstream. Furthermore, as described above, during the encoding process, the encoder uses macroblocks as the basic encoding unit, and correspondingly, during the decoding process, the decoder also uses macroblocks (e.g., encoded macroblocks) as the basic decoding unit for decoding.

[0205] For example, the low-frequency subband entropy decoding unit 711 performs entropy decoding on the low-frequency subband encoded data 701 in the bitstream, using macroblocks as the basic decoding unit, to obtain the quantization coefficients 702 (i.e., the quantization coefficients of the current macroblock) and syntax elements 707 of the low-frequency subband block. The description of the quantization coefficients 702 of the low-frequency subband can be found on the encoder side and will not be repeated here. Specifically, the low-frequency subband entropy decoding unit 711 obtains the encoded macroblocks (i.e., the encoded data of the macroblocks) of the low-frequency subbands (e.g., LL subbands) of each subgraph in the bitstream, and performs entropy decoding on each encoded macroblock to obtain the quantization coefficients 702 (which can be simply referred to as the quantization coefficients of the macroblock of the low-frequency subband) and syntax elements 707 of the corresponding low-frequency subband for each encoded macroblock. During the decoding process, the currently decoded encoded macroblock can be called the current block.

[0206] The low-frequency subband decoding unit is used to output the quantization coefficients 702 of the low-frequency subband block to the inverse quantization / inverse transform unit 712 and to output the mode information 707 to the prediction unit 714.

[0207] The inverse quantization / inverse transform unit 712 is used to obtain the quantization coefficients 702 of the low-frequency subband block to obtain the inverse quantization coefficients 703 of the low-frequency subband block. Alternatively, it can be the inverse transform coefficients of the current block of the low-frequency subband (depending on whether inverse transform processing was performed). Specifically, the inverse quantization / inverse transform unit 712 performs inverse quantization on the quantization coefficients of the current block of the low-frequency subband, or performs both inverse quantization and inverse transform, to obtain the inverse quantization coefficients of the current block of the low-frequency subband. The inverse quantization / inverse transform unit 712 outputs the inverse quantization coefficients 703 of the low-frequency subband block to the low-frequency subband reconstruction unit 713, for example, the inverse quantization coefficients of the current block of the low-frequency subband.

[0208] The low-frequency subband reconstruction unit 713 is used to obtain the low-frequency subband reconstruction block 704, which can also be called the reconstruction coefficient of the low-frequency subband block, based on the quantization coefficients 703 and the prediction block 705 of the low-frequency subband. Specifically, the low-frequency subband reconstruction unit 713 adds the prediction block to the inverse quantization coefficients of the current block of the low-frequency subband to obtain the low-frequency subband reconstruction block 704 corresponding to the current macroblock.

[0209] The prediction unit 714 is used to acquire mode information 412 and perform corresponding prediction processing according to the mode information 412. For example, it can perform intra-frame prediction based on the low-frequency subband reconstruction block 704, or perform inter-frame prediction based on the reconstructed low-frequency subband 706. Its execution method can be referred to the coding side, and will not be repeated here. The prediction unit 714 outputs prediction block 705 to the low-frequency subband reconstruction block 704 unit.

[0210] For example, the high-frequency subband entropy decoding unit 721 acquires the high-frequency subband encoded data 707 in the bitstream, and, using macroblocks as the basic decoding unit, acquires the quantization coefficients 708 of each high-frequency subband block (which are the quantization coefficients of the current macroblock). Specifically, the high-frequency subband entropy decoding unit 721 performs entropy decoding on the current block of the high-frequency subband encoded data 707 to obtain the quantization coefficients of the current block of the high-frequency subband. Optionally, based on entropy decoding, control information corresponding to the current block can also be acquired, such as mode information 412. The high-frequency subband entropy decoding unit 721 outputs the quantization coefficients 708 of the high-frequency subband block to the inverse quantization / inverse transform unit 722.

[0211] The inverse quantization / inverse transform unit 722, also known as the high-frequency subband inverse quantization / inverse transform unit, is used to obtain the quantization coefficients 708 of the high-frequency subband block to obtain the reconstruction coefficients 709 of the high-frequency subband block. The reconstruction coefficients can be either inverse quantization coefficients after inverse quantization processing, or inverse transform coefficients after inverse quantization and inverse transform processing.

[0212] The high-frequency subband reconstruction unit 723 (also known as the high-frequency subband splicing unit) is used to obtain the reconstruction coefficients 709 of the high-frequency subband block to obtain the reconstructed high-frequency subband 731, which can also be referred to as the reconstructed value or reconstructed data of the high-frequency subband. Specifically, the high-frequency subband reconstruction unit 723 can obtain the reconstruction coefficients corresponding to each macroblock of the high-frequency subband, that is, reconstruct the high-frequency subband block. The high-frequency subband reconstruction unit 723 can splice the obtained multiple macroblocks to obtain the corresponding high-frequency subband. Among them, the reconstructed high-frequency subband may optionally include reconstructing the HL subband (e.g., the reconstruction coefficients of the HL subband), reconstructing the HH subband (e.g., the reconstruction coefficients of the HH subband), and reconstructing the LH subband (e.g., the reconstruction coefficients of the LH subband).

[0213] The inverse wavelet transform unit 730 is used to acquire the reconstructed high-frequency subband 731 and the reconstructed low-frequency subband 706 to obtain the reconstructed sub-image 732. Specifically, the inverse wavelet transform unit 730 acquires the reconstructed low-frequency subband 706 output by the low-frequency subband stitching unit 715 and the reconstructed high-frequency subband 731 output by the high-frequency subband reconstruction unit 723, and performs an inverse wavelet transform on the reconstructed low-frequency subband 706 and the reconstructed high-frequency subband 731 to obtain the reconstructed sub-image 732. The inverse wavelet transform unit 730 outputs the reconstructed sub-image 732 to the image combining unit (also known as the image stitching unit, etc.).

[0214] Image combining unit 740 is used to acquire reconstructed sub-images 732 to obtain a reconstructed image 733 of the original image, which can also be called a decoded image or a decoded image, etc. Specifically, image combining unit 740 can acquire N reconstructed sub-images (N is an integer greater than 0) of the image (referring to the original image), and stitch (or combine) the N reconstructed sub-images according to the division method (including size and position) of each reconstructed sub-image during encoding to obtain the reconstructed image 733.

[0215] Optionally, after acquiring the reconstructed image, the image combining unit 740 can determine whether the reconstructed image contains a padding portion based on the image size information in the image header information and the size information of the current reconstructed image. In one example, if the size of the current reconstructed image is the same as the size indicated by the image size information (i.e., the same as the original image size), the image combining unit 740 can send the reconstructed image to the display device. In this case, the sizes of the displayed image, the original image, and the reconstructed image are all the same. In another example, if the size of the current reconstructed image is different from the size indicated by the image size information (e.g., larger than the original image size), the image combining unit 740 can remove the padding portion of the current reconstructed image based on the size indicated by the image size information to obtain the displayed image. The size of the displayed image is the same as the size of the original image. Optionally, the decoder is used, for example, to output the reconstructed image through the decoder's output port (or output interface) for presentation to the user or for the user to view.

[0216] Other variations of the decoder can be used to decode compressed bitstreams.

[0217] Referring to Figure 7B, which is an exemplary schematic / conceptual block diagram of a decoder, in this example, the wavelet inverse transform unit 730 is used to obtain the reconstruction coefficients 709 of the high-frequency subband block, i.e., the high-frequency subband reconstruction block, and the low-frequency subband reconstruction block 704 output by the low-frequency subband reconstruction block unit 713. The wavelet inverse transform is then performed on the high-frequency subband reconstruction block (e.g., including HH subband reconstruction blocks, HL subband reconstruction blocks, and LH subband reconstruction blocks) and the low-frequency subband reconstruction block 704 to obtain the reconstruction block 734, which is the reconstruction block of the current subgraph, and can also be referred to as the reconstruction data of the current block of the current subgraph or the reconstruction value of the current block of the current subgraph, etc.

[0218] The wavelet inverse transform unit 730 outputs a reconstructed block 734 to the sub-image combination unit 750. The sub-image combination unit 750 can obtain a reconstructed sub-image 732 of the current sub-image based on at least one reconstructed block corresponding to the current sub-image; this can also be referred to as the reconstructed value or reconstructed data of the current sub-image. The undescribed parts of Figure 7B can be referred to Figure 7A, and will not be elaborated here.

[0219] The bitstream output by the encoder in the embodiments of this application will be described in detail below. The bitstream structure described below can be applied to the encoder shown in Figure 4, and of course, it can also be applied to other encoder variations based on Figure 4.

[0220] Referring to Figure 8, which is an exemplary schematic diagram of the bitstream structure, the bitstream in the example of Figure 8 includes, but is not limited to, image header information and image data.

[0221] For example, the image data includes at least one image data region (also referred to as an image data sub-region), such as, but not limited to, a first image data region and a second image data region. During the encoding process, the encoder (e.g., through a combination unit) writes high-frequency subband encoded data and low-frequency subband encoded data into the bitstream. Specifically, the encoder writes high-frequency subband encoded data into the first image data region and low-frequency subband encoded data into the second image data region. The order in which the encoded data is written is merely illustrative and will not be repeated below.

[0222] For example, image header information includes, but is not limited to, offset information and image size information.

[0223] For example, image size information is used to indicate the size of the original image. As mentioned above, during the encoding process, some sub-images may be padded during sub-image partitioning to ensure that the length and width of each sub-image are multiples of 16. Thus, during decoding, the size of the reconstructed image obtained by the decoder may be larger than the original image size. The decoder can process the reconstructed image based on the image size information to remove the padded portions.

[0224] For example, offset information is used to indicate the position of a data region in the bitstream, and can also be understood as indicating the position of independently decodeable coded data in the bitstream. When decoding coded data (i.e., the bitstream) according to this application, the offset information in the image header information can be used to obtain independently decodeable coded data, and decoding operations can be performed on the coded data. The independently decodeable coded data (e.g., low-frequency subband coded data and high-frequency subband coded data) can be decoded synchronously during decoding to improve decoding efficiency.

[0225] In one example, the offset information can be the length of the image data region containing adjacent, independently decodeable encoded data in the bitstream.

[0226] In another example, the offset information can be the offset (i.e., the difference) between the starting position of the image data region where the independently decoded encoded data is located and the ending position of the image header information.

[0227] It should be noted that the embodiments in this application only use a single image stream as an example for illustration, that is, the stream includes only one image data. During the encoding of video images, the encoder can generate a bitstream after encoding each image, that is, the bitstream includes multiple image data, and each image data carries the encoded data of the corresponding image.

[0228] Specifically, in the example shown in Figure 8, the high-frequency subband encoded data (including LH subband encoded data, HH subband encoded data, and HL subband encoded data) of each sub-image of the image are continuously written into the first image data region. The description of the second image data region can be found in Figure 15, and will not be repeated here.

[0229] For example, as shown in Figure 8, sub-images 1-HL-MB0, 1-HH-MB0, and 1-LH-MB0 are consecutively written into the first image data region. Here, 1-HL-MB0 represents the encoded macroblock MB0 of the HL subband of sub-image 1, 1-HH-MB0 represents the encoded macroblock MB0 of the HH subband of sub-image 1, and 1-LH-MB0 represents the encoded macroblock MB0 of the LH subband of sub-image 1. The figure only shows the encoded data structure of sub-image 1 in the bitstream; the other sub-images are similar and will not be illustrated individually here.

[0230] In this example, during decoding, the decoding end can decode the high-frequency subband encoded data according to the sub-image order, that is, each sub-image in the first image data region is decoded independently. The low-frequency subband encoded data is also decoded according to the sub-image order, that is, each sub-image in the second image data region is decoded independently. When decoding the first image data region, the decoding end can decode each coded macroblock one by one according to the coded macroblock order of each sub-image in the region. That is, the three high-frequency subband encoded data of sub-image 1 are written continuously into the first image data region; therefore, during decoding, the three high-frequency subband encoded data of sub-image 1 can be decoded one by one to obtain the decoded high-frequency subband. The structure of the LL subband encoded data is also based on each sub-image as the granularity, and the encoded data of each sub-image includes the LL subband encoded data of each macroblock in the sub-image.

[0231] In the embodiments of this application, multiple independently decoded encoded data can be decoded simultaneously, or one or more high-frequency subbands can be decoded simultaneously, and the number of simultaneous decodes depends on the decoder hardware performance.

[0232] Referring to Figure 9, which is a flowchart illustrating an exemplary encoding method, the specific steps include, but are not limited to, the following:

[0233] S901, obtain the quantization coefficients of the block to be encoded.

[0234] For example, the block to be encoded can be a macroblock, such as an 8x8 block (unit is pixels). The block to be encoded can include chroma components and luminance components, or it can be understood that the block to be encoded includes chroma transformation blocks and luminance transformation blocks.

[0235] For example, in the embodiments of this application, the quantization coefficients of the block to be encoded include the quantization coefficients of the chroma component and the quantization coefficients of the luma component. For example, in the wavelet architecture shown in Figure 4, the residual quantization block 407 (also called the quantization coefficient block) can optionally be a quantization coefficient block of the chroma component or a quantization coefficient block of the luma component. The sizes of the quantization coefficient blocks of the chroma component and the quantization coefficient blocks of the luma component can be the same or different, and both are less than or equal to the size of the macroblock. For example, the size of the quantization coefficient block of the luma component can be 4x4, that is, the quantization coefficients of the macroblock include the quantization coefficients in the four 4x4 quantization coefficient blocks corresponding to the chroma component. Accordingly, in the embodiments of this application, the quantization coefficients of the block to be encoded include the quantization coefficients in the quantization coefficient block of the chroma component and the quantization coefficients in the quantization coefficient block of the luma component. The quantization coefficient block is a matrix that includes multiple quantization coefficients.

[0236] Specifically, taking the chroma component as an example, as shown in Figure 4, the encoder can obtain the residual block of the chroma component based on the current block (i.e., macroblock 404) and the prediction block. The encoder quantizes the residual block to obtain the residual quantization block 407 (which can also be called the quantization coefficient block of the chroma component).

[0237] In another example, the quantization coefficient of the block to be encoded can be quantization coefficient 209 as shown in Figure 2.

[0238] Referring to Figure 10, which is a schematic flowchart illustrating an exemplary encoding method, in this embodiment, the encoder acquires a quantization coefficient block (which can be a quantization coefficient block for the chroma component or a quantization coefficient block for the luminance component, as will not be repeated below). The encoder scans the acquired quantization coefficient block to obtain a scanning result. The scanning result includes the quantization coefficients in the scanned quantization coefficient block, and the scanning result is one-dimensional data. The encoder can encode based on the scanning result (i.e., the quantization coefficients of the block to be encoded) to obtain a bitstream.

[0239] Referring to Figure 11, which is an exemplary scanning diagram, this example illustrates a 4x4 quantization coefficient block (i.e., the quantization coefficient block includes 16 quantization coefficients), where each square represents one quantization coefficient. After acquiring the quantization coefficient block, the encoder scans the block according to a preset scanning order to obtain the scanning result of the current quantization coefficient block. In this embodiment, the scanning order may optionally start from the direct current (DC) quantization coefficient of the quantization coefficient block (i.e., the quantization coefficient in the upper left corner) and end at the last quantization coefficient of the current quantization coefficient block (i.e., the quantization coefficient in the lower right corner).

[0240] Optionally, the scanning method in Figure 11 is a horizontal scanning method. This method is only an illustrative example. In other embodiments, other scanning sequences such as vertical scanning can also be used to scan the quantization coefficient block to obtain the corresponding scanning results. The scanning sequence can be set according to actual needs.

[0241] In this embodiment, the scanning result is one-dimensional data. That is, the encoder can obtain the one-dimensional quantization coefficients corresponding to the quantization coefficient block by scanning the quantization coefficient block.

[0242] In the embodiments of this application, the quantization coefficients of the block to be encoded can be understood as the quantization coefficients in the quantization coefficient block, or as the scanning result of the quantization coefficient block of the block to be encoded. Specifically, before encoding the quantization coefficients, a scanning operation needs to be performed to obtain one-dimensional data corresponding to the quantization coefficient block.

[0243] S902, using at least one of truncated Rice code defined by Rice parameter and exponential Golomb code defined by Rice parameter, to encode the residual value of the absolute value of the quantization coefficients to obtain the bitstream of the image to be encoded; wherein: in the process of encoding a residual value, the Rice parameter value used is adjusted based on the encoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute value is greater than a first value, and the image to be encoded includes the block to be encoded.

[0244] For example, the encoder encodes the quantization coefficients of the current block (for example, the quantization coefficients in the chroma component quantization coefficient block or the quantization coefficients in the luminance component quantization coefficient block) in the encoding order.

[0245] Referring to Figure 12, which is an exemplary diagram of the encoding order, in this embodiment, the encoding order of the encoder is the reverse of the scanning order. That is, the encoder starts from the last quantization coefficient X_n scanned in the scanning result (i.e., the last quantization coefficient in Figure 11) and encodes the quantization coefficients in the scanning result one by one until the first quantization coefficient X_0 scanned in the scanning result (i.e., the DC quantization coefficient in Figure 11).

[0246] Of course, in other embodiments, the encoding order can also be the same as the scanning order, that is, starting from the first DC quantization coefficient scanned in the scanning result and encoding one by one until the last quantization coefficient scanned.

[0247] Referring to Figure 13, which is a schematic flowchart illustrating an exemplary encoding method, this example provides a detailed description of the encoding process in S902. For instance, the encoder obtains the residual value of the absolute value of the current quantization coefficient based on the current quantization coefficient.

[0248] Referring to Figure 14, which is an exemplary illustration of the residual value, the syntax element for the residual value of the absolute value of a quantization coefficient is represented as `coeff_abs_level_remaining`. The residual value of the absolute value of a quantization coefficient is the portion (or numerical value) greater than a given value. Referring to Figure 13, assuming a given value of B0, the residual value of the absolute value of the quantization coefficient is the portion greater than B0, with an initial value of B0+1.

[0249] Optionally, the given value can be at least one numerical value such as 0, 1, or 2, which can be set according to actual needs.

[0250] For example, taking a given value of 1, in one example, if the quantization coefficient to be encoded is 0, the encoder can encode `significant_coeff_flag`, a syntax element used to indicate whether the corresponding quantization coefficient is 0. Specifically, `significant_coeff_flag` being 0 indicates that the corresponding quantization coefficient is 0, and `significant_coeff_flag` being 1 indicates that the corresponding quantization coefficient is not 0. Correspondingly, the bitstream includes encoded data where `significant_coeff_flag` = 0 to indicate that the corresponding quantization coefficient is 0, but does not include encoded data for that quantization coefficient itself. In other words, during decoding, the decoder can determine that the corresponding quantization coefficient is 0 based on `significant_coeff_flag` being 0.

[0251] Of course, in some instances, significant_coeff_flag (and coeff_abs_level_greater1_flag below) can also be considered as one type of quantization coefficient encoded data. Correspondingly, in this example, it can also be understood as the encoded data in the bitstream that includes the quantization coefficient, including encoded data where significant_coeff_flag = 0, but excluding encoded data of the residual value of the absolute value of the quantization coefficient. This will not be repeated below.

[0252] In another example, if the current quantization coefficient to be encoded is 1, the encoder can encode `significant_coeff_flag` and `coeff_abs_level_greater1_flag`. Here, `coeff_abs_level_greater1_flag` indicates whether the absolute value of the corresponding quantization coefficient is greater than a first value (e.g., 1, which can be set according to actual needs). If `coeff_abs_level_greater1_flag` is 0, it indicates that the absolute value of the corresponding quantization coefficient is not greater than 1. Therefore, when `significant_coeff_flag` is 1, indicating that the corresponding quantization coefficient is not 0, and `coeff_abs_level_greater1_flag` is 0, then the absolute value of the corresponding quantization coefficient is 1. If `coeff_abs_level_greater1_flag` is 1, it indicates that the absolute value of the corresponding quantization coefficient is greater than 1. Optionally, in this example (i.e., the absolute value of the quantization coefficient is 1), the encoder can encode the significant_coeff_flag and coeff_abs_level_greater1_flag of the quantization coefficient, where significant_coeff_flag is 1 and coeff_abs_level_greater1_flag is 0. Accordingly, the bitstream includes encoded data where significant_coeff_flag = 1 and coeff_abs_level_greater1_flag = 0 to indicate that the absolute value of the corresponding quantization coefficient is 1, but does not include the encoded data of the quantization coefficient itself. That is, during decoding, the decoder can determine that the absolute value of the corresponding quantization coefficient is 1 based on significant_coeff_flag and coeff_abs_level_greater1_flag.

[0253] In another example, if the quantization coefficient to be encoded is greater than 1, the encoder can encode the quantization coefficient's significance_coeff_flag, coeff_abs_level_greater1_flag, and the remaining value of the absolute value of the quantization coefficient (denoted as coeff_abs_level_remaining). Here, significance_coeff_flag being 1 indicates that the corresponding quantization coefficient is non-zero; coeff_abs_level_greater1_flag being 1 indicates that the corresponding quantization coefficient is greater than 1; and coeff_abs_level_remaining is the portion (or value) of the absolute value of the quantization coefficient that is greater than a given value.

[0254] Referring again to Figure 13, exemplarily, the encoder obtains the current value of the Rice parameter. In one example, the current value of the Rice parameter can be the initial value. In another example, the current value of the Rice parameter can be the updated value of the Rice parameter based on the encoded quantization coefficients. The update process will be described in detail in the following embodiments and will not be repeated here.

[0255] In this embodiment, the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute value is greater than a first value.

[0256] In one example, if the number of quantization coefficients in the block to be encoded whose absolute value is greater than the first value is greater than the second value, the initial value of the Rice parameter is the third value. In another example, if the number of quantization coefficients in the block to be decoded whose absolute value is greater than the first value is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

[0257] Optionally, the third value can be 0, the fourth value 1, the first value 1, and the second value 3. All of these values ​​can be set according to actual needs.

[0258] The first value can be a given value or one of the given values. For example, in some instances, the given values ​​can be 1 and 2. For instance, when encoding quantization coefficients with an absolute value greater than 2, `coeff_abs_level_greater1_flag = 1` and `coeff_abs_level_greater2_flag = 1` are encoded. Here, `coeff_abs_level_greater1_flag = 1` indicates that the absolute value of the quantization coefficient is greater than 1, and `coeff_abs_level_greater2_flag = 1` indicates that the absolute value of the quantization coefficient is greater than 2. In this example, the given values ​​are 1 and 2, and the first value can be either 1 or 2, depending on the actual requirements.

[0259] In the embodiment of the present application, the encoder may update the value of the Rice parameter during the encoding process based on the initial value of the Rice parameter and the value of the quantization coefficient.

[0260] Still referring to FIG. 13, for example, the encoder obtains a variable threshold based on a current value of the Rice parameter. Optionally, the variable threshold (denoted as cMax) is obtained by left shifting 3 by the value of the Rice parameter, that is, cMax=3<<k. Wherein, k is the current value of the Rice parameter, and the value 3 is a preset value. "<<" is a left shift operator, which means shifting all binary bits of 3 to the left by k bits.

[0261] For example, the encoder encodes the remaining value of the absolute value of at least one quantization coefficient of the current block by using at least one of a truncated Rice code defined by the Rice parameter and an exponential-Golomb code defined by the Rice parameter. Wherein, the at least one quantization coefficient is optionally a quantization coefficient whose absolute value is greater than a given value.

[0262] Specifically, based on the variable threshold, the encoder encodes the remaining value of the absolute value of the current quantization coefficient (denoted as coeff_abs_level_remaining) by using the truncated Rice code defined by the Rice parameter and the exponential-Golomb code defined by the Rice parameter.

[0263] In one example, if the quantization coefficient is less than the variable threshold, the encoder uses the truncated Rice code defined by the Rice parameter to encode the remaining value of the absolute value of the quantization coefficient.

[0264] Referring to FIG. 15A, which is an exemplary schematic diagram of encoding. For example, if the remaining value of the absolute value (e.g., a first remaining value) of a current quantization coefficient to be encoded (e.g., a first quantization coefficient, which may be any quantization coefficient with an absolute value greater than the given value in FIG. 12) is less than the variable threshold, the encoder uses the truncated Rice code defined by the Rice parameter to encode the first remaining value, so as to obtain encoded data of the first remaining value (i.e., coeff_abs_level_remaining) of the first quantization coefficient.

[0265] Wherein, as shown in FIG. 13, the variable threshold is obtained based on a value of the currently used Rice parameter, and the obtaining method may refer to the above description, which will not be repeated herein.

[0266] By way of example, assuming that the value of the current quantization coefficient to be encoded is 3, the value of k is 2, and the given value is 1. The encoder obtains that the value of the variable threshold is 12 based on the value of k. The encoder determines that the remaining value of the absolute value of the quantization coefficient (which is 1) is less than the variable threshold (which is 12), and the encoder uses the truncated Rice code defined by the Rice parameter to encode the remaining value of the absolute value of the current quantization coefficient.

[0267] In another example, if the quantization factor is greater than a variable threshold, the encoder uses truncated Rice code, defined by the Rice parameter, and exponential Golomb code, defined by the Rice parameter, to encode the remaining value of the absolute value of the quantization factor.

[0268] Referring to Figure 15B, which is an exemplary encoding diagram, if the residual value of the absolute value of the quantization coefficient to be encoded (which can be any quantization coefficient in Figure 12 whose absolute value is greater than a given value) is greater than or equal to a variable threshold, the encoder uses truncated Rice code defined by the Rice parameter to encode the portion (or value) of the residual value that is less than or equal to the variable threshold. Furthermore, the encoder uses exponential Golomb code defined by the Rice parameter to encode the portion (or value) of the residual value that is greater than or equal to the variable threshold, thus obtaining the encoded data of the residual value.

[0269] For example, consider a quantization coefficient of 10, k = 1, and a given value of 1 (indicating a quantization coefficient greater than or equal to 2). The encoder, based on k, obtains a variable threshold of 6 (determined by left-shifting the binary value of 3 by 1 bit). The encoder determines that the remaining absolute value of the quantization coefficient is 8 (10-2=8), which is greater than the variable threshold of 6. The encoder uses a truncated Rice code, defined by the Rice parameter, to encode the portion of the remaining absolute value of the current quantization coefficient that is less than or equal to the variable threshold (its value is 6). The encoder also uses an exponential Golomb code, defined by the Rice parameter, to encode the portion of the remaining value greater than or equal to the variable threshold (its value is 2). Thus, in this example, during decoding, the decoder decodes the bitstream and obtains the truncated Rice code, whose value is, for example, "111" (see below for specific encoding methods). Based on this truncated Rice code, the decoder can determine that the absolute value of the quantization coefficient is a value greater than or equal to the variable threshold (e.g., 6). The decoder can then obtain the portion (or value) of the absolute value of the quantization coefficient that is less than or equal to the variable threshold, which is 6. The decoder continues decoding the bitstream to obtain the value encoded in exponential Golomb code. This value is the portion (or value) greater than or equal to the variable threshold, which is 2. The decoder can obtain the absolute value of the quantization coefficient, which is 8 (6+2=8).

[0270] In one possible implementation, the encoder uses exponential Golomb codes defined by the Rice parameter to encode the residual value of the absolute value of the quantization coefficients.

[0271] Referring to Figure 15C, which is an exemplary encoding diagram, the encoder uses exponential Golomb codes defined by Rice coding to encode the residual value of the absolute value of the current quantization coefficient (which can be any quantization coefficient in Figure 12 whose absolute value is greater than a given value) to obtain the encoded data of the residual value of the absolute value of the current quantization coefficient (i.e., coeff_abs_level_remaining).

[0272] For example, the encoder writes the encoded data of the residual values ​​of the absolute values ​​of the quantization coefficients into the bitstream.

[0273] The following sections will explain truncated Rice code and exponential Golomb code respectively.

[0274] In this embodiment, the truncated Rice code defined by the Rice parameter can be a k-order truncated Rice code, and the exponential Golomb code defined by the Rice parameter can be a k-order exponential Golomb code. Wherein, the value of k is the value of the Rice parameter. Of course, in some instances, a k-order truncated Rice code and a k+1-order exponential Golomb code can also be used. For example, if the initial value of the Rice parameter is 0, then the initial value of the Rice parameter corresponding to the k-order truncated Rice code is k, which is 0, and the initial value of the k+1-order exponential Golomb code is k+1, which is 1.

[0275] k-th order truncated Rice code:

[0276] For a syntax element value x, the truncated Rice code is controlled by the threshold parameter cMax (i.e., the variable threshold) and the Rice parameter (cRiceParam).

[0277] in:

[0278] cMax = 3 <k,k=cRiceParam。

[0279] The value of k is the value of the Rice parameter. Among them, 3 is the preset value, which can be set according to actual needs.

[0280] Truncated Rice codes consist of prefix and suffix codes, where:

[0281] The prefixVal means:

[0282] prefixVal=code_num>>cRiceParam

[0283] Wherein, code_num is the numerical value to be encoded, which, for example, in this embodiment, can be the residual value of the absolute value of the quantization coefficient. When prefixVal is less than cMax>>cRiceParam, the prefix length is prefixVal+1, that is, prefixVal consists of one 1 and one 0; when prefixVal is greater than or equal to cMax>>cRiceParam, the length of the prefix string is cMax>>cRiceParam, that is, cMax>>cRiceParam consists of one 1.

[0284] The suffix suffix Val means:

[0285] The suffix string exists only when code_num < cMax and the parameter cRiceParam > 0. When the suffix string exists, suffixVal = code_num-(prefixVal<<cRiceParam). It is represented by cRiceParam fixed bits.

[0286] k-order exponential Golomb code:

[0287] For the coded value code_num, it is represented as [(M-k) Ones][0][M bits INFO]

[0288] Wherein, INFO is the information bit, that is, the encoding result of the coded value obtained by k-order exponential Golomb coding consists of M-k 1s (it can also be M-k 0s, which can be set according to actual requirements), one 0 and M-bit information bits. For example, for 30, when k=3, it is represented as 11000110.

[0289] M=floor[log2(code_num+2^k)]

[0290] INFO=code_num+2^k-2^M

[0291] Still referring to FIG. 13, after the encoder encodes the current quantization coefficient, it executes an update procedure for the value of the Rice parameter based on the current quantization coefficient. The update procedure for the value of the Rice parameter is as follows: the encoder conditionally updates the value of the Rice parameter based on the current quantization coefficient to obtain the updated value of the Rice parameter. The next quantization coefficient to be encoded will be encoded using the truncated Rice code and / or Golomb code defined by the updated value of the Rice parameter. That is, the value of the Rice parameter used when encoding the i-th quantization coefficient is a value adjusted based on the encoded quantization coefficients. The "encoded quantization coefficient(s)" herein may refer to the previous quantization coefficient before the i-th quantization coefficient. Of course, in the embodiments of the present application, the Rice parameter may also be adjusted multiple times, that is, it is a value after multiple adjustments based on a plurality of previous encoded quantization coefficients. Correspondingly, the "encoded quantization coefficient(s)" may also refer to a plurality of quantization coefficients before the i-th quantization coefficient.

[0292] Specifically, the encoder determines whether to update the value of the Rice parameter based on the absolute value of the quantization coefficient and a variable threshold. If the absolute value of the quantization coefficient is greater than the variable threshold, the encoder updates the value of the Rice parameter. If the absolute value of the quantization coefficient is less than or equal to the variable threshold, the encoder does not update the value of the Rice parameter.

[0293] In one example, if the absolute value of a quantization coefficient is greater than a variable threshold, the encoder updates the value of the Rice parameter, resulting in the updated Rice parameter value. When encoding the next quantization coefficient, truncated Rice code and / or exponential Golomb code, defined by the updated Rice parameter value, are used. Here, the next quantization coefficient refers to the next quantization coefficient to be encoded among the current quantization coefficients in the encoding order (e.g., reverse scan order).

[0294] For example, the updated value of the Rice parameter can be the sum of the current Rice parameter value and the first increment. In this embodiment, the first increment is 1. That is, if the absolute value of the quantization coefficient is greater than the variable threshold, the k value is incremented by 1.

[0295] In another example, if the absolute value of the quantization coefficient is less than or equal to the variable threshold, the encoder does not update the value of the Rice parameter. Alternatively, it can be understood as updating the Rice parameter with an increment of 0.

[0296] Optionally, in this embodiment, the encoder is set with a maximum value for the Rice parameter, for example, a maximum value of 4, which can be set according to actual needs. Specifically, before updating the Rice parameter, the encoder can determine whether the value of the Rice parameter has reached the maximum value. If it has reached the maximum value, the update process is not executed. That is, after the value of the Rice parameter reaches 4, the update process is no longer executed, and the Rice parameter value used for subsequent quantization coefficients is the maximum value, i.e., 4.

[0297] The following example illustrates in detail the process of updating the value of the Rice parameter.

[0298] Referring to Figure 16, which is an exemplary schematic diagram of the Rice parameter update process, the encoder obtains the first residual value of the absolute value of the first quantization coefficient. The encoder obtains a first variable threshold based on the value of k. Here, the current value of k is the first Rice parameter value, which can be, for example, an initial value; in this example, an initial value of 0 is used for illustration.

[0299] The encoder encodes a first residual value based on a first variable threshold, using at least one of a k-order truncated Rice code and a k-order exponential Golomb code, to obtain encoded data of the first residual value. Here, k is the first Rice parameter value, for example, 0.

[0300] The encoder determines whether to update the k value based on the first quantization coefficient and the first variable threshold. In this example, if the absolute value of the first quantization coefficient is greater than the first variable threshold, the encoder increments the k value by 1 to obtain the second Rice parameter value, for example, 1.

[0301] The encoder obtains the second residual value of the absolute value of the second quantization coefficient. Based on the current value of k, the encoder obtains the second variable threshold. Here, the current value of k is the second Ricean parameter value, for example, 1.

[0302] The encoder encodes the second residual value based on a second variable threshold, using at least one of a k-order truncated Rice code and a k-order exponential Golomb code, to obtain the encoded data of the second residual value. Here, k is the value of the second Rice parameter, for example, 1.

[0303] Referring to Figure 17, which is an exemplary flowchart of a decoding method, the specific steps include, but are not limited to, the following:

[0304] S1701, Obtain the bitstream of the image to be decoded. The image to be decoded includes the block to be decoded, and the bitstream includes the residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded.

[0305] For example, the image to be decoded can also be called the current image. The image to be decoded includes blocks to be decoded, which can also be called the current block. During the decoding process, the macroblock (i.e., the block to be decoded) is also used as the basic decoding unit.

[0306] In an optional embodiment, the image to be decoded can be the original image, or a sub-image after the original image has been divided, etc.

[0307] In the embodiments of this application, the decoder receives, for example, a bitstream generated by an encoder, which includes, but is not limited to, the residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded, or can be understood as encoded data including the residual values ​​of the absolute values ​​of the quantization coefficients of the block to be encoded.

[0308] S1702, using at least one of truncated Rice code defined by the Rice parameter and exponential Golomb code defined by the Rice parameter, decode the residual value of the absolute value of the quantization coefficients of the block to be decoded to obtain the quantization coefficients of the block to be decoded, wherein: in the process of decoding a residual value, the Rice parameter value used is adjusted based on the decoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be decoded whose absolute value is greater than a first value.

[0309] For example, the decoder decodes the bitstream using at least one of truncated Rice code defined by the Rice parameter and exponential Golomb code defined by the Rice parameter to obtain the residual values ​​of the absolute values ​​of the quantization coefficients of the block to be decoded. Based on these residual values, the quantization coefficients of the block to be decoded are then decoded.

[0310] Specifically, the decoder can decode the bitstream to obtain syntax elements such as significant_coeff_flag and coeff_abs_level_greater1_flag corresponding to each quantization coefficient. The concepts of the above syntax elements can be found on the encoding side, and will not be repeated here.

[0311] In this embodiment, the decoder can determine the number of quantization coefficients whose absolute value is greater than a first value based on the number of `coeff_abs_level_greater1_flag` values. As described above, `coeff_abs_level_greater1_flag` indicates whether the absolute value of a quantization coefficient is greater than 1 (i.e., the first value). If it is greater than 1, `coeff_abs_level_greater1_flag` is 1; if it is less than or equal to 1, `coeff_abs_level_greater1_flag` is 0. Accordingly, after decoding the bitstream and obtaining at least one `coeff_abs_level_greater1_flag` corresponding to a quantization coefficient, the decoder detects the number of syntax elements where `coeff_abs_level_greater1_flag` is 1.

[0312] In one example, if the number of syntax elements with `coeff_abs_level_greater1_flag` set to 1 is greater than the second value (e.g., 3, the same as the encoding side), then it can be determined that among the quantization coefficients of the block to be decoded, the number of quantization coefficients with an absolute value greater than the first value is greater than the second value. The initial value of the Rice parameter is further determined to be the third value (e.g., 1). In another example, if the number of syntax elements with `coeff_abs_level_greater1_flag` set to 1 is less than or equal to the second value (e.g., 3, the same as the encoding side), then it can be determined that among the quantization coefficients of the block to be decoded, the number of quantization coefficients with an absolute value greater than the first value is less than or equal to the second value. The initial value of the Rice parameter is further determined to be the fourth value (e.g., 0).

[0313] In this article, we will only use coeff_abs_level_greater1_flag as an example. If the first value is 2, then the number of quantization coefficients whose absolute value is greater than the first value can be determined based on the coeff_abs_level_greater2_flag syntax element.

[0314] In this embodiment, the decoder can determine whether there is encoded data with the residual value of the absolute value of the corresponding quantization coefficient in the bitstream based on significant_coeff_flag and coeff_abs_level_greater1_flag.

[0315] In one example, if the bitstream does not contain encoded data of the residual absolute value of a certain quantization coefficient, the encoder can directly decode the corresponding quantization coefficient based on syntax elements such as significant_coeff_flag and coeff_abs_level_greater1_flag.

[0316] In another example, if there is encoded data of the residual absolute value of a certain quantization coefficient in the bitstream, the decoder decodes the bitstream using at least one of truncated Rice code defined by the Rice parameter and exponential Golomb code defined by the Rice parameter to obtain the residual absolute value of the quantization coefficient of the block to be decoded.

[0317] Specifically, let's take the decoding process of the first quantization coefficient in the quantization coefficients as an example:

[0318] In one example, if the remainder of the absolute value of the first quantization coefficient is a value less than a variable threshold, the decoder uses a truncated Rice code defined by the first Rice parameter value to decode the remainder of the absolute value of the first quantization coefficient. Specifically, as described at the encoder, a value with a remainder less than the variable threshold is encoded using k-order truncated Rice code. Accordingly, during decoding, the decoder can determine whether the remainder of the absolute value of the first quantization coefficient is a value less than the variable threshold based on the truncated Rice code of the remainder of the absolute value of the first quantization coefficient in the bitstream. If so, the decoder uses the k-order truncated Rice code to decode the bitstream and obtain the remainder of the absolute value of the first quantization coefficient.

[0319] In another example, if the remainder of the absolute value of the first quantization coefficient is a value greater than or equal to a variable threshold, the decoder uses a truncated Rice code defined by the first Rice parameter value to decode the portion of the first remainder less than or equal to the variable threshold, and uses an exponential Golomb code defined by the first Rice parameter value to decode the portion of the remainder greater than the variable threshold. Specifically, the decoder can determine that the remainder of the absolute value of the first quantization coefficient is a value greater than the variable threshold based on the truncated Rice code of the remainder. The decoder can use a k-order truncated Rice code to decode the bitstream to obtain the portion of the remainder of the absolute value of the first quantization coefficient less than or equal to the variable threshold. Furthermore, the decoder uses a k-order exponential Golomb code to decode the bitstream to obtain the portion of the remainder of the absolute value of the first quantization coefficient greater than or equal to the variable threshold, thus obtaining the remainder of the absolute value of the first quantization coefficient.

[0320] In another example, the decoder can also decode the bitstream using exponential Golomb codes defined by the Rice parameter to obtain the residual value of the absolute value of the first quantization coefficient.

[0321] For example, the process of decoding the residual value of the absolute value of the quantization coefficients using truncated Rice code and / or exponential Golomb code defined by the Rice parameter during decoding can be understood as the inverse process corresponding to encoding.

[0322] For example, during decoding, the decoding order is the same as the encoding order, that is, the order of the quantization coefficients obtained is the reverse of the scanning order.

[0323] Exemplarily, during decoding, the decoding process using k-order truncated Rice code is:

[0324] cMax=3<<k, k=cRiceParam.

[0325] First, parsing bit by bit starting from the current position of the bitstream, if consecutive cMax>>k bits are all 1, then code_num=cMax

[0326] Otherwise, after the first occurrence of 0, parse k-bit suffix,

[0327] code_num=(leadingOneBits<<k) + the value corresponding to the fixed-length k-bit suffix.

[0328] Wherein: cRiceParam is the Rice parameter, k is the value of the Rice parameter, cMax is a variable threshold, the preset value of the decoder is equal to the preset value of the encoder, and can be set according to actual requirements. code_num is the decoded data, that is, the residual value of the absolute value of the decoded quantized coefficient.

[0329] During decoding, when decoding k-order exponential Golomb code, first search for the first zero bit leadingOneBits starting from the current position of the bitstream, and then calculate the value of code_num according to the formula:

[0330] code_num=2^(leadingOneBits+k)-2^k+INFO.

[0331] In a possible implementation, the encoding method in the embodiments of the present application can be applied to a wavelet architecture, for example, the encoder shown in FIG. 4. Specifically, the encoder may perform wavelet transform on an image to be encoded to obtain wavelet coefficients of a low-frequency subband (for example, wavelet coefficients 403 of the low-frequency subband in FIG. 4). The encoder performs block division processing on the wavelet coefficients of the low-frequency subband to obtain wavelet coefficients of a block to be encoded, which may also be referred to as wavelet coefficients of the low-frequency subband of the block to be encoded (for example, macroblock 404 in FIG. 4). That is, the wavelet coefficients of the low-frequency subband include the wavelet coefficients of the block to be encoded. Then, the encoder may perform processing such as quantization on the wavelet coefficients of the low-frequency subband of the block to be encoded to obtain quantized coefficients of the block to be encoded, which may also be referred to as quantized coefficients of the low-frequency subband of the block to be encoded, for example, residual quantization block 407 in FIG. 4. For specific processing, reference may be made to the relevant description of FIG. 4 above, which will not be repeated here.

[0332] Referring to Figure 18, which is an exemplary decoding process diagram, the decoder, after decoding the residual value of the absolute value of a quantization coefficient, can also obtain the numerical value of the quantization coefficient based on other syntax elements corresponding to that quantization coefficient. These other syntax elements include, but are not limited to, the sign bit and `coeff_abs_level_greater1_flag`. For example, if a quantization coefficient corresponds to `coeff_abs_level_greater1_flag`, then the absolute value of its quantization coefficient is the sum of the residual value of the absolute value of the quantization coefficient and (given value + 1). Here, `coeff_abs_level_greater1_flag` indicates whether the residual value of the absolute value of the quantization coefficient is greater than 1, and the corresponding given value is 1. By obtaining the sign bit and the absolute value of the quantization coefficient, the decoder can obtain the corresponding quantization coefficient.

[0333] In the embodiments of this application, during the process of decoding the remaining value of the absolute value of the quantization coefficient on the decoding side, the decoder also adjusts the value of the Rice parameter based on the absolute value of the already decoded quantization coefficient, so as to apply the adjusted value of the Rice parameter to the decoding process of the next quantization coefficient.

[0334] Specifically, taking the first quantization coefficient as an example, the decoder uses at least one of the truncated Rice code defined by the first Rice parameter value and the exponential Golomb code defined by the first Rice parameter value to decode the first residual value. Based on the first residual value, the first quantization coefficient is decoded.

[0335] Next, the decoder updates the first Rice parameter value based on the absolute value of the first quantization coefficient to obtain the second Rice parameter value. Specifically, if the absolute value of the first quantization coefficient is greater than a variable threshold, the second Rice parameter value is the sum of the first Rice parameter value and the first increment. In this embodiment, the first increment at the decoding end is the same as the first increment at the encoding end, for example, 1, and can be set according to actual needs.

[0336] For example, the variable threshold is obtained based on the first Rice parameter value. The specific calculation method can be found on the encoding side and will not be repeated here.

[0337] For example, the decoder uses at least one of a truncated Rice code defined by the second Rice parameter value and an exponential Golomb code defined by the second Rice parameter value to decode the second residual value of the second quantization coefficient after the first quantization coefficient in the quantization coefficients. Its specific update process is the same as on the encoder side; details not described can be found in the relevant content on the encoder side.

[0338] S1703, based on the quantization coefficients, obtains the reconstructed data of the block to be decoded.

[0339] For example, the decoder can obtain the reconstructed data of the low-frequency subband of the block to be decoded based on the quantization coefficients of the block. Then, it performs an inverse wavelet transform based on the reconstructed data of the low-frequency subband to obtain the reconstructed data of the block to be decoded.

[0340] Specifically, after the decoder obtains the residual value of the absolute value of the quantization coefficient, it can obtain the value of the corresponding quantization coefficient, thereby obtaining the quantization coefficient of the block to be decoded, such as the quantization coefficient 702 of the low-frequency subband block in Figure 7A or Figure 7B.

[0341] The decoder obtains the reconstructed data of the low-frequency subband of the block to be decoded based on the quantization coefficients of the block to be decoded, such as the low-frequency subband reconstruction block 704 in Figure 7A or Figure 7B.

[0342] Next, the decoder can perform an inverse wavelet transform based on the reconstructed data of the low-frequency subband of the block to be decoded to obtain the reconstructed data of the block to be decoded, such as reconstructed block 734 in Figure 7B. Based on the reconstructed data of the block to be decoded, the decoder can obtain the reconstructed data of the image to be decoded, such as reconstructed image 733 in Figure 7B.

[0343] In the example shown in Figure 7A, the decoder can obtain the reconstructed low-frequency subband data of the image to be decoded based on the reconstructed low-frequency subband data of the block to be decoded, such as the reconstructed low-frequency subband 706 in Figure 7A. The decoder can perform inverse wavelet transform based on the reconstructed low-frequency subband data of the image to be decoded to obtain the reconstructed data of the image to be decoded, such as the reconstructed sub-image 732.

[0344] Referring to Figure 19, Figure 19 is a schematic structural diagram of a video decoding device 1900 provided in an embodiment of this application. The video decoding device 1900 is suitable for implementing the embodiments described herein. In one embodiment, the video decoding device 1900 may be a video decoder (e.g., the decoder shown in Figures 3, 7A, and 7B) or a video encoder (e.g., the encoder shown in Figures 2 and 4). In another embodiment, the video decoding device 1900 may be one or more components of the aforementioned decoder or encoder.

[0345] The video decoding device 1900 includes: an input port 1910 and a receiving unit (Rx) 1920 for receiving data; a processor, logic unit, or central processing unit (CPU) 1930 for processing data; a transmitter unit (Tx) 1940 and an output port 1950 for transmitting data; and a memory 1960 for storing data. The video decoding device 1900 may also include photoelectric conversion components and electro-optic (EO) components coupled to the input port 1910, the receiver unit 1920, the transmitter unit 1940, and the output port 1950 for the input or output of optical or electrical signals.

[0346] Processor 1930 is implemented in both hardware and software. Processor 1930 can be implemented as one or more CPU chips, cores (e.g., multi-core processors), FPGAs, ASICs, and DSPs. Processor 1930 communicates with input port 1910, receiver unit 1920, transmitter unit 1940, output port 1950, and memory 1960. Processor 1930 includes encoding module 1970 or decoding module 1970. Encoding / decoding module 1970 implements the embodiments disclosed herein to implement the encoding or decoding methods provided by the embodiments of this application. For example, encoding / decoding module 1970 implements, processes, or provides various encoding operations. Therefore, encoding / decoding module 1970 provides substantial improvements to the functionality of video decoding device 1900 and affects the transitions of video decoding device 1900 to different states. Alternatively, encoding / decoding module 1970 can be implemented with instructions stored in memory 1960 and executed by processor 1930.

[0347] Memory 1960 includes one or more disks, tape drives, and solid-state drives, which can be used as overflow data storage devices to store programs while they are selectively executed, and to store instructions and data read during program execution. Memory 1960 can be volatile and / or non-volatile, and can be read-only memory (ROM), random access memory (RAM), ternary content-addressable memory (TCAM), and / or static random access memory (SRAM).

[0348] Referring to FIG20, FIG20 is a simplified block diagram of an apparatus 2000 that can be used as either or both of the source device 12 and destination device 14 in FIG1A according to an exemplary embodiment. The apparatus 2000 can implement the techniques of this application. In other words, FIG20 is a schematic block diagram of an implementation of an encoder or decoder according to an embodiment of this application. The apparatus 2000 may include a processor 2010, a memory 2030, and a bus system 2050. The processor 2010 and the memory 2030 are connected via the bus system 2050. The memory 2030 is used to store instruction / program code, and the processor 2010 is used to execute the instruction / program code stored in the memory 2030. The memory 2030 of the apparatus 2000 stores instruction / program code, and the processor 2010 can call the program code stored in the memory 2030 to execute various video encoding or decoding methods described in this application. To avoid repetition, further details are omitted here.

[0349] In this embodiment, the processor 2010 may be a central processing unit (CPU), or it may be other general-purpose processors, DSPs, ASICs, FPGAs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0350] The memory 2030 may include read-only memory (ROM) or random access memory (RAM). Any other suitable type of storage device may also be used as memory 2030. Memory 2030 may include program code and data 2031 accessed by processor 2010 using bus 2050. Memory 2030 may further include an operating system 2033 and an application program 2035, which includes at least one program that allows processor 2010 to execute the encoding or decoding methods described in this application. For example, application program 2035 may include applications 1 to N, which further include video encoding or decoding applications that execute the encoding or decoding methods described in this application.

[0351] In addition to the data bus, the bus system 2050 may also include a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus system 2050 in the diagram.

[0352] Optionally, the device 2000 may also include one or more output devices, such as a display 2070. In one example, the display 2070 may be a haptic display that combines a display with a haptic unit capable of operatively sensing touch input. The display 2070 may be connected to the processor 2010 via a bus 2050.

[0353] Based on the same inventive concept as the above method, this embodiment of the invention also provides an encoding device 2100, which includes: an acquisition module 2101 and an encoding module 2102. The acquisition module 2101 is used to acquire the quantization coefficients of the block to be encoded. The encoding module 2102 is used to encode the residual value of the absolute value of the quantization coefficients using at least one of truncated Rice code defined by Rice parameters and exponential Golomb code defined by Rice parameters, to obtain the bitstream of the image to be encoded. In the process of encoding a residual value, the Rice parameter value used is adjusted based on the encoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute value is greater than a first value, and the image to be encoded includes the block to be encoded.

[0354] This application embodiment also provides a decoding device 2200, which includes: an acquisition module 2201, a decoding module 2202, and a reconstruction module 2203. The acquisition module 2201 is used to acquire the bitstream of an image to be decoded, the image to be decoded including blocks to be decoded, and the bitstream including residual values ​​of the absolute values ​​of the quantization coefficients of the blocks to be decoded. The decoding module 2202 is used to decode the residual values ​​of the absolute values ​​of the quantization coefficients of the blocks to be decoded using at least one of truncated Rice code defined by a Rice parameter and exponential Golomb code defined by a Rice parameter, to obtain the quantization coefficients of the blocks to be decoded, wherein: in the process of decoding a residual value, the Rice parameter value used is adjusted based on the decoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the blocks to be decoded whose absolute values ​​are greater than a first value. The reconstruction module 2203 is used to acquire reconstructed data of the blocks to be decoded based on the quantization coefficients.

[0355] All relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0356] All relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0357] This application also provides a chip, including one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the steps of the above-described related method steps that implement the method in the above embodiments are executed.

[0358] This embodiment also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the methods described in the above embodiments.

[0359] This embodiment also provides a computer program product comprising computer instructions that, when executed by a computer or processor, cause the computer to perform the aforementioned steps to implement the methods described in the above embodiments. Exemplarily, the computer program product may be stored on a computer-readable storage medium.

[0360] The computer-readable storage media mentioned in this application include random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, read-only optical discs (CD-ROMs), or any other form of storage media known in the art.

[0361] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the apparatus is running, the processor may execute the computer execution instructions stored in the memory to cause the chip to execute the methods in the above-described method embodiments.

[0362] In this embodiment, the device, computer-readable storage medium, computer program product, or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0363] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0364] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0365] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0366] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0367] Any content in the various embodiments of this application, as well as any content in the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.

[0368] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A decoding method, characterized in that, include: Obtain the bitstream of the image to be decoded, wherein the image to be decoded includes blocks to be decoded, and the bitstream includes the residual values ​​of the absolute values ​​of the quantization coefficients of the blocks to be decoded; The residual value of the absolute value of the quantization coefficients of the block to be decoded is decoded using at least one of truncated Rice code defined by the Rice parameter and exponential Golomb code defined by the Rice parameter to obtain the quantization coefficients of the block to be decoded, wherein: the Rice parameter value used in decoding a residual value is adjusted based on the decoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be decoded whose absolute value is greater than a first value; Based on the quantization coefficients, the reconstructed data of the block to be decoded is obtained.

2. The method according to claim 1, characterized in that, If the number of quantization coefficients with an absolute value greater than the first value in the block to be decoded is greater than the second value, the initial value of the Rice parameter is the third value; if the number of quantization coefficients with an absolute value greater than the first value in the block to be decoded is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

3. The method according to claim 2, characterized in that, The third value is 1, and the fourth value is 0.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: A syntax element for at least one quantization coefficient in the quantization coefficients of the block to be decoded, wherein the syntax element is used to indicate that the absolute value of the corresponding quantization coefficient is greater than the first value.

5. The method according to any one of claims 1 to 4, characterized in that, The first value is 1.

6. The method according to claim 1, characterized in that, The quantization coefficients of the block to be decoded include a first quantization coefficient, and the residual value includes a first residual value of the absolute value of the first quantization coefficient. Decoding the residual value of the absolute value of the quantization coefficients of the block to be decoded using at least one of truncated Rice code defined by the Rice parameter and exponential Golomb code defined by the Rice parameter includes: The first residual value is decoded using at least one of truncated Rice code defined by the first Rice parameter value and exponential Golomb code defined by the first Rice parameter value to obtain the first quantization coefficient; The first Rice parameter value is updated based on the absolute value of the first quantization coefficient to obtain the second Rice parameter value; wherein, if the absolute value of the first quantization coefficient is greater than a variable threshold, the second Rice parameter value is the sum of the first Rice parameter value and the first increment, and the variable threshold is obtained based on the first Rice parameter value; The second residual value of the second quantization coefficient following the first quantization coefficient is decoded using at least one of the truncated Rice code defined by the second Rice parameter value and the exponential Golomb code defined by the second Rice parameter value.

7. The method according to claim 6, characterized in that, The second Rice parameter value is less than or equal to the fifth value.

8. The method according to claim 6 or 7, characterized in that, Decoding the first residual value using at least one of a truncated Rice code defined by a first Rice parameter value and an exponential Golomb code defined by the first Rice parameter value includes: If the first remaining value is less than the variable threshold, the first remaining value is decoded using either the truncated Rice code defined by the first Rice parameter value or the exponential Golomb code defined by the first Rice parameter value.

9. The method according to claim 6 or 7, characterized in that, Decoding the first residual value using at least one of a truncated Rice code defined by a first Rice parameter value and an exponential Golomb code defined by the first Rice parameter value includes: If the first residual value is greater than or equal to the variable threshold, the truncated Rice code defined by the first Rice parameter value is used to decode the portion of the first residual value that is less than or equal to the variable threshold, and the exponential Golomb code defined by the first Rice parameter value is used to decode the portion of the residual value that is greater than or equal to the variable threshold.

10. The method according to any one of claims 6 to 9, characterized in that, The first increment is 1.

11. The method according to any one of claims 1 to 10, characterized in that, The step of obtaining the reconstructed data of the block to be decoded based on the quantization coefficients includes: Based on the quantization coefficients of the block to be decoded, the reconstructed data of the low-frequency subband of the block to be decoded is obtained; Inverse wavelet transform is performed on the reconstructed data of the low-frequency subband of the block to be decoded to obtain the reconstructed data of the block to be decoded.

12. An encoding method, characterized in that, include: Obtain the quantization coefficients of the block to be encoded; The residual values ​​of the absolute values ​​of the quantization coefficients are encoded using at least one of truncated Rice code defined by the Rice parameter and exponential Golomb code defined by the Rice parameter to obtain a bitstream of the image to be encoded, wherein: in the process of encoding a residual value, the Rice parameter value used is adjusted based on the encoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute values ​​are greater than a first value, the image to be encoded including the block to be encoded.

13. The method according to claim 12, characterized in that, If the number of quantization coefficients with an absolute value greater than the first value in the quantization coefficients of the block to be encoded is greater than the second value, the initial value of the Rice parameter is the third value. If the number of quantization coefficients with an absolute value greater than the first value in the quantization coefficients of the block to be decoded is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

14. The method according to claim 13, characterized in that, The third value is 1, and the fourth value is 0.

15. The method according to any one of claims 12 to 14, characterized in that, The method further includes: A syntax element for encoding at least one quantization coefficient among the quantization coefficients of the block to be encoded, wherein the syntax element is used to indicate that the absolute value of the corresponding quantization coefficient is greater than the first value.

16. The method according to any one of claims 12 to 15, characterized in that, The first value is 1.

17. The method according to claim 12, characterized in that, The quantization coefficients of the block to be encoded include a first quantization coefficient, and the residual value includes a first residual value of the absolute value of the first quantization coefficient. Encoding the residual value of the absolute value of the quantization coefficient using at least one of a truncated Rice code defined by the Rice parameter and an exponential Golomb code defined by the Rice parameter includes: The first residual value is encoded using at least one of truncated Rice code defined by the first Rice parameter value and exponential Golomb code defined by the first Rice parameter value; The first Rice parameter value is updated based on the absolute value of the first quantization coefficient to obtain the second Rice parameter value; wherein, if the absolute value of the first quantization coefficient is greater than a variable threshold, the second Rice parameter value is the sum of the first Rice parameter value and the first increment, and the variable threshold is obtained based on the first Rice parameter. The second residual value of the second quantization coefficient following the first quantization coefficient is encoded using at least one of the truncated Rice code defined by the second Rice parameter and the exponential Golomb code defined by the second Rice parameter.

18. The method according to claim 17, characterized in that, The second Rice parameter value is less than or equal to the fifth value.

19. The method according to claim 17 or 18, characterized in that, Encoding the first residual value using at least one of a truncated Rice code defined by the first Rice parameter value and an exponential Golomb code defined by the first Rice parameter value includes: If the first residual value is less than the variable threshold, the first residual value is encoded using either the truncated Rice code defined by the first Rice parameter value or the exponential Golomb code defined by the first Rice parameter value.

20. The method according to claim 17 or 18, characterized in that, Encoding the first residual value using at least one of a truncated Rice code defined by the first Rice parameter value and an exponential Golomb code defined by the first Rice parameter value includes: If the first residual value is greater than or equal to the variable threshold, the portion of the first residual value less than or equal to the variable threshold is encoded using truncated Rice code defined by the first Rice parameter value, and the portion of the first residual value greater than or equal to the variable threshold is encoded using exponential Golomb code defined by the first Rice parameter value.

21. The method according to any one of claims 17 to 20, characterized in that, The first increment is 1.

22. The method according to claim 12, characterized in that, The process of obtaining the quantization coefficients of the block to be encoded includes: Perform wavelet transform on the image to be encoded to obtain the wavelet coefficients of the low-frequency sub-band; the wavelet coefficients of the low-frequency sub-band include the wavelet coefficients of the low-frequency sub-band of the block to be encoded; The wavelet coefficients of the low-frequency subband of the block to be encoded are quantized to obtain the quantization coefficients of the block to be encoded.

23. A decoding device, characterized in that, include: An acquisition module is used to acquire the bitstream of an image to be decoded, wherein the image to be decoded includes blocks to be decoded, and the bitstream includes the residual values ​​of the absolute values ​​of the quantization coefficients of the blocks to be decoded; A decoding module is configured to decode the residual value of the absolute value of the quantization coefficients of the block to be decoded using at least one of truncated Rice code defined by a Rice parameter and exponential Golomb code defined by the Rice parameter, to obtain the quantization coefficients of the block to be decoded, wherein: in the process of decoding a residual value, the Rice parameter value used is adjusted based on the decoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be decoded whose absolute value is greater than a first value; The reconstruction module is used to obtain the reconstruction data of the block to be decoded based on the quantization coefficients.

24. The apparatus according to claim 23, characterized in that, If the number of quantization coefficients with an absolute value greater than the first value in the block to be decoded is greater than the second value, the initial value of the Rice parameter is the third value; if the number of quantization coefficients with an absolute value greater than the first value in the block to be decoded is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

25. The method according to claim 2, characterized in that, The third value is 1, and the fourth value is 0.

26. An encoding device, characterized in that, include: The acquisition module is used to acquire the quantization coefficients of the block to be encoded; An encoding module is configured to encode the residual value of the absolute value of the quantization coefficients using at least one of truncated Rice code defined by a Rice parameter and exponential Golomb code defined by the Rice parameter, to obtain a bitstream of an image to be encoded, wherein: in the process of encoding a residual value, the Rice parameter value used is adjusted based on the encoded quantization coefficients; the initial value of the Rice parameter is associated with the number of quantization coefficients in the block to be encoded whose absolute value is greater than a first value, the image to be encoded including the block to be encoded.

27. The apparatus according to claim 26, characterized in that, If the number of quantization coefficients with an absolute value greater than the first value in the quantization coefficients of the block to be encoded is greater than the second value, the initial value of the Rice parameter is the third value. If the number of quantization coefficients with an absolute value greater than the first value in the quantization coefficients of the block to be decoded is less than or equal to the second value, the initial value of the Rice parameter is the fourth value.

28. The apparatus according to claim 27, characterized in that, The third value is 1, and the fourth value is 0.

29. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by a computer or processor, cause the steps of the method as described in any one of claims 1 to 22 to be performed.

30. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a bitstream generated according to the encoding method described in any one of claims 12 to 22.