Coding method, coder, bitstream and storage medium

By introducing an independent context model into video encoding and decoding, the problem of inaccurate context models in existing technologies is solved, thereby improving encoding efficiency and decoding accuracy.

CN122349013APending Publication Date: 2026-07-07HISENSE VISUAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HISENSE VISUAL TECH CO LTD
Filing Date
2025-01-07
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing context models based on neighborhood coefficients and diagonal distances are not accurate enough in video encoding and decoding, affecting coding efficiency.

Method used

An independent context model is introduced, especially when the current transform block is located at the top left corner. The context model that independently determines the first parameter does not depend on the neighborhood coefficients and diagonal distance, thereby improving the accuracy of probability estimation.

Benefits of technology

Encoding and decoding performance is improved by using an independent context model, which enhances encoding efficiency and decoding accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122349013A_ABST
    Figure CN122349013A_ABST
Patent Text Reader

Abstract

A coding method, a coder, a bitstream and a storage medium are provided. The decoding method comprises: parsing a bitstream, determining first information, the first information being used for indicating a position of a last non-zero coefficient of a current transform block; if the first information indicates that the last non-zero coefficient is located at a top-left corner of the current transform block, decoding a first parameter of the current transform block based on a first context model; wherein the first context model is different from a second context model, and the second context model is a context model used by a transform block decoded before the current transform block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, an encoder and decoder, a bitstream, and a storage medium. Background Technology

[0002] Context-based adaptive binary arithmetic coding (CABAC) combines contextual models and arithmetic coding to effectively utilize the spatial and temporal correlations of video signals, thereby achieving high coding efficiency.

[0003] Related techniques can determine the context model used in the transformation coefficient encoding and decoding process based on neighborhood coefficients and diagonal distance. However, in some cases, the context model determined by the above methods is not accurate enough. Summary of the Invention

[0004] This application provides an encoding / decoding method, an encoding / decoding method, a bitstream, and a storage medium. The various aspects covered in this application are described below.

[0005] In a first aspect, a decoding method is provided, which is applied to a decoder. The decoding method includes: parsing the bitstream and determining first information, the first information being used to indicate the position of the last non-zero coefficient of the current transform block; if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, then decoding the first parameter of the current transform block based on a first context model; wherein the first context model is different from a second context model, the second context model being the context model used by transform blocks decoded before the current transform block.

[0006] Secondly, an encoding method is provided, which is applied to an encoder. The encoding method includes: determining first information, the first information being used to indicate the position of the last non-zero coefficient of the current transform block; if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, then encoding a first parameter of the current transform block based on a first context model; wherein the first context model is different from a second context model, the second context model being the context model used by transform blocks encoded before the current transform block.

[0007] Thirdly, a decoder is provided, comprising: a determining unit for parsing a bitstream and determining first information, the first information indicating the position of the last non-zero coefficient of the current transform block; and a processing unit, wherein if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, the processing unit is used to decode a first parameter of the current transform block based on a first context model; wherein the first context model is different from a second context model, the second context model being the context model used by transform blocks decoded before the current transform block.

[0008] Fourthly, a decoder is provided, comprising: a memory for storing a computer program; and a processor for executing the method of the first aspect when running the computer program.

[0009] Fifthly, an encoder is provided, comprising: a determining unit for determining first information, the first information indicating the position of the last non-zero coefficient of the current transform block; and a processing unit, wherein if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, the processing unit is configured to encode a first parameter of the current transform block based on a first context model; wherein the first context model is different from a second context model, the second context model being the context model used by transform blocks encoded prior to the current transform block.

[0010] In a sixth aspect, an encoder is provided, comprising: a memory for storing a computer program; and a processor for executing the method of the second aspect when running the computer program.

[0011] In a seventh aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program that, when executed, implements the method as described in the first or second aspect.

[0012] Eighthly, a computer program product is provided, including a computer program that, when executed, implements the method as described in the first or second aspect.

[0013] A ninth aspect provides a non-volatile computer-readable storage medium for storing bit streams, the bit streams being generated by an encoding method using an encoder, or the bit streams being decoded by a decoding method using a decoder, wherein the decoding method is the method described in the first aspect and the encoding method is the method described in the second aspect.

[0014] In a tenth aspect, a bitstream is provided, including a bitstream generated according to the method described in the second aspect.

[0015] Eleventhly, a chip is provided, including a processor for calling a program from memory, causing a device on which the chip is mounted to perform the method as described in the first aspect or the second aspect.

[0016] When the last non-zero coefficient is located at the top left corner of the current transform block, this embodiment of the application introduces an independent context model for the first parameter, which helps improve the accuracy of the probability estimation of the first parameter, thereby improving encoding and decoding performance. Introducing an independent context model for the first parameter can be understood as determining the context model of the first parameter without relying on neighborhood coefficients and diagonal distance, thus helping to avoid the influence of different neighborhood conditions on the probability estimation of the first parameter. Attached Figure Description

[0017] Figure 1 This is a structural example diagram of a video encoder applicable to embodiments of this application.

[0018] Figure 2 This is a structural example diagram of a video decoder that can be applied to embodiments of this application.

[0019] Figure 3 This is a schematic diagram showing the statistical results of the magnitude of the syntax element abs_level_gt1_flag provided in the embodiments of this application.

[0020] Figure 4 This is a flowchart illustrating the decoding method provided in an embodiment of this application.

[0021] Figure 5 This is a flowchart illustrating the encoding method provided in an embodiment of this application.

[0022] Figure 6 This is a schematic diagram of the structure of a decoder provided in one embodiment of this application.

[0023] Figure 7 A schematic diagram of the decoder provided in another embodiment of this application.

[0024] Figure 8 This is a schematic diagram of the encoder provided in one embodiment of this application.

[0025] Figure 9 This is a schematic diagram of the encoder provided in another embodiment of this application. Detailed Implementation

[0026] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0027] Figure 1 This is a schematic block diagram of a video encoder involved in an embodiment of this application.

[0028] It should be understood that the video encoder 100 can be used for lossy compression of images, or for lossless compression of images. The lossless compression can be visually lossless compression or mathematically lossless compression.

[0029] This video encoder 100 can be applied to image data in luminance / chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents luminance (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) used to describe color and saturation. For example, in color format, 4:2:0 means that there are 4 luminance components and 2 chrominance components (YYYYCbCr) per 4 pixels; 4:2:2 means that there are 4 luminance components and 4 chrominance components (YYYYCbCrCbCr) per 4 pixels; and 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr).

[0030] For example, the video encoder 100 reads video data and, for each image in the video data, divides the image into several coding tree units (CTUs). In some examples, CTUs may be called "tree blocks," "largest coding unit" (LCU), or "coding treeblock" (CTB). Each CTU can be associated with a pixel block of equal size within the image. Each pixel can correspond to one luminance (luma) sample and two chrominance (chroma) samples. Therefore, each CTU can be associated with one luminance sample block and two chrominance sample blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU can be further divided into several coding units (CUs) for encoding. CUs can be rectangular or square blocks. CUs can correspond to prediction units (PUs) and transform units (TUs).

[0031] In some embodiments, such as Figure 1As shown, the video encoder 100 may include: a prediction module 110, a residual module 120, a transform / quantization module 130, an inverse transform / quantization module 140, a reconstruction module 150, a loop filtering module 160, a decoded image buffer 170, and an entropy coding module 180. It should be noted that the video encoder 100 may contain more, fewer, or different functional components.

[0032] In some embodiments, the current block may be referred to as the current coding unit (CU). A prediction block may also be referred to as a prediction image block or an image prediction block, and a reconstructed image block may also be referred to as a reconstruction block or an image reconstruction block. Due to the need for parallel processing, an image can be divided into slices. Slices within the same image can be processed in parallel, meaning there is no data dependency between them. A "frame" is a commonly used term, generally understood to mean that one frame is an image. In this document, "frame" can also be replaced with "image" or "slice," etc.

[0033] In some embodiments, the prediction module 110 includes an inter-frame prediction module 111 and an intra-frame prediction module 112. Because there is a strong correlation between adjacent pixels in an image of a video, intra-frame prediction is used in video encoding and decoding techniques to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent images in a video, inter-frame prediction is used in video encoding and decoding techniques to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.

[0034] The inter-frame prediction module 111 can be used for inter-frame prediction, which can include motion estimation and motion compensation. It can reference image information from different images. Inter-frame prediction uses motion information to find reference blocks in the reference images and generates prediction blocks based on these reference blocks to eliminate temporal redundancy. The motion information includes a list of reference images, the reference image index, and motion vectors. Motion vectors can be integer-pixel or fractional-pixel. If the motion vector is fractional-pixel, interpolation filtering needs to be used in the reference image to create the required fractional-pixel blocks. Here, the integer-pixel or fractional-pixel blocks in the reference image found based on the motion vectors are called reference blocks. Some techniques directly use the reference blocks as prediction blocks, while others process the reference blocks further to generate prediction blocks. Processing the reference blocks further to generate prediction blocks can also be understood as using the reference blocks as prediction blocks and then processing them to generate new prediction blocks.

[0035] The intra-frame prediction module 112 refers only to information from the same image to predict pixel information within the current image block, thereby eliminating spatial redundancy.

[0036] Intra-frame prediction has multiple prediction modes. Taking the international digital video coding standards H-series as an example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, while H.265 / HEVC extends this to 33 angular prediction modes and 2 non-angular prediction modes. High Efficiency Video Coding (HEVC) uses Planar, DC, and 33 angular modes, for a total of 35 prediction modes. Versatile Video Coding (VVC) uses Planar, DC, and 65 angular modes, for a total of 67 prediction modes.

[0037] It should be noted that with the increase in angle modes, intra-frame prediction will be more accurate and better meet the needs of the development of high-definition and ultra-high-definition digital video.

[0038] The residual module 120 can generate a residual block of the CU based on the pixel blocks of the CU and the prediction blocks of the CU. For example, the residual module 120 can generate a residual block of the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the corresponding sample in the prediction block of the CU.

[0039] Transform / quantization module 130 quantizes transform coefficients. Transform / quantization module 130 quantizes transform coefficients associated with the CU based on quantization parameter (QP) values ​​associated with the CU. Video encoder 100 can adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP values ​​associated with the CU.

[0040] The inverse transform / quantization module 140 can apply inverse quantization and inverse transform to the quantized transform coefficients to reconstruct the residual block from the quantized transform coefficients.

[0041] The reconstruction module 150 can add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by the prediction module 110 to produce reconstructed image blocks associated with the CU. By reconstructing each sample block of the CU in this way, the video encoder 100 can reconstruct the pixel blocks of the CU.

[0042] The loop filtering module 160 is used to process the pixels after inverse transformation and inverse quantization to compensate for the distortion information and provide a better reference for subsequent encoded pixels. For example, it can perform deblocking filtering to reduce the block effect of pixel blocks associated with CU.

[0043] In some embodiments, the loop filtering module 160 includes a deblocking filtering module and a sample adaptive compensation / adaptive loop filtering (SAO / ALF) module, wherein the deblocking filtering module is used to remove block effects, and the SAO / ALF module is used to remove ringing effects.

[0044] The decoded image buffer 170 can store reconstructed pixel blocks. The inter-frame prediction module 111 can use a reference image containing the reconstructed pixel blocks to perform inter-frame prediction on PUs in other images. In addition, the intra-frame prediction module 112 can use the reconstructed pixel blocks in the decoded image buffer 170 to perform intra-frame prediction on other PUs in the same image as the CU.

[0045] The entropy encoding module 180 can receive quantized transform coefficients from the transform / quantization module 130. The entropy encoding module 180 can perform one or more entropy encoding operations on the quantized transform coefficients to produce entropy-encoded data.

[0046] Figure 2 This is a schematic block diagram of a video decoder involved in an embodiment of this application.

[0047] like Figure 2 As shown, the video decoder 200 includes: an entropy decoding module 210, a prediction module 220, an inverse quantization / transformation module 230, a reconstruction module 240, a loop filtering module 250, and a decoded image buffer 260. It should be noted that the video decoder 200 may contain more, fewer, or different functional components.

[0048] Video decoder 200 can receive a bitstream. Entropy decoding module 210 can parse the bitstream to extract syntax elements. As part of parsing the bitstream, entropy decoding module 210 can parse the entropy-encoded syntax elements in the bitstream. Prediction module 220, dequantization / transform module 230, reconstruction module 240, and loop filtering module 250 can decode video data based on the syntax elements extracted from the bitstream, i.e., generate decoded video data.

[0049] In some embodiments, the prediction module 220 includes an intra-frame prediction module 222 and an inter-frame prediction module 221.

[0050] Intra-prediction module 222 can perform intra-prediction to generate prediction blocks for PUs. Intra-prediction module 222 can use intra-prediction modes to generate prediction blocks for PUs based on pixel blocks of spatially adjacent PUs. Intra-prediction module 222 can also determine the intra-prediction mode of PUs based on one or more syntax elements parsed from the bitstream.

[0051] Inter-frame prediction module 221 can construct a first reference image list (list 0) and a second reference image list (list 1) based on the syntax elements parsed from the bitstream. Furthermore, if the PU uses inter-frame prediction coding, entropy decoding module 210 can parse the motion information of the PU. Inter-frame prediction module 221 can determine one or more reference blocks of the PU based on the motion information of the PU. Inter-frame prediction module 221 can generate prediction blocks for the PU based on one or more reference blocks of the PU.

[0052] The dequantization / transformation module 230 reversibly quantizes (i.e., dequantizes) the transform coefficients associated with the TU. The dequantization / transformation module 230 can use the QP value associated with the CU of the TU to determine the degree of quantization.

[0053] After the inverse quantization transform coefficients, the inverse quantization / transformation module 230 can apply one or more inverse transforms to the inverse quantization transform coefficients to generate a residual block associated with TU.

[0054] The reconstruction module 240 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the pixel block of the CU. For example, the reconstruction module 240 can add the samples of the residual block to the corresponding samples of the prediction block to reconstruct the pixel block of the CU, thereby obtaining the reconstructed image block.

[0055] The loop filter module 250 can perform deblocking filtering operations to reduce the block effect of pixel blocks associated with the CU.

[0056] The video decoder 200 can store the reconstructed image of the CU in the decoded image buffer 260. The video decoder 200 can use the reconstructed image in the decoded image buffer 260 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.

[0057] The basic process of video encoding and decoding is as follows: At the encoding end, an image is divided into blocks. For the current block, the prediction module 110 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual module 120 can calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block. This residual block can also be called residual information. This residual block is transformed and quantized by the transform / quantization module 130, which can remove information that is not sensitive to the human eye to eliminate visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization module 130 can be called a temporal residual block, and the temporal residual block after transformation and quantization by the transform / quantization module 130 can be called a frequency residual block or a frequency domain residual block. The entropy coding module 180 receives the quantized transform coefficients output by the transform / quantization module 130, and can perform entropy coding on the quantized transform coefficients to output a bitstream. For example, the entropy coding module 180 can eliminate character redundancy based on the target context model and the probability information of the binary bitstream.

[0058] At the decoding end, the entropy decoding module 210 parses the bitstream to obtain the prediction information and quantization coefficient matrix of the current block. The prediction module 220 uses the prediction information to generate a prediction block for the current block using intra-frame prediction or inter-frame prediction. The inverse quantization / transform module 230 uses the quantization coefficient matrix obtained from the bitstream to perform inverse quantization and inverse transform on the quantization coefficient matrix to obtain a residual block. The reconstruction module 240 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks form a reconstructed image. The loop filtering module 250 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image. The encoding end also requires similar operations to the decoding end to obtain a decoded image. This decoded image can also be called a reconstructed image, which can be used as a reference image for inter-frame prediction of subsequent images.

[0059] It should be noted that the block partitioning information determined at the encoding end, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, are carried in the bitstream when necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, and loop filtering mode information or parameter information as the encoding end by parsing the bitstream and analyzing existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end.

[0060] It is understandable that the "inverse transformation" of the transform coefficients at the decoding end can also be referred to as "transformation" in standard texts. In the embodiments of this application, "transformation" and "inverse transformation" correspond to two opposite processes. For example, "transformation" converts spatial domain values ​​to frequency domain coefficients, while "inverse transformation" converts frequency domain coefficients back to spatial domain values. If the standard only specifies decoding, then "transformation" in the standard text refers to the decoding part, specifically the "inverse transformation" in this document. The "inverse transformation" of the transform coefficients at the decoding end can also be referred to as "transformation" in standard texts.

[0061] The above describes the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. This application is applicable to the basic flow of a video codec under this block-based hybrid coding framework, but is not limited to this framework and flow.

[0062] The encoding and decoding framework provided in the embodiments of this application has been described in detail above. The following section introduces the CABAC entropy encoding and CABAC entropy decoding involved in this application.

[0063] CABAC entropy coding

[0064] The core algorithm of CABAC entropy coding is adaptive binary arithmetic coding. Specifically, CABAC entropy coding can combine a context model with adaptive binary arithmetic coding, such as performing arithmetic coding based on a probability model and the binary bits of syntax elements, and further updating the context model based on the coding result. It should be understood that the syntax elements mentioned here can also be called parameters, and this application does not limit this.

[0065] CABAC's input can be binary or non-binary syntax elements, and its output can be encoded bits. For example, the CABAC entropy coding process can include the following three steps: binaryization, context modeling, and binary arithmetic coding. It can be seen that through these steps, the encoding process from non-binary syntax elements to the output bitstream can be completed.

[0066] CABAC offers several binary representation methods, including fixed-length binary representation (FL), truncated Rice Binary Representation (TR), truncated binary representation (TB), and exponential-golomb coding of order k (EGK). In CABAC, different binary representation methods can be selected based on the varying probability distributions of different syntax elements.

[0067] When the probabilities of syntax elements are uniformly distributed, a fixed-length binary encoding scheme can be used. Assuming a given syntax element has a value of x, and 0 ≤ x ≤ cMax, the fixed-length binary string of x can be obtained directly by converting a decimal number to a binary number. Taking the syntax element abs_level_gt1_flag as an example, this syntax element can be fixed-length binary, and its cMax value is 1.

[0068] The H.266 / versatile video coding (VCC) standard employs a biprobability model to predict the least probable symbol (LPS) probability for each context.

[0069] p(t+1)=(p0(t+1)+p1(t+1)) / 2

[0070] p0(t+1)=p0(t)·(1-α0)+x(t)·α0

[0071] p1(t+1)=p0(t)·(1-α1)+x(t)·α1

[0072] The two probability models are represented by p0(t) and p1(t), respectively, and α0 and α1 are the probability update rates of the two probability models.

[0073] To avoid multiplication, α is limited to α = 2. -β (β∈N + If so, the probability prediction model can be represented by the following formula.

[0074] q(t+1)=q(t)-(q(t)>>β+x(t)·((2 b -1)>>β)

[0075] Where q(t) is the b-bit integer representation of p(t), and in the standard b0 = 10 and b1 = 14.

[0076] p(t)=q(t)·2 b +2 b-1

[0077] In the H.266 / VVC standard, each context model used by a syntax element is specified by a unique context index ctxId. Each context model involves two types of variables: shiftIdx, which controls the rate of model probability updates, and pStateIdx0 (q0(t) in the probability prediction model) and pStateIdx1 (q1(t) in the probability prediction model), which predict the probability states.

[0078] Based on the value of the encoded binary symbol and the update rate shiftIdx, the probability states pStateIdx0 and pStateIdx1 are continuously updated using a probabilistic prediction model. Furthermore, the predicted probabilities obtained from the biprobability model can be used to calculate the mean of the predicted probabilities, resulting in the predicted probability pState of the LPS. The specific calculation formula is shown below.

[0079] pState=pStateldx1+16·pStateldx0

[0080] pStateldx0=pStateIdx0-(pStateIdx0>>shift0)+((210-1)·Bin>>shift0)

[0081] pStateldx1=pStateIdx1-(pStateIdx1>>shift1)+((214-1)·Bin>>shift1)

[0082] shift0 = (shiftIdx >> 2) + 2

[0083] shift1=(shiftIdx&3)+3+shift0

[0084] Where shift0 (α0 in the probabilistic prediction model) and shift1 (α1 in the probabilistic prediction model) are the update rates of the predicted probabilities pStateIdx0 and pStateIdx1, respectively; Bin is the encoded binary symbol; the predicted probabilities pStateIdx0 and pStateIdx1 are represented by 10-bit and 14-bit integers, respectively.

[0085] Before encoding the first binary symbol, a key issue to be addressed is how to initialize its context model. In H.266 / VVC, initial values ​​`initValue` and `shiftIdx` are assigned to each context index. `initValue` can be used to calculate the model's probability state, as shown in the following formula.

[0086] slopeIdx = initValue >> 3##

[0087] offsetIdx = initValue#

[0088] m = slopeIdx - 4#

[0089] n = (offsetIdx·18) + 1#

[0090] preCtxState=Clip3(1,127,((m·(Clip3(0,63,SliceQPy)-16))>>1)+n)#

[0091] pStateIdx0=preCtxState<<3#

[0092] pStateIdx1=preCtxState<<7#

[0093] SliceQPy is the quantization parameter of the luminance signal.

[0094] Compared to VVC, the enhanced compression model (ECM) introduces some new techniques in its CABAC entropy coding. The improvements of CABAC in ECM are described below.

[0095] In ECM, corresponding weights are added to pStateIdx0 and pStateIdx1 predicted by the biprobability model, and a mechanism is set up to fine-tune shift0 and shift1 based on the encoded symbol being 0 or 1.

[0096] For example, by introducing weights, the probability of the result for binary arithmetic encoding can be derived, as shown in the following formula.

[0097] p=((32-ω)·p0+ω·p1)>>5

[0098] Here, ω is a weight selected from a predefined set ω∈{10,12,16,20,22}. ECM predetermines three distinct weights for each context model of I, B, and P slice types. Similar to existing context initialization, the weights for I slice types are only allowed for intra-frame slices, while the weights for B and P slice types can be toggled for inter-frame slices based on the same slice-level syntax sh_cabac_init_flag.

[0099] The CABAC used in VVC has two probabilistic states, which can be updated using short and long windows respectively. The sizes of the long and short windows are uniquely specified by the `shiftIdx` field in the standard documentation, thus controlling the different update rates for the long and short windows. In ECM, the initial value of `shiftIdx` can be fine-tuned based on the encoded sign being 0 or 1, i.e., the size of the long and short windows can be fine-tuned. For example, the update range for both the long and short windows can be -7 to 7, while the lower limit of the window size is set to 2.

[0100] Binary arithmetic coding can perform arithmetic coding on each Bin after the current syntax element is binaryized, based on the probability model parameters, to obtain the final output bitstream.

[0101] Binary arithmetic coding is based on recursive interval partitioning, which allows the encoding interval and its lower bound to be saved during the recursive process. The H.266 / VVC standard includes two encoding methods: conventional coding and bypass coding. Conventional coding can utilize an adaptive probability model for encoding; bypass coding can encode in an equal-probability manner, meaning its probability state does not need to be updated.

[0102] The input to a conventional encoder consists of context-dependent parameters (shiftIdx, pStateIdx0, pStateIdx1) and the Bin value to be encoded. The encoder's state is the current encoding range width (Range) and range starting point (Low). The initial value of Range is 510, and the initial value of Low is 0. For example, the encoding process of conventional encoders is shown in steps 1 through 4.

[0103] Step 1, calculate the interval width R corresponding to LPS. LPS r MPS .

[0104] qRangeIdx = Range >> 5

[0105] pState=pStateIdx1+16·pStateldx0

[0106]

[0107] R LPS =(qRangeIdx·pState5)>>1+4

[0108] R MPS =Range-R LPS

[0109] Where pState5 represents the prediction probability with 5-bit precision; when pState >> 14 = 1, the prediction probability is greater than 0.5, and pState is the prediction probability of MPS, XORed. The operation maintains its predicted probability as LPS.

[0110] Step 2, update Low and Range.

[0111] MPS = pState >> 14

[0112] If Bin = LPS, then Low = Low + R MPS Range = R LPS If Bin = MPS, then Low remains unchanged, and Range = R. MPS .

[0113] Step 3: If the Range value is less than 256, perform renormalization.

[0114] As the encoding range Range is updated, the Range value may be less than 256, at which point renormalization is required. Simultaneously, both Low and Range are left-shifted until the Range value is greater than or equal to 256. The bits shifted out by Low become the encoded output bits.

[0115] Step 4: Update the context using the Bin value.

[0116] CABAC Entropy Decoding

[0117] CABAC entropy decoding can decode the corresponding symbol by reading the lower limit value of the interval written to the bitstream. Specifically, the input to CABAC entropy decoding can be the lower limit value m_Value and the ctxIdx corresponding to the syntax element, while the input to CABAC entropy decoding can be the corresponding syntax element value.

[0118] For example, the CABAC entropy decoding process can include the following three steps: obtaining the context, binary arithmetic decoding, and reconstructing the syntax elements. These three steps complete the decoding process from the read bitstream to the reconstructed syntax elements.

[0119] In the process of obtaining the context, firstly, the current syntax element being decoded can be determined based on the standard syntax element structure; secondly, the bypassFlag and possible ctxIdx of the current symbol being decoded can be obtained based on the position of bin in the bitstream, the corresponding binIdx, and some context reference information.

[0120] The shiftIdx, pStateIdx0, pStateIdx1, and weights are obtained from the corresponding context, and the estimated probability of the current symbol is determined based on these parameters. The shiftIdx, pStateIdx0, pStateIdx1, and weights mentioned here can be found in the relevant introduction to the entropy coding process above.

[0121] Corresponding to the encoding process mentioned earlier, binary arithmetic decoding includes regular decoding and bypass decoding. Regular decoding can utilize an adaptive probability model for decoding; bypass decoding can perform decoding in an equally probable manner, and its probability state does not need to be updated. The bypassFlag obtained above can be used to distinguish between these two methods.

[0122] The input to a regular encoder is the context model (shiftIdx, pStateIdx0, pStateIdx1) and the current encoding range length Range. The initial value of Range is 510, and the lower limit of the range m_value can be obtained by reading bytes from the bitstream.

[0123] After obtaining the context used for decoding the current symbol, the size of the interval corresponding to the LPS symbol can be calculated based on the estimated probability and the current encoding interval length m_Range. Further, by comparing the lower limit of the interval with the size of the current encoding interval, it can be determined whether the symbol is 1 or 0. For example, binary arithmetic decoding may include steps 1 to 4.

[0124] Step 1, calculate the interval width R corresponding to LPS. LPS R MPS .

[0125] qRangeIdx = Range >> 5

[0126] pState=pStateIdx1+16·pStateldx0

[0127]

[0128] R LPS =(qRangeIdx·pState5)>>1+4

[0129] R MPS =Range-R LPS

[0130] Where pState5 represents the prediction probability with 5-bit precision; when pState >> 14 = 1, the prediction probability is greater than 0.5, and pState is the prediction probability of MPS, XORed. The operation maintains its predicted probability as LPS.

[0131] Step 2: Compare the lower limit of the interval and the corresponding sub-interval positions of MPS and LPS.

[0132] If m_Value <R MPS Then m_Value remains unchanged, Range = R MPS , Bin=MPS; if m_Value>=R MPS Then m_Value = m_Value - R MPS Range = R LPS Bin = LPS.

[0133] Step 3: When the Range value is less than 256, perform renormalization.

[0134] As the encoding range (Range) is updated, the Range value may become less than 256, requiring renormalization. Simultaneously, both Low and Range are left-shifted until the Range value is greater than or equal to 256. The bits shifted out from Low become the decoded output bits.

[0135] Step 4: Update the context using the Bin value.

[0136] The binary string of a syntax element can be obtained through the binary arithmetic decoding described above. By performing the reverse binarization process on this binary string, the corresponding value of the syntax element can be reconstructed.

[0137] It should be understood that the entropy decoding of CABAC basically corresponds to the entropy encoding process of CABAC. For the parts not described in detail, please refer to the introduction above.

[0138] In ECM version 11.0, the coefficients (or transform coefficients) of a transform block can be represented by parameters (i.e., the syntax elements mentioned above). These parameters can be summed and combined to represent the absolute value of a transform coefficient. For example, these parameters can include one or more of the following syntax elements: sig_coeff_flag, abs_level_gtx_flag, par_level_flag, abs_remainder, dec_abs_level.

[0139] `sig_coeff_flag` is a flag used for context-based encoding and decoding to indicate whether the coefficients at the current position of the transform block are zero. If the coefficients of the current transform block are 0, then `sig_coeff_flag = 1`.

[0140] `abs_level_gtx_flag` is a flag used in context-based model encoding / decoding to indicate whether the absolute value of the coefficients at the current position of the transform block is greater than `x`. `x` is a positive number. In ECM version 11.0, `x` can have either a value of 1 or 3. For example, if `x = 1`, and the coefficients of the transform block are greater than 1, then `abs_level_gt1_flag = 1`. Similarly, if `N = 3`, and the coefficients of the transform block are greater than 3, then `abs_level_gt3_flag = 1`.

[0141] `par_level_flag` is a flag used in context-based encoding / decoding to indicate whether the number of coefficients at the current position of the transform block is odd or even. If the number of coefficients in the transform block is odd, then `par_level_flag = 1`.

[0142] `abs_remainder` is a remainder syntax element that uses Columbus coding for bypass encoding. It represents the remaining absolute value of the coefficients encoded and decoded at the current position of the current transform block. For example, if the absolute value of the first level of a transform block coefficient is greater than the second value, the fourth parameter can be used to represent the absolute value of the remaining quantized transform block coefficients.

[0143] dec_abs_level is the absolute value of the current coefficient. It uses Columbus coding for bypass encoding. During the encoding and decoding of the current block coefficients, if the number of flags encoded based on the context model exceeds the threshold, the remaining coefficients will no longer be represented by sig_coeff_flag, abs_level_gtx_flag, par_level_flag, and abs_remainder, but will directly use the absolute value of the coefficients encoded and decoded using Columbus coding.

[0144] At the encoding end, the encoder can transform and quantize the residual information to obtain transform coefficients. Furthermore, the above syntax elements can be encoded based on the transform coefficients, so that the encoded syntax elements can represent the transform coefficients.

[0145] At the decoding end, the decoder can obtain the aforementioned syntax elements from the bitstream and determine the transform coefficients based on the values ​​of the syntax elements. Then, it performs inverse quantization and inverse transform on the transform coefficients to obtain the residual information.

[0146] When encoding and decoding syntax elements, a context model index is required, or in other words, the context model of the syntax element needs to be determined. The following example, using the CABAC entropy encoding and decoding process of the syntax element `abs_level_gt1_flag`, illustrates the method for determining the context model of this syntax element.

[0147] As mentioned above, abs_level_gt1_flag is used to indicate whether the coefficient at the current scan position is greater than 1. A value of 1 indicates that the current coefficient is greater than 1, and a value of 0 indicates that the current coefficient is less than or equal to 1.

[0148] The entropy encoding process of the syntax element abs_level_gt1_flag may include, for example, steps 1 to 4 below.

[0149] Step 1, binary conversion of abs_level_gt1_flag.

[0150] Table 1 shows the binary representation and input parameters of the syntax element abs_level_gt1_flag. It can be seen that the syntax element abs_level_gt1_flag uses a fixed-length encoding binary representation scheme.

[0151] Table 1

[0152]

[0153] Step 2: Determine the context model for the syntax element abs_level_gt1_flag.

[0154] For example, the context index variable ctxIdx of abs_level_gt1_flag can be determined based on the initial value and the context index increment ctxInc.

[0155] First, the method for determining the initial state of the context model of abs_level_gt1_flag is introduced.

[0156] The H.266 standard defines a table of context index values ​​(ctxIdx) for each syntax element, and the index value determines the initial value (initValue) of that syntax element. To this end, the H.266 standard provides a table indicating the table number for each syntax element and the context index value (ctxIdx) corresponding to different start types.

[0157] Taking the H.266 standard as an example, Table 2 shows the table number of the syntax element abs_level_gt1_flag, as well as the ctxIdx set of this syntax element under different initialization types.

[0158] Table 2

[0159]

[0160] Referring to Table 2, it can be seen that different initialization types (initType) correspond to different ctxIdx sets. For each type of frame, abs_level_gt1_flag can use 72 context models. When initType=0, the ctxIdx candidate set is 0-71; when initType=1, the ctxIdx candidate set is 72-143; and when initType=2, the ctxIdx candidate set is 144-215.

[0161] For example, `initType` can be determined based on the frame type and `sh_cabac_init_flag`. `sh_cabac_init_flag` can be determined by `pps_cabac_init_present_flag`. `pps_cabac_init_present_flag` equal to 1 indicates that `sh_cabac_init_flag` exists in the segment header referencing PPS, and its value is inferred to be 1. `pps_cabac_init_present_flag` equal to 0 indicates that `sh_cabac_init_flag` does not exist in the segment header referencing PPS, and its value is inferred to be 0.

[0162] For example, initType can be determined using the following code.

[0163] if(sh_slice_type==I)

[0164] initType=0

[0165] else if (sh_slice_type == P)

[0166] initType=sh_cabac_init_flag? 2:1

[0167] else

[0168] initType=sh_cabac_init_flag? 1:2

[0169] Table 3 shows the initial values ​​for the 216 contexts of `abs_level_gt1_flag`. `initValue` is used to calculate the model probability state, and `shiftIdx` controls the model probability update rate. The inputs to the regular encoder (`shiftIdx`, `pStateIdx0`, `pStateIdx1`) can be obtained from these two values. The method for determining the inputs to the regular encoder based on `initValue` and `shiftIdx` can be found in the relevant section on CABAC entropy coding methods.

[0170] Table 3

[0171]

[0172]

[0173] Secondly, the method for determining the context model ctxInc of abs_level_gt1_flag is introduced.

[0174] The value of ctxInc may be related to locNumSig and locSumAbsPass1, so we will first introduce how locNumSig and locSumAbsPass1 are determined. Among them, locNumSig can represent the sum of the number of non-zero coefficients in the neighborhood, and locSumAbsPass1 can represent the sum of the coefficients in the neighborhood with an absolute value greater than 1 during the first scan.

[0175] When determining locNumSig and locSumAbsPass1, the following inputs are required: color component index cIdx, the brightness position offset (x0, y0) of the current top-left corner of the transform block relative to the top-left corner of the image, the scan position (xC, yC) of the current coefficient, the binary logarithm log2TbWidth of the transform block width, and the binary logarithm log2TbHeight of the transform block height. Specifically, locNumSig and locSumAbsPass1 can be determined based on the following code.

[0176]

[0177] In addition to locNumSig and locSumAbsPass1, determining the context index increment ctxInc of the syntax element abs_level_gt1_flag also requires the input color component index cIdx, the brightness position offset (x0, y0) of the current top-left corner of the transform block relative to the top-left corner of the image, the scan position (xC, yC) of the current coefficient, the binary logarithm log2TbWidth of the transform block width, and the binary logarithm log2TbHeight of the transform block height. Specifically, ctxInc can be determined based on the following method.

[0178] If transform_skip_flag[x0][y0][cIdx] equals 1 and sh_ts_residual_coding_disabled_flag equals 0, then the calculation is as follows:

[0179] If BdpcmFlag[x0][y0][cIdx] equals 1, then ctxInc is calculated as follows:

[0180] ctxInc = 67

[0181] Otherwise, if xC is greater than 0 and yC is greater than 0, then ctxInc is calculated as follows:

[0182] ctxInc=64+sig_coeff_flag[xC-1][yC]+sig_coeff_flag[xC][yC-1]

[0183] Otherwise, if xC is greater than 0, then ctxInc is calculated as follows:

[0184] ctxInc=64+sig_coeff_flag[xC-1][yC]

[0185] Otherwise, if yC is greater than 0, then ctxInc is calculated as follows:

[0186] ctxInc=64+sig_coeff_flag[xC][yC-1]

[0187] Otherwise, ctxInc is calculated as follows:

[0188] ctxInc = 64

[0189] Otherwise (if transform_skip_flag[x0][y0][cIdx] equals 0 or sh_ts_residual_coding_disabled_flag equals 1), the calculation is as follows:

[0190] ctxInc=offset+(d==0?(cIdx==0?21:7):cIdx==0?d<3?14:(d<10?7:0):0)

[0191] Where offset = min(locSumAbsPass1 – locNumSig, 6); variable d is set to xC + yC. Variable d can also be understood as the distance between the current scan position and the object in the current image.

[0192] Furthermore, ctxIdx equals the sum of ctxInc and ctxIdxOffset, where ctxIdxOffset is the minimum ctxIdx value for the corresponding initType in Table 2. Table 4 shows an example of assigning ctxInc to a syntax element.

[0193] Table 4

[0194]

[0195] Refer to Table 4 to determine the candidate ctxIdx in the candidate set based on binIdx.

[0196] Step 3, binary arithmetic encoding.

[0197] After determining the value of ctxIdx, arithmetic coding is started based on abs_level_gt1_flag and (shiftIdx, pStateIdx0, pStateIdx1) determined by initValue and shiftIdx to perform interval partitioning.

[0198] Step 4: Update candidate probabilities.

[0199] Update the probability model corresponding to the candidate ctxIdx. Specifically, update the parameters pStateIdx0 and pStateIdx1.

[0200] The process of entropy decoding of abs_level_gt1_flag is similar to the entropy encoding process described earlier. For the parts not described in detail, please refer to the content described earlier.

[0201] The process of entropy decoding of abs_level_gt1_flag can include steps 1 through 5.

[0202] Step 1: Determine the initial state of the context model, see the previous introduction to the entropy coding process.

[0203] Step 2: Determine the context index of the abs_level_gt1_flag residual block level.

[0204] Step 3, binary arithmetic decoding. Based on the interval division and the value corresponding to the lower limit of the interval in the bitstream, determine the symbol. The value of this symbol may be 0 or 1.

[0205] Step 4: Assign a value to abs_level_gt1_flag. Assign a value to abs_level_gt1_flag based on the parsed symbol value.

[0206] Step 5: Update candidate probabilities.

[0207] As can be seen, ECM currently considers neighborhood coefficients and diagonal distance when modeling the context of the syntax element `abs_level_gt1_flag`. However, in some cases, the context model determined by neighborhood coefficients and diagonal distance is not accurate enough. The following example will illustrate this issue in detail.

[0208] Figure 3 This is a schematic diagram showing the statistical results of the magnitude of the syntax element abs_level_gt1_flag provided in the embodiments of this application. Figure 3 The figure shows the statistical results of the magnitude of the transform coefficient abs_level_gt1_flag when the last non-zero coefficient is located at (0,0).

[0209] See Figure 3 The horizontal axis of this histogram represents the magnitude of the transform coefficients' `abs_level_gt1_flag`, and the vertical axis represents the number of occurrences of the `abs_level_gt1_flag` magnitude. When the last non-zero coefficient is at position (0,0), the number of `abs_level_gt1_flag` magnitude values ​​of 1 is approximately 18750, while the number of `abs_level_gt1_flag` magnitude values ​​of 2 is approximately 500. From... Figure 3 As can be seen, when the last non-zero coefficient is located at (0,0), the probability that the amplitude of abs_level_gt1_flag is 1 is very high.

[0210] If the context model for determining `abs_level_gt1_flag` based on neighborhood coefficients and diagonal distance is used, it may predict that the probability of `abs_level_gt1_flag` having an amplitude of 1 is relatively small, contradicting statistical results. Therefore, in this case, the context model for determining `abs_level_gt1_flag` based on neighborhood coefficients and diagonal distance is not accurate enough.

[0211] It should be understood that the above is merely an example to illustrate the problem that the defined context model is not accurate enough, and the embodiments of this application are not limited thereto.

[0212] To address the aforementioned issues, this application provides a decoding method comprising: parsing a bitstream and determining first information, wherein the first information indicates the position of the last non-zero coefficient of the current transform block; if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, then decoding a first parameter of the current transform block based on a first context model; wherein the first context model is different from a second context model, and the second context model is the context model used by transform blocks decoded before the current transform block.

[0213] Furthermore, this application embodiment also provides an encoding method, including: determining first information, the first information being used to indicate the position of the last non-zero coefficient of the current transform block; if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, then encoding the first parameter of the current transform block based on a first context model; wherein, the first context model is different from the second context model, the second context model being the context model used by transform blocks encoded before the current transform block.

[0214] When the last non-zero coefficient is located at the top left corner of the current transform block, this embodiment of the application introduces an independent context model for the syntax element, namely the first parameter, which helps to improve the accuracy of the probability estimation of the first parameter, thereby helping to improve the encoding and decoding performance. Introducing an independent context model for the first parameter can be understood as determining the context model of the first parameter without relying on neighborhood coefficients and diagonal distance, thus helping to avoid the influence of different neighborhood conditions on the probability estimation of the first parameter.

[0215] The following is combined with Figure 4 The decoding method of the embodiments of this application will be described in detail with examples.

[0216] Figure 4 This is a flowchart illustrating the decoding method provided in an embodiment of this application. Figure 4 The method can be applied to the decoder.

[0217] See Figure 4 In step S410, the bitstream is parsed to determine the first information, which is used to indicate the position of the last non-zero coefficient of the current transform block.

[0218] In some embodiments, the first piece of information can be either `last_sig_coeff` or `last_flag`. By parsing `last_sig_coeff` or `last_flag`, the position of the last non-zero coefficient can be determined.

[0219] The position of the last non-zero coefficient can be represented by its coordinates within the current transform block. In other words, the position of the last non-zero coefficient can refer to its coordinates within the current transform block. For example, the origin of the coordinate system in the current transform block can be the position corresponding to a transform coefficient at the top-left corner of the block; that is, the origin (0,0) is located in the first row and first column of the current transform block. Similarly, transform coefficients located in the first row and second column of the current transform block can be represented by coordinates (0,1).

[0220] Alternatively, the position of the last non-zero coefficient can be represented by its row and column positions within the current transform block. In other words, the position of the last non-zero coefficient can include its row number and column number within the current transform block.

[0221] In some embodiments, the top-left corner of the current transform block can refer to a position with coordinates (0,0), (0,1), or (1,0). The last non-zero coefficient being located at the top-left corner (0,0) of the current transform block can be replaced by the last non-zero coefficient being located in the first row and the first column of the current transform block.

[0222] It should be understood that in the future, the coordinates in the current transform block may be defined in a new way, and this application does not limit this.

[0223] See also Figure 4 In step S420, if the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then the first parameter of the current transform block is decoded based on the first context model. The first parameter may refer to a parameter representing the transform coefficient in the current transform block.

[0224] The first context model differs from the second context model, which is the context model used for the transform blocks decoded before the current transform block.

[0225] Alternatively, if the last non-zero coefficient is located at the top left corner of the current transform block, a separate context model is used. This separate context model refers to one that is independent of the context model used in previous decoding processes.

[0226] Alternatively, if the last non-zero coefficient is located in the upper left corner of the current transform block, then the context model is changed, that is, from the second context model to the first context model.

[0227] In this way, during the decoding of the first parameter, the probability of the first parameter's value is independent of the second context model used in the previous decoding process. In other words, it is independent of the value of the first parameter in the neighborhood coefficient, which helps to improve the accuracy of the first parameter decoding and thus helps to improve the decoding performance.

[0228] As mentioned earlier, transform coefficients can be represented by syntax elements. In other words, the transform coefficient can be decoded by decoding the syntax elements of the transform coefficient. Figure 4 The first parameter mentioned in the method shown can be a syntax element.

[0229] Based on the statistical results mentioned earlier, the probability of the last non-zero coefficient having an amplitude of 1 is relatively high. Therefore, when determining the context model of the grammatical elements related to the amplitude of the transformation coefficients, an independent context model can be used, namely the first context model mentioned earlier, which helps to improve the accuracy of the determined context model.

[0230] Syntax elements related to the magnitude of the transform coefficients may include, for example, sig_coeff_flag, abs_level_gt1_flag, and abs_level_gt2_flag.

[0231] The following section uses the example of the last non-zero coefficient being located at (0,0) to introduce the decoding methods of the above-mentioned syntax elements.

[0232] If the last non-zero coefficient is located at (0,0), then the syntax element sig_coeff_flag of that coefficient is known and does not need to be decoded again, thus saving resources.

[0233] Based on the statistical results above, the probability of the last non-zero coefficient having an amplitude of 1 is very high, meaning the probability of abs_level_gt1_flag being 0 is very high. Therefore, an independent context model is used for abs_level_gtx_flag.

[0234] Additionally, the amplitude of the last non-zero coefficient has a certain probability of being 2. Based on this, the value of abs_level_gt3_flag is 0. Therefore, the default value of abs_level_gt3_flag can be 0, thus eliminating the need to decode abs_level_gt3_flag and saving resources.

[0235] Based on the above analysis, the first parameter can be used to indicate whether the magnitude of the transform coefficient in the current transform block is greater than 1. If the magnitude of the transform coefficient is greater than 1, the first parameter takes the first value; if the magnitude of the transform coefficient is less than or equal to 1, the first parameter takes the second value. For example, the first parameter can be abs_level_gt1_flag, and of course, the first parameter can also be represented by any other letters and / or numbers.

[0236] As mentioned earlier, the top-left corner of the current transform block can include positions (0,0), (0,1), and (1,0). When the last non-zero coefficient is located in different positions among these three locations, the coefficients of the current transform block can be decoded using the same context model or different context models. In this case, using the same context model helps reduce decoding complexity, while using different context models helps improve the accuracy of the context model. This is because the amplitude variation of the coefficients of the current transform block may differ depending on the location of the last non-zero coefficient. Therefore, decoding using different context models helps to utilize these different variation patterns to determine a more suitable context model, thereby improving decoding performance.

[0237] In some embodiments, the current transform block can be a luminance transform block or a chrominance transform block. That is, regardless of whether it is a luminance transform block or a chrominance transform block, if the last non-zero coefficient is located at the top left corner of the current transform block, the first context model is used to decode the transform coefficients. Alternatively, independent context models can be used for encoding both luminance and chrominance transform blocks, and the context model used for the luminance transform block is the same as that used for the chrominance transform block.

[0238] Using the same context model for both luminance and chrominance transformation blocks helps reduce implementation complexity.

[0239] In other embodiments, the first context model includes a first sub-model and a second sub-model. If the current transform block is a luminance transform block, the first parameter is decoded based on the first sub-model; if the current transform block is a chrominance transform block, the first parameter is decoded based on the second sub-model.

[0240] In other words, both the luminance and chrominance transformation blocks can be decoded using independent context models. However, the context model used for the luminance transformation block differs from that used for the chrominance transformation block. This is because the variation patterns of the luminance and chrominance transformation coefficients may differ. Using different context models to decode the luminance and chrominance transformation coefficients helps to capture their different variation patterns, thereby improving performance.

[0241] In some embodiments, step 420 can be replaced by: if the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then determining the index of the first context model; determining the first context model according to the index of the first context model; thereby performing arithmetic decoding on the first parameter according to the first context model, and updating the probability state of the first context model.

[0242] For example, the first context model can be determined by looking up a table based on its index. This method is described above and will not be repeated here.

[0243] When the last non-zero coefficient is located at the top left corner of the current transform block, the context model index of the first parameter can be pre-configured or predefined, thus helping to save transmission overhead. For example, if the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, the decoder can obtain the index of the first context model from pre-stored code or code stored in external memory.

[0244] The process of performing arithmetic decoding of the first parameter based on the first context model and updating the probability state of the first context model is similar to that in related technologies. Please refer to the previous introduction, and it will not be repeated here.

[0245] In some embodiments, the first context model can be obtained through training, such as by training on statistical data or test data, and using the probability estimation results as the loss (or loss function) for model training to determine the first context model. The training method can refer to the methods in related technologies, and this application does not limit it.

[0246] To avoid performance loss caused by inaccurate context models, this application also proposes two other solutions, which are briefly introduced below.

[0247] As mentioned earlier, determining the initial values ​​of the context model is the first step. Related techniques typically use the original values ​​as the initial values ​​for the context model. In some embodiments, the initial values ​​of the context model can be changed for decoding. It should be understood that this method, by changing the initial values ​​of the context model, helps improve the accuracy of the context model's probability estimation of parameters related to the coefficients of the current transform block. In the training process described above, for example, the accuracy of the probability estimation can be used as one of the losses in the model training process.

[0248] In some embodiments, parsing the bitstream can determine second information, which indicates the encoding mode. The encoding mode mentioned here may include a mode in which the last non-zero coefficient is disabled at position (0,0) in the current transform block, and the magnitude of that coefficient is not 1.

[0249] In other words, if the second information indicates that the encoding mode is to disable the last non-zero coefficient at position (0,0) in the current transform block and the amplitude of the coefficient is not 1, then the amplitude of the last non-zero coefficient is directly determined to be 1 during the decoding process.

[0250] In this way, for the last non-zero coefficient, there is no need to decode syntax elements such as abs_level_gt1_flag, which helps to reduce the complexity of decoding and improve decoding efficiency.

[0251] The following example, using the syntax element abs_level_gt1_flag as the first parameter and the top-left corner of the current transform block as (0,0), illustrates the method for determining the context index ctxIdx of the first parameter. This method may include steps 1 to 3 as follows.

[0252] Step 1: Determine if the last non-zero coefficient is located at (0,0).

[0253] When parsing the syntax element abs_level_gt1_flag, the position of the last non-zero coefficient is first determined. If the position of the last non-zero coefficient is (0,0), then step 2 is executed.

[0254] Step 2, select the abs_level_gt1_flag context model.

[0255] When the last non-zero coefficient is located at (0,0) in the current transform block, a separate context is used for the syntax element abs_level_gt1_flag, such as ctxIdx = 216.

[0256] Step 3: Perform binary arithmetic decoding and update the context model probabilities.

[0257] After modifying the calculation method and context model of ctxIdx (i.e., changing abs_level_gt1_flag from the second context model to the first context model), binary arithmetic decoding of abs_level_gt1_flag is performed based on the modified ctxIdx index (i.e., the first context model), and the context probability model is updated. The decoding principle is consistent with related technologies.

[0258] The method provided in this application, in determining the context model of the syntax element `abs_level_gt1_flag`, retains the original conditions and adds a case (the case where the last non-zero coefficient is at position (0,0)) and defines an independent context model used in this case. This allows for more refined context model operations for `abs_level_gt1_flag`. This approach helps improve the accuracy of estimating the probability of the syntax element `abs_level_gt1_flag`, thereby contributing to improved decoding performance.

[0259] It should be understood that the transform coefficients can be obtained based on the first parameter and other syntax elements. After obtaining the coefficients of the transform block, the residual information can be determined based on the coefficients of the current transform block. For example, inverse quantization and inverse transform operations can be performed on the coefficients of the current transform block to obtain the residual information. After obtaining the residual information, the reconstruction information can be determined based on the residual information.

[0260] The above text combined Figure 4 This document describes in detail the decoding method provided in the embodiments of this application. The following section, in conjunction with... Figure 5 The encoding method provided in the embodiments of this application is described in detail.

[0261] Figure 5 This is a flowchart illustrating the encoding method provided in an embodiment of this application. Figure 5 The method can be applied to encoders.

[0262] See Figure 5 In step S510, first information is determined, which is used to indicate the position of the last non-zero coefficient of the current transform block.

[0263] In some embodiments, the first information can be either last_sig_coeff or last_flag. The position of the last non-zero coefficient determines the first information, which is then encoded.

[0264] The position of the last non-zero coefficient can be represented by its coordinates within the current transform block. In other words, the position of the last non-zero coefficient can refer to its coordinates within the current transform block. For example, the origin of the coordinate system in the current transform block can be the position corresponding to a transform coefficient at the top-left corner of the block; that is, the origin (0,0) is located in the first row and first column of the current transform block. Similarly, transform coefficients located in the first row and second column of the current transform block can be represented by coordinates (0,1).

[0265] Alternatively, the position of the last non-zero coefficient can be represented by its row and column positions within the current transform block. In other words, the position of the last non-zero coefficient can include its row number and column number within the current transform block.

[0266] In some embodiments, the top-left corner of the current transform block can refer to a position with coordinates (0,0), (0,1), or (1,0). The last non-zero coefficient being located at the top-left corner (0,0) of the current transform block can be replaced by the last non-zero coefficient being located in the first row and the first column of the current transform block.

[0267] It should be understood that in the future, the coordinates in the current transform block may be defined in a new way, and this application does not limit this.

[0268] See also Figure 5 In step S520, if the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, the first parameter of the last non-zero coefficient is encoded based on the first context model.

[0269] The first context model differs from the second context model, which is the context model used by the transform blocks encoded before the current transform block.

[0270] Alternatively, if the last non-zero coefficient is located at the top left corner of the current transform block, a separate context model is used. Here, a separate context model refers to one that is independent of the context model used in previous encoding processes.

[0271] Alternatively, if the last non-zero coefficient is located in the upper left corner of the current transform block, then the context model is changed, that is, from the second context model to the first context model.

[0272] In this way, during the encoding of the first parameter, the probability of the first parameter's value is independent of the second context model used in the previous encoding process. In other words, it is independent of the value of the first parameter in the neighborhood coefficient, which helps to improve the accuracy of the first parameter encoding and thus helps to improve the encoding performance.

[0273] As mentioned earlier, transform coefficients can be represented using syntax elements. In other words, the transform coefficient can be encoded by encoding the syntax elements of the transform coefficient. Figure 5 The first parameter mentioned in the method shown can be a syntax element.

[0274] Based on the statistical results mentioned earlier, the probability of the last non-zero coefficient having an amplitude of 1 is relatively high. Therefore, when determining the context model of the grammatical elements related to the amplitude of the transformation coefficients, an independent context model can be used, namely the first context model mentioned earlier, which helps to improve the accuracy of the determined context model.

[0275] Syntax elements related to the magnitude of the transform coefficients may include, for example, sig_coeff_flag, abs_level_gt1_flag, and abs_level_gt3_flag.

[0276] The following section uses the example of the last non-zero coefficient being located at (0,0) to introduce the encoding methods of the above-mentioned syntax elements.

[0277] If the last non-zero coefficient is located at (0,0), then the syntax element sig_coeff_flag of that coefficient is known and does not need to be encoded again, thus saving encoding resources.

[0278] Based on the statistical results above, the probability of the last non-zero coefficient having an amplitude of 1 is very high, meaning the probability of abs_level_gt1_flag being 0 is very high. Therefore, an independent context model is used for abs_level_gtx_flag.

[0279] Additionally, the magnitude of the last non-zero coefficient has a certain probability of being 2. Based on this, the value of abs_level_gt3_flag is 0. Therefore, the default value of abs_level_gt3_flag can be 0, thus eliminating the need to encode abs_level_gt3_flag and saving encoding resources.

[0280] Based on the above analysis, the first parameter can be used to indicate whether the magnitude of the transform coefficient in the current transform block is greater than 1. If the magnitude of the transform coefficient is greater than 1, the first parameter takes the first value; if the magnitude of the transform coefficient is less than or equal to 1, the first parameter takes the second value. For example, the first parameter can be abs_level_gt1_flag, and of course, the first parameter can also be represented by any other letters and / or numbers.

[0281] As mentioned earlier, the top-left corner of the current transform block can include positions (0,0), (0,1), and (1,0). When the last non-zero coefficient is located in different positions among these three locations, the coefficients of the current transform block can be encoded using the same context model or different context models. In this case, using the same context model helps reduce encoding complexity, while using different context models helps improve the accuracy of the context model. This is because the amplitude variation of the coefficients of the current transform block may differ depending on the location of the last non-zero coefficient. Therefore, encoding using different context models helps to utilize these different variation patterns to determine a more suitable context model, thereby improving encoding performance.

[0282] In some embodiments, the current transform block can be a luminance transform block or a chrominance transform block. That is, regardless of whether it is a luminance transform block or a chrominance transform block, if the last non-zero coefficient is located at the top left corner of the current transform block, then the transform coefficients are encoded using the first context model. Alternatively, independent context models can be used for encoding both luminance and chrominance transform blocks, and the context model used for the luminance transform block is the same as that used for the chrominance transform block.

[0283] Using the same context model for both luminance and chrominance transformation blocks helps reduce implementation complexity.

[0284] In other embodiments, the first context model includes a first sub-model and a second sub-model. If the current transform block is a luminance transform block, the first parameter is encoded based on the first sub-model; if the current transform block is a chrominance transform block, the first parameter is encoded based on the second sub-model.

[0285] In other words, both the luma and chroma transformation blocks can be encoded using independent context models. However, the context model used for the luma transformation block differs from that used for the chroma transformation block. This is because the variation patterns of the luma and chroma transformation coefficients may differ. Encoding the luma and chroma transformation coefficients using different context models helps capture these different variation patterns, thereby improving performance.

[0286] In some embodiments, step 520 can be replaced by: if the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then determining the index of the first context model; determining the first context model according to the index of the first context model; thereby performing arithmetic encoding on the first parameter according to the first context model, and updating the probability state of the first context model.

[0287] For example, the first context model can be determined by looking up a table based on its index. This method is described above and will not be repeated here.

[0288] When the last non-zero coefficient is located at the top left corner of the current transform block, the context model index of the first parameter can be pre-configured or predefined, thus helping to save transmission overhead. For example, if the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, there is no need to transmit the index of the first context model to the encoder.

[0289] The process of arithmetically encoding the first parameter based on the first context model and updating the probability state of the first context model is similar to that in related technologies. Please refer to the previous introduction for details, which will not be repeated here.

[0290] In some embodiments, the first context model can be obtained through training, such as by training on statistical data or test data, and using the probability estimation results as the loss (or loss function) for model training to determine the first context model. The training method can refer to the methods in related technologies, and this application does not limit it.

[0291] To avoid performance loss caused by inaccurate context models, this application also proposes two other solutions, which are briefly introduced below.

[0292] As mentioned earlier, determining the initial values ​​of the context model is the first step. Related techniques typically use the original values ​​as the initial values ​​for the context model. In some embodiments, the initial values ​​of the context model can be changed for encoding. It should be understood that this method, by changing the initial values ​​of the context model, helps improve the accuracy of the context model's probability estimation of parameters related to the coefficients of the current transform block. In the training process described above, for example, the accuracy of the probability estimation can be used as one of the losses in the model training process.

[0293] In some embodiments, second information is determined to indicate an encoding mode; and the second information is written into the bitstream. The encoding mode mentioned herein may include a mode in which the last non-zero coefficient is located at position (0,0) in the current transform block and the magnitude of that coefficient is not 1.

[0294] In other words, if the last non-zero coefficient is located at (0,0) in the current transform block, the coefficient magnitude is directly inferred to be 1, and there is no need to encode syntax elements such as abs_level_gt1_flag. Therefore, when performing mode selection at the encoding end, if the last non-zero coefficient of the transformed residual block is located in the (0,0) region and the magnitude of the coefficient is not 1, the magnitude is directly set to 1 and the corresponding rate-distortion cost is calculated.

[0295] This eliminates the need to encode syntax elements such as abs_level_gt1_flag, which helps save transmission overhead and thus improves compression performance.

[0296] The method provided in this application, in determining the context model of the syntax element `abs_level_gt1_flag`, retains the original conditions and adds a case (the case where the last non-zero coefficient is at position (0,0)) and defines an independent context model used in this case. This allows for more refined context model operations for `abs_level_gt1_flag`. This approach helps improve the accuracy of estimating the probability of the syntax element `abs_level_gt1_flag`, thereby contributing to improved coding performance.

[0297] It should be noted that the independent context model mentioned in the embodiments of this application can also be replaced by an independent context.

[0298] It should be understood that the method provided in this application embodiment can be extended to other situations. For example, in some cases, the magnitude or position of the transform coefficients has a clear regularity, and an independent context model can be used to decode the parameters related to the magnitude or position of the transform coefficients, thereby helping to improve coding performance.

[0299] The above text combined Figures 1 to 5 The method embodiments of this application are described in detail below, in conjunction with... Figures 6 to 9 The present application provides a detailed description of the apparatus embodiments. It should be understood that the descriptions of the method embodiments correspond to the descriptions of the apparatus embodiments; therefore, any parts not described in detail can be found in the foregoing method embodiments.

[0300] Figure 6 This is a schematic diagram of the decoder structure provided in one embodiment of this application. Figure 6 As shown, the decoder 600 includes a determining unit 610 and a processing unit 620. The determining unit 610 is used to parse the bitstream and determine first information, which indicates the position of the last non-zero coefficient of the current transform block. If the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, the processing unit 620 is used to decode the first parameter of the current transform block based on a first context model. The first context model is different from the second context model, which is the context model used by transform blocks decoded before the current transform block.

[0301] In some implementations, the current transformation block is a luminance transformation block or a chrominance transformation block.

[0302] In some implementations, the first context model includes a first sub-model and a second sub-model. If the current transform block is a luminance transform block, the first parameter is decoded based on the first sub-model; if the current transform block is a chrominance transform block, the first parameter is decoded based on the second sub-model.

[0303] In some implementations, the first parameter is used to indicate whether the magnitude of the transform coefficient in the current transform block is greater than 1. If the first parameter is a first value, then the magnitude of the transform coefficient is greater than 1; if the first parameter is a second value, then the magnitude of the transform coefficient is less than or equal to 1.

[0304] In some implementations, the last non-zero coefficient is located at the top left corner of the current transform block, including: the last non-zero coefficient is located in the first row of the current transform block, and the last non-zero coefficient is located in the first column of the current transform block.

[0305] In some implementations, the processing unit 620 is used to determine the index of the first context model; determine the first context model based on the index of the first context model; perform arithmetic decoding on the first parameter based on the first context model; and update the probability state of the first context model.

[0306] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment 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 described above can be implemented in hardware or as a software functional module.

[0307] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0308] Therefore, embodiments of this application provide a computer-readable storage medium applied to a decoder 600, the computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned decoding method.

[0309] Based on the composition of the decoder 600 and the computer-readable storage medium described above, see [link to documentation]. Figure 7 This illustrates a schematic diagram of the specific hardware structure of the decoder provided in an embodiment of this application. Figure 7 As shown, the decoder 700 may include a communication interface 710, a memory 720, and a processor 730; the various components are coupled together via a bus system 740. It is understood that the bus system 740 is used to implement communication between these components. In addition to a data bus, the bus system 740 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 7 The general designated all buses as Bus System 740. Among them,

[0310] The communication interface 710 is used for receiving and sending signals during the process of sending and receiving information with other external network elements.

[0311] Memory 720 is used to store computer programs.

[0312] Processor 730, when running the computer program, performs the following:

[0313] Analyze the bitstream to determine the first information, which indicates the position of the last non-zero coefficient of the current transform block;

[0314] If the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then the first parameter of the current transform block is decoded based on the first context model;

[0315] The first context model is different from the second context model, which is the context model used by the transform block decoded before the current transform block.

[0316] It is understood that the memory 720 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous DRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Memory Bus RAM (DRRAM). The memory 720 of the systems and methods described in this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0317] The processor 730 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 730 or by instructions in software form. The processor 730 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 720, and the processor 730 reads the information in memory 720 and, in conjunction with its hardware, completes the steps of the above method.

[0318] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0319] In some embodiments, the processor 730 is further configured to perform the decoding method described in the foregoing embodiments when running the computer program.

[0320] Figure 8 This is a schematic diagram of the encoder provided in one embodiment of this application. Figure 8 As shown, the encoder 800 includes a determining unit 810 and a processing unit 820. The determining unit 810 is used to determine first information, which indicates the position of the last non-zero coefficient of the current transform block. If the first information indicates that the last non-zero coefficient is located at the upper left corner of the current transform block, then the processing unit 820 is used to encode a first parameter of the current transform block based on a first context model. The first context model is different from a second context model, where the second context model is the context model used by transform blocks encoded before the current transform block.

[0321] In some implementations, the current transformation block is a luminance transformation block or a chrominance transformation block.

[0322] In some implementations, the first context model includes a first sub-model and a second sub-model. If the current transform block is a luminance transform block, the first parameter is encoded based on the first sub-model; if the current transform block is a chrominance transform block, the first parameter is encoded based on the second sub-model.

[0323] In some implementations, the first parameter is used to indicate whether the magnitude of the transform coefficient in the current transform block is greater than 1. If the first parameter is a first value, then the magnitude of the transform coefficient is greater than 1; if the first parameter is a second value, then the magnitude of the transform coefficient is less than or equal to 1.

[0324] In some implementations, the last non-zero coefficient is located at the top left corner of the current transform block, including: the last non-zero coefficient is located in the first row of the current transform block, and the last non-zero coefficient is located in the first column of the current transform block.

[0325] In some implementations, the processing unit 720 is used to determine the index of the first context model; determine the first context model based on the index of the first context model; perform arithmetic encoding on the first parameter based on the first context model; and update the probability state of the first context model.

[0326] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment 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 described above can be implemented in hardware or as a software functional module.

[0327] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0328] Therefore, this application provides a computer-readable storage medium for use in an encoder 800. The computer-readable storage medium stores a computer program that, when executed by a processor, implements the encoding method described in the foregoing embodiments.

[0329] Based on the composition of the encoder 800 and the computer-readable storage medium described above, see [link to documentation]. Figure 9 This illustrates a schematic diagram of the specific hardware structure of the encoder provided in an embodiment of this application. Figure 9 As shown, encoder 900 may include: communication interface 910, memory 920, and processor 930; the various components are coupled together via bus system 940. It is understood that bus system 940 is used to implement communication between these components. In addition to a data bus, bus system 940 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 9 The general designated all buses as Bus System 940. Among them,

[0330] The communication interface 910 is used for receiving and sending signals during the process of sending and receiving information with other external network elements.

[0331] Memory 920 is used to store computer programs.

[0332] Processor 930, when running the computer program, performs the following:

[0333] Determine the first information, which is used to indicate the position of the last non-zero coefficient in the current transform block;

[0334] If the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then the first parameter of the current transform block is encoded based on the first context model;

[0335] The first context model is different from the second context model, which is the context model used by the transform block encoded before the current transform block.

[0336] It is understood that the memory 920 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous DRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Memory Bus RAM (DRRAM). The memory 720 of the systems and methods described in this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0337] The processor 930 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the processor 930 or by software instructions. The processor 930 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 920, and the processor 930 reads the information in memory 920 and, in conjunction with its hardware, completes the steps of the above method.

[0338] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0339] In some embodiments, the processor 930 is further configured to execute the encoding method described in the foregoing embodiments when running the computer program.

[0340] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0341] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0342] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0343] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0344] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0345] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A decoding method applied to a decoder, the decoding method comprising: Analyze the bitstream to determine the first information, which indicates the position of the last non-zero coefficient of the current transform block; If the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then the first parameter of the current transform block is decoded based on the first context model; The first context model is different from the second context model, which is the context model used by the transform block decoded before the current transform block.

2. The method according to claim 1, wherein, The current transformation block is either a luminance transformation block or a chrominance transformation block.

3. The method according to claim 1, wherein, The first context model includes a first sub-model and a second sub-model. If the current transform block is a brightness transform block, then the first parameter is decoded based on the first sub-model; If the current transform block is a chroma transform block, then the first parameter is decoded based on the second sub-model.

4. The method according to any one of claims 1-3, wherein, The first parameter is used to indicate whether the magnitude of the transform coefficients in the current transform block is greater than 1. If the first parameter takes the first value, then the magnitude of the transformation coefficient is greater than 1; If the first parameter takes the second value, then the magnitude of the transformation coefficient is less than or equal to 1.

5. The method according to any one of claims 1-4, wherein, The last non-zero coefficient is located at the top left corner of the current transform block, including: The last non-zero coefficient is located in the first row of the current transform block, and the last non-zero coefficient is located in the first column of the current transform block.

6. The method according to any one of claims 1-5, wherein, Decoding the first parameter of the current block based on the first context model includes: Determine the index of the first context model; The first context model is determined based on the index of the first context model; The first parameter is arithmetically decoded based on the first context model, and the probability state of the first context model is updated.

7. An encoding method applied to an encoder, the encoding method comprising: Determine the first information, which is used to indicate the position of the last non-zero coefficient in the current transform block; If the first information indicates that the last non-zero coefficient is located at the top left corner of the current transform block, then the first parameter of the current transform block is encoded based on the first context model; The first context model is different from the second context model, which is the context model used by the transform block encoded before the current transform block.

8. A decoder, comprising: Memory, used to store computer programs; A processor, configured to perform the method as described in any one of claims 1-6 when running the computer program.

9. An encoder, comprising: Memory, used to store computer programs; A processor, configured to perform the method of claim 7 when running the computer program.

10. A non-volatile computer-readable storage medium for storing a bitstream, said bitstream being generated by an encoding method using an encoder, or said bitstream being decoded by a decoding method using a decoder, wherein, The decoding method is the method as described in any one of claims 1-6, and the encoding method is the method as described in claim 7.

11. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program that, when executed, implements the method as claimed in any one of claims 1-6 or 7.

12. A chip, wherein, The chip includes a processor for calling a program from memory to cause a device on which the chip is mounted to perform the method as claimed in any one of claims 1-6 or 7.