Coefficient encoding / decoding method, encoder, decoder, and computer storage medium

By identifying and encoding/decoding the last non-zero coefficient position and reducing syntax elements in context mode, the method enhances encoding/decoding efficiency and speed in high-bit-depth, high-bit-rate, high-quality, or lossless video compression.

JP7821919B2Active Publication Date: 2026-02-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2025028177
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2026-02-27
Estimated Expiration
2041-04-12

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies for high-bit-depth, high-bit-rate, high-quality, or lossless compression scenarios face inefficiencies in throughput, speed, and overhead due to the need to encode and decode larger coefficients, leading to increased complexity and reduced performance.

Method used

A method and system for coefficient encoding and decoding that identifies video flag information and the position of the last non-zero coefficient, utilizing position reversal flag information to encode and decode coefficients before this position, reducing the number of syntax elements encoded/decoded in context mode, and performing coordinate transformation to minimize overhead.

Benefits of technology

This approach improves encoding/decoding throughput, speed, and compression efficiency by reducing the number of syntax elements encoded/decoded, particularly in high-bit-depth, high-bit-rate, high-quality, or lossless compression scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007821919000019
    Figure 0007821919000019
  • Figure 0007821919000020
    Figure 0007821919000020
  • Figure 0007821919000021
    Figure 0007821919000021
Patent Text Reader

Abstract

To provide a coefficient coding / decoding method, an encoder, a decoder, and a computer storage medium.SOLUTION: A coefficient decoding method includes: when the last non-zero coefficient position-reverse flag information, obtained when video flag information acquired from a bitstream indicates that a preset condition is satisfied, indicates that position reversing of the last non-zero coefficient is used, calculating coordinate information of the last non-zero coefficient, to identify the position of the last non-zero coefficient; according to a preset scanning order, decoding all coefficients before the position of the last no-zero coefficient to identify coefficients of the current block. In video coding / decoding scenarios with high bit depth, high bit rate, high quality, or lossless compression, the throughput and coding / decoding speed of coefficient coding / decoding can be improved, and compression efficiency can also be improved.SELECTED DRAWING: Figure 9
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The embodiments of the present application relate to the technical field of video encoding and decoding, and in particular to a coefficient encoding and decoding method, an encoder, a decoder, and a computer storage medium. [Background technology]

[0002] As the demand for video display quality increases, computer vision-related fields are gaining attention. In recent years, image processing technology has been successfully applied in various industries. In the video image encoding and decoding process, the encoding side transforms and quantizes the image data to be encoded, then compresses and encodes it using an entropy coding unit, and the resulting bitstream is transmitted to the decoding side. On the decoding side, the bitstream is analyzed and, after undergoing inverse quantization and inverse transformation, the original input image data can be restored.

[0003] Currently, compared with low-bit-depth, low-quality, low-bit-rate video encoding and decoding (which can be referred to as "normal video"), high-bit-depth, high-quality, high-bit-rate video encoding and decoding (which can be referred to as "high-quality video") typically requires more and larger coefficients to be encoded and decoded. Thus, existing related schemes for high-quality video may result in greater overhead and waste, which may further affect the speed and throughput of encoding and decoding. Summary of the Invention

[0004] In embodiments of the present application, a coefficient encoding / decoding method, an encoder, a decoder, and a computer storage medium are provided, which can improve coefficient encoding / decoding throughput and encoding / decoding speed, as well as compression efficiency, in high bit-depth, high bit-rate, high-quality, or lossless compression video encoding / decoding scenarios.

[0005] The technical solutions of the embodiments of the present application can be realized as follows.

[0006] In a first aspect, an embodiment of the present application provides a coefficient decoding method applied to a decoder, the method comprising: Parsing the bitstream to obtain video flag information; If the video flag information indicates that the video satisfies the preset condition, parsing the bitstream to obtain position reversal flag information of the last non-zero coefficient and coordinate information of the last non-zero coefficient; If the last non-zero coefficient position reversal flag information indicates that the current block utilizes the last non-zero coefficient position reversal, determining the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient; and decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0007] In a second aspect, an embodiment of the present application provides a coefficient coding method applied to an encoder, the method comprising: Identifying video flag information and the location of the last non-zero coefficient; If the video flag information indicates that the video satisfies a preset condition, identifying position reversal flag information of the last non-zero coefficient; Identifying coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and position inversion flag information of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing bit information obtained by encoding, video flag information, and coordinate information of the last non-zero coefficient into a bitstream.

[0008] In a third aspect, an embodiment of the present application provides an encoder, the encoder comprising a first identifying unit and an encoding unit. the first identifying unit is configured to identify video flag information and a position of a last non-zero coefficient, and, when the video flag information indicates that the video satisfies a preset condition, identify position inversion flag information of the last non-zero coefficient; the first identifying unit is further configured to identify coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient; The encoding unit is configured to encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write bit information obtained by encoding, video flag information, and coordinate information of the last non-zero coefficient into a bitstream.

[0009] In a fourth aspect, an embodiment of the present application provides an encoder, the encoder comprising a first memory and a first processor. the first memory is configured to store a computer program executable by the first processor; The first processor is configured to, when executing a computer program, perform the method according to the second aspect.

[0010] In a fifth aspect, an embodiment of the present application provides a decoder, the decoder comprising: an analyzing unit and a second identifying unit. the parsing unit is configured to parse the bitstream to obtain video flag information; and when the video flag information indicates that the video satisfies a preset condition, parse the bitstream to obtain position reversal flag information of the last non-zero coefficient and coordinate information of the last non-zero coefficient; the second identifying unit is configured to identify a position of the last non-zero coefficient by calculating coordinate information of the last non-zero coefficient when the position reversal flag information of the last non-zero coefficient indicates that the current block utilizes position reversal of the last non-zero coefficient; The analysis unit is further configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0011] In a sixth aspect, an embodiment of the present application provides a decoder, the decoder comprising a second memory and a second processor. the second memory is configured to store a computer program executable by the second processor; The second processor is configured to perform the method according to the first aspect when executing a computer program.

[0012] In a seventh aspect, an embodiment of the present application provides a computer storage medium having a computer program stored thereon, the computer program being configured to perform the method of the first aspect or the method of the second aspect when executed.

[0013] In an embodiment of the present application, a coefficient encoding / decoding method, an encoder, a decoder, and a computer storage medium are provided. The encoder identifies video flag information and the position of the last non-zero coefficient. If the video flag information indicates that the video satisfies a predetermined condition, it identifies position reversal flag information of the last non-zero coefficient. Based on the position of the last non-zero coefficient and the position reversal flag information of the last non-zero coefficient, it identifies coordinate information of the last non-zero coefficient. According to a predetermined scanning order, all coefficients before the position of the last non-zero coefficient are coded, and bit information obtained by coding, the video flag information, and the coordinate information of the last non-zero coefficient are written to a bitstream. The decoder analyzes the bitstream to obtain the video flag information. If the video flag information indicates that the video satisfies the predetermined condition, it analyzes the bitstream to obtain the position reversal flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. If the position reversal flag information of the last non-zero coefficient indicates that the current block uses position reversal of the last non-zero coefficient, it identifies the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient. The coefficients of the current block are identified by decoding all coefficients before the position of the last non-zero coefficient according to a preset scan order. In this way, in video encoding / decoding scenarios with high bit depth, high bit rate, high quality, or lossless compression, the coefficient distribution rules differ from those in normal video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or eliminated, such as syntax elements for the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing coordinate transformation when the value of the coordinate information of the last non-zero coefficient is large, the overhead of encoding / decoding in the bitstream can be reduced, and the throughput and encoding / decoding speed of coefficient encoding / decoding can be improved. Furthermore, because the syntax elements that are reduced or eliminated have a small impact on video encoding / decoding with high bit depth, high bit rate, high quality, or lossless compression, compression efficiency can also be improved. [Brief explanation of the drawings]

[0014] [Figure 1] FIG. 1 is a schematic diagram illustrating the application of a coding framework according to the related art. [Figure 2] FIG. 2 is a schematic diagram showing the positional relationship between a current coefficient and adjacent coefficients according to the related art. [Figure 3] FIG. 3 is a flowchart showing the bin arithmetic decoding process according to the related art. [Figure 4] FIG. 4 is a flowchart illustrating a binary decision arithmetic decoding process according to the related art. [Figure 5] FIG. 5 is a flowchart illustrating renormalization of an arithmetic decoding engine according to the related art. [Figure 6] FIG. 6 is a flowchart illustrating a bypass decoding process according to the related art. [Figure 7] FIG. 7 is a schematic diagram showing the positional relationship between a region where non-zero coefficients can exist and a zero-set region according to the related art. [Figure 8A] FIG. 8A is a schematic diagram showing the system structure of an encoder according to an embodiment of the present application. [Figure 8B] FIG. 8B is a schematic diagram showing the system structure of a decoder according to an embodiment of the present application. [Figure 9] FIG. 9 is a flowchart illustrating a coefficient decoding method according to an embodiment of the present application. [Figure 10A] FIG. 10A is a schematic diagram illustrating the location of the last non-zero coefficient relative to the top-left corner of the current block according to an embodiment of the present application. [Figure 10B] FIG. 10B is a schematic diagram illustrating the location of the last non-zero coefficient relative to the bottom right corner of the current block according to an embodiment of the present application. [Figure 11] FIG. 11 is a flowchart illustrating a coefficient encoding method according to an embodiment of the present application. [Figure 12] FIG. 12 is a schematic diagram illustrating the structure of an encoder according to an embodiment of the present application. [Figure 13]FIG. 13 is a schematic diagram showing a specific hardware structure of an encoder according to an embodiment of the present application. [Figure 14] FIG. 14 is a schematic diagram illustrating the structure of a decoder according to an embodiment of the present application. [Figure 15] FIG. 15 is a schematic diagram showing a specific hardware structure of a decoder according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION

[0015] In order to more fully understand the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings, which are used for illustration purposes only and are not intended to limit the embodiments of the present application.

[0016] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0017] In the following description, although "some embodiments" refers to a subset of all possible embodiments, it should be understood that "some embodiments" may refer to the same or different subsets of all possible embodiments, and may be combined with each other unless inconsistent. Note that the terms "first / second / third" in the embodiments of the present application merely distinguish between similar objects and do not imply a specific order of objects. The terms "first / second / third" may be interchanged with a specific order or priority where permitted, such that the embodiments of the present application described herein may be implemented in an order other than that illustrated or described herein.

[0018] In a video image, a coding block (CB) is generally represented by a first image component, a second image component, and a third image component. The first image component, the second image component, and the third image component are a luma component, a blue chroma component, and a red chroma component, respectively. Specifically, the luma component is generally represented by the symbol Y, the blue chroma component is generally represented by the symbol Cb or U, and the red chroma component is generally represented by the symbol Cr or V. Thus, a video image may be represented in either a YCbCr format or a YUV format.

[0019] Before describing the embodiments of the present application in more detail, the nouns and terms used in the embodiments of the present application will be explained. The nouns and terms used in the embodiments of the present application are interpreted as follows. MPEG (Moving Picture Experts Group) International Standardization Organization (ISO), International Electrotechnical Commission (IEC), JVET (joint video exploration team) AOM (Alliance for Open Media) Next-generation video encoding and decoding standard H.266 / versatile video coding (VVC), VVC Reference Software Test Platform (VVC Test Model, VTM), Audio Video Standard (AVS), AVS High-Performance Test Model (HPM), Context-based Adaptive Binary Arithmetic Coding (CABAC), Regular residual coding / decoding (RRC), Transform Skip Residual Coding (TSRC).

[0020] Currently, a block-based hybrid coding / decoding framework is used in common video coding / decoding standards (e.g., VVC). Each image (frame) in a video image is divided into largest coding units (LCUs) of the same size (e.g., 128x128, 64x64, etc.). Each LCU can be divided into rectangular coding units (CUs) based on a rule, and the CUs can be divided into smaller prediction units (PUs), transform units (TUs), etc. Specifically, as shown in Figure 1, the hybrid coding / decoding framework can include modules such as prediction, transform, quantization, entropy coding, and in-loop filtering. The prediction module can include intra prediction and inter prediction, and inter prediction can include motion estimation and motion compensation. Because there is a strong correlation between adjacent samples in a video picture, the intra prediction method can be used in video coding and decoding technology to eliminate spatial redundancy between adjacent samples. Because there is a strong similarity between adjacent images in a video, the inter prediction method can be used in video coding and decoding technology to eliminate temporal redundancy between adjacent images, thereby improving coding and decoding efficiency.

[0021] The basic flow of a video encoder / decoder is as follows: In the encoder, an image is divided into blocks, a predicted block of the current block is generated by intra- or inter-prediction of the current block, the predicted block is subtracted from the original block of the current block to obtain a residual block, the residual block is transformed and quantized to obtain a quantization coefficient matrix, and the quantization coefficient matrix is ​​entropy coded and output to a bitstream. In the decoder, a predicted block of the current block is generated by intra- or inter-prediction of the current block, the bitstream is decoded to obtain a quantization coefficient matrix, the quantization coefficient matrix is ​​inversely quantized and inversely transformed to obtain a residual block, and the predicted block and residual block are added to obtain a reconstructed block. The reconstructed block forms a reconstructed image. The reconstructed image is then in-loop filtered based on the image or block to obtain a decoded image. The encoder also requires a similar process to the decoder to obtain a decoded image. The decoded image can be used as a reference image for inter-prediction of a subsequent image. The block partition information identified by the encoder, as well as mode or parameter information for prediction, transform, quantization, entropy coding, in-loop filtering, etc., are output to the bitstream as needed. The decoder analyzes the existing information to identify the same block partition information, mode or parameter information for prediction, transform, quantization, entropy coding, in-loop filtering, etc. as the encoder. This ensures that the decoded image obtained by the encoder is the same as the decoded image obtained by the decoder. The decoded image obtained by the encoder is usually also called the reconstructed image. During prediction, the current block may be divided into prediction units, and during transformation, the current block may be divided into transform units. The division between prediction units and transform units may be different. The above is the basic flow of a video encoder / decoder in a block-based hybrid encoding / decoding framework. As technology develops, some modules and steps in this framework or flow may be optimized.The embodiments of the present application apply to the basic flow of a video encoder-decoder in such a block-based hybrid encoding-decoding framework, but are not limited to such framework or flow.

[0022] The current block may be a current coding / decoding unit (CU), a current prediction unit (PU), or a current transform unit (TU).

[0023] Block partition information, mode information and parameter information for prediction, transform, and quantization, and coefficients are written into a bitstream using entropy coding. By assuming that different elements have different probabilities and assigning short codewords to elements with high probability of occurrence and long codewords to elements with low probability of occurrence, higher coding efficiency can be achieved than fixed-length coding. However, if the probabilities of different elements are close or almost the same, the compression space available through entropy coding is limited. CABAC is a common entropy coding method, and is used in HEVC and VCC. CABAC can improve compression efficiency by using a context model, but the use and update of the context mode makes operation more complex. CABAC has a bypass mode. The bypass mode does not require the use and update of a context model, achieving higher throughput. In an embodiment of the present application, a CABAC mode that requires the use and update of a context model can be referred to as a context mode.

[0024] Generally, a context model must first be identified based on a defined method. When invoking a defined binary-decision arithmetic decoding process, parameters of the context model can be used as input. The selection of a context model has dependencies among neighboring coefficients. For example, FIG. 2 is a schematic diagram illustrating the positional relationship between a current coefficient and neighboring coefficients according to the related art. In FIG. 2, the black blocks represent the current coefficient, and the grid-lined blocks represent neighboring coefficients. As shown in FIG. 2, the context model to be selected for the sig_coeff_flag of the current coefficient needs to be determined based on information about the five neighboring coefficients to the right, below, and below the current coefficient's right. As can be further seen from FIG. 2, the operation of the context mode is much more complex than the operation of the bypass mode, and there are dependencies among neighboring coefficients.

[0025] When the CABAC arithmetic encoding / decoding engine needs to use the context mode, it needs to invoke the defined binary decision arithmetic decoding process. This process includes the state transition process, i.e., context model update. The binary decision arithmetic decoding process invokes the renormalization process of the arithmetic decoding engine. When the bypass mode is used, it needs to invoke the bypass decoding process.

[0026] Below, we will introduce the use of CABAC for VVC as an example.

[0027] In the CABAC arithmetic encoding / decoding engine, the inputs of the arithmetic decoding process are ctxTable, ctxIdx, bypassFlag, and the state variables ivlCurrRange and ivlOffse of the arithmetic decoding engine, and the output of the arithmetic decoding process is the bin value.

[0028] ctxTable is a table used to select a context mode, and ctxIdx is the index of the context model.

[0029] 3 is a flowchart showing the arithmetic decoding process of bin according to the related art. As shown in FIG. 3, to decode the value of bin, the context index table ctxTable, ctxIdx, bypassFlag are transmitted as input to the arithmetic decoding process DecodeBin(ctxTable, ctxIdx, bypassFlag), and the details are as follows: If the value of bypassFlag is 1, the bypass decoding process DecodeBypass() is called. Otherwise, if the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, then call DecodeTerminate(). Otherwise (if the value of bypassFlag is 0 and the value of ctxTable is not 0), invoke the defined binary decision arithmetic decoding process DecodeDecision(ctxTable, ctxIdx).

[0030] Also, in the binary decision arithmetic decoding process, the inputs to the process are the variables ctxTable, ctxIdx, ivlCurrRange, and ivlOffset, and the outputs of the process are the decoded value binVal and the updated variables ivlCurrRange and ivlOffset.

[0031] 4 is a flowchart illustrating a binary decision arithmetic decoding process according to the related art. As shown in FIG. 4, pStateIdx0 and pStateIdx1 are two states of the current context model.

[0032] (1) The value of the variable ivlLpsRange is derived based on the following method. Given the current value of ivlCurrRange, the variable qRangeIdx is derived based on the following method: qRangeIdx=ivlCurrRange>>5. Given qRangeIdx and the pStateIdx0 and pStateIdx1 associated with ctxTable and ctxIdx, valMps and ivlLpsRange are derived based on the following method: pState=pStateIdx1+16×pStateIdx0, valMps=pState>>14, ivlLpsRange = (qRangeIdx × ((valMps?32767-pState:pState)>>9)>>1) + 4.

[0033] (2) Set the value of the variable ivlCurrRange to ivlCurrRange-ivlLpsRange, and perform the following operations: If ivlOffset is greater than or equal to ivlCurrRange, the value of the variable binVal is 1-valMps, the value of ivlOffset is obtained by subtracting ivlCurrRange from ivlOffset, and the value of ivlCurrRange is ivlLpsRange. Otherwise (if ivlOffset is less than ivlCurrRange), the value of the variable binVal is valMps.

[0034] Given the value of binVal, perform the defined state transition. Based on the current value of ivlCurrRange, you can perform the defined renormalization.

[0035] Furthermore, in the state transition process, the inputs of the process are the current pStateIdx0 and pStateIdx1 and the decoded value binVal, and the output of the process are the updated context variables pStateIdx0 and pStateIdx1 associated with ctxTable and ctxIdx. The variables shift0 and shift1 are derived from shiftIdx, and the correspondence between shiftIdx, ctxTable, and ctxIdx is defined as follows: shift0=(shiftIdx>>2)+2, shift1=(shiftIdx&3)+3+shift0.

[0036] Based on the decoded value binVal, two variables pStateIdx0 and pStateIdx1 associated with ctxTable and ctxIdx are updated as follows: pStateIdx0=pStateIdx0-(pStateIdx0>>shift0)+(1023×binVal>>shift0), pStateIdx1=pStateIdx1-(pStateIdx1>>shift1)+(16383×binVal>>shift1).

[0037] Also, the inputs to the renormalization process of the arithmetic decoding engine are the bits in the slice data and the variables ivlCurrRange and ivlOffset, and the output is the updated variables ivlCurrRange and ivlOffset.

[0038] 5 is a flowchart showing the renormalization of an arithmetic decoding engine according to the related art. As shown in FIG. 5, the current value of ivlCurrRange is first compared with 256, and the subsequent steps are as follows: If ivlCurrRange is greater than or equal to 256, no renormalization is necessary and the RenormD process terminates. Otherwise (if ivlCurrRange is less than 256), a renormalization loop is entered. In this loop, the value of ivlCurrRange is multiplied by 2, i.e., shifted one bit to the left. The value of ivlOffset is multiplied by 2, i.e., shifted one bit to the left. The one bit obtained by read_bits(1) is shifted into ivlOffset.

[0039] In the entire process, no data in the bitstream will cause ivlOffset to be greater than or equal to ivlCurrRange.

[0040] Furthermore, the inputs of the binary decision bypass decoding process are the bits in the slice data and the variables ivlCurrRange and ivlOffset, and the outputs are the updated variable ivlOffset and the decoded value binVal.

[0041] If the bypassFlag is 1, the bypass decoding process is called, and Figure 6 is a flowchart showing the bypass decoding process according to the related art. As shown in Figure 6, first, the value of ivlOffset is multiplied by 2, i.e., shifted one bit to the left. Then, the one bit obtained by read_bits(1) is shifted to ivlOffset. The value of ivlOffset is compared with the value of ivlCurrRange, and the subsequent steps are as follows: If ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1 and ivlOffset is equal to ivlOffset minus ivlCurrRange. Otherwise (if ivlOffset is less than ivlCurrRange), set the value of binVal to 0.

[0042] In the entire process, no data in the bitstream will cause ivlOffset to be greater than or equal to ivlCurrRange.

[0043] It should be noted that current video coding and decoding standards typically support one or more types of transforms and transform skips for residuals. Transforms include the discrete cosine transform (DCT). A residual block that uses a transform generally exhibits certain characteristics after transformation (and quantization). For example, after some transformation (and quantization), energy is concentrated in the low-frequency region, resulting in large coefficients in the upper-left corner and small coefficients in the lower-right corner, with many zero coefficients. On the other hand, transform skip literally means no transform is performed. Because the coefficients after transform skip have different distribution rules than those after transform, different coefficient encoding and decoding methods can be used. For example, in VCC, RRC is used for transformed coefficients and TSRC is used for transform skip coefficients.

[0044] In a typical transform, such as a DCT transform, the frequency of a transformed block increases from left to right and from top to bottom. The upper left corner represents low frequencies, and the lower right corner represents high frequencies. The human eye is more sensitive to low-frequency information but not particularly sensitive to high-frequency information. Taking advantage of this characteristic, some high-frequency information can be processed more or removed, resulting in less impact on vision. Some techniques, such as zero-out, can forcibly set some high-frequency information to zero. For example, for a 64x64 block, coefficients at positions with abscissas greater than or equal to 32 or ordinates greater than 32 are forcibly set to zero. This is merely an example, and the zero-out range can be derived in a more complex manner, so a description is omitted here. As shown in FIG. 7, a non-zero coefficient (also called a significant coefficient) may exist in the upper left corner (i.e., the region where non-zero coefficients are possible), and all coefficients in the lower right corner are set to zero (i.e., the zero-out region). In this way, for subsequent coefficient encoding and decoding, the coefficients in the zero-filled region are always 0 and do not need to be coded.

[0045] Furthermore, after the residual in video is transformed (and quantized), the coefficient distribution typically exhibits the characteristic that the upper-left corner has a large number of coefficients and the lower-right corner has many zero coefficients. Therefore, during coefficient encoding and decoding, several methods are used to ensure that coefficients within a certain range of the upper-left corner require encoding and decoding, while coefficients within a certain range of the lower-right corner do not require encoding and decoding (i.e., these coefficients are defaulted to be zero). One method involves first identifying the position of the last non-zero coefficient of the block in scanning order when encoding or decoding the coefficients of a block. After identifying this position, all coefficients after the position of the last non-zero coefficient in scanning order are considered to be zero, i.e., do not require encoding or decoding. Only the position of the last non-zero coefficient and the coefficients before that position require encoding and decoding. For example, in VVC, the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is identified using last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix.

[0046] (a) last_sig_coeff_x_prefix specifies the prefix of the horizontal (or column) coordinate of the last non-zero coefficient in the current block in scan order. The value of last_sig_coeff_x_prefix should be in the range from 0 to (log2ZoTbWidth<<1)-1, inclusive.

[0047] If last_sig_coeff_x_prefix does not exist, the value of last_sig_coeff_x_prefix is ​​0.

[0048] (b) last_sig_coeff_y_prefix specifies the prefix of the vertical (or row) coordinate of the last non-zero coefficient in the current block in scan order. The value of last_sig_coeff_y_prefix should be in the range from 0 to (log2ZoTbHeight<<1)-1, inclusive.

[0049] If last_sig_coeff_y_prefix does not exist, the value of last_sig_coeff_y_prefix is ​​0.

[0050] (c) last_sig_coeff_x_suffix specifies the suffix of the horizontal (or column) coordinate of the last non-zero coefficient in scan order in the current block. The value of last_sig_coeff_x_suffix should be in the range from 0 to (1<<((last_sig_coeff_x_prefix>>1)-1))-1, inclusive.

[0051] The value of the horizontal (or column) coordinate of the last non-zero coefficient in scan order in the current transform block, LastSignificantCoeffX, is derived in the following way: if last_sig_coeff_x_suffix is ​​not present, then LastSignificantCoeffX = last_sig_coeff_x_prefix; otherwise (if last_sig_coeff_x_suffix is ​​present), then LastSignificantCoeffX = (1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix.

[0052] (d) last_sig_coeff_y_suffix specifies the suffix of the vertical (or row) coordinate of the last non-zero coefficient in scan order in the current transform block. The value of last_sig_coeff_y_suffix should be in the range from 0 to (1<<((last_sig_coeff_y_prefix>>1)-1))-1, inclusive.

[0053] The value of the vertical (or row) coordinate of the last non-zero coefficient in scan order in the current transform block, LastSignificantCoeffY, is derived in the following manner. If last_sig_coeff_y_suffix is ​​not present, then LastSignificantCoeffY=last_sig_coeff_y_prefix. Otherwise (if last_sig_coeff_y_suffix is ​​present), then LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix.

[0054] Furthermore, the last non-zero coefficient and all coefficients before the last non-zero coefficient need to be coded / decoded, but in normal video, a certain percentage of these coefficients are still 0. VVC uses a flag sb_coded_flag, which indicates whether the current sub-block needs to be coded / decoded, to determine whether the coefficients in the current sub-block need to be coded / decoded. If coding / decoding is not required, it is assumed that all coefficients in the current sub-block are 0. Here, a sub-block is usually an nxn sub-block, for example, a 4x4 sub-block.

[0055] sb_coded_flag[xS][yS] specifies the following information of the sub-block at position (xS, yS) in the current transform block, where the sub-block is an array of transform coefficient levels. If the value of sb_coded_flag[xS][yS] is 0, all transform coefficient levels in the sub-block at position (xS, yS) in the current transform block are set to 0. If sb_coded_flag[xS][yS] does not exist, the value of sb_coded_flag[xS][yS] is 1.

[0056] Furthermore, when encoding and decoding coefficients, the compression efficiency can be improved by utilizing the characteristics of the coefficients. For example, in normal video, a certain percentage of the coefficients that need to be encoded or decoded are zero. Therefore, a single syntax element can be used to indicate whether the current coefficient is zero. This syntax element is usually a single binary symbol. If the current coefficient is zero, it means that the encoding and decoding of the current coefficient has finished. If not, it is necessary to continue encoding and decoding the current coefficient. As another example, in normal video, a certain percentage of the non-zero coefficients have absolute values ​​of 1. Therefore, a single syntax element can be used to indicate whether the absolute value of the current coefficient is greater than 1. This syntax element is usually a single binary symbol. If the absolute value of the current coefficient is less than or equal to 1, it means that the encoding and decoding of the current coefficient has finished. If not, it is necessary to continue encoding and decoding the current coefficient. For example, the syntax elements for VCC are as follows:

[0057] sig_coeff_flag[xC][yC] is used to specify whether the corresponding transform coefficient level at position (xC, yC) of the current transform block is a non-zero coefficient. If the value of sig_coeff_flag[xC][yC] is 0, the transform coefficient level at the (xC, yC) position is set to 0. Otherwise (if the value of sig_coeff_flag[xC][yC] is 1), the transform coefficient level at the (xC, yC) position is a non-zero coefficient.

[0058] If sig_coeff_flag[xC][yC] does not exist, it is estimated as follows. If the value of transform_skip_flag[x0][y0][cIdx] is 0, or if the value of sh_ts_residual_coding_disabled_flag is 1, the following applies. If (xC, yC) is the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) according to the scan order, or if all of the following conditions are true, the value of sig_coeff_flag[xC][yC] is estimated to be 1. (xC & ((1 << log2SbW) - 1), yC & ((1 << log2SbH) - 1)) is equal to (0, 0), the value of inferSbDcSigCoeffFlag is equal to 1, and the value of sb_coded_flag[xS][yS] is equal to 1. Otherwise, the value of sig_coeff_flag[xC][yC] is estimated to be 0. Otherwise (if the value of transform_skip_flag[x0][y0][cIdx] is 1 and the value of sh_ts_residual_coding_disabled_flag is 0), the following applies. If all of the following conditions are true, the value of sig_coeff_flag[xC][yC] is estimated to be 1. (xC & ((1 << log2SbW) - 1), yC & ((1 << log2SbH) - 1)) is equal to ((1 << log2SbW) - 1, (1 << log2SbH) - 1), the value of inferSbSigCoeffFlag is 1, and the value of sb_coded_flag[xS][yS] is 1. Otherwise, the value of sig_coeff_flag[xC][yC] is assumed to be 0.

[0059] abs_level_gtx_flag[n][j] is used to specify whether the absolute value of the transform coefficient level (at scan position n) is greater than (j<<1) + 1. If abs_level_gtx_flag[n][j] does not exist, the value of abs_level_gtx_flag[n][j] is 0.

[0060] Thus, after processing the above flags (or syntax elements), if the coding / decoding of the current coefficient has not yet finished, the remaining absolute value of the coefficient (e.g., abs_remainder in VVC) needs to be coded.

[0061] abs_remainder[n] is the remaining absolute value of the transform coefficient level at scan position n, which is coded and decoded using the Golomb-Rice code. If abs_remainder[n] does not exist, the value of abs_remainder[n] is 0.

[0062] In VVC, syntax elements such as sig_coeff_flag and abs_level_gtx_flag are coded and decoded in context mode, while abs_remainder is coded and decoded in bypass mode. As mentioned above, context mode coding is more complex than bypass mode coding and, intuitively, slower. When there are many coefficients that need to be coded and decoded, frequent use of context mode coding and decoding affects the decoding speed. Therefore, the number of syntax elements coded and decoded in context mode is limited. For example, when the number of binary symbols coded and decoded in context mode exceeds a threshold, subsequent coefficients are forced to be coded and decoded in bypass mode, such as dec_abs_level in VVC.

[0063] dec_abs_level[n] is the intermediate value at scan position n that is coded and decoded using the Golomb-Rice code. ZeroPos[n] can be derived by analyzing dec_abs_level[n]. The absolute value of the transform coefficient level at position (xC, yC) AbsLevel[xC][yC] is derived as follows: If dec_abs_level[n] does not exist, or if the value of dec_abs_level[n] is equal to ZeroPos[n], the value of AbsLevel[xC][yC] is 0. Otherwise, if the value of dec_abs_level[n] is less than ZeroPos[n], the value of AbsLevel[xC][yC] is dec_abs_level[n]+1. Otherwise (if the value of dec_abs_level[n] is greater than ZeroPos[n]), the value of AbsLevel[xC][yC] is dec_abs_level[n].

[0064] The above are all absolute values ​​of the coefficients, and the sign of a non-zero coefficient can be specified by the coefficient sign flag coeff_sign_flag or some sign derivation methods. coeff_sign_flag[n] can be used to specify the sign of the transform coefficient at scan position n based on the following method: If the value of coeff_sign_flag[n] is 0, the corresponding transform coefficient is a positive value. Otherwise (if the value of coeff_sign_flag[n] is 1), the corresponding transform coefficient is a negative value.

[0065] If coeff_sign_flag[n] does not exist, the value of coeff_sign_flag[n] becomes 0, and in this case, the sign of the transform coefficient at the coordinate (xC, yC) is specified based on CoeffSignLevel[xC][yC]. If the value of CoeffSignLevel[xC][yC] is 0, the corresponding transform coefficient is 0. Otherwise, if the value of CoeffSignLevel[xC][yC] is 1, the corresponding transform coefficient is a positive value. Otherwise (if the value of CoeffSignLevel[xC][yC] is -1), the corresponding transform coefficient is a negative value.

[0066] CoeffSignLevel[xC][yC] may be derived by some other methods, but the description thereof will be omitted here.

[0067] VVC also uses a parity flag par_level_flag for the coefficient value, which indicates the parity of the current coefficient value and is used to identify the value of the current coefficient and for dependent quantization.

[0068] par_level_flag[n] specifies the parity of the transform coefficient level at position n in the scan order. If par_level_flag[n] is not present, the value of par_level_flag[n] is 0.

[0069] In addition to specifying the parity of the transform coefficients, par_level_flag can also be used, together with abs_level_gtx_flag, abs_remainder, etc., to specify the magnitude of the coefficients.

[0070] Here, context mode encoding and decoding requires selecting, using, and updating the context mode, while bypass mode encoding and decoding does not. Typically, placing syntax elements encoded and decoded in context mode together and syntax elements encoded and decoded in bypass mode together within a certain range is more friendly to hardware design. For example, first process all syntax elements encoded and decoded in context mode in a block, and then process syntax elements encoded and decoded in bypass mode. All syntax elements encoded and decoded in context mode in the current block may be further divided into several groups, and all syntax elements encoded and decoded in bypass mode in a block may be further divided into several groups.

[0071] In one specific example, the specific syntax of the RRC is shown in Table 1.

[0072] [Table 1] JPEG0007821919000002.jpg224153JPEG0007821919000003.jpg232153JPEG0007821919 000004.jpg225152JPEG0007821919000005.jpg230153JPEG0007821919000006.jpg63153

[0073] The array AbsLevel[xC][yC] represents an array of absolute values ​​of the transform coefficients of the current transform block. The array AbsLevelPass1[xC][yC] represents an array of absolute values ​​of a reconstruction of a portion of the transform coefficients of the current transform block. The array indices xC and yC represent the (xC, yC) position in the current transform block.

[0074] After entering the function residual_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx), it is necessary to identify some information about the block size. For example, identify the logarithms log2ZoTbWidth and log2ZoTbHeight of the block size after zero-out. Coefficients whose abscissa is within the range of [0, (1<<log2ZoTbWidth)-1] and ordinate is within the range of [0, (1<<log2ZoTbHeight)-1] may be non-zero coefficients. Here, (1<<log2ZoTbWidth) indicates the width of the transform block after zero-out, and (1<< log2ZoTbHeight) indicates the height of the transform block after zero-out. Next, based on last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, etc., identify the position of the last non-zero coefficient. Coefficients before the last non-zero coefficient according to the scan order may be non-zero coefficients. Next, identify the value of remBinsPass1, that is, identify it based on the equation remBinsPass1 = ((1<<(log2TbWidth+log2TbHeight))×7)>>2. remBinsPass1 specifies the number of syntax elements encoded and decoded in the context mode in the current block. In the embodiments of this application, remBinsPass1 can be understood as the remaining binaries inpass1, that is, the number of remaining binary symbols in the first round. Coefficients before the last non-zero coefficient according to the scan order need to be encoded and decoded. For sub-blocks containing those coefficients, sequentially identify whether each current sub-block needs to be encoded and decoded. If it needs to be encoded and decoded, in this method, set the syntax elements encoded and decoded in the context mode in one sub-block in the first round, and set the syntax elements encoded and decoded in the bypass mode later.For each coefficient, it may be necessary to process up to four syntax elements coded and decoded in context mode (i.e., one sig_coeff_flag, two abs_level_gtx_flag, and one par_level_flag). In the first round, after processing a syntax element coded and decoded in context mode, subtract one from remBinsPass1. If one coefficient is large enough, after processing several syntax elements coded and decoded in context mode in the first round, it may be necessary to process the remaining value (i.e., abs_remainder). If remBinsPass1 is small enough (remBinsPass1 >= 4 is not satisfied), the first round ends, and the remaining coefficients are directly processed in bypass mode (i.e., dec_abs_level).

[0075] In another specific example, the specific syntax of the TSRC is shown in Table 2.

[0076] [Table 2] JPEG0007821919000008.jpg232153JPEG0007821919000009.jpg232153JPEG0007821919000010.jpg56153

[0077] After entering the function residual_ts_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx), some information about the block size needs to be specified. Next, the value of RemCcbs is specified, that is, it is specified based on the equation RemCcbs=((1<<(log2TbWidth+log2TbHeight))×7)>>2. RemCcbs specifies the number of syntax elements in the current block that are to be coded and decoded in the context mode. In the embodiment of the present application, RemCcbs can be understood as the remaining context coded binaries, that is, the remaining number of binary symbols that are to be coded and decoded in the context mode. Whether the current sub-block needs to be coded and decoded is specified for each sub-block. Unlike the RRC method, in the TSRC method, if a subblock needs to be coded or decoded, syntax elements coded or decoded in context mode are set in the second round. For each coefficient, up to four syntax elements coded or decoded in context mode are processed in the first and second rounds, respectively. Syntax elements coded or decoded in bypass mode are set later. In the first and second rounds, 1 is subtracted from remBinsPass1 each time a syntax element coded or decoded in context mode is processed. If one coefficient is sufficiently large, after processing several syntax elements coded or decoded in context mode in the first and second rounds, the remaining value (i.e., abs_remainder) needs to be processed. If remBinsPass1 is sufficiently small (does not satisfy remBinsPass1 >= 4), the first two rounds end, and the remaining coefficients are directly processed in bypass mode. In this case, abs_remainder remains.

[0078] In summary, according to the related art, such conventional coefficient encoding and decoding methods, conventional commonly used videos, such as consumer videos, have excellent compression efficiency. Consumer videos typically have a bit depth of 8 or 10 bits per pixel and a relatively low bit rate (usually less than a few megabytes per second (MB / s)). However, some applied videos require a higher bit depth, such as 12, 14, 16, or higher bits per pixel. A higher bit depth typically results in larger coefficients, more non-zero coefficients, and a higher bit rate. Some applied videos require higher quality, and higher quality typically results in larger coefficients, more non-zero coefficients, and a higher bit rate. A higher bit rate requires higher processing power (e.g., throughput) from the decoder.

[0079] Compared with low-bit-depth, low-quality, low-bitrate video (normal video), high-bit-depth, high-quality, high-bitrate video ("high-bitrate video") typically has more coefficients that need to be coded and decoded, and the coefficients are larger. For example, for a block of the same size, the number of coefficients that need to be coded and decoded in high-bit-depth video is much larger than the number of coefficients that need to be coded and decoded in normal video. This is because in normal video blocks, many coefficients are zero after prediction, transformation, and quantization, while in high-bit-depth video blocks, many coefficients are nonzero after prediction, transformation, and quantization. Because a large proportion of coefficients that need to be coded and decoded after prediction, transformation, and quantization in normal video blocks are zero, it is very effective to distinguish the range of coefficients that need to be coded and decoded based on the position of the last nonzero coefficient (LastSignificantCoeffX, LastSignificantCoeffY). Because the coefficients before the position of the last non-zero coefficient are likely to be zero, it is very effective to further distinguish whether the current sub-block needs to be coded or decoded using the flag sb_coded_flag indicating whether the sub-block needs to be coded or decoded. However, if the current block has a large number of non-zero coefficients, and most or even all of the coefficients are non-zero, the position of the last non-zero coefficient and the flag indicating whether the sub-block needs to be coded or decoded will not filter out many non-zero coefficients. Furthermore, coding or decoding the position of the non-zero coefficient and the flag indicating whether the sub-block needs to be coded or decoded in the bitstream itself occupies a certain amount of overhead, which is wasteful.

[0080] In another aspect, the location of the last non-zero coefficient and the flag indicating whether to encode or decode a sub-block are all coded or decoded in context mode. Context mode coding and decoding is more complex than bypass mode, and processing this information also affects the speed and throughput of software and hardware coding and decoding.

[0081] In another aspect, current methods for encoding and decoding the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) involve encoding and decoding the coordinates of the position of the last non-zero coefficient. In normal video, most of the non-zero coefficients are concentrated in the upper left corner, and most of the area in the lower right corner contains zero coefficients, so the values ​​of LastSignificantCoeffX and LastSignificantCoeffY are generally small. In high-resolution video, many non-zero coefficients are also present in the lower right corner, so the values ​​of LastSignificantCoeffX and LastSignificantCoeffY are generally large. Therefore, encoding and decoding large values ​​in the bitstream results in significant overhead. This method can also be used for lossless compression, because quantization cannot be used in lossless compression, which typically involves a relatively large number of coefficients. In this case, using existing related schemes results in significant overhead and waste, further affecting the speed and throughput of encoding and decoding.

[0082] In an embodiment of the present application, a coefficient decoding method applied to a decoder is provided. The bitstream is analyzed to obtain video flag information. If the video flag information indicates that the video satisfies a preset condition, the bitstream is analyzed to obtain position reversal flag information of the last non-zero coefficient and coordinate information of the last non-zero coefficient. If the position reversal flag information of the last non-zero coefficient indicates that the current block uses position reversal of the last non-zero coefficient, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are decoded to determine the coefficients of the current block.

[0083] An embodiment of the present application further provides a coefficient encoding method applied to an encoder: determining video flag information and the position of the last non-zero coefficient; if the video flag information indicates that the video satisfies a preset condition, determining position reversal flag information of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the position reversal flag information of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient into a bitstream.

[0084] In this way, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, where the coefficient distribution rules are different from those in normal video scenarios, the number of syntax elements coded and decoded in context mode during coefficient coding and decoding can be reduced or eliminated, such as syntax elements such as the position of the last non-zero coefficient and subblock coding and decoding flags. Furthermore, by performing coordinate transformation when the value of the coordinate information of the last non-zero coefficient is large, the overhead due to coding and decoding in the bitstream can be reduced and the coefficient coding and decoding throughput and coding and decoding speed can be improved. Furthermore, because the syntax elements that are reduced or eliminated have a small impact on high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.

[0085] Hereinafter, each embodiment of the present application will be described in detail with reference to the drawings.

[0086] 8A, which shows a block diagram of an example of the structure of an encoder system according to an embodiment of the present application. As shown in FIG. 8A, the encoder 100 may include a division unit 101, a prediction unit 102, a first adder 107, a transformation unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse transformation unit 111, a second adder 112, a filtering unit 113, a decoded picture buffer (DPB) unit 114, and an entropy coding unit 115. Here, the input of the encoder 100 may be a video consisting of a series of images or a single still image, and the output of the encoder 100 may be a bitstream (which may also be called a "codestream") representing a compressed version of the input video.

[0087] The division unit 101 divides an image in the input video into one or more coding tree units (CTUs). The division unit 101 may divide the image into multiple tiles and further divide one tile into one or more bricks. Here, one tile or one brick may include one or more complete and / or partial CTUs. The division unit 101 may also form one or more slices. One slice may include one or more tiles in an image arranged in raster order, or one or more tiles in an image covering a rectangular area. The division unit 101 may further form one or more sub-images, and each sub-image may include one or more slices, tiles, or bricks.

[0088] In the encoding process of the encoder 100, the division unit 101 transmits the CTU to the prediction unit 102. The prediction unit 102 may generally include a block division unit 103, a motion estimation (ME) unit 104, a motion compensation (MC) unit 105, and an intra prediction unit 106. Specifically, the block division unit 103 further divides the input CTU into smaller coding units (CUs) by iteratively using quadtree division, binary tree division, or ternary tree division. The prediction unit 102 may obtain an inter-predicted block of the CU using the ME unit 104 and the MC unit 105. The intra prediction unit 106 may obtain an intra-predicted block of the CU using various intra prediction modes, including MIP mode. For example, a rate-distortion optimized motion estimation method can be invoked by the ME unit 104 and the MC unit 105 to obtain an inter-predicted block, and a rate-distortion optimized mode decision method can be invoked by the intra-prediction unit 106 to obtain an inter-predicted block.

[0089] The prediction unit 102 outputs a prediction block of the CU, and the first adder 107 calculates the difference between the CU at the output of the division unit 101 and the prediction block of the CU, i.e., a residual CU. The transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs quantized coefficients (i.e., levels). The inverse quantization unit 110 performs a scaling operation on the quantized coefficients to output reconstructed coefficients. The inverse transform unit 111 performs one or more inverse transforms corresponding to the transform in the transform unit 108 and outputs a reconstructed residual. The second adder 112 calculates the reconstructed CU by adding the reconstructed residual and the prediction block of the CU from the prediction unit 102. The second adder 112 also sends its output to the prediction unit 102 to be used as a reference for intra prediction. After all CUs in an image or sub-image are reconstructed, the filtering unit 113 performs in-loop filtering on the reconstructed image or sub-image. Here, the filtering unit 113 may include one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping with chroma scaling (LMCS) filter, and a neural-network-based filter. Alternatively, if the filtering unit 113 determines that a CU is not used as a reference for encoding or decoding other CUs, it may perform in-loop filtering on one or more target samples in the CU.

[0090] The output of the filtering unit 113 is a decoded image or sub-image, which is buffered in the DPB unit 114. The DPB unit 114 outputs the decoded image or sub-image based on timing and control information. Here, the image stored in the DPB unit 114 can further be used as a reference for inter-prediction or intra-prediction by the prediction unit 102. Finally, the entropy coding unit 115 converts parameters required for decoding the image (such as control parameters and supplemental information) from the encoder 100 into binary format, and writes the binary format into a bitstream based on the syntax structure of each data unit, i.e., the encoder 100 finally outputs a bitstream.

[0091] Furthermore, the encoder 100 may include a first processor and a first memory for storing a computer program. The first processor reads and executes the computer program, causing the encoder 100 to read the input video and generate a corresponding bitstream. The encoder 100 may also be a computing device with one or more chips. The above units implemented as integrated circuits on the chips have similar connections and data exchange functions as the corresponding units in FIG. 8A.

[0092] Referring to Figure 8B, Figure 8B shows a block diagram of an example of the structure of a decoder system according to an embodiment of the present application. As shown in Figure 8B, the decoder 200 may include an analysis unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transform unit 206, an adder 207, a filtering unit 208, and a decoded image buffer unit 209. Here, the input of the decoder 200 may be a bitstream representing a compressed version of a video or a single still image, and the output of the decoder 200 may be a decoded video consisting of a series of images or a single decoded still image.

[0093] The input bitstream of the decoder 200 may be the bitstream generated by the encoder 100. The parsing unit 201 parses the input bitstream and obtains values ​​of syntax elements from the input bitstream. The parsing unit 201 converts the binary representations of the syntax elements into numerical values ​​to obtain one or more decoded images, and sends the numerical values ​​to units in the decoder 200. The parsing unit 201 may further parse one or more syntax elements from the input bitstream to represent the decoded images.

[0094] In the decoding process of the decoder 200, the parsing unit 201 sends the values ​​of the syntax elements and one or more variables set or specified based on the values ​​of the syntax elements to units in the decoder 200 to obtain one or more decoded images.

[0095] The prediction unit 202 identifies a prediction block of a currently decoded block (e.g., a CU). Here, the prediction unit 202 may include a motion compensation unit 203 and an intra prediction unit 204. Specifically, if it is indicated that an inter decoding mode is to be used to decode the currently decoded block, the prediction unit 202 sends related parameters from the analysis unit 201 to the motion compensation unit 203 to obtain an inter prediction block. If it is indicated that an intra prediction mode (including a MIP mode indicated based on a MIP mode index value) is to be used to decode the currently decoded block, the prediction unit 202 sends related parameters from the analysis unit 201 to the intra prediction unit 204 to obtain an intra prediction block.

[0096] The inverse quantization unit 205 has the same function as the inverse quantization unit 110 in the encoder 100. The inverse quantization unit 205 performs a scaling operation on the quantized coefficients (i.e., levels) from the analysis unit 201 to obtain reconstructed coefficients.

[0097] The inverse transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The inverse transform unit 206 performs one or more transform operations (i.e., the inverse operations of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain a reconstructed residual.

[0098] The adder 207 performs an addition operation on its inputs (the predicted block from the prediction unit 202 and the reconstructed residual from the inverse transform unit 206) to obtain a reconstructed block of the current decoded block. The reconstructed block is also sent to the prediction unit 202 to be used as a reference for other blocks to be coded and decoded under intra prediction modes.

[0099] After all CUs in an image or sub-image are reconstructed, the filtering unit 208 performs in-loop filtering on the reconstructed image or sub-image. The filtering unit 208 may include one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping with chroma scaling (LMCS) filter, and a neural network-based filter. Alternatively, if the filtering unit 208 determines that the reconstructed block is not used as a reference for decoding other blocks, it may perform in-loop filtering on one or more target samples in the reconstructed block. Here, the output of the filtering unit 208 is a decoded image or sub-image, which is buffered in the DPB unit 209. The DPB unit 209 outputs the decoded image or sub-image based on timing and control information. The image stored in the DPB unit 209 may further be used as a reference for inter prediction or intra prediction by the prediction unit 202.

[0100] Furthermore, the decoder 200 may include a second processor and a second memory for storing a computer program. When the first processor reads and executes the computer program, the decoder 200 reads the input bitstream and generates a corresponding decoded video. The decoder 200 may also be a computing device with one or more chips. The above units implemented as integrated circuits on the chips have similar connections and data exchange functions as the corresponding units in Figure 8B.

[0101] Furthermore, when the embodiment of the present application is applied to the encoder 100, In Budapest The term "block" specifically refers to a current image block (also called a "coding block") in a video image that is waiting to be coded. When the embodiment of the present application is applied to the decoder 200, the term "current In Budapest Note that "lock" specifically refers to the image block in the video image that is currently waiting to be decoded (which may also be called the "decode block").

[0102] In one embodiment of the present application, refer to Figure 9, which is a flowchart illustrating a coefficient decoding method according to an embodiment of the present application. As shown in Figure 9, the method may include the following contents:

[0103] S901: The bitstream is analyzed to obtain video flag information.

[0104] It should be noted that the coefficient decoding method of the embodiment of the present application is applied to a decoder. Specifically, based on the structure of the decoder 200 shown in Fig. 8B, the coefficient decoding method of the embodiment of the present application is mainly applied to the "analysis unit 201" in the decoder 200. The analysis unit 201 can perform decoding using an adaptive binary arithmetic coding / decoding mode or a bypass mode based on a context model, obtain the value of related flag information (or syntax element), and identify the coefficients of the current block.

[0105] It should be noted that the coefficient encoding / decoding generally described in video standards can include two parts, i.e., encoding and decoding, so the coefficient encoding / decoding includes a coefficient encoding method on the encoder side and a coefficient decoding method on the decoder side, and the embodiment of the present application is described as a coefficient decoding method on the decoder side.

[0106] In normal circumstances, for normal video, the coefficient decoding method is the same as existing methods in the related art. However, for specific situations, such as high bit-depth, high quality, high bit-rate, or lossless video encoding and decoding scenarios, the embodiments of the present application can amend the method for deriving the final non-zero coefficient positions.

[0107] In some embodiments of the present application, it is first necessary to determine whether the current video satisfies a preset condition, which can be represented by video flag information. In some embodiments, analyzing the bitstream to obtain the video flag information includes: determining that the video flag information indicates that the video satisfies a predetermined condition if the value of the video flag information is a first value; or The method may include specifying that, if the value of the video flag information is a second value, the video flag information indicates that the video does not satisfy the preset condition.

[0108] Here, the first value is 1 and the second value is 0.

[0109] In another specific example, the first value may be set to true and the second value may be set to false. In yet another specific example, the first value may be set to 0 and the second value may be set to 1, or the first value may be set to false and the second value may be set to true. There is no limitation thereon.

[0110] The predetermined conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0111] That is, compared with normal video, the video according to the embodiment of the present application has characteristics such as high bit depth, high quality, high bit rate, high frame rate and lossless compression.

[0112] Furthermore, the video flag information may be a sequence-level flag, or may be a flag of a higher level, such as VUI (Video Usability Information), SEI (Supplemental enhancement information), etc. Whether a video satisfies a preset condition can be determined by determining whether the video satisfies high bit depth, high bit rate, high quality, lossless compression, etc., and these four cases will be described below as examples.

[0113] In some embodiments, if the video flag information is high bit depth flag information, the method further comprises: If the high bit depth flag information indicates that the video satisfies the high bit depth, the method may further include identifying the video as satisfying a preset condition.

[0114] In some embodiments, if the video flag information is high bitrate flag information, the method comprises: If the high bit rate flag information indicates that the video satisfies the high bit rate, the method may further include identifying the video as satisfying a preset condition.

[0115] In some embodiments, if the video flag information is high quality flag information, the method comprises: If the high quality flag information indicates that the video meets high quality, the method may further include identifying the video as meeting a preset condition.

[0116] In some embodiments, if the video flag information is lossless compression flag information, the method comprises: If the lossless compression flag information indicates that the video satisfies lossless compression, the method may further include identifying the video as satisfying a preset condition.

[0117] For example, taking the sequence level as an example, the video flag information may be high bit-depth flag information (represented by sps_high_bit_depth_flag) used to indicate whether the current video sequence is a high bit-depth sequence, or high bit-rate flag information (represented by sps_high_bit_rate_flag) used to indicate whether the current video sequence is a high bit-rate sequence, or other flag information indicating high bit-depth, high bit-rate, high quality, or lossless compression, and is not specifically limited in the embodiments of the present application.

[0118] S902: If the video flag information indicates that the video satisfies the preset condition, parse the bitstream to obtain the position reversal flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient.

[0119] In addition, when the video flag information indicates that the video satisfies a preset condition, the position reversal flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient can be further obtained by analyzing the bitstream.

[0120] The coordinate information of the last non-zero coefficient may be identified based on last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix. Therefore, in some embodiments, parsing the bitstream to obtain the coordinate information of the last non-zero coefficient may include the following: Parsing the bitstream to obtain prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient. Identifying the horizontal coordinate of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the horizontal coordinate of the last non-zero coefficient. Identifying the vertical coordinate of the last non-zero coefficient based on the prefix information of the vertical coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient. The coordinate information of the last non-zero coefficient is determined based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0121] The prefix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_prefix and specifies the prefix of the horizontal (or column) coordinate of the last non-zero coefficient of the current block according to the preset scan order. The prefix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix and specifies the prefix of the vertical (or row) coordinate of the last non-zero coefficient of the current block according to the preset scan order. The suffix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix and specifies the suffix of the horizontal (column) coordinate of the last non-zero coefficient of the current block according to the preset scan order. The suffix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_suffix and specifies the suffix of the vertical (or row) coordinate of the last non-zero coefficient of the current block according to the preset scan order.

[0122] Note that last_sig_coeff_x_prefix and last_sig_coeff_x_suffix specify the abscissa (i.e., horizontal coordinate) of the last non-zero coefficient, and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix specify the ordinate (i.e., vertical coordinate) of the last non-zero coefficient, thereby obtaining coordinate information of the last non-zero coefficient.

[0123] The position reversal flag information of the last non-zero coefficient may be represented by reverse_last_sig_coeff_flag. In an embodiment of the present application, the position reversal flag information of the last non-zero coefficient may be flag information at least one of a sequence level, a picture level, a slice level, and a block level, or may be flag information at a higher level (e.g., VUI, SEI, etc.). There is no limitation thereon.

[0124] That is, reverse_last_sig_coeff_flag may be a flag at a sequence level or higher, or may be a picture level flag, a slice level flag, a block level flag, or a flag at other levels. Also, the block level flag may include an LCU level flag, a CU level flag, or another block level flag, and is not limited in the embodiments of the present application.

[0125] In some embodiments, the method comprises: Identifying that if the value of the position reversal flag information of the last non-zero coefficient is a first value, the position reversal flag information of the last non-zero coefficient indicates that the current block uses position reversal of the last non-zero coefficient; or The method may further include specifying that, if the value of the position reversal flag information of the last non-zero coefficient is a second value, the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize position reversal of the last non-zero coefficient.

[0126] That is, for example, if the first value is 1 and the second value is 0, it can be determined that if the value of reverse_last_sig_coeff_flag is 1, the reverse_last_sig_coeff_flag indicates that the current block uses the position reversal of the last non-zero coefficient. Alternatively, if the value of reverse_last_sig_coeff_flag is 0, it can be determined that the reverse_last_sig_coeff_flag indicates that the current block does not use the position reversal of the last non-zero coefficient.

[0127] S903: If the position reversal flag information of the last non-zero coefficient indicates that the current block uses the position reversal of the last non-zero coefficient, the position of the last non-zero coefficient is identified by calculating the coordinate information of the last non-zero coefficient.

[0128] S904: According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are decoded to identify the coefficients of the current block.

[0129] It should be noted that in the embodiment of the present application, if the position reversal flag information of the last non-zero coefficient indicates that the current block utilizes position reversal of the last non-zero coefficient, the coordinate information of the last non-zero coefficient can be specified as the horizontal and vertical distances from the position of the last non-zero coefficient to the bottom right corner of the current block.

[0130] In this case, in some embodiments, locating the last non-zero coefficient by calculating coordinate information of the last non-zero coefficient may include the following. Specifies the width and height of the current block. The horizontal coordinate of the last non-zero coefficient is obtained by subtracting the horizontal distance from the position of the last non-zero coefficient to the bottom right corner of the current block from the width of the current block. The vertical coordinate of the last non-zero coefficient is obtained by subtracting the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block from the height of the current block. Based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient, the position of the last non-zero coefficient is specified.

[0131] Note that the coordinate information of the last non-zero coefficient is usually the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block. In normal videos, most of the non-zero coefficients are concentrated in the upper left corner, and most of the area in the lower right corner has zero coefficients. However, in high-bit-depth, high-quality, high-bit-rate video encoding and decoding, there are also many non-zero coefficients in the lower right corner, so the value of the coordinate information of the last non-zero coefficient is usually large. In this case, in order to save overhead, during coefficient encoding, a coordinate transformation (specifically, it can be a coordinate inversion calculation, that is, the coordinate information of the last non-zero coefficient after coordinate inversion is the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block) needs to be performed. In that case, during coefficient decoding, a coordinate inversion calculation needs to be performed. After being inverted again, the coordinate information of the last non-zero coefficient can be restored so that it becomes the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block. In this way, the position of the last non-zero coefficient is specified, and all the coefficients before the position of the last non-zero coefficient in the current block are decoded according to the preset scan order.

[0132] Note that the current block here may be a block without zero-out transformation or a block after zero-out transformation. Taking the block after zero-out transformation as an example, in this case, the width of the current block is 1 << log2ZoTbWidth, and the height of the current block is 1 << log2ZoTbHeight. reverse_last_sig_coeff_flag indicates that the current block uses the position inversion of the last non-zero coefficient (that is, when the value of reverse_last_sig_coeff_flag is 1). LastSignificantCoeffX=(1< <log2ZoTbWidth)-1-LastSignificantCoeffXであり、 LastSignificantCoeffY=(1< <log2ZoTbHeight)-1-LastSignificantCoeffYである。

[0133] The (LastSignificantCoeffX, LastSignificantCoeffY) on the right side of the equation represents the coordinate information of the last non-zero coefficient obtained by decoding, and the (LastSignificantCoeffX, LastSignificantCoeffY) on the left side of the equation represents the position of the last non-zero coefficient (which can be considered as the target coordinate information of the last non-zero coefficient).

[0134] In the present application embodiment, if the value of reverse_last_sig_coeff_flag is 0, in some embodiments, the method may further include the following content: If the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize position reversal of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is specified as the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block. The location of the last non-zero coefficient is determined based on the horizontal and vertical distance from the location of the last non-zero coefficient to the top left corner of the current block.

[0135] If reverse_last_sig_coeff_flag indicates that the current block does not use the position reversal of the last non-zero coefficient, the coordinate information of the last non-zero coefficient obtained by decoding can be regarded as the target coordinate information of the last non-zero coefficient. In the embodiment of the present application, the target coordinate information of the last non-zero coefficient is the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block.

[0136] In some embodiments, the method may further include: If the last non-zero coefficient position reversal flag information indicates that the current block does not use the last non-zero coefficient position reversal, the position of the last non-zero coefficient is directly identified based on the coordinate information of the last non-zero coefficient. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are decoded to identify the coefficients of the current block.

[0137] It should be noted that the preset scanning order may be a diagonal order, a zigzag order, a horizontal order, a vertical order, a 4x4 sub-block scanning order, or any other scanning order, and is not limited in the embodiments of the present application.

[0138] Note that after obtaining reverse_last_sig_coeff_flag, if the value of reverse_last_sig_coeff_flag is 1, and if the position reversal of the last non-zero coefficient needs to be used, the coordinate information of the last non-zero coefficient needs to be obtained by decoding, and then the coordinate information of the last non-zero coefficient needs to be calculated to identify the position of the last non-zero coefficient. Next, all coefficients before the position of the last non-zero coefficient are decoded according to a preset scanning order. If the value of reverse_last_sig_coeff_flag is 0, that is, if the position reversal of the last non-zero coefficient does not need to be used, the coordinate information of the last non-zero coefficient needs to be obtained by decoding, and then the position of the last non-zero coefficient can be directly identified based on the coordinate information of the last non-zero coefficient. Next, all coefficients before the position of the last non-zero coefficient are decoded according to a preset scanning order.

[0139] Thus, in a specific situation, an embodiment of the present application provides an adjustment to the method for deriving the position of the last non-zero coefficient during coefficient encoding / decoding. That is, in a normal situation, the coefficient encoding / decoding method is the same as existing methods in the related art. The specific situation may refer, for example, to high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless compression video encoding / decoding. In a normal situation, as shown in FIG. 10A , the abscissa of the position of the last non-zero coefficient, i.e., the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented and coded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the ordinate of the position of the last non-zero coefficient, i.e., the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented and coded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix. On the other hand, in the case of high bit-depth, high quality, high bit-rate video encoding / decoding or lossless video encoding / decoding, the location of the last non-zero coefficient is generally near the lower right corner of the region of all possible non-zero coefficients of the current block. In this case, as shown in FIG. 10B, the horizontal distance from the location of the last non-zero coefficient to the lower right corner of the region of all possible non-zero coefficients of the current block is represented and coded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the vertical distance from the location of the last non-zero coefficient to the lower right corner of the region of all possible non-zero coefficients of the current block is represented and coded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix.For example, if all possible non-zero coefficient regions of the current block are rectangular regions from (0, 0) to ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), last_sig_coeff_x_prefix and last_sig_coeff_x_suffix are encoded and represent the horizontal distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix are encoded and represent the vertical distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1).

[0140] The correction to the semantics is as follows.

[0141] In the current block, the value LastSignificantCoeffX of the horizontal (or column) coordinate of the last non-zero coefficient according to the preset scan order is derived based on the following method. If last_sig_coeff_x_suffix does not exist, LastSignificantCoeffX = last_sig_coeff_x_prefix. Otherwise (if last_sig_coeff_x_suffix exists), LastSignificantCoeffX = (1 << ((last_sig_coeff_x_prefix >> 1) - 1)) * (2 + (last_sig_coeff_x_prefix & 1)) + last_sig_coeff_x_suffix. If the value of reverse_last_sig_coeff_flag is 1, LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1 - LastSignificantCoeffX. In the current block, the vertical (or row) coordinate value LastSignificantCoeffY of the last non-zero coefficient according to the preset scanning order is derived based on the following method. If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY=last_sig_coeff_y_prefix. Otherwise (if last_sig_coeff_y_suffix exists), LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix. If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1< <log2ZoTbHeight)-1-LastSignificantCoeffYである。

[0142] reverse_last_sig_coeff_flag is a position reversal flag for the last non-zero coefficient, and indicates whether the position of the last non-zero coefficient needs to be reversed. If the value of reverse_last_sig_coeff_flag is 1, it indicates that the position of the last non-zero coefficient needs to be reversed; otherwise, it indicates that the position of the last non-zero coefficient does not need to be reversed.

[0143] Note that reverse_last_sig_coeff_flag may be a flag at a sequence level or higher, or may be a picture level flag, a slice level flag, a block level flag, or a flag at another level. Furthermore, the block level flag includes an LCU level flag, a CU level flag, or a flag at another block level.

[0144] In addition, reverse_last_sig_coeff_flag may depend on some other flags, such as high bit-depth flag information or high bit-rate flag information, etc. That is, if the value of the high bit-depth flag information or high bit-rate flag information is 1, reverse_last_sig_coeff_flag needs to be decoded; otherwise, reverse_last_sig_coeff_flag does not need to be decoded.

[0145] In one specific example, taking the sequence level as an example, assume there is a sequence-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, sps_reverse_last_sig_coeff_flag needs to be decoded. Here, sps_reverse_last_sig_coeff_flag is a position reversal flag for the last non-zero coefficient of the current sequence. If the value of sps_reverse_last_sig_coeff_flag is 1, it indicates that the block in the current sequence uses position reversal of the last non-zero coefficient; otherwise (i.e., if the value of sps_reverse_last_sig_coeff_flag is 0), it indicates that the block in the current sequence does not use position reversal of the last non-zero coefficient. In the above syntax table, reverse_last_sig_coeff_flag is changed to sps_reverse_last_sig_coeff_flag.

[0146] The syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 3.

[0147] [Table 3]

[0148] In another specific example, taking the slice level as an example, assume that there is a slice-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, sh_reverse_last_sig_coeff_flag needs to be decoded. Here, sh_reverse_last_sig_coeff_flag is a position reversal flag for the last non-zero coefficient of the current slice. If the value of sh_reverse_last_sig_coeff_flag is 1, it indicates that the block in the current slice uses position reversal of the last non-zero coefficient; otherwise (i.e., if the value of sh_reverse_last_sig_coeff_flag is 0), it indicates that the block in the current slice does not use position reversal of the last non-zero coefficient. In the above syntax table, reverse_last_sig_coeff_flag is changed to sh_reverse_last_sig_coeff_flag.

[0149] The syntax elements are as follows (Slice header syntax), see Table 4.

[0150] [Table 4]

[0151] In addition, if the video flag information indicates that the video satisfies a preset condition, it may be defaulted that all coefficients that may need to be decoded need to be decoded. That is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients of the current block are scanned according to a preset scan order. Therefore, in the embodiment of the present application, last-coefficient enabled flag information may be introduced to specify whether the current block uses the last coefficient position.

[0152] In some embodiments, if the video flag information indicates that the video meets a preset condition, the method may further include: The bitstream is parsed to obtain the last coefficient valid flag information. If the last coefficient validity flag information indicates that the current block uses the last coefficient position, all coefficients before the last coefficient position are decoded according to a preset scanning order to identify the coefficients of the current block.

[0153] The last coefficient valid flag information may be represented by default_last_coeff_enabled_flag. In an embodiment of the present application, the last coefficient valid flag information may be flag information at least at one of a sequence level, an image level, a slice level, and a block level, or may be flag information at a higher level (for example, VUI, SEI, etc.). There is no limitation thereon.

[0154] That is, default_last_coeff_enabled_flag may be a flag at a sequence level or higher, or may be a flag at an image level, a flag at a slice level, a flag at a block level, or a flag at another level. Also, the block level flag may include a flag at an LCU level, a flag at a CU level, or a flag at another block level, and is not limited in the embodiments of the present application.

[0155] In some embodiments, the method comprises: Identifying that if the value of the last coefficient valid flag information is a first value, the last coefficient valid flag information indicates that the current block uses the last coefficient position; or The method may further include specifying that, if the value of the last coefficient valid flag information is the second value, the last coefficient valid flag information indicates that the current block does not utilize the last coefficient position.

[0156] Here, the first value is 1 and the second value is 0.

[0157] In another specific example, the first value may be set to true and the second value may be set to false. In yet another specific example, the first value may be set to 0 and the second value may be set to 1, or the first value may be set to false and the second value may be set to true. There is no limitation thereon.

[0158] Thus, for example, if the first value is 1 and the second value is 0, it can be determined that if the value of default_last_coeff_enabled_flag is 1, the default_last_coeff_enabled_flag indicates that the current block uses the last coefficient position. Alternatively, if the value of default_last_coeff_enabled_flag is 0, it can be determined that the default_last_coeff_enabled_flag indicates that the current block does not use the last coefficient position.

[0159] If the current block uses the last coefficient position, all coefficients before the last coefficient position can be decoded according to a preset scanning order to identify the coefficients of the current block.

[0160] Furthermore, if the current block does not use the last coefficient position, that is, if the value of the last coefficient valid flag information is 0, in some embodiments, the method may further include the following content: The bitstream is analyzed to obtain the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. The position of the last non-zero coefficient is identified based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are decoded to identify the coefficients of the current block.

[0161] If the current block does not use the last coefficient position, it is necessary to decode and obtain the position of the last non-zero coefficient. Specifically, the bitstream is analyzed to obtain last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix, and then the position of the last non-zero coefficient is identified based on last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix. Otherwise, if the current block uses the last coefficient position, it is no longer necessary to identify the position of the last non-zero coefficient, and it is no longer necessary to decode and obtain last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix.

[0162] If the current block uses the last coefficient position, all coefficients before the last coefficient position can be decoded according to a preset scan order. If the current block does not use the last coefficient position, all coefficients before the position of the last non-zero coefficient can be decoded according to a preset scan order. Here, the preset scan order may be a diagonal order, a zigzag order, a horizontal order, a vertical order, a 4x4 sub-block scan order, or any other scan order, and is not limited in the embodiments of the present application.

[0163] Furthermore, with respect to the last coefficient position, in some embodiments, the last coefficient position is the bottom right corner of a matrix of all possible non-zero coefficients in the current block, or the last coefficient position is the last position in scanning all possible non-zero coefficients in the current block according to a preset scanning order.

[0164] It should be noted that the last coefficient position in the embodiments of the present application does not represent the position of the last non-zero coefficient, because although the coefficient at the last coefficient position may be zero, the coefficient at the last non-zero coefficient position is not necessarily zero.

[0165] In one particular example, the method may further include setting the position of the last non-zero coefficient to the last coefficient position.

[0166] That is, in the embodiment of the present application, the position of the last non-zero coefficient can still be utilized, and in this case, it is necessary to set the position of the last non-zero coefficient to the last position of all possible non-zero coefficients in the current block according to the preset scanning order.

[0167] In addition, the last coefficient position may be represented by (LastCoeffX, LastCoeffY), that is, the last position of all possible non-zero coefficients in the current block according to the preset scanning order. In some embodiments, the method may further include the following content. The width and height of a transformation block obtained by performing a preset operation on the current block are specified. Coordinate calculation is performed based on the width and height of the transformation block to obtain the coordinate information of the lower right corner of the transformation block. The last coefficient position is identified based on the coordinate information of the lower right corner of the transform block.

[0168] Here, the preset operation includes at least a zero-out operation.

[0169] Note that (LastCoeffX, LastCoeffY) represents the coordinate information of the bottom right corner of the transform block after zero-out. The method for deriving (LastCoeffX, LastCoeffY) is as follows. LastCoeffX=(1< <log2ZoTbWidth)-1であり、LastCoeffY=(1<<log2ZoTbHeight)-1である。

[0170] In this way, if the value of default_last_coeff_enabled_flag is 1, the last coefficient position can be identified based on (LastCoeffX, LastCoeffY).

[0171] In one specific example, the position of the last non-zero coefficient is still utilized. In this case, the position of the last non-zero coefficient may be set to the last position of all possible zero coefficients in the current block according to a preset scanning order. In some embodiments, the method may further include the following: When setting the position of the last non-zero coefficient to the last coefficient position, the position of the last non-zero coefficient is identified based on coordinate information of the lower right corner of the transform block.

[0172] That is, the position of the last non-zero coefficient can be expressed as (LastSignificantCoeffX, LastSignificantCoeffY), that is, the method of deriving (LastSignificantCoeffX, LastSignificantCoeffY) is as follows: LastSignificantCoeffX=(1< <log2ZoTbWidth)-1であり、LastSignificantCoeffY=(1<<log2ZoTbHeight)-1である。

[0173] (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinate information of the bottom right corner of the transform block after zero-out. If the value of default_last_coeff_enabled_flag is 1, the position of the last non-zero coefficient can be identified based on (LastSignificantCoeffX, LastSignificantCoeffY).

[0174] Thus, in certain circumstances, during coefficient encoding / decoding, it is assumed by default that all coefficients that may need to be encoded / decoded must be encoded / decoded. That is, under normal circumstances, the coefficient encoding / decoding method is the same as existing methods in the related art. For example, certain circumstances may refer to high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless compression video encoding / decoding. By default, it is assumed that all coefficients that may need to be encoded / decoded must be encoded / decoded. That is, the position of the last nonzero coefficient is no longer used, and all possible nonzero coefficients in the current block are scanned according to a preset scanning order. In other words, the position of the last coefficient that needs to be encoded / decoded is set to the last position of all possible nonzero coefficients in the current block according to the preset scanning order. This position is usually the lower right corner of the matrix consisting of all possible nonzero coefficients in the current block. Here, the position of the last coefficient that needs to be encoded / decoded is used, rather than the position of the last nonzero coefficient. This is because the coefficient at the last coefficient position that needs to be coded or decoded may be zero, but the coefficient at the last non-zero coefficient position is not necessarily zero.

[0175] In one special case, we still use the position of the last non-zero coefficient, in which case we set the position of the last non-zero coefficient to the last position of all possible non-zero coefficients in the current block according to a preset scanning order.

[0176] Also, the reason we mentioned all possible non-zero coefficients in the current block according to the preset scanning order is because, in addition to the last non-zero coefficient, some other techniques (such as the zero-out technique mentioned above) may default some coefficients in a block to be 0.

[0177] The corrections to the semantics are as shown in Table 5.

[0178] [Table 5]

[0179] In an embodiment of the present application, a condition can be added before decoding the information required for the last non-zero coefficient, namely, if default_last_coeff_enabled_flag is false (i.e., the value of default_last_coeff_enabled_flag is equal to 0), it is necessary to decode syntax elements such as last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, etc. If default_last_coeff_enabled_flag is true (i.e., the value of default_last_coeff_enabled_flag is equal to 1), it is not necessary to decode syntax elements such as last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, etc.

[0180] Here, default_last_coeff_enabled_flag is a default last coefficient enabled flag used to indicate whether the default last coefficient is used. If the value of default_last_coeff_enabled_flag is 1, it indicates that the default last coefficient position is used, that is, it indicates that the last position of all possible non-zero coefficients in the current block according to the preset scan order is set to the last coefficient position that needs to be decoded. Otherwise, it indicates that the default last coefficient position is not used.

[0181] If the value of default_last_coeff_enabled_flag is 1, the default last coefficient position (LastCoeffX, LastCoeffY) is the last position of all possible non-zero coefficients in the current block according to the preset scan order. All coefficients before (LastCoeffX, LastCoeffY) need to be scanned according to the preset scan order. In the embodiment of the present application, the method for deriving (LastCoeffX, LastCoeffY) is as follows: LastCoeffX=(1< <log2ZoTbWidth)-1であり、LastCoeffY=(1<<log2ZoTbHeight)-1である。

[0182] (LastCoeffX, LastCoeffY) is the coordinate information of the bottom right corner of the transform block after zero-out.

[0183] In one special example, the position of the last non-zero coefficient is still used. In this case, the position of the last non-zero coefficient is set to the last position of all possible non-zero coefficients in the current block according to the preset scanning order. In the embodiment of the present application, the method for deriving the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is as follows: LastSignificantCoeffX=(1< <log2ZoTbWidth)-1であり、LastSignificantCoeffY=(1<<log2ZoTbHeight)-1である。

[0184] (LastSignificantCoeffX, LastSignificantCoeffY) is the coordinate information of the bottom right corner of the transform block after zero-out.

[0185] Note that default_last_coeff_enabled_flag may be a flag at a sequence level or higher, or may be a picture level flag, a slice level flag, a block level flag, or a flag at another level. Furthermore, the block level flag includes an LCU level flag, a CU level flag, or a flag at another block level.

[0186] In addition, default_last_coeff_enabled_flag may depend on some other flags, such as high bit-depth flag information or high bit-rate flag information, etc. That is, if the value of the high bit-depth flag information or high bit-rate flag information is 1, default_last_coeff_enabled_flag needs to be decoded, and if not, default_last_coeff_enabled_flag does not need to be decoded.

[0187] In one specific example, taking the sequence level as an example, assume there is a sequence-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, sps_default_last_coeff_enabled_flag needs to be decoded. Here, sps_default_last_coeff_enabled_flag is the default last coefficient enabled flag of the current sequence. If the value of sps_default_last_coeff_enabled_flag is 1, it indicates that the block in the current sequence uses the default last coefficient; otherwise (i.e., if the value of sps_default_last_coeff_enabled_flag is 0), it indicates that the block in the current sequence does not use the default last coefficient. In the above syntax table, default_last_coeff_enabled_flag is changed to sps_default_last_coeff_enabled_flag.

[0188] The syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 6.

[0189] [Table 6]

[0190] In another specific example, taking the slice level as an example, assume that there is a slice-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, sh_default_last_coeff_enabled_flag needs to be decoded. Here, sh_default_last_coeff_enabled_flag is the default last coefficient enabled flag of the current slice. If the value of sh_default_last_coeff_enabled_flag is 1, it indicates that the block in the current slice uses the default last coefficient; otherwise (i.e., if the value of sh_default_last_coeff_enabled_flag is 0), it indicates that the block in the current slice does not use the default last coefficient. In the above syntax table, default_last_coeff_enabled_flag is changed to sh_default_last_coeff_enabled_flag.

[0191] The syntax elements are as follows (Slice header syntax), see Table 7.

[0192] [Table 7]

[0193] In addition, if the video flag information indicates that the video satisfies the preset condition, all scanned sub-blocks need to be decoded by default, and in this case, there is no need to transmit sb_coded_flag in the bitstream, i.e., neither the encoder nor the decoder needs to process the flag, thereby improving the decoding speed. Therefore, in the embodiment of the present application, sub-block default decoding flag information (default sub-block coded flag) can be further introduced, which is used to determine whether sub-blocks waiting to be decoded in the current block will be defaulted when decoded.

[0194] In some embodiments, if the video flag information indicates that the video meets a preset condition, the method may further include: The bitstream is parsed to obtain the sub-block default decoding flag information. If the sub-block default decoding flag information indicates that a sub-block awaiting decoding in the current block will be defaulted when it is decoded, the value of the sub-block decoding flag information is determined to be the first value, and all coefficients in the sub-block awaiting decoding are decoded.

[0195] Note that the sub-block default decoding flag information can be represented by default_sb_coded_flag. In an embodiment of the present application, the sub-block default decoding flag information is at least one of flag information at a sequence level, an image level, a slice level, and a block level, and may also be flag information at a higher level (e.g., VUI, SEI, etc.). There is no limitation thereon.

[0196] That is, default_sb_coded_flag may be a flag at a sequence level or higher, or may be a picture level flag, a slice level flag, a block level flag, or a flag at other levels. Also, the block level flag may include an LCU level flag, a CU level flag, or a flag at other block levels, and is not limited in the embodiments of the present application.

[0197] In some embodiments, the method comprises: determining that, if the value of the sub-block default decoding flag information is a first value, the sub-block default decoding flag information indicates that the sub-block waiting to be decoded will be defaulted when decoded; or The method may further include specifying that, if the value of the sub-block default decoding flag information is a second value, the sub-block default decoding flag information indicates that the sub-block awaiting decoding will not be defaulted once decoded.

[0198] Here, the first value is 1 and the second value is 0.

[0199] In another specific example, the first value may be set to true and the second value may be set to false. In yet another specific example, the first value may be set to 0 and the second value may be set to 1, or the first value may be set to false and the second value may be set to true. There is no limitation thereon.

[0200] Thus, taking as an example a first value being 1 and a second value being 0, it can be specified that when the value of default_sb_coded_flag is 1, default_sb_coded_flag indicates that the sub-blocks waiting to be decoded should be decoded by default, or when the value of default_sb_coded_flag is 0, default_sb_coded_flag indicates that the sub-blocks waiting to be decoded should not be decoded by default.

[0201] If the sub-block waiting to be decoded needs to be decoded by default, the value of default_sb_coded_flag is 1, which means that the value of sb_coded_flag is 1, i.e., sb_coded_flag does not need to be decoded. In this case, it defaults to the fact that all coefficients in the sub-block waiting to be decoded need to be decoded.

[0202] Also, if the subblock waiting to be decoded does not need to be decoded by default, that is, if the value of default_sb_coded_flag is 0, in some embodiments, the method may further include the following content. The bitstream is parsed to obtain the sub-block decoding flag information. If the value of the sub-block decoding flag information is the first value, all coefficients in the sub-block waiting to be decoded are decoded.

[0203] In addition, if the sub-block waiting to be decoded does not default to needing to be decoded, the sub-block decoding flag information needs to be decoded and then, according to the sub-block decoding flag information, it is determined whether all coefficients in the sub-block waiting to be decoded should be decoded.

[0204] Also, for the sub-block decoding flag information, the method comprises: If the value of the sub-block decoding flag information is a first value, specifying that all coefficients in the sub-block waiting to be decoded are to be decoded; or The method can further include specifying that all coefficients in the sub-block to be decoded are zero if the value of the sub-block decoding flag information is the second value.

[0205] In an embodiment of the present application, the sub-block decoding flag information may be represented by sb_coded_flag. For example, a first value is 1 and a second value is 0. When the value of sb_coded_flag is 1, it may be determined that all coefficients in the sub-block waiting to be decoded need to be decoded. Or, when the value of sb_coded_flag is 0, it may be determined that all coefficients in the sub-block waiting to be decoded do not need to be decoded. In this case, all coefficients in the sub-block waiting to be decoded are zero.

[0206] Thus, in certain circumstances, during coefficient encoding and decoding, it is assumed by default that all scanned sub-blocks need to be coded or decoded; in other words, it is assumed that all scanned sub-blocks contain nonzero coefficients. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in the related art. For example, a certain situation may refer to high-bit-depth, high-quality, high-bit-rate video coding and decoding or lossless compression video coding and decoding. In this case, there are many nonzero coefficients, and most scanned sub-blocks need to be coded or decoded; in other words, most scanned sub-blocks contain nonzero coefficients. In this way, it is no longer necessary to transmit sb_coded_flag in the bitstream, and the encoder / decoder does not need to process the flag, thereby improving the encoding and decoding speed. Furthermore, since rarely present flags are removed, this slightly improves compression performance.

[0207] The corrections to the semantics are as shown in Table 8.

[0208] [Table 8]

[0209] default_sb_coded_flag is a flag that indicates whether the sub-block needs to be decoded by default. If the value of default_sb_coded_flag is 1, it can be specified that the value of sb_coded_flag[xS][yS] is 1, in which case there is no need to decode sb_coded_flag[xS][yS] from the bitstream. Otherwise (if the value of default_sb_coded_flag is 0), there is still a need to decode sb_coded_flag[xS][yS] from the bitstream.

[0210] Note that default_sb_coded_flag may be a flag at the sequence level or higher, or may be a picture level flag, a slice level flag, a block level flag, or a flag at another level. Furthermore, the block level flag includes an LCU level flag, a CU level flag, or a flag at another block level.

[0211] The default_sb_coded_flag may depend on some other flags, such as high bit-depth flag information or high bit-rate flag information, etc. That is, if the value of the high bit-depth flag information or high bit-rate flag information is 1, the default_sb_coded_flag needs to be decoded; otherwise, the default_sb_coded_flag does not need to be decoded.

[0212] In one specific example, taking the sequence level as an example, assume there is a sequence-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, sps_default_sb_coded_flag needs to be decoded. Here, sps_default_sb_coded_flag is a flag that indicates whether sub-blocks of the current sequence need to be decoded by default. If the value of sps_default_sb_coded_flag is 1, it indicates that sub-blocks of blocks in the current sequence need to be decoded by default; otherwise (i.e., if the value of sps_default_sb_coded_flag is 0), it indicates that sub-blocks of blocks in the current sequence do not need to be decoded by default. In the above syntax table, default_sb_coded_flag is changed to sps_default_sb_coded_flag.

[0213] The syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 9.

[0214] [Table 9]

[0215] In another specific example, taking the slice level as an example, assume that there is a slice-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, sh_default_sb_coded_flag needs to be decoded. Here, sh_default_sb_coded_flag is a flag that indicates whether sub-blocks of the current slice need to be decoded by default. If the value of sh_default_sb_coded_flag is 1, it indicates that sub-blocks of blocks in the current slice need to be decoded by default; otherwise (i.e., if the value of sh_default_sb_coded_flag is 0), it indicates that sub-blocks of blocks in the current slice do not need to be decoded by default. In the above syntax table, default_sb_coded_flag is changed to sh_default_sb_coded_flag.

[0216] The syntax elements are as follows (Slice header syntax), see Table 10.

[0217] [Table 10]

[0218] The embodiments of the present application relate to three optimization methods, which are as follows:

[0219] Method 1 is as follows: In certain circumstances, during coefficient encoding / decoding, it is assumed by default that all coefficients that may need to be encoded / decoded must be encoded / decoded. That is, under normal circumstances, the coefficient encoding / decoding method is the same as existing methods in the related art. For example, a certain situation may refer to high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless compression video encoding / decoding. It is assumed by default that all coefficients that may need to be encoded / decoded must be encoded / decoded. That is, the position of the last nonzero coefficient is no longer used, and all possible nonzero coefficients in the current block are scanned according to a preset scanning order. In other words, the position of the last coefficient that needs to be encoded / decoded is set to the last position of all possible nonzero coefficients in the current block according to the preset scanning order. Here, the position of the last coefficient that needs to be encoded / decoded is used, rather than the position of the last nonzero coefficient. This is because, although the coefficient at the last coefficient position that needs to be encoded / decoded may be zero, the coefficient at the last nonzero coefficient position is not necessarily zero.

[0220] Also, in one particular example, the position of the last non-zero coefficient is still utilized, in this case, setting the position of the last non-zero coefficient to the last position of all possible non-zero coefficients in the current block according to the preset scanning order.

[0221] Method 2 is as follows: In certain circumstances, the method for deriving the position of the last non-zero coefficient during coefficient encoding / decoding is modified. That is, in normal circumstances, the coefficient encoding / decoding method is the same as existing methods in the related art. The specific situation may refer, for example, to high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless compression video encoding / decoding. In normal circumstances, the abscissa of the position of the last non-zero coefficient, i.e., the horizontal distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the ordinate of the position of the last non-zero coefficient, i.e., the vertical distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix. On the other hand, in the case of high bit-depth, high quality, high bit-rate video encoding / decoding or lossless video encoding / decoding, the position of the last non-zero coefficient is generally near the lower right corner of the region of all possible non-zero coefficients of the current block. In this case, the horizontal distance from the position of the last non-zero coefficient to the lower right corner of the region of all possible non-zero coefficients of the current block is represented and coded as last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the region of all possible non-zero coefficients of the current block is represented and coded as last_sig_coeff_y_prefix, last_sig_coeff_y_suffix.For example, if all possible non-zero coefficient regions of the current block are rectangular regions from (0, 0) to ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), last_sig_coeff_x_prefix and last_sig_coeff_x_suffix are encoded, representing the horizontal distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix are encoded, representing the vertical distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1).

[0222] Method 3 is as follows. In a specific situation, by default, it is assumed that all scanned sub-blocks need to be encoded / decoded during coefficient encoding / decoding. In other words, by default, all scanned sub-blocks contain non-zero coefficients. That is, in a normal situation, the coefficient encoding / decoding method is the same as the existing methods in the related art. A specific situation can refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless video encoding / decoding. In this case, there are many non-zero coefficients, and most of the scanned sub-blocks need to be encoded / decoded. In other words, most of the scanned sub-blocks contain non-zero coefficients. In this case, there is no need to transmit sb_coded_flag in the bitstream, and the encoder / decoder does not need to process that flag.

[0223] In contrast to the above three methods, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, the coefficient distribution rules are different from those in normal video scenarios. Therefore, during coefficient encoding and decoding, the number of syntax elements encoded and decoded in context mode can be reduced or eliminated, such as the position of the last non-zero coefficient and subblock encoding and decoding flags, thereby improving the coefficient encoding and decoding throughput and encoding and decoding speed. Furthermore, because the above flags play a minor role in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding, not using these flags can improve compression efficiency to a certain extent without reducing it.

[0224] In addition, in an embodiment of the present application, taking the sequence level as an example, the sequence level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high bit depth sequence may be replaced by sps_high_bit_rate_flag indicating whether the current video sequence is a high bit rate sequence, and may further be replaced by other flags indicating high bit depth, high bit rate, high quality, or lossless encoding, etc.

[0225] It should be noted that the coefficient decoding methods of the embodiments of the present application are all described based on an example in which the technical solutions are applied to all components in a video, where all components refer to R, G, B in an RGB format video, or Y, U, V (Y, Cb, Cr) in a YUV format video, etc. The coefficient decoding methods of the embodiments of the present application may be applied to only one component, for example, only the Y component in a YUV format. The coefficient decoding methods of the embodiments of the present application may also be applied to each component individually, that is, it is possible to control whether they are applied to each component individually.

[0226] In this embodiment, a coefficient decoding method applied to a decoder is provided. The bitstream is analyzed to obtain video flag information. If the video flag information indicates that the video satisfies a preset condition, the bitstream is analyzed to obtain position reversal flag information of the last non-zero coefficient and coordinate information of the last non-zero coefficient. If the position reversal flag information of the last non-zero coefficient indicates that the current block uses position reversal of the last non-zero coefficient, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are decoded to determine the coefficients of the current block. In this way, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, where the coefficient distribution rules are different from those in normal video scenarios, the number of syntax elements coded and decoded in context mode during coefficient coding and decoding can be reduced or eliminated, such as syntax elements such as the position of the last non-zero coefficient and subblock coding and decoding flags. Furthermore, by performing coordinate transformation when the value of the coordinate information of the last non-zero coefficient is large, the overhead due to coding and decoding in the bitstream can be reduced and the coefficient coding and decoding throughput and coding and decoding speed can be improved. Furthermore, because the syntax elements that are reduced or eliminated have a small impact on high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.

[0227] In another embodiment of the present application, refer to Figure 11, which is a flowchart illustrating a coefficient encoding method according to an embodiment of the present application. As shown in Figure 11, the method may include the following contents:

[0228] S1101: Identify video flag information and the position of the last non-zero coefficient.

[0229] S1102: If the video flag information indicates that the video satisfies a preset condition, identify the position reversal flag information of the last non-zero coefficient.

[0230] S1103: Coordinate information of the last non-zero coefficient is identified based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient.

[0231] S1104: According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are coded, and the bit information obtained by coding, video flag information, and coordinate information of the last non-zero coefficient are written to the bitstream.

[0232] It should be noted that the coefficient coding method of the embodiment of the present application is applied to an encoder. Specifically, based on the structure of the encoder 100 shown in Fig. 8A, the coefficient coding method of the embodiment of the present application is mainly applied to the "entropy coding unit 115" in the encoder 100. The entropy coding unit 115 can use a context model-based adaptive binary arithmetic coding / decoding mode or a bypass mode to entropy code related flag information (or syntax elements), and then write them into a bitstream.

[0233] It should be noted that the coefficient encoding / decoding generally described in a video standard can include two parts, i.e., encoding and decoding, so the coefficient encoding / decoding includes an encoder-side coefficient encoding method and a decoder-side coefficient decoding method, and the embodiment of the present application is described as an encoder-side coefficient encoding method.

[0234] In normal circumstances, for normal video, the coefficient coding method is the same as existing methods in the related art. However, for specific situations, such as high-bit-depth, high-quality, high-bit-rate, or lossless video encoding and decoding scenarios, the embodiment of the present application can amend the method for deriving the position of the last non-zero coefficient. In this case, the embodiment of the present application needs to introduce video flag information and last non-zero coefficient position inversion flag information to identify the position of the last non-zero coefficient, and then encode all coefficients before the position of the last non-zero coefficient in the current block according to a preset scanning order.

[0235] In some embodiments of the present application, it is first necessary to determine whether the current video satisfies a preset condition, which can be represented by video flag information. In some embodiments, determining the video flag information includes: Identifying the value of the video flag information as a first value if the video satisfies a predetermined condition; or If the video does not satisfy the predetermined condition, the value of the video flag information may be determined to be a second value.

[0236] Here, the first value is 1 and the second value is 0.

[0237] In another specific example, the first value may be set to true and the second value may be set to false. In yet another specific example, the first value may be set to 0 and the second value may be set to 1, or the first value may be set to false and the second value may be set to true. There is no limitation thereon.

[0238] The predetermined conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0239] Furthermore, the video flag information may be a sequence level flag, or may be a higher level flag (for example, VUI, SEI), etc. Whether a video satisfies a preset condition can be determined by determining whether the video satisfies high bit depth, high bit rate, high quality, lossless compression, etc., and these four cases will be described below as examples.

[0240] In some embodiments, if the video flag information is high bit depth flag information, the method further comprises: If the video satisfies the high bit depth, the method may further include specifying that the high bit depth flag information indicates that the video satisfies the preset condition.

[0241] In some embodiments, if the video flag information is high bitrate flag information, the method comprises: If the video satisfies the high bit rate, the method may further include identifying that the high bit rate flag information indicates that the video satisfies the preset condition.

[0242] In some embodiments, if the video flag information is high quality flag information, the method comprises: If the video meets the high quality, the method may further include specifying that the high quality flag information indicates that the video meets the preset condition.

[0243] In some embodiments, if the video flag information is lossless compression flag information, the method comprises: If the video satisfies the lossless compression, the method may further include determining that the lossless compression flag information indicates that the video satisfies the preset condition.

[0244] For example, taking the sequence level as an example, the video flag information may be high bit depth flag information (represented by sps_high_bit_depth_flag) used to indicate whether the current video sequence is a high bit depth sequence, or high bit rate flag information (represented by sps_high_bit_rate_flag) used to indicate whether the current video sequence is a high bit rate sequence, or other flag information indicating high bit depth, high bit rate, high quality, or lossless compression, and is not specifically limited in the embodiments of the present application.

[0245] Furthermore, with regard to the position reversal flag information of the last non-zero coefficient, identifying the position reversal flag information of the last non-zero coefficient is If the current block uses position reversal of the last non-zero coefficient, specifying that the value of the position reversal flag information of the last non-zero coefficient is a first value; or If the current block does not utilize position reversal of the last non-zero coefficient, the value of the position reversal flag information of the last non-zero coefficient may be specified to be a second value.

[0246] In an embodiment of the present application, the position reversal flag information of the last non-zero coefficient may be represented by reverse_last_sig_coeff_flag. Here, the position reversal flag information of the last non-zero coefficient may be flag information of at least one of the sequence level, the image level, the slice level, and the block level, and may also be flag information of a higher level (e.g., VUI, SEI, etc.). There is no limitation thereon.

[0247] That is, reverse_last_sig_coeff_flag may be a flag at a sequence level or higher, or may be a picture level flag, a slice level flag, a block level flag, or a flag at other levels. Also, the block level flag may include an LCU level flag, a CU level flag, or another block level flag, and is not limited in the embodiments of the present application.

[0248] Thus, for example, if the first value is 1 and the second value is 0, when the current block specifies that the position reversal of the last non-zero coefficient is used, the value of reverse_last_sig_coeff_flag is 1. Alternatively, when the current block specifies that the position reversal of the last non-zero coefficient is not used, the value of reverse_last_sig_coeff_flag is 0.

[0249] In addition, the position of the last non-zero coefficient may include an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient. When the initial horizontal coordinate is the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, and the initial vertical coordinate is the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, determining the coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient can be performed as follows: When the value of the position reversal flag information of the last non-zero coefficient is a first value, determining the coordinate information of the last non-zero coefficient by performing calculation based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient; or When the value of the position inversion flag information of the last non-zero coefficient is the second value, the method may include directly determining the coordinate information of the last non-zero coefficient based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient.

[0250] In other words, in some embodiments, the method comprises: When the value of the position inversion flag information of the last non-zero coefficient is the first value, the coordinate information of the last non-zero coefficient is inverted from the position of the last non-zero coefficient to the first value. In Budapest Specify the horizontal and vertical distance to the bottom right corner of the lock, or When the value of the position inversion flag information of the last non-zero coefficient is the second value, the coordinate information of the last non-zero coefficient is inverted from the position of the last non-zero coefficient to the first non-zero coefficient. In Budapest The distance may further include specifying the horizontal and vertical distance to the top left corner of the lock.

[0251] That is, the coordinate information of the last nonzero coefficient is usually the horizontal and vertical distances from the position of the last nonzero coefficient to the upper-left corner of the current block. In typical video, most of the nonzero coefficients are concentrated in the upper-left corner, and most of the area in the lower-right corner contains zero coefficients. However, in high-bit-depth, high-quality, and high-bit-rate video encoding and decoding, there are also many nonzero coefficients in the lower-right corner, so the value of the coordinate information of the last nonzero coefficient is usually large. In this case, to save overhead, a coordinate transformation (specifically, a coordinate inversion calculation) must be performed during coefficient encoding. That is, the coordinate information of the last nonzero coefficient after coordinate inversion is the horizontal and vertical distances from the position of the last nonzero coefficient to the lower-right corner of the current block. In this case, the decoder must perform a coordinate inversion calculation during coefficient decoding. After being inverted again, the coordinate information of the last nonzero coefficient can be restored to the horizontal and vertical distances from the position of the last nonzero coefficient to the upper-left corner of the current block. In this way, the position of the last nonzero coefficient is identified.

[0252] Also, in some embodiments, determining the coordinate information of the last non-zero coefficient by performing calculations based on the initial horizontal and vertical coordinates of the last non-zero coefficient may include the following: Specifies the width and height of the current block. Obtain the horizontal coordinate of the last non-zero coefficient by subtracting the initial horizontal coordinate of the last non-zero coefficient from the width of the current block. Obtain the vertical coordinate of the last non-zero coefficient by subtracting the initial vertical coordinate of the last non-zero coefficient from the height of the current block. The coordinate information of the last non-zero coefficient is determined based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0253] Note that the current block here may be a block without zero-out conversion or a block after zero-out conversion. Taking the block after zero-out conversion as an example, in this case, the width of the current block is 1<<log2ZoTbWidth, and the height of the current block is 1<<log2ZoTbHeight. When reverse_last_sig_coeff_flag indicates that the position reversal of the last non-zero coefficient is used (i.e., the value of reverse_last_sig_coeff_flag is 1), LastSignificantCoeffX=(1<<log2ZoTbWidth)-1-LastSignificantCoeffX, LastSignificantCoeffY=(1<<log2ZoTbHeight)-1-LastSignificantCoeffY.

[0254] (LastSignificantCoeffX,LastSignificantCoeffY) on the right side of the equation represents the coordinate information of the directly specified last non-zero coefficient (i.e., the initial horizontal coordinate and initial vertical coordinate of the last non-zero coefficient), and (LastSignificantCoeffX,LastSignificantCoeffY) on the left side of the equation represents the coordinate information of the last non-zero coefficient obtained after coordinate reversal (i.e., when the current block uses the reversal of the last non-zero coefficient, it is the coordinate information of the last non-zero coefficient written into the bit stream).

[0255] In some embodiments, writing the coordinate information of the last non-zero coefficient into the bit stream may include the following. Based on the coordinate information of the last non-zero coefficient, specify the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. Write the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient into the bitstream.

[0256] Note that prefix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_prefix. Prefix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix. Suffix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix. Suffix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_suffix. last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix are written to the bitstream. This allows the decoder to identify the coordinate information of the last non-zero coefficient by analyzing the bitstream.

[0257] As such, the embodiment of the present application provides a correction to the method for deriving the position of the last non-zero coefficient. That is, under normal circumstances, the coefficient encoding / decoding method is the same as existing methods in the related art. A specific situation may refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless compression video encoding / decoding. Under normal circumstances, as shown in FIG. 10A , the abscissa of the position of the last non-zero coefficient, i.e., the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented and coded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the ordinate of the position of the last non-zero coefficient, i.e., the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented and coded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix. On the other hand, in the case of high-bit-depth, high-quality, high-bitrate video encoding / decoding or lossless video encoding / decoding, the location of the last non-zero coefficient is generally near the lower right corner of the region of all possible non-zero coefficients of the current block. In this case, as shown in FIG. 10B , the horizontal distance from the location of the last non-zero coefficient to the lower right corner of the region of all possible non-zero coefficients of the current block is represented and coded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the vertical distance from the location of the last non-zero coefficient to the lower right corner of the region of all possible non-zero coefficients of the current block is represented and coded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix. Therefore, the introduction of reverse_last_sig_coeff_flag in the embodiment of the present application can solve the problem of relatively large overhead caused by encoding a relatively large value in the bitstream.

[0258] Furthermore, if the video flag information indicates that the video satisfies a preset condition, it may be defaulted that all coefficients that may need to be coded need to be coded. That is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients of the current block are scanned according to a preset scan order. Therefore, in the embodiment of the present application, last coefficient valid flag information may be introduced to specify whether the current block uses the last coefficient position.

[0259] In some embodiments, if the video flag information indicates that the video meets a preset condition, the method may further include: The last coefficient valid flag information is identified. If the last coefficient valid flag information indicates that the current block uses the last coefficient position, all coefficients before the last coefficient position are coded according to a preset scanning order, and the bit information obtained by coding, the video flag information, and the last coefficient valid flag information are written into the bitstream.

[0260] The last coefficient valid flag information may be represented by default_last_coeff_enabled_flag. In an embodiment of the present application, the last coefficient valid flag information may be flag information at least at one of a sequence level, an image level, a slice level, and a block level, or may be flag information at a higher level (for example, VUI, SEI, etc.). There is no limitation thereon.

[0261] Regarding the last coefficient valid flag information, in some embodiments, identifying the last coefficient valid flag information is performed by This may include determining that the value of the last coefficient valid flag information is a first value if the current block uses the last coefficient position, or determining that the value of the last coefficient valid flag information is a second value if the current block does not use the last coefficient position.

[0262] That is, for example, if the first value is 1 and the second value is 0, when the current block uses the last coefficient position, the value of default_last_coeff_enabled_flag is 1. When the current block does not use the last coefficient position, the value of default_last_coeff_enabled_flag is 0.

[0263] Also, with respect to the last coefficient position, in some embodiments, the last coefficient position is the bottom right corner of a matrix of all possible non-zero coefficients in the current block, or the last coefficient position is the last position in scanning all possible non-zero coefficients in the current block according to a preset scan order.

[0264] It should be noted that the last coefficient position in the embodiments of the present application does not represent the position of the last non-zero coefficient, because although the coefficient at the last coefficient position may be zero, the coefficient at the last non-zero coefficient position is not necessarily zero.

[0265] In one particular example, the method may further include setting the position of the last non-zero coefficient to the last coefficient position.

[0266] That is, in the embodiment of the present application, the position of the last non-zero coefficient can still be utilized, and in this case, it is necessary to set the position of the last non-zero coefficient to the last position of all possible non-zero coefficients in the current block according to the preset scanning order.

[0267] In addition, the last coefficient position may be represented by (LastCoeffX, LastCoeffY), that is, the last position of all possible non-zero coefficients in the current block according to the preset scanning order. In some embodiments, the method may further include the following content. The width and height of a transformation block obtained by performing a preset operation on the current block are specified. Coordinate calculation is performed based on the width and height of the transformation block to obtain the coordinate information of the lower right corner of the transformation block. The last coefficient position is identified based on the coordinate information of the lower right corner of the transform block.

[0268] Here, the preset operation includes at least a zero setting operation.

[0269] Note that (LastCoeffX, LastCoeffY) represents the coordinate information of the bottom right corner of the transform block after zero-out. The method for deriving (LastCoeffX, LastCoeffY) is as follows. LastCoeffX=(1< <log2ZoTbWidth)-1であり、LastCoeffY=(1<<log2ZoTbHeight)-1である。

[0270] In this way, if the value of default_last_coeff_enabled_flag is 1, the last coefficient position can be identified based on (LastCoeffX, LastCoeffY).

[0271] In one specific example, the position of the last non-zero coefficient is still utilized. In this case, the position of the last non-zero coefficient may be set to the last position of all possible zero coefficients in the current block according to a preset scanning order. In some embodiments, the method may further include the following: When setting the position of the last non-zero coefficient to the last coefficient position, the position of the last non-zero coefficient is identified based on coordinate information of the lower right corner of the transform block.

[0272] That is, the position of the last non-zero coefficient can be expressed as (LastSignificantCoeffX, LastSignificantCoeffY), that is, the method of deriving (LastSignificantCoeffX, LastSignificantCoeffY) is as follows: LastSignificantCoeffX=(1< <log2ZoTbWidth)-1であり、LastSignificantCoeffY=(1<<log2ZoTbHeight)-1である。

[0273] (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinate information of the bottom right corner of the transform block after zero-out. If the value of default_last_coeff_enabled_flag is 1, the position of the last non-zero coefficient can be identified based on (LastSignificantCoeffX, LastSignificantCoeffY).

[0274] In addition, if the current block does not use the last coefficient position, that is, if the value of the last coefficient valid flag information is 0, in some embodiments, the method may further include the following content: Identify prefix information for the horizontal coordinate of the last non-zero coefficient, prefix information for the vertical coordinate of the last non-zero coefficient, suffix information for the horizontal coordinate of the last non-zero coefficient, and suffix information for the vertical coordinate of the last non-zero coefficient. The position of the last non-zero coefficient is identified based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are coded, and the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are written into the bitstream.

[0275] If the current block does not use the last coefficient position, the position of the last non-zero coefficient needs to be identified. Specifically, it is necessary to identify last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix, and then write last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix to the bitstream.

[0276] In this way, during coefficient encoding / decoding, all coefficients that may need to be encoded / decoded are assumed to be encoded / decoded by default. That is, under normal circumstances, the coefficient encoding / decoding method is the same as existing methods in the related art. A specific situation may refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless compression video encoding / decoding. By default, all coefficients that may need to be encoded / decoded are assumed to be encoded / decoded by default. That is, the position of the last nonzero coefficient is no longer used, and all possible nonzero coefficients in the current block are scanned according to a preset scanning order. In other words, the position of the last coefficient that needs to be encoded / decoded is set to the last position of all possible nonzero coefficients in the current block according to the preset scanning order. This position is usually the lower right corner of the matrix consisting of all possible nonzero coefficients in the current block. Therefore, in this embodiment, the introduction of the default_last_coeff_enabled_flag can reduce or even eliminate syntax elements related to the position of the last nonzero coefficient, thereby saving overhead and avoiding waste.

[0277] In addition, if the video flag information indicates that the video satisfies the preset condition, all scanned sub-blocks need to be coded by default, and in this case, there is no need to transmit sb_coded_flag in the bitstream, i.e., neither the encoder nor the decoder needs to process the flag, thereby improving the coding speed. Therefore, in an embodiment of the present application, sub-block default coding flag information can be further introduced, which is used to determine whether sub-blocks waiting to be coded in the current block will be coded by default.

[0278] In some embodiments, if the video flag information indicates that the video meets a preset condition, the method may further include: The sub-block default encoding flag information of the sub-blocks waiting to be encoded in the current block is identified. If the sub-block default encoding flag information indicates that the sub-block waiting to be encoded will be defaulted when encoded, all coefficients in the sub-block waiting to be encoded are encoded, and the bit information obtained by encoding and the sub-block default encoding flag information are written to the bitstream.

[0279] Note that the sub-block default coding flag information may be represented by default_sb_coded_flag. In an embodiment of the present application, the sub-block default coding flag information may be at least one of flag information at a sequence level, an image level, a slice level, and a block level, and may also be flag information at a higher level (e.g., VUI, SEI, etc.). There is no limitation thereon.

[0280] Regarding the sub-block default flag information, in some embodiments, determining the sub-block default coding flag information of the sub-blocks waiting to be coded can be performed by: If the sub-block to be coded is to be coded by default, the value of the sub-block default coding flag information is determined to be a first value; or This may include specifying that the value of the sub-block default encoding flag information is a second value if the sub-block to be encoded does not default when encoded.

[0281] Thus, for example, if the first value is 1 and the second value is 0, the value of default_sb_coded_flag is 1 to specify that the sub-block waiting to be coded should be coded by default, or the value of default_sb_coded_flag is 0 to specify that the sub-block waiting to be coded should not be coded by default.

[0282] If the sub-block to be coded is by default required to be coded, the value of default_sb_coded_flag is 1, which means that the value of sb_coded_flag is 1, i.e., sb_coded_flag does not need to be coded. If the sub-block to be coded is not by default required to be coded, i.e., the sub-block default coding flag information indicates that the sub-block to be coded will not be coded by default, in some embodiments, the method may further include the following: Identifying sub-block coding flag information of the sub-block to be coded, and writing the sub-block coding flag information into the bitstream.

[0283] Also, in some embodiments, determining the sub-block coding flag information of the sub-block to be coded comprises: If the sub-block needs to be coded, determining that the value of the sub-block coding flag information is a first value; or If all coefficients in the sub-block are zero, determining that the value of the sub-block coding flag information is a second value.

[0284] In an embodiment of the present application, the sub-block coding flag information may be represented by sb_coded_flag. For example, a first value is 1 and a second value is 0. When it is determined that a sub-block to be coded needs to be coded, this means that the sub-block to be coded contains a non-zero coefficient to be coded, and the value of sb_coded_flag is 1. When it is determined that a sub-block to be coded does not need to be coded, this means that all coefficients in the sub-block to be coded are zero, and the value of sb-coded-flag is 0.

[0285] In this way, during coefficient encoding and decoding, it is assumed by default that all scanned sub-blocks need to be encoded or decoded, or in other words, that all scanned sub-blocks contain non-zero coefficients. That is, under normal circumstances, the coefficient encoding and decoding method is the same as existing methods in the related art. A specific situation may refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding and decoding or lossless compression video encoding and decoding. In this case, there are many non-zero coefficients, and most scanned sub-blocks need to be encoded or decoded, or in other words, most scanned sub-blocks contain non-zero coefficients. In this way, it is no longer necessary to transmit sb_coded_flag in the bitstream, and the encoder does not need to process the flag, thereby improving the encoding and decoding speed. In addition, since rarely present flags are removed, this slightly improves compression performance.

[0286] An embodiment of the present application further provides a coefficient encoding method applied to an encoder: determining video flag information and the position of the last non-zero coefficient; if the video flag information indicates that the video satisfies a preset condition, determining position reversal flag information of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the position reversal flag information of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient into a bitstream. In this way, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, where the coefficient distribution rules are different from those in normal video scenarios, the number of syntax elements coded and decoded in context mode during coefficient coding and decoding can be reduced or eliminated, such as syntax elements such as the position of the last non-zero coefficient and subblock coding and decoding flags. Furthermore, by performing coordinate transformation when the value of the coordinate information of the last non-zero coefficient is large, the overhead due to coding and decoding in the bitstream can be reduced and the coefficient coding and decoding throughput and coding and decoding speed can be improved. Furthermore, because the syntax elements that are reduced or eliminated have a small impact on high-bit-depth, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.

[0287] In another embodiment of the present application, based on the same inventive idea as the above embodiment, refer to Fig. 12, which is a schematic diagram showing the structure of an encoder 120 according to an embodiment of the present application. As shown in Fig. 12, the encoder 120 may include a first specific unit 1201 and an encoding unit 1202. The first identifying unit 1201 is configured to identify video flag information and a position of a last non-zero coefficient, and, when the video flag information indicates that the video satisfies a preset condition, identify position inversion flag information of the last non-zero coefficient; The first identifying unit 1201 is further configured to identify, according to the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient, coordinate information of the last non-zero coefficient; The encoding unit 1202 is configured to encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write bit information obtained by encoding, video flag information, and coordinate information of the last non-zero coefficient into a bitstream.

[0288] In some embodiments, the first identification unit 1201 is further configured to identify the value of the video flag information as a first value if the video satisfies a predetermined condition, or to identify the value of the video flag information as a second value if the video does not satisfy the predetermined condition.

[0289] In some embodiments, the predetermined conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0290] In some embodiments, the first identifying unit 1201 is further configured to identify that if the current block utilizes position reversal of the last non-zero coefficient, the value of the position reversal flag information of the last non-zero coefficient is a first value, or if the current block does not utilize position reversal of the last non-zero coefficient, the value of the position reversal flag information of the last non-zero coefficient is a second value.

[0291] In some embodiments, the location of the last non-zero coefficient includes an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient, where the initial horizontal coordinate is the horizontal distance from the location of the last non-zero coefficient to the top-left corner of the current block, and the initial vertical coordinate is the vertical distance from the location of the last non-zero coefficient to the top-left corner of the current block. Accordingly, the first identification unit 1201 is further configured to identify the coordinate information of the last non-zero coefficient by performing calculation based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient when the value of the position reversal flag information of the last non-zero coefficient is a first value, or to directly identify the coordinate information of the last non-zero coefficient based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient when the value of the position reversal flag information of the last non-zero coefficient is a second value.

[0292] In some embodiments, the first identification unit 1201 is further configured to identify a width and a height of the current block, obtain the horizontal coordinate of the last non-zero coefficient by subtracting the initial horizontal coordinate of the last non-zero coefficient from the width of the current block, obtain the vertical coordinate of the last non-zero coefficient by subtracting the initial vertical coordinate of the last non-zero coefficient from the height of the current block, and identify coordinate information of the last non-zero coefficient based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0293] In some embodiments, the first identifying unit 1201 further comprises: when the value of the position inversion flag information of the last non-zero coefficient is a first value, the first identifying unit 1201 determines the coordinate information of the last non-zero coefficient from the position of the last non-zero coefficient to the first value; In Budapest If the value of the position inversion flag information of the last non-zero coefficient is the second value, the coordinate information of the last non-zero coefficient is specified as the horizontal distance and vertical distance from the position of the last non-zero coefficient to the current position. In Budapest The horizontal and vertical distances to the top left corner of the lock are specified.

[0294] In some embodiments, the encoding unit 1202 is further configured to determine, based on the coordinate information of the last non-zero coefficient, horizontal coordinate prefix information of the last non-zero coefficient, vertical coordinate prefix information of the last non-zero coefficient, horizontal coordinate suffix information of the last non-zero coefficient, and vertical coordinate suffix information of the last non-zero coefficient, and to write the horizontal coordinate prefix information of the last non-zero coefficient, vertical coordinate prefix information of the last non-zero coefficient, horizontal coordinate suffix information of the last non-zero coefficient, and vertical coordinate suffix information of the last non-zero coefficient to the bitstream.

[0295] In some embodiments, the position reversal flag information of the last non-zero coefficient is flag information at at least one of a sequence level, an image level, a slice level, and a block level.

[0296] In some embodiments, the first identifying unit 1201 is further configured to: when the video flag information indicates that the video satisfies a preset condition, identify the last coefficient valid flag information; The encoding unit 1202 is further configured to, when the last coefficient valid flag information indicates that the current block uses the last coefficient position, encode all coefficients before the last coefficient position according to a preset scanning order, and write the bit information obtained by encoding, the video flag information, and the last coefficient valid flag information into a bitstream.

[0297] In some embodiments, the first identifying unit 1201 is further configured to identify the value of the last coefficient valid flag information as a first value if the current block uses the last coefficient position, or to identify the value of the last coefficient valid flag information as a second value if the current block does not use the last coefficient position.

[0298] In some embodiments, the last coefficient position is the bottom right corner of a matrix of all possible non-zero coefficients in the current block, or the last coefficient position is the last position in scanning all possible non-zero coefficients in the current block according to a preset scan order.

[0299] In some embodiments, the first identifying unit 1201 is further configured to set the position of the last non-zero coefficient to the last coefficient position.

[0300] In some embodiments, the first identification unit 1201 is further configured to identify the width and height of the transformation block obtained by performing a preset operation on the current block, obtain coordinate information of the lower right corner of the transformation block by performing coordinate calculation based on the width and height of the transformation block, and identify the last coefficient position based on the coordinate information of the lower right corner of the transformation block.

[0301] In some embodiments, the preset operation includes at least a set-to-zero operation.

[0302] In some embodiments, the first identification unit 1201 is further configured to identify the position of the last non-zero coefficient based on coordinate information of the lower right corner of the transform block when setting the position of the last non-zero coefficient to the last coefficient position.

[0303] In some embodiments, the first identifying unit 1201 is further configured to: when the current block does not use a last coefficient position, identify prefix information of a horizontal coordinate of a last non-zero coefficient, prefix information of a vertical coordinate of a last non-zero coefficient, suffix information of a horizontal coordinate of a last non-zero coefficient, and suffix information of a vertical coordinate of a last non-zero coefficient; and identify the position of the last non-zero coefficient based on the prefix information of the horizontal coordinate of a last non-zero coefficient, prefix information of the vertical coordinate of a last non-zero coefficient, suffix information of the horizontal coordinate of a last non-zero coefficient, and suffix information of the vertical coordinate of a last non-zero coefficient; The encoding unit 1202 is further configured to encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient into the bitstream.

[0304] In some embodiments, the final coefficient significance flag information is at least one of sequence level, image level, slice level, and block level flag information.

[0305] In some embodiments, the first identifying unit 1201 is further configured to: when the video flag information indicates that the video satisfies a preset condition, identify sub-block default coding flag information of a sub-block waiting to be coded in the current block; The encoding unit 1202 is further configured to, if the sub-block default encoding flag information indicates that the sub-block to be encoded will be defaulted when encoded, encode all coefficients in the sub-block to be encoded and write bit information obtained by encoding and the sub-block default encoding flag information into the bitstream.

[0306] In some embodiments, the first identification unit 1201 is further configured to: identify sub-block coding flag information of the sub-block to be coded, and write the sub-block coding flag information into the bitstream, when the sub-block default coding flag information indicates that the sub-block to be coded will not be defaulted once coded.

[0307] In some embodiments, the first identification unit 1201 is further configured to identify that the value of the sub-block default encoding flag information is a first value if the sub-block to be encoded will default when encoded, or to identify that the value of the sub-block default encoding flag information is a second value if the sub-block to be encoded will not default when encoded.

[0308] In some embodiments, the first determining unit 1201 further determines that if the sub-block needs to be coded, the value of the sub-block coding flag information is a first value; or The sub-block coding flag information is configured to specify a value of the sub-block coding flag information to be a second value when all coefficients in the sub-block are zero.

[0309] In some embodiments, the sub-block default coding flag information is at least one of sequence level, image level, slice level, and block level flag information.

[0310] In some embodiments, the first value is 1 and the second value is 0.

[0311] In some embodiments, the first identification unit 1201 is further configured to identify that when the video flag information is high bit-depth flag information, if the video meets the high bit-depth, the high bit-depth flag information indicates that the video meets the predetermined condition.

[0312] In some embodiments, the first identification unit 1201 is further configured to determine that when the video flag information is high bitrate flag information, if the video meets the high bitrate, the high bitrate flag information indicates that the video meets the preset condition.

[0313] In some embodiments, the first identification unit 1201 is further configured to identify that if the video flag information is high quality flag information, if the video meets high quality, the high quality flag information indicates that the video meets the preset condition.

[0314] In some embodiments, the first identification unit 1201 is further configured to determine that when the video flag information is lossless compression flag information, if the video satisfies lossless compression, the lossless compression flag information indicates that the video satisfies the preset condition.

[0315] In the embodiments of the present application, it may be understood that a "unit" may be a part of a circuit, a part of a processor, a part of a program, or a part of software. Naturally, a "unit" may be modular or non-modular. Furthermore, each constituent unit according to the present embodiment may be integrated into one processing unit, each unit may exist physically independently, or two or more units may be integrated into one unit. The integrated unit may be realized in the form of a hardware or software functional module.

[0316] When an integrated unit is implemented as a software functional module rather than being sold or used as an independent product, it may be stored in a computer-readable recording medium. According to this understanding, an essential part of the technical solution of the present application, a part that contributes to the prior art, or all or part of the technical solution may be expressed as a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The storage medium includes various types of media capable of storing program code, such as a universal serial bus (USB) flash disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0317] Therefore, in an embodiment of the present application, a computer storage medium is provided that is applied to the encoder 120. The computer storage medium stores a computer program, which, when executed by a first processor, performs any of the methods in the above embodiments.

[0318] Based on the above-described structure of the encoder 120 and the computer storage medium, reference is now made to FIG. 13, which is a schematic diagram illustrating a specific hardware structure of the encoder 120 according to an embodiment of the present application. As shown in FIG. 13, the encoder 120 may include a first communication interface 1301, a first memory 1302, and a first processor 1303. These components are coupled via a first bus system 1304. The first bus system 1304 is used to realize connection and communication between these components. In addition to a data bus, the first bus system 1304 further includes a power bus, a control bus, and a status signal bus. However, for clarity, various buses are marked as the first bus system 1304 in FIG. 13.

[0319] The first communication interface 1301 is used to send and receive signals in the process of sending and receiving information to and from other external network elements.

[0320] The first memory 1302 is used to store a computer program executable by the first processor 1303 .

[0321] When executing a computer program, the first processor 1303: Identifying video flag information and the location of the last non-zero coefficient; If the video flag information indicates that the video satisfies a preset condition, identifying position reversal flag information of the last non-zero coefficient; Identifying coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and position inversion flag information of the last non-zero coefficient; Encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing bit information obtained by encoding, video flag information, and coordinate information of the last non-zero coefficient into a bitstream.

[0322] It should be noted that the first memory 1302 in the embodiment of the present application can be a volatile memory or a nonvolatile memory, or can include both a volatile memory and a nonvolatile memory. The nonvolatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM) that functions as an external high-speed cache. By way of illustrative, but non-limiting example, various RAMs are available, including static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The first memory 1302 of the systems and methods described herein can include, but is not limited to, these and any other suitable types of memory.

[0323] The first processor 1303 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit in the form of hardware or instructions in the form of software in the first processor 1303. The first processor 1303 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 device, a discrete gate or transistor logic device, or a discrete hardware component. The processor can implement or execute various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present application can be directly performed and completed by a hardware decoding processor, or can be performed and completed by a combination of hardware and software modules in the decoding processor. The software module can be stored in a storage medium well known in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is stored in the first memory 1302. The first processor 1303 reads information from the first memory 1302 and completes the steps of the above method in cooperation with the processor hardware.

[0324] It can be understood that the embodiments described herein can be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof. When implemented by hardware, a processing unit can be implemented by one or more application specific integrated circuits (ASICs), digital signal processing (DSPs), DSP devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units, or a combination thereof, used to perform the functions described herein. When implemented by software, the techniques described herein can be realized by modules (e.g., procedures, functions, etc.) that perform the functions described herein. The software code is stored in memory and executed by the processor. The memory can be implemented within the processor or external to the processor.

[0325] Optionally, in another embodiment, the first processor 1303 is configured to execute any of the methods in the above embodiments when executing a computer program.

[0326] In an embodiment of the present application, an encoder is provided. The encoder may include a first specific unit and a coding unit. In this manner, in a high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenario, the coefficient distribution rule is different from that in a normal video scenario. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or eliminated, thereby reducing the encoding / decoding overhead in the bitstream and improving the coefficient encoding / decoding throughput and encoding / decoding speed. Furthermore, since the syntax elements to be reduced or eliminated have a small impact on high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, the compression efficiency can also be improved.

[0327] In another embodiment of the present application, based on the same inventive idea as the above embodiment, refer to Fig. 14, Fig. 14 is a schematic diagram showing the structure of a decoder 140 according to an embodiment of the present application. As shown in Fig. 14, the decoder 140 may include an analyzing unit 1401 and a second identifying unit 1402. the parsing unit 1401 is configured to parse the bitstream to obtain video flag information; and when the video flag information indicates that the video satisfies a preset condition, parse the bitstream to obtain position reversal flag information of the last non-zero coefficient and coordinate information of the last non-zero coefficient; the second identifying unit 1402 is configured to identify the position of the last non-zero coefficient by calculating coordinate information of the last non-zero coefficient when the position reversal flag information of the last non-zero coefficient indicates that the current block utilizes position reversal of the last non-zero coefficient; The analysis unit 1401 is further configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0328] In some embodiments, the second identifying unit 1402 is further configured to, when the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize position reversal of the last non-zero coefficient, directly identify the position of the last non-zero coefficient based on the coordinate information of the last non-zero coefficient; The analysis unit 1401 is further configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0329] In some embodiments, the second identification unit 1402 is further configured to: determine that, if the value of the video flag information is a first value, the video flag information indicates that the video satisfies the preset condition; or, if the value of the video flag information is a second value, the video flag information indicates that the video does not satisfy the preset condition.

[0330] In some embodiments, the predetermined conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0331] In some embodiments, the second identifying unit 1402 is further configured to identify that, if the value of the position reversal flag information of the last non-zero coefficient is a first value, the position reversal flag information of the last non-zero coefficient indicates that the current block utilizes position reversal of the last non-zero coefficient, or, if the value of the position reversal flag information of the last non-zero coefficient is a second value, the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize position reversal of the last non-zero coefficient.

[0332] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream to obtain prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of a horizontal coordinate of the last non-zero coefficient, and suffix information of a vertical coordinate of the last non-zero coefficient; The second identification unit 1402 is further configured to identify the horizontal coordinate of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the horizontal coordinate of the last non-zero coefficient, identify the vertical coordinate of the last non-zero coefficient based on the prefix information of the vertical coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient, and identify coordinate information of the last non-zero coefficient based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0333] In some embodiments, the second identifying unit 1402 is further configured to: when the position reversal flag information of the last non-zero coefficient indicates that the current block utilizes position reversal of the last non-zero coefficient, identify the coordinate information of the last non-zero coefficient as horizontal and vertical distances from the position of the last non-zero coefficient to a lower-right corner of the current block; In addition, the second identification unit 1402 is further configured to identify the width and height of the current block, obtain the horizontal coordinate of the last non-zero coefficient by subtracting the horizontal distance from the position of the last non-zero coefficient to the lower right corner of the current block from the width of the current block, obtain the vertical coordinate of the last non-zero coefficient by subtracting the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block from the height of the current block, and identify the position of the last non-zero coefficient based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0334] In some embodiments, the second identifying unit 1402 is further configured to: identify the coordinate information of the last non-zero coefficient as the horizontal and vertical distances from the position of the last non-zero coefficient to the upper-left corner of the current block when the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize position reversal of the last non-zero coefficient; and identify the position of the last non-zero coefficient based on the horizontal and vertical distances from the position of the last non-zero coefficient to the upper-left corner of the current block.

[0335] In some embodiments, the position reversal flag information of the last non-zero coefficient is flag information at at least one of a sequence level, an image level, a slice level, and a block level.

[0336] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream to obtain last coefficient significance flag information, and if the last coefficient significance flag information indicates that the current block utilizes the last coefficient position, decode all coefficients before the last coefficient position according to a preset scanning order to identify the coefficients of the current block.

[0337] In some embodiments, the second identifying unit 1402 is further configured to identify that if the value of the last coefficient valid flag information is a first value, the last coefficient valid flag information indicates that the current block uses the last coefficient position, or if the value of the last coefficient valid flag information is a second value, the last coefficient valid flag information indicates that the current block does not use the last coefficient position.

[0338] In some embodiments, the parsing unit 1401 is further configured, when the value of the last coefficient valid flag information is a second value, to parse the bitstream to obtain prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of a horizontal coordinate of the last non-zero coefficient, and suffix information of a vertical coordinate of the last non-zero coefficient; The second identification unit 1402 is further configured to identify the position of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient, and to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0339] In some embodiments, the last coefficient position is the bottom right corner of a matrix of all possible non-zero coefficients in the current block, or the last coefficient position is the last position in scanning all possible non-zero coefficients in the current block according to a preset scan order.

[0340] In some embodiments, the second identifying unit 1402 is further configured to set the position of the last non-zero coefficient to the last coefficient position.

[0341] In some embodiments, the second identification unit 1402 is further configured to identify the width and height of the transformation block obtained by performing a preset operation on the current block, obtain coordinate information of the lower right corner of the transformation block by performing coordinate calculation based on the width and height of the transformation block, and identify the last coefficient position based on the coordinate information of the lower right corner of the transformation block.

[0342] In some embodiments, the preset operation includes at least a set-to-zero operation.

[0343] In some embodiments, the second identification unit 1402 is further configured to identify the position of the last non-zero coefficient based on coordinate information of the lower right corner of the transform block when setting the position of the last non-zero coefficient to the last coefficient position.

[0344] In some embodiments, the final coefficient significance flag information is at least one of sequence level, image level, slice level, and block level flag information.

[0345] In some embodiments, the parsing unit 1401 is further configured to: parse the bitstream to obtain sub-block default decoding flag information when the video flag information indicates that the video satisfies the preset condition; and, when the sub-block default decoding flag information indicates that a sub-block awaiting decoding in the current block will default when decoded, determine that the value of the sub-block decoding flag information is a first value; and decode all coefficients in the sub-block awaiting decoding.

[0346] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream to obtain sub-block decoding flag information when the sub-block default decoding flag information indicates that the sub-block awaiting decoding will not default when decoded, and to decode all coefficients in the sub-block awaiting decoding when the value of the sub-block decoding flag information is a first value.

[0347] In some embodiments, the second identifying unit 1402 is further configured to identify that if the value of the sub-block default decoding flag information is a first value, the sub-block default decoding flag information indicates that the sub-block waiting to be decoded will default when decoded, or if the value of the sub-block default decoding flag information is a second value, the sub-block default decoding flag information indicates that the sub-block waiting to be decoded will not default when decoded.

[0348] In some embodiments, the second identifying unit 1402 further identifies that all coefficients in the sub-block waiting to be decoded are to be decoded if the value of the sub-block decoding flag information is a first value; or When the value of the sub-block decoding flag information is a second value, it is configured to identify that all coefficients in the sub-block to be decoded are zero.

[0349] In some embodiments, the sub-block default decoding flag information is at least one of sequence level, picture level, slice level, and block level flag information.

[0350] In some embodiments, the first value is 1 and the second value is 0.

[0351] In some embodiments, the second identification unit 1402 is further configured to, when the video flag information is high bit-depth flag information, identify the video as meeting a predetermined condition if the high bit-depth flag information indicates that the video meets a high bit-depth.

[0352] In some embodiments, the second identification unit 1402 is further configured to, when the video flag information is high bitrate flag information, identify the video as meeting the preset condition if the high bitrate flag information indicates that the video meets the high bitrate.

[0353] In some embodiments, the second identification unit 1402 is further configured to: when the video flag information is high quality flag information, if the high quality flag information indicates that the video meets high quality, identify the video as meeting the preset condition.

[0354] In some embodiments, the second identification unit 1402 is further configured to: when the video flag information is lossless compression flag information, if the lossless compression flag information indicates that the video satisfies the lossless compression, identify that the video satisfies the predetermined condition.

[0355] In the embodiments of the present application, it may be understood that a "unit" may be a part of a circuit, a part of a processor, a part of a program, or a part of software. Naturally, a "unit" may be modular or non-modular. Furthermore, each constituent unit according to the present embodiment may be integrated into one processing unit, each unit may exist physically independently, or two or more units may be integrated into one unit. The integrated unit may be realized in the form of a hardware or software functional module.

[0356] When the integrated unit is implemented as a software functional module rather than being sold or used as an independent product, it may be stored in a computer-readable recording medium. According to this understanding, an essential part of the technical solution of the present application, a part that contributes to the prior art, or all or part of the technical solution may be expressed as a software product. This computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The storage medium includes various types of media capable of storing program code, such as a USB flash disk, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0357] Therefore, in an embodiment of the present application, a computer storage medium is provided that is applied to the decoder 140. The computer storage medium stores a computer program, which, when executed by a first processor, performs any of the methods in the above embodiments.

[0358] Based on the above-described structure of the decoder 140 and the computer storage medium, reference is now made to FIG. 15, which is a schematic diagram illustrating a specific hardware structure of the decoder 140 according to an embodiment of the present application. As shown in FIG. 15, the decoder 140 may include a second communication interface 1501, a second memory 1502, and a second processor 1503. These components are coupled via a second bus system 1504. The second bus system 1504 is used to realize connection and communication between these components. In addition to a data bus, the second bus system 1504 further includes a power bus, a control bus, and a status signal bus. However, for clarity, various buses are marked as the second bus system 1504 in FIG. 15.

[0359] The second communication interface 1501 is used to send and receive signals in the process of sending and receiving information to and from other external network elements.

[0360] The second memory 1502 is used to store a computer program executable by the second processor 1503 .

[0361] When executing the computer program, the second processor 1503 Parsing the bitstream to obtain video flag information; If the video flag information indicates that the video satisfies the preset condition, parsing the bitstream to obtain position reversal flag information of the last non-zero coefficient and coordinate information of the last non-zero coefficient; If the last non-zero coefficient position reversal flag information indicates that the current block utilizes the last non-zero coefficient position reversal, determining the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient; Decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0362] Optionally, in another embodiment, the second processor 1503 is configured to execute any of the methods in the above embodiments when executing a computer program.

[0363] The second memory 1502 has similar hardware functions to the first memory 1302, and the second processor 1503 has similar hardware functions to the first processor 1303, and detailed descriptions thereof will be omitted.

[0364] In an embodiment of the present application, a decoder is provided. The decoder may include an analyzing unit and a second identifying unit. In this manner, in a high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenario, the coefficient distribution rule is different from that in a normal video encoding / decoding scenario. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or eliminated, thereby reducing the encoding / decoding overhead in the bitstream and improving the coefficient encoding / decoding throughput and encoding / decoding speed. Furthermore, since the syntax elements reduced or eliminated have a small impact on high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, the compression efficiency can also be improved.

[0365] It should be noted that in this application, terms such as "comprises," "comprises," or other variants are intended to cover and not exclude the inclusion of other components, so that a process, method, article, or apparatus that includes a set of elements may include not only those elements but also other elements not expressly listed, or other elements inherent to the process, method, article, or apparatus. Unless otherwise limited, a process, method, article, or apparatus that includes an element defined by the phrase "comprises" does not exclude the presence of other identical elements.

[0366] The sequence numbers of the above embodiments of the present application do not indicate the superiority or inferiority of the embodiments, but are used for explanation purposes only.

[0367] The methods disclosed in the several method embodiments of the present application can be combined in any manner to arrive at new method embodiments, provided there is no contradiction.

[0368] The features disclosed in the various product embodiments of this application may be combined in any manner to arrive at new product embodiments, unless inconsistent.

[0369] The features disclosed in any method or apparatus embodiment of the present application may be combined in any manner, unless inconsistent, to produce new method or apparatus embodiments.

[0370] The above is only a specific embodiment of the present application, and the scope of protection of the present application is not limited thereto. Any modifications or replacements that can be easily conceived by those skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be determined by the scope of protection of the claims. [Industrial Applicability]

[0371] In an embodiment of the present application, for an encoder and decoder, because the coefficient distribution rule in a high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenario is different from that in a normal video scenario, the number of syntax elements to be encoded / decoded in context mode during coefficient encoding / decoding is reduced or eliminated, such as syntax elements such as the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing coordinate transformation when the value of the coordinate information of the last non-zero coefficient is large, the overhead due to encoding / decoding in the bitstream can be reduced and the throughput and encoding / decoding speed of coefficient encoding / decoding can be improved. Furthermore, because the syntax elements to be reduced or eliminated have a small impact on high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved.

Claims

1. A coefficient decoding method applied to a decoder, comprising: Parsing the bitstream to obtain sequence-level flags; If the sequence level flag indicates that the video satisfies a preset condition, parsing the bitstream to obtain position reversal flag information of the last non-zero coefficient; Parsing the bitstream to obtain horizontal coordinate prefix information of a last non-zero coefficient, vertical coordinate prefix information of the last non-zero coefficient, horizontal coordinate suffix information of the last non-zero coefficient, and vertical coordinate suffix information of the last non-zero coefficient; Identifying the horizontal coordinate of the last non-zero coefficient based on prefix information of the horizontal coordinate of the last non-zero coefficient and suffix information of the horizontal coordinate of the last non-zero coefficient; Identifying the vertical coordinate of the last non-zero coefficient based on prefix information of the vertical coordinate of the last non-zero coefficient and suffix information of the vertical coordinate of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient; If the position reversal flag information of the last non-zero coefficient indicates that the current block uses the position reversal of the last non-zero coefficient, calculating coordinate information of the last non-zero coefficient to identify the position of the last non-zero coefficient; and decoding all coefficients before the position of the last non-zero coefficient according to a predetermined scanning order to identify coefficients of the current block; The horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_x_suffix is ​​not present, then LastSignificantCoeffX = last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX=(1<<log2ZoTbWidth)-1-LastSignificantCoeffX; The vertical coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_y_suffix is ​​not present, then LastSignificantCoeffY=last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1<<log2ZoTbHeight)-1-LastSignificantCoeffY; LastSignificantCoeffX represents a value of a horizontal coordinate of the last non-zero coefficient in the current block according to the preset scanning order, LastSignificantCoeffY represents a value of a vertical coordinate of the last non-zero coefficient in the current block according to the preset scanning order, last_sig_coeff_x_prefix represents prefix information of the horizontal coordinate of the last non-zero coefficient, and last_ sig_coeff_y_prefix represents prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents position reversal flag information of the last non-zero coefficient.

10. A coefficient decoding method comprising:

2. The coefficient decoding method includes: If the position reversal flag information of the last non-zero coefficient indicates that the current block does not use the position reversal of the last non-zero coefficient, directly identifying the position of the last non-zero coefficient based on the coordinate information of the last non-zero coefficient; and decoding all coefficients before the position of the last non-zero coefficient according to the preset scanning order to identify coefficients of the current block.

2. The coefficient decoding method according to claim 1, wherein:

3. The coefficient decoding method includes: determining that the sequence-level flag indicates that the video satisfies the preset condition if the value of the sequence-level flag is a first value; or determining that the sequence-level flag indicates that the video does not satisfy the preset condition if the value of the sequence-level flag is a second value.

2. The coefficient decoding method according to claim 1, wherein:

4. the predetermined conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression; 4. The coefficient decoding method according to claim 3, wherein the coefficient decoding method comprises:

5. The coefficient decoding method includes: determining that, when the value of the position reversal flag information of the last non-zero coefficient is a first value, the position reversal flag information of the last non-zero coefficient indicates that the current block utilizes the position reversal of the last non-zero coefficient; or determining that the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize position reversal of the last non-zero coefficient when the value of the position reversal flag information of the last non-zero coefficient is a second value; 2. The coefficient decoding method according to claim 1, wherein:

6. The coefficient decoding method includes: If the position reversal flag information of the last non-zero coefficient indicates that the current block uses the position reversal of the last non-zero coefficient, specifying the coordinate information of the last non-zero coefficient as horizontal and vertical distances from the position of the last non-zero coefficient to a lower right corner of the current block; Accordingly, determining the location of the last non-zero coefficient by calculating coordinate information of the last non-zero coefficient includes: Identifying a width and height of the current block; obtaining a horizontal coordinate of the last non-zero coefficient by subtracting the horizontal distance from the position of the last non-zero coefficient to a lower right corner of the current block from the width of the current block; obtaining a vertical coordinate of the last non-zero coefficient by subtracting the vertical distance from the position of the last non-zero coefficient to a lower right corner of the current block from the height of the current block; determining a position of the last non-zero coefficient based on a horizontal coordinate of the last non-zero coefficient and a vertical coordinate of the last non-zero coefficient; 2. The coefficient decoding method according to claim 1, wherein:

7. The coefficient decoding method includes: If the position reversal flag information of the last non-zero coefficient indicates that the current block does not use the position reversal of the last non-zero coefficient, specifying the coordinate information of the last non-zero coefficient as horizontal and vertical distances from the position of the last non-zero coefficient to an upper left corner of the current block; determining the location of the last non-zero coefficient based on horizontal and vertical distances from the location of the last non-zero coefficient to an upper left corner of the current block.

2. The coefficient decoding method according to claim 1, wherein:

8. the position inversion flag information of the last non-zero coefficient is at least one of flag information at a sequence level, a picture level, a slice level, and a block level; 2. The coefficient decoding method according to claim 1, wherein:

9. 1. A coefficient coding method applied to an encoder, comprising: Identifying a sequence level flag and the location of the last non-zero coefficient; If the sequence level flag indicates that the video satisfies a preset condition, determining position reversal flag information of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and position inversion flag information of the last non-zero coefficient; determining, based on the coordinate information of the last non-zero coefficient, prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scan order, and writing bit information obtained by encoding, the sequence level flag, prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient into a bitstream; The horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_x_suffix is ​​not present, then LastSignificantCoeffX = last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX=(1<<log2ZoTbWidth)-1-LastSignificantCoeffX; The vertical coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_y_suffix is ​​not present, then LastSignificantCoeffY=last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1<<log2ZoTbHeight)-1-LastSignificantCoeffY; LastSignificantCoeffX represents a value of a horizontal coordinate of the last non-zero coefficient in the current block according to the preset scanning order, LastSignificantCoeffY represents a value of a vertical coordinate of the last non-zero coefficient in the current block according to the preset scanning order, last_sig_coeff_x_prefix represents prefix information of the horizontal coordinate of the last non-zero coefficient, and last_ sig_coeff_y_prefix represents prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents position reversal flag information of the last non-zero coefficient.

10. A coefficient coding method comprising:

10. identifying the sequence-level flags determining that the value of the sequence-level flag is a first value if the video satisfies the predetermined condition; or determining a value of the sequence-level flag to be a second value if the video does not satisfy the preset condition; 10. The coefficient coding method according to claim 9.

11. the predetermined conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression; 11. The coefficient coding method according to claim 10.

12. Identifying the position reversal flag information of the last non-zero coefficient includes: If the current block uses position reversal of the last non-zero coefficient, determining that the value of the position reversal flag information of the last non-zero coefficient is a first value; or If the current block does not utilize position reversal of the last non-zero coefficient, determining that the value of position reversal flag information of the last non-zero coefficient is a second value.

10. The coefficient coding method according to claim 9.

13. the location of the last non-zero coefficient includes an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient, the initial horizontal coordinate being a horizontal distance from the location of the last non-zero coefficient to an upper left corner of the current block, and the initial vertical coordinate being a vertical distance from the location of the last non-zero coefficient to an upper left corner of the current block; Accordingly, determining coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and position inversion flag information of the last non-zero coefficient includes: If the value of the position inversion flag information of the last non-zero coefficient is the first value, determining coordinate information of the last non-zero coefficient by performing calculation based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient; or when the value of the position inversion flag information of the last non-zero coefficient is the second value, directly determining coordinate information of the last non-zero coefficient based on an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient; 13. The coefficient coding method according to claim 12.

14. determining the coordinate information of the last non-zero coefficient by performing calculations based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient, Identifying a width and height of the current block; obtaining the horizontal coordinate of the last non-zero coefficient by subtracting the initial horizontal coordinate of the last non-zero coefficient from the width of the current block; obtaining a vertical coordinate of the last non-zero coefficient by subtracting the initial vertical coordinate of the last non-zero coefficient from the height of the current block; determining coordinate information of the last non-zero coefficient based on a horizontal coordinate of the last non-zero coefficient and a vertical coordinate of the last non-zero coefficient; 14. The method of claim 13, wherein the coefficients are coded in a predetermined order.

15. The coefficient encoding method includes: If the value of the position inversion flag information of the last non-zero coefficient is the first value, specifying the coordinate information of the last non-zero coefficient as the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block; or If the value of the position inversion flag information of the last non-zero coefficient is the second value, specifying the coordinate information of the last non-zero coefficient as horizontal and vertical distances from the position of the last non-zero coefficient to an upper left corner of the current block.

14. The method of claim 13, wherein the coefficients are coded in a predetermined order.

16. 1. An encoder comprising a memory and a processor, the memory stores a computer program executable by the processor; When the processor executes the computer program, Identifying a sequence level flag and the location of the last non-zero coefficient; If the sequence level flag indicates that the video satisfies a preset condition, determining position reversal flag information of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and position inversion flag information of the last non-zero coefficient; determining, based on the coordinate information of the last non-zero coefficient, prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scan order, and writing bit information obtained by encoding, the sequence level flag, prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient into a bitstream; The horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_x_suffix is ​​not present, then LastSignificantCoeffX = last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX=(1<<log2ZoTbWidth)-1-LastSignificantCoeffX; The vertical coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_y_suffix is ​​not present, then LastSignificantCoeffY=last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1<<log2ZoTbHeight)-1-LastSignificantCoeffY; LastSignificantCoeffX represents a value of a horizontal coordinate of the last non-zero coefficient in the current block according to the preset scanning order, LastSignificantCoeffY represents a value of a vertical coordinate of the last non-zero coefficient in the current block according to the preset scanning order, last_sig_coeff_x_prefix represents prefix information of the horizontal coordinate of the last non-zero coefficient, and last_ sig_coeff_y_prefix represents prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents position reversal flag information of the last non-zero coefficient.

1. An encoder characterized by:

17. 1. A decoder comprising a memory and a processor, the memory stores a computer program executable by the processor; When the processor executes the computer program, Parsing the bitstream to obtain sequence-level flags; If the sequence level flag indicates that the video satisfies a preset condition, parsing the bitstream to obtain position reversal flag information of the last non-zero coefficient; Parsing the bitstream to obtain horizontal coordinate prefix information of a last non-zero coefficient, vertical coordinate prefix information of the last non-zero coefficient, horizontal coordinate suffix information of the last non-zero coefficient, and vertical coordinate suffix information of the last non-zero coefficient; Identifying the horizontal coordinate of the last non-zero coefficient based on prefix information of the horizontal coordinate of the last non-zero coefficient and suffix information of the horizontal coordinate of the last non-zero coefficient; Identifying the vertical coordinate of the last non-zero coefficient based on prefix information of the vertical coordinate of the last non-zero coefficient and suffix information of the vertical coordinate of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient; If the position reversal flag information of the last non-zero coefficient indicates that the current block uses the position reversal of the last non-zero coefficient, calculating coordinate information of the last non-zero coefficient to identify the position of the last non-zero coefficient; decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order to identify coefficients of the current block; The horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_x_suffix is ​​not present, then LastSignificantCoeffX = last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX=(1<<log2ZoTbWidth)-1-LastSignificantCoeffX; The vertical coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_y_suffix is ​​not present, then LastSignificantCoeffY=last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1<<log2ZoTbHeight)-1-LastSignificantCoeffY; LastSignificantCoeffX represents a value of a horizontal coordinate of the last non-zero coefficient in the current block according to the preset scanning order, LastSignificantCoeffY represents a value of a vertical coordinate of the last non-zero coefficient in the current block according to the preset scanning order, last_sig_coeff_x_prefix represents prefix information of the horizontal coordinate of the last non-zero coefficient, and last_ sig_coeff_y_prefix represents prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents position reversal flag information of the last non-zero coefficient.

10. A decoder comprising:

18. A method for transmitting a bitstream, comprising: Executing the coefficient coding method according to any one of claims 9 to 15 to generate the bitstream; transmitting the bitstream; Including, 1. A method for transmitting a bitstream, comprising:

Citation Information

Patent Citations

  • Context determination for entropy coding of run-length encoded transform coefficients

    US20150358621A1

  • Coding of last significant coefficient flags

    US20200396486A1

  • Method and apparatus for advanced cabac context adaptation for last coefficient coding

    WO2018011295A1

  • Image decoding device and image coding device

    WO2018173862A1