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

JP7642097B2Active Publication Date: 2025-03-07GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2023562336
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-04-12
Publication Date
2025-03-07
Estimated Expiration
2041-04-12

Smart Images

  • Figure 0007642097000017
    Figure 0007642097000017
  • Figure 0007642097000018
    Figure 0007642097000018
  • Figure 0007642097000019
    Figure 0007642097000019
Patent Text Reader

Abstract

In an embodiment of the present application, a coefficient encoding / decoding method, an encoder, a decoder, and a computer storage medium are disclosed. The method includes the following contents: Analyze a bitstream to obtain video flag information; If the video flag information indicates that the video meets a preset condition, analyze 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 position reversal flag information of the last non-zero coefficient indicates that position reversal of the last non-zero coefficient is used, calculate the coordinate information of the last non-zero coefficient to determine the position of the last non-zero coefficient; According to a preset scanning order, decode all coefficients before the position of the last non-zero coefficient to determine the coefficients of the current block. In this way, in a scenario of high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the throughput of coefficient encoding / decoding and the encoding / decoding speed can be improved, and the compression efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

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

[0002] As the requirements for video display quality increase, computer vision-related fields are gaining attention. In recent years, image processing technology has been successfully applied in various industries. In the process of encoding and decoding video images, the encoding side transforms and quantizes the image data to be encoded, then compresses and encodes it using an entropy encoding unit, and transmits the bit stream generated by entropy encoding to the decoding side. The decoding side analyzes the bit stream and can restore the original input image data after undergoing the processes of inverse quantization and inverse transformation.

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

[0004] In the embodiments of the present application, a coefficient encoding / decoding method, an encoder, a decoder and a computer storage medium are provided, which can improve the coefficient encoding / decoding throughput and the encoding / decoding speed, as well as improve the 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 for application in a decoder, the method comprising: Parsing the bitstream to obtain video flag information; When 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 position reversal of the last non-zero coefficient, determining the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient; Decoding all coefficients prior to the location of the last non-zero coefficient according to a preset scanning order to identify 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; identifying position reversal flag information of a last non-zero coefficient when the video flag information indicates that the video satisfies a preset condition; 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, to 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 according to 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 in the 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 a method according to the second aspect.

[0010] In a fifth aspect, an embodiment of the present application provides a decoder, the decoder comprising: an analysis unit and a second identification 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 a 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 operable, when executed, to perform the method according to the first aspect or the method according to the second aspect.

[0013] In an embodiment of the present application, a coefficient encoding / decoding method, an encoder, a decoder, and a computer storage medium are provided. In the encoder, video flag information and a position of a last non-zero coefficient are identified. If the video flag information indicates that the video satisfies a preset condition, position inversion flag 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, coordinate information of the last non-zero coefficient is identified. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are encoded, and bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient are written into a bitstream. In the decoder, the bitstream is analyzed to obtain the video flag information. If the video flag information indicates that the video satisfies a preset condition, the bitstream is analyzed to obtain the position inversion flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. If the position inversion flag information of the last non-zero coefficient indicates that the current block uses position inversion 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. According to a preset scan order, all coefficients before the position of the last non-zero coefficient are decoded to identify the coefficients of the current block. In this way, in a scenario of video encoding / decoding with high bit depth, high bit rate, high quality, or lossless compression, the coefficient distribution rule is different from that of a normal video scenario, so during coefficient encoding / decoding, the number of syntax elements to be encoded / decoded in the context mode is reduced or removed, for example, syntax elements such as the position of the last non-zero coefficient, sub-block encoding / decoding flags, and further, 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. In addition, since the syntax elements to be reduced or removed have a small effect in video encoding / decoding with high bit depth, high bit rate, high quality, or lossless compression, the compression efficiency can also be improved. [Brief description of the drawings]

[0014] [Figure 1] FIG. 1 is a schematic diagram illustrating an application of a coding framework according to the related art. [Diagram 2] FIG. 2 is a schematic diagram showing the positional relationship between a current coefficient and adjacent coefficients according to the related art. [Diagram 3] FIG. 3 is a flowchart showing a bin arithmetic decoding process according to the related art. [Figure 4] FIG. 4 is a flow chart illustrating a binary decision arithmetic decoding process according to the related art. [Diagram 5] FIG. 5 is a flow chart showing renormalization of an arithmetic decoding engine according to the related art. [Figure 6] FIG. 6 is a flow chart 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 in which non-zero coefficients can exist and a zero-set region according to the related art. [Figure 8A] FIG. 8A is a schematic diagram showing a system structure of an encoder according to an embodiment of the present application. [Figure 8B] FIG. 8B is a schematic diagram showing a system structure of a decoder according to an embodiment of the present application. [Figure 9] FIG. 9 is a flow chart 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 flow chart illustrating a coefficient encoding method according to an embodiment of the present application. [Figure 12] FIG. 12 is a schematic diagram showing 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 showing 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 PREFERRED EMBODIMENTS

[0015] In order to more fully understand the characteristics 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. The accompanying drawings are only used for explanation purposes and are not intended to limit the embodiments of the present application.

[0016] All technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains, unless otherwise defined. 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" are used, which describes a subset of all possible embodiments, it can be understood that "some embodiments" may be the same or different subsets of all possible embodiments, which may be combined with each other unless there is a contradiction. It should be noted that the terms "first / second / third" in the embodiments of the present application merely distinguish similar objects and do not imply a specific order of objects. "First / second / third" may be interchanged with a specific order or priority when permitted, so that the embodiments of the present application described herein may be implemented in an order other than that shown 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 a YCbCr format or a YUV format.

[0019] Before describing the embodiments of the present application in more detail, the nouns and terms according to the embodiments of the present application will be described. The nouns and terms according to the embodiments of the present application are applied to the following interpretation. 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 Model (HPM), Context-based Adaptive Binary Arithmetic Coding (CABAC), Regular residual coding / decoding (Regular Residual Coding, RRC), Transform Skip Residual Coding (TSRC).

[0020] Currently, a block-based mixed coding / decoding framework is used in general-purpose video coding / decoding standards (e.g., VVC). Each image (frame) in a video image is divided into largest coding / decoding units (LCUs) of the same size (e.g., 128×128, 64×64, etc.), and each LCU can be divided into rectangular coding / decoding units (CUs) based on a rule, and the CU can be divided into smaller prediction units (PUs), transform units (TUs), etc. Specifically, as shown in FIG. 1, the mixed coding / decoding framework can include modules such as prediction, transform, quantization, entropy coding, and in-loop filter. The prediction module can include intra prediction and inter prediction, and the inter prediction can include motion estimation and motion compensation. Because there is a strong correlation between adjacent samples in a video picture, the method of intra prediction can be used in video coding and decoding technology to eliminate the spatial redundancy between adjacent samples. Because there is a strong similarity between adjacent pictures in a video, the method of inter prediction can be used in video coding and decoding technology to eliminate the temporal redundancy between adjacent pictures, thereby improving the 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 prediction block of the current block is generated by performing intra prediction or inter prediction on the current block, the prediction 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, the quantization coefficient matrix is ​​entropy coded and output to a bitstream. In the decoder, a prediction block of the current block is generated by performing intra prediction or inter prediction on the current block, while the bitstream is decoded to obtain a quantization coefficient matrix, the quantization coefficient matrix is ​​inverse quantized and inverse transformed to obtain a residual block, and the prediction block and the residual block are added to obtain a reconstructed block. The reconstructed block forms a reconstructed image. The reconstructed image is in-loop filtered based on the image or block to obtain a decoded image. The encoder also needs to perform similar processing to the decoder to obtain a decoded image. The decoded image can be a reference image for inter prediction of a subsequent image. The block partition information identified by the encoder, and mode or parameter information such as prediction, transform, quantization, entropy coding, in-loop filtering, etc. are output to the bitstream as necessary. The decoder analyzes and analyzes the existing information to identify the same block partition information, mode or parameter information such as 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, and the division of prediction units and transform units may be different. The above is the basic flow of a video encoder-decoder in a block-based mixed encoding-decoding framework. As technology develops, some modules or steps in the framework or flow may be optimized.The embodiments of the present application apply to the basic flow of a video encoder-decoder in this block-based hybrid encoding-decoding framework, but are not limited to this framework or flow.

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

[0023] Block division information, mode information and parameter information of each of prediction, transformation, and quantization, coefficients, etc. are written into a bitstream by entropy coding. By assuming that the probabilities of different elements are different, and assigning short codewords to elements with a high probability of appearing and long codewords to elements with a low probability of appearing, it is possible to obtain higher coding efficiency than fixed-length coding. However, if the probabilities of different elements are close or almost the same, the compression space by entropy coding becomes limited. CABAC is a normal entropy coding method, and entropy coding is performed using CABAC in HEVC, VCC, etc. CABAC can improve compression efficiency by using a context model, but the use and update of the context mode makes the operation more complicated. CABAC has a bypass mode. In the bypass mode, it is possible to achieve a higher throughput without requiring the use and update of the context model. In the embodiment of the present application, a mode in CABAC that requires the use and update of the context model can be called a context mode.

[0024] Generally, a context model needs to be identified based on a defined method first. When invoking a defined binary decision arithmetic decoding process, the parameters of the context model can be used as input. In selecting a context model, there is a dependency between adjacent coefficients. For example, FIG. 2 is a schematic diagram showing the positional relationship between a current coefficient and adjacent coefficients according to the related art. In FIG. 2, the black-filled block represents the current coefficient, and the grid-lined block represents the adjacent coefficients. As shown in FIG. 2, which context model to select for the sig_coeff_flag of the current coefficient needs to be identified based on the information of the five adjacent coefficients to the right, below, and right below the current coefficient. As can be further seen from FIG. 2, the operation of the context mode is much more complicated than the operation of the bypass mode, and there is also a dependency between adjacent coefficients.

[0025] When the CABAC arithmetic encoding / decoding engine needs to use the context mode, it needs to call the defined binary decision arithmetic decoding process, which includes the state transition process, i.e., the context model update. In the binary decision arithmetic decoding process, it needs to call the renormalization process of the arithmetic decoding engine. When the bypass mode is used, it needs to call 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 an index of the context model.

[0029] Fig. 3 is a flow chart 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), call the defined binary decision arithmetic decoding process DecodeDecision(ctxTable, ctxIdx).

[0030] Also, in the binary decision arithmetic decoding process, the inputs of 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 flow chart showing 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, then 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 a value for 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 outputs 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] Additionally, 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), enter a renormalization loop. In this loop, multiply the value of ivlCurrRange by 2, i.e., shift it one bit to the left. Multiply the value of ivlOffset by 2, i.e., shift it one bit to the left. Shift one bit obtained by read_bits(1) into ivlOffset.

[0039] In the entire process, no data in the bitstream will ever 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 bypassFlag is 1, the bypass decoding process is called, and Fig. 6 is a flow chart showing the bypass decoding process according to the related art. As shown in Fig. 6, first, the value of ivlOffset is multiplied by 2, that is, shifted left by 1 bit. Shift 1 bit obtained by read_bits(1) to ivlOffset. Compare the value of ivlOffset 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 ever cause ivlOffset to be greater than or equal to ivlCurrRange.

[0043] It should be understood that current video coding and decoding standards usually support one or more types of transform and transform skip for the residual. Transforms include the Discrete Cosine Transform (DCT), etc. A residual block that uses a transform generally exhibits certain characteristics after it has been transformed (and quantized). For example, after some transform (and quantization), the energy is concentrated in the low-frequency region, so the coefficients in the upper left corner are large, and the coefficients in the lower right corner are small, and there are many 0 coefficients. On the other hand, a transform skip literally means that no transform is performed. The coefficients after a transform skip have a different distribution rule from those after the transform, so different coefficient encoding and decoding methods can be used. For example, in VCC, After exchange RRC is used for the coefficients of , and TSRC is used for the coefficients after transform skipping.

[0044] In a general transformation, for example, in a DCT transformation, the transformed block has a higher frequency from left to right and a higher frequency from top to bottom. The upper left corner represents low frequency and the lower right corner represents high frequency. The human eye is more sensitive to low frequency information, but is not particularly sensitive to high frequency information. Taking advantage of this characteristic, some high frequency information is processed more or removed, which has less impact on vision. In some techniques, for example, zero-out, some high frequency information can be forcibly set to 0. For example, for a 64×64 block, coefficients at positions where the abscissa is 32 or more or the ordinate is 32 or more are forcibly set to 0. The above is just an example, and the range of zero-out can be derived in a more complicated way, so the description here is omitted. 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 the existence of a non-zero coefficient is possible), and all coefficients in the lower right corner are set to zero (i.e., the zero-out region). In this way, for the subsequent coefficient encoding and decoding, the coefficients in the zero-filled region are always zero and do not need to be encoded.

[0045] Furthermore, after transforming (and quantizing) the residual in a normal video, the coefficient distribution has the characteristic that the coefficients in the upper left corner are large and the coefficients in the lower right corner are large, so during the coefficient encoding / decoding, some methods are used to ensure that the coefficients within a certain range of the upper left corner need to be encoded / decoded, and the coefficients within a certain range of the lower right corner do not need to be encoded / decoded (i.e., these coefficients are defaulted to be zero). In one method, when encoding / decoding the coefficients of a block, the position of the last non-zero coefficient of the block in the scanning order is first identified. After identifying this position, all the coefficients after the position of the last non-zero coefficient in the scanning order are considered to be zero, i.e., do not need to be encoded / decoded. Only the coefficients at and before the position of the last non-zero coefficient need to be encoded / decoded. 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 nonzero 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 nonzero 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 nonzero coefficient in the current block, in scan order. 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 the scan order in the current transform block, LastSignificantCoeffX, is derived in the following manner. If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX = last_sig_coeff_x_prefix. Otherwise (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.

[0052] (d) last_sig_coeff_y_suffix specifies the suffix of the vertical (or row) coordinate of the last non-zero coefficient in the current transform block, in scan order. y The value of _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 the 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), LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix.

[0054] Also, 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. In VVC, a flag sb_coded_flag indicating whether the current sub-block needs to be coded / decoded is used to determine whether the coefficients in the current sub-block need to be coded / decoded. If coding / decoding is not required, it is considered that all the coefficients in the current sub-block are 0. Here, the sub-block is usually an n×n sub-block, for example, a 4×4 sub-block.

[0055] sb_coded_flag[xS][yS] specifies the following information of the sub-block with 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, then 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] is not present, the value of sb_coded_flag[xS][yS] is 1.

[0056] Furthermore, when processing the coefficient encoding / decoding, 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 / decoded are 0, so whether or not the current coefficient is 0 can be expressed by one syntax element, and this syntax element is usually one binary symbol. If the current coefficient is 0, it means that the encoding / decoding of the current coefficient has ended, and if not, it is necessary to continue encoding / decoding the current coefficient. As another example, in normal video, a certain percentage of the non-zero coefficients have absolute values ​​of 1, so whether or not the absolute value of the current coefficient is greater than 1 can be expressed by one syntax element, and this syntax element is usually one binary symbol. If the absolute value of the current coefficient is less than or equal to 1, it means that the encoding / decoding of the current coefficient has ended, and if not, it is necessary to continue encoding / decoding the current coefficient. For example, the syntax elements related to 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 position (xC, yC) 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 inferred 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] is not present, 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 that is encoded and decoded by the Golomb-Rice code. If abs_remainder[n] does not exist, the value of abs_remainder[n] is 0.

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

[0063] dec_abs_level[n] is an intermediate value at scan position n that is encoded and decoded using the Golomb-Rice code. ZeroPos[n] can be derived by analyzing dec_abs_level[n]. The absolute value AbsLevel[xC][yC] of the transform coefficient level at position (xC, yC) is derived in the following way: If dec_abs_level[n] is not present, 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 the non-zero coefficient can be specified by the coefficient sign flag coeff_sign_flag or some sign derivation method. 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] is 0, and in this case, the sign of the transform coefficient at the coordinates (xC, yC) is specified based on CoeffSignLevel[xC][yC]. If the value of CoeffSignLevel[xC][yC] is 0, the corresponding transform coefficient is set to 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 using some other methods, but the description thereof will be omitted here.

[0067] VVC also uses a parity flag par_level_flag for the value of the coefficient, which indicates the parity of the value of the current coefficient 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, then 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, along with abs_level_gtx_flag, abs_remainder, etc., to specify the magnitude of the coefficients.

[0070] Here, the context mode encoding / decoding needs to select, use, and update the context mode, but the bypass mode encoding / decoding does not need to select, use, and update the context mode. Usually, within a certain range, the syntax elements encoded / decoded in the context mode are placed together, and the syntax elements encoded / decoded in the bypass mode are placed together, which is more friendly to the hardware design. For example, first, process all the syntax elements encoded / decoded in the context mode in one block, and then process the syntax elements encoded / decoded in the bypass mode. All the syntax elements encoded / decoded in the context mode in the current block may be further divided into several groups, and all the syntax elements encoded / decoded in the bypass mode in one 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] TIFF0007642097000002.tif241170TIFF0007642097000003.tif239170TIFF0007642097000004.tif243170TIFF0007642097000005.tif209170

[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 indexes 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 the present application, remBinsPass1 can be understood as 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 determine whether each current sub-block needs to be encoded and decoded. If it needs to be encoded and decoded, in the 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 that are coded / 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 each syntax element that is coded / decoded in context mode, subtract one from remBinsPass1. If one coefficient is large enough, it may be necessary to process the remaining value (i.e., abs_remainder) after processing some syntax elements that are coded / decoded in context mode in the first round. If remBinsPass1 is small enough (does not satisfy remBinsPass1>=4), 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] TIFF0007642097000007.tif242170TIFF0007642097000008.tif246170

[0077] After entering the function residual_ts_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx), some information of the block size needs to be specified. Then, the value of RemCcbs is specified, i.e., 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 / decoded in the context mode. In the embodiment of the present application, RemCcbs can be understood as remaining context coded binaries, i.e., the remaining number of binary symbols to be coded / decoded in the context mode. Whether the current sub-block needs to be coded / decoded is specified for each sub-block. Unlike the above RRC, in the TSRC method, if a coefficient needs to be coded or decoded, the syntax elements coded or decoded in context mode in one sub-block are set in the second round, and for each coefficient, up to four syntax elements coded or decoded in context mode are processed in the first and second rounds, respectively. The syntax elements coded or decoded in bypass mode are set later. In the first and second rounds, 1 is subtracted from remBinsPass1 every time a syntax element coded or decoded in context mode is processed. If one coefficient is large enough, after processing some 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 small enough (does not satisfy remBinsPass1>=4), the first two rounds are completed, and the remaining coefficients are directly processed in bypass mode, which is still abs_remainder in this case.

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

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

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

[0081] In another aspect, the current method of encoding and decoding the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is to encode and decode the coordinates at 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 has zero coefficients, so the values ​​of LastSignificantCoeffX and LastSignificantCoeffY are generally small. In high-resolution video, there are many non-zero coefficients in the lower right corner, so the values ​​of LastSignificantCoeffX and LastSignificantCoeffY are generally large, and encoding and decoding large values ​​in the bitstream will result in larger overhead. There is also a possibility of using this method for lossless compression, because quantization cannot be used in lossless compression, and in this case, the coefficients are generally relatively large and relatively large. In this case, using existing related schemes will result in larger overhead and waste, and will also affect 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: Analyze a bitstream to obtain video flag information; If the video flag information indicates that the video meets 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; 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, determine the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient; Decode all coefficients before the position of the last non-zero coefficient according to a preset scan order to determine the coefficients of the current block.

[0083] In an embodiment of the present application, a coefficient encoding method applied to an encoder is further provided: determining video flag information and a position of a last non-zero coefficient; if the video flag information indicates that the video satisfies a preset condition, determining position inversion flag information of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the 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 in the encoding, the video flag information, and the coordinate information of the last non-zero coefficient into a bitstream.

[0084] In this way, in a high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding scenario, since the coefficient distribution rule is different from that of a normal video scenario, during coefficient encoding / decoding, the number of syntax elements to be encoded / decoded in the context mode is reduced or removed, for example, syntax elements such as the position of the last non-zero coefficient, sub-block encoding / decoding flags, and further, 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 of coefficient encoding / decoding and the encoding / decoding speed can be improved. In addition, since the syntax elements to be reduced or removed have a small effect in high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the 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] Referring to Fig. 8A, Fig. 8A 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 sequence 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 tiles, and further divide a tile into one or more bricks, where 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, where one slice may include one or more tiles in an image 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, where the 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-decoding units (CUs) by iteratively using quad-tree division, binary tree division, and ternary tree division. The prediction unit 102 may obtain an inter prediction block of the CU using the ME unit 104 and the MC unit 105. The intra prediction unit 106 may obtain an intra prediction block of the CU using various intra prediction modes including MIP mode. As an example, a rate-distortion optimized motion estimation method can be invoked by ME unit 104 and MC unit 105 to obtain an inter-predicted block, and a rate-distortion optimized mode decision method can be invoked by intra prediction unit 106 to obtain an inter-predicted block.

[0089] The prediction unit 102 outputs a prediction block of a 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, that is, the 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 outputs reconstructed coefficients by performing a scaling operation on the quantized 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 a 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, where the filtering unit 113 includes 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, etc. Alternatively, the filtering unit 113 performs in-loop filtering on one or more target samples in a CU when it determines that the CU is not used as a reference for encoding / decoding other CUs.

[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 an image (such as control parameters and supplementary information) from the encoder 100 into a 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 recording a computer program. The first processor reads and executes the computer program, which causes 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 Fig. 8B, Fig. 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 Fig. 8B, the decoder 200 can 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 is a bitstream representing a compressed version of a video or a single still image, and the output of the decoder 200 can be a decoded video consisting of a sequence 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 display 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 current 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 used to decode the current 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 used to decode the current 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 prediction 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 / 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 includes 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. Or, if the filtering unit 208 determines that the reconstructed block is not used as a reference for decoding other blocks, it performs 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, and these decoded images or sub-images are 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 can further be used as a reference for inter prediction or intra prediction by the prediction unit 202.

[0100] In addition, the decoder 200 may include a second processor and a second memory for recording 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 Fig. 8B.

[0101] Also, please note that when an embodiment of the present application is applied to the encoder 100, the "current block" specifically refers to an image block in a video image that is currently waiting to be encoded (which may also be referred to as an "encoding block"), and when an embodiment of the present application is applied to the decoder 200, the "current block" specifically refers to an image block in a video image that is currently waiting to be decoded (which may also be referred to as a "decoding 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 parsed 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 coefficient 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 at the encoder side and a coefficient decoding method at the decoder side. The embodiment of the present application is described in the coefficient decoding method at 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 circumstances, 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 of deriving the final non-zero coefficient position.

[0107] In the embodiment 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, parsing the bitstream to obtain the video flag information includes: determining that the video flag information indicates that the video satisfies a preset condition if the value of the video flag information is a first value; or The method may include specifying that, if a 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 videos, the videos according to the embodiments of the present application have characteristics such as high bit depth, high quality, high bit rate, high frame rate and lossless compression.

[0112] Moreover, the video flag information may be a sequence level flag, or may be a higher level flag, such as VUI (Video Usability Information), SEI (Supplemental enhancement information), etc. Whether or not a video satisfies a preset condition can be determined by determining whether or not the video satisfies high bit depth, whether or not the video satisfies high bit rate, whether or not the video satisfies high quality, whether or not the video satisfies 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 comprises: If the high bit depth flag information indicates that the video meets the high bit depth, the method may further include determining that the video meets a preset condition.

[0114] In some embodiments, if the video flag information is high bitrate flag information, the method comprises: If the high bitrate flag information indicates that the video meets the high bitrate, the method may further include determining that the video meets 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, when the video flag information is lossless compression flag information, the method further comprises: If the lossless compression flag information indicates that the video satisfies the lossless compression, the method may further include determining that the video satisfies 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), which is used to indicate whether the current video sequence is a high bit-depth sequence. Or, the video flag information may be high bit-rate flag information (represented by sps_high_bit_rate_flag), which is used to indicate whether the current video sequence is a high bit-rate sequence. Or, the flag information may be other flag information indicating high bit-depth, high bit-rate, high quality, or lossless compression, and is not specifically limited in the embodiment of the present application.

[0118] S902: If the video flag information indicates that the video satisfies the preset condition, parse the bitstream to obtain position inversion flag information of the last non-zero coefficient and 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 inversion 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. Thus, 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 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. Identifying the horizontal coordinate of the last non-zero coefficient based on the horizontal coordinate prefix information of the last non-zero coefficient and the horizontal coordinate suffix information of the last non-zero coefficient. Identifying the vertical coordinate of the last non-zero coefficient based on the vertical coordinate prefix information of the last non-zero coefficient and the vertical coordinate suffix information of the last non-zero coefficient. 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 at least one of flag information of a sequence level, a picture level, a slice level, and a block level, and may also be flag information of a higher level (e.g., VUI, SEI, etc.). There is no limitation thereon.

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

[0125] In some embodiments, the method comprises: determining that 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 when the value of the position reversal flag information of the last non-zero coefficient is a first value; or The method may further include determining 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, taking a first value as 1 and a second value as 0, it can be specified that if the value of reverse_last_sig_coeff_flag is 1, reverse_last_sig_coeff_flag indicates that the current block uses the position reversal of the last non-zero coefficient, or if the value of reverse_last_sig_coeff_flag is 0, 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 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, decode all coefficients before the position of the last non-zero coefficient to identify the coefficients of the current block.

[0129] In addition, in an embodiment of the present application, 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 coordinate information of the last non-zero coefficient can be specified as the horizontal distance and vertical distance 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. Obtain the horizontal coordinate of the last non-zero coefficient by subtracting the horizontal distance from the location of the last non-zero coefficient to the bottom 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. 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.

[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, coordinate transformation (specifically, it can be 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, coordinate inversion calculation needs to be performed. After being inverted again, the coordinate information of the last non-zero coefficient can be restored to be 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, identify the position of the last non-zero coefficient and decode all the coefficients before the position of the last non-zero coefficient in the current block 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 nonzero coefficient indicates that the current block does not utilize position reversal of the last nonzero coefficient, the coordinate information of the last nonzero coefficient is specified as the horizontal and vertical distances from the position of the last nonzero 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 distances 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 distance and vertical distance 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 position reversal flag information of the last non-zero coefficient indicates that the current block does not use position reversal of the last non-zero coefficient, the position of the last non-zero coefficient is directly specified 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] In addition, 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.

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

[0139] Thus, in a certain situation, the embodiment of the present application provides a correction of the derivation method of 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 the existing method in the related art. A certain situation may refer to, for example, 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 by last_sig_coeff_x_prefix, 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 by last_sig_coeff_y_prefix, 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 close to the lower right corner of the region of all possible non-zero coefficients of the current block, in which case 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, 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, last_sig_coeff_y_suffix, as shown in FIG.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 to 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 to 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 exists, 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 is ​​present), 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 of 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, and if not, 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 other levels. Furthermore, the block level flag includes a LCU level flag, a CU level flag, or a flag at other block levels.

[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 the high bit-rate flag information is 1, reverse_last_sig_coeff_flag needs to be decoded, and if not, reverse_last_sig_coeff_flag does not need to be decoded.

[0145] In one specific example, taking the sequence level as an example, assume that there is a sequence level flag sps_high_bit_depth_flag indicating 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 of 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, a slice level is used to indicate whether the current video sequence is a high bit depth sequence. slice Assume that there is a flag sps_high_bit_depth_flag at the slice level. 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 the position reversal flag of 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. Reverse_last_sig_coeff_flag in the above syntax table 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 for specifying whether the current block uses the last coefficient position may also be introduced.

[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] In addition, the last coefficient valid flag information can be represented by default_last_coeff_enabled_flag. In the embodiment of the present application, the last coefficient valid flag information may be at least one of flag information of a sequence level, an image level, a slice level, and a block level, and may also be flag information of a higher level (for example, VUI, SEI, etc.). There is no limitation thereon.

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

[0155] In some embodiments, the method comprises: determining that the last coefficient valid flag information indicates that the current block uses the last coefficient position if the value of the last coefficient valid flag information is a first value; or The method may further include determining that, if a 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 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] In this manner, for example, where the first value is 1 and the second value is 0, it may be specified 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, or, if the value of default_last_coeff_enabled_flag is 0, 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 bitstream is parsed to obtain the horizontal coordinate prefix information of the last non-zero coefficient, the vertical coordinate prefix information of the last non-zero coefficient, the horizontal coordinate suffix information of the last non-zero coefficient, and the vertical coordinate suffix information of the last non-zero coefficient. The position of the last nonzero coefficient is identified based on the prefix information of the horizontal coordinate of the last nonzero coefficient, the prefix information of the vertical coordinate of the last nonzero coefficient, the suffix information of the horizontal coordinate of the last nonzero coefficient, and the suffix information of the vertical coordinate of the last nonzero 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 determined 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 determine 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 last non-zero coefficient position 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 embodiment of the present application.

[0163] Further, for 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 of scanning all possible non-zero coefficients in the current block according to a preset scan order.

[0164] It should be noted that the last coefficient position in the embodiments of this 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 can further include setting the position of the last non-zero coefficient to the last coefficient position.

[0166] That is, in an embodiment of the present application, the position of the last non-zero coefficient can still be utilized, in which 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] And the last coefficient position may be represented as (LastCoeffX, LastCoeffY), i.e., 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: The width and height of a transformation block obtained by performing a preset operation on the current block are determined. 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 lower right corner of the transform block after zero-out. The method of 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 can 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 can further include the following content: When setting the position of the last non-zero coefficient to the last coefficient position, the position of the last non-zero coefficient is determined based on the 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 derivation method of (LastSignificantCoeffX, LastSignificantCoeffY) is as follows: LastSignificantCoeffX=(1< <log2ZoTbWidth)-1であり、LastSignificantCoeffY=(1<<log2ZoTbHeight)-1である。

[0173] (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinate information of the lower 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 a certain situation, during coefficient encoding / decoding, it is defaulted that all coefficients that may need to be encoded / decoded need to be encoded / decoded. That is, in a normal situation, the coefficient encoding / decoding method is the same as the existing method in the related art. The certain situation may refer to, for example, high bit depth, high quality, high bit rate video encoding / decoding or lossless compression video encoding / decoding. It is defaulted that all coefficients that may need to be encoded / decoded need to be encoded / decoded, that is, the position of the last non-zero coefficient is no longer used, and all possible non-zero 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 non-zero 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 non-zero coefficients in the current block. Here, the position of the last coefficient that needs to be encoded / decoded is used instead of the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position that needs to be encoded or decoded may be zero, but the coefficient at the last nonzero coefficient position is not necessarily zero.

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

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

[0177] 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, i.e., 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 coefficient position that needs to be decoded is set to the last position of all possible non-zero coefficients in the current block according to the preset scan order. Otherwise, it indicates that the default last coefficient position is not used.

[0181] When 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 scanning order. It is necessary to scan all coefficients before (LastCoeffX, LastCoeffY) according to the preset scanning order. In the embodiment of the present application, the derivation method of (LastCoeffX, LastCoeffY) is as follows: LastCoeffX=(1< <log2ZoTbWidth)-1であり、LastCoeffY=(1<<log2ZoTbHeight)-1である。

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

[0183] In one special example, the position of the last non-zero coefficient is still utilized. 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 of 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 lower right corner of the transform block after zero-out.

[0185] In addition, default_last_coeff_enabled_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 other levels. In addition, the block level flag includes a LCU level flag, a CU level flag, or a flag at other block levels.

[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 the high bit rate flag information is 1, it is necessary to decode default_last_coeff_enabled_flag, and if not, it is not necessary to decode default_last_coeff_enabled_flag.

[0187] In one specific example, taking the sequence level as an example, assume that there is a sequence level flag sps_high_bit_depth_flag indicating 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, a slice level is used to indicate whether the current video sequence is a high bit depth sequence. sliceAssume that there is a flag sps_high_bit_depth_flag at the slice level. 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. The default_last_coeff_enabled_flag in the above syntax table 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] Furthermore, if the video flag information indicates that the video meets the preset condition, all scanned sub-blocks should be decoded by default, in which 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, improving the decoding speed. Therefore, the embodiment of the present application may further introduce sub-block default decoding flag information (default sub-block coded flag) used to determine whether a sub-block waiting to be decoded in the current block is to 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 default when it is decoded, the value of the sub-block decoding flag information is determined to be a first value, and all coefficients in the sub-block awaiting decoding are decoded.

[0195] In addition, subblock default Decryption The 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, a picture level, a slice level, and a block level, and may also be flag information at a higher level (for example, VUI, SEI, etc.). There is no limitation thereon.

[0196] That is, default_sb_coded_flag may be a sequence level or higher flag, or may be an image level flag, a slice level flag, a block level flag, or other level flag. Also, the block level flag may include an LCU level flag, a CU level flag, or other block level flag, and is not limited in the embodiment 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 is to be defaulted when it is decoded; or The method may further include determining 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 default when 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 defaulted to decoded, 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 defaulted to decoded.

[0201] If the sub-block waiting to be decoded defaults to need to be decoded, 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 need to decode all coefficients in the sub-block waiting to be decoded.

[0202] In addition, if the subblock waiting to be decoded does not default to need to be decoded, i.e., 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 is not defaulted as needing to be decoded, the sub-block decoding flag information needs to be decoded and then, depending on the sub-block decoding flag information, it is determined whether or not all coefficients in the sub-block waiting to be decoded are to 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, determining that all coefficients in the sub-block waiting to be decoded are to be decoded; or The method can further include identifying, if the value of the sub-block decoding flag information is the second value, that all coefficients in the sub-block to be decoded are zero.

[0205] In an embodiment of the present application, the sub-block decoding flag information can be represented by sb_coded_flag. Taking as an example that the first value is 1 and the second value is 0, when the value of sb_coded_flag is 1, it can 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 can 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] In this way, in a certain situation, during coefficient encoding / decoding, it is defaulted that all scanned sub-blocks need to be encoded / decoded, in other words, it is defaulted that 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 method in the related art. A certain situation can refer to, for example, high bit depth, high quality, high bit rate video encoding / decoding or lossless compression 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 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, which can improve the encoding / decoding speed. In addition, since the flag that rarely exists is removed, the compression performance is slightly improved at this time.

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

[0208] [Table 8]

[0209] default_sb_coded_flag is a flag indicating whether or not the subblock should 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 sequence level or higher flag, or may be a picture level flag, a slice level flag, a block level flag, or other level flag. Also, the block level flag includes an LCU level flag, a CU level flag, or other block level flag.

[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 the high bit rate flag information is 1, the default_sb_coded_flag needs to be decoded, and if not, the default_sb_coded_flag does not need to be decoded.

[0212] In one specific example, taking the sequence level as an example, assume that there is a sequence level flag sps_high_bit_depth_flag indicating 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 indicating whether to default that a sub-block of a block in the current sequence needs to be decoded. If the value of sps_default_sb_coded_flag is 1, it indicates that to default that a sub-block of a block in the current sequence needs to be decoded, otherwise (i.e., if the value of sps_default_sb_coded_flag is 0), it indicates that to not default that a sub-block of a block in the current sequence needs to be decoded. 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, a slice level is used to indicate whether the current video sequence is a high bit depth sequence. sliceAssume that there is a flag sps_high_bit_depth_flag at the slice level. 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 indicating whether or not to default that sub-blocks of the current slice need to be decoded. If the value of sh_default_sb_coded_flag is 1, it indicates that the sub-blocks of the block 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 the sub-blocks of the block in the current slice do not need to be decoded by default. The default_sb_coded_flag in the above syntax table 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] It should be noted that the embodiment of the present application relates to three optimization methods, which are as follows:

[0219] Method 1 is as follows. In a certain situation, during coefficient encoding / decoding, it is defaulted that all coefficients that may need to be encoded / decoded need to be encoded / decoded. That is, in a normal situation, the coefficient encoding / decoding method is the same as the existing method in the related art. A certain situation can refer to, for example, high bit depth, high quality, high bit rate video encoding / decoding or lossless compression video encoding / decoding. It is defaulted that all coefficients that may need to be encoded / decoded need to be encoded / decoded, that is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients in the current block are scanned according to a preset scan order. In other words, the last position of all possible non-zero coefficients in the current block according to the preset scan order is set as the last position of the coefficients that need to be encoded / decoded. Here, the last position of the coefficients that need to be encoded / decoded is used instead of the position of the last non-zero coefficient. This is because the coefficient in the last coefficient position that needs to be encoded / decoded may be 0, but the coefficient in the last non-zero coefficient position is not necessarily 0.

[0220] Also, in one particular example, the position of the last non-zero coefficient is still utilized, in this case by 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 scan order.

[0221] Method 2 is as follows. In a certain situation, during coefficient encoding / decoding, the method of deriving the position of the last non-zero coefficient is corrected. That is, in a normal situation, the coefficient encoding / decoding method is the same as the existing method in the related art. The certain situation may refer to, for example, high bit depth, high quality, high bit rate video encoding / decoding or lossless compression video encoding / decoding. In a normal situation, 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 by last_sig_coeff_x_prefix, 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 by last_sig_coeff_y_prefix, last_sig_coeff_y_suffix. On the other hand, for high bit depth, high quality, high bit rate video encoding / decoding or lossless video encoding / decoding, the location of the last nonzero coefficient is generally close to the lower right corner of the region of all possible nonzero coefficients of the current block. In this case, the horizontal distance from the location of the last nonzero coefficient to the lower right corner of the region of all possible nonzero coefficients of the current block is represented and coded by last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, and the vertical distance from the location of the last nonzero coefficient to the lower right corner of the region of all possible nonzero coefficients of the current block is represented and coded by 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 to 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 to represent 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, it is defaulted that all scanned sub-blocks need to be encoded / decoded during coefficient encoding / decoding. In other words, it is defaulted that all scanned sub-blocks contain non-zero coefficients. That is, in the 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 reversible-compression 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, it is not necessary to transmit sb_coded_flag in the bit stream, and the encoder / decoder does not need to process the flag.

[0223] In contrast to the above three methods, in the scenario of high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the coefficient distribution rule is different from that of normal video scenario, so during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as syntax elements such as the position of the last non-zero coefficient, sub-block encoding / decoding flags, thereby improving the throughput of coefficient encoding / decoding and the encoding / decoding speed. In addition, since the above flags play a small role in high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, not using these flags does not reduce the compression efficiency, but instead can improve the compression efficiency to a certain extent.

[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 method of the embodiments of the present application is described based on the example that the technical solution is applied to all components in the video, and all components refer to R, G, B in the video of RGB format, or Y, U, V (Y, Cb, Cr) in the video of YUV format, etc. The coefficient decoding method of the embodiments of the present application may be applied to only one component, for example, only the Y component of the YUV format. The coefficient decoding method of the embodiments of the present application may also be applied to each component, that is, it is also possible to control whether it is applied to each component.

[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 utilizes 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 scan 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 a high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding scenario, since the coefficient distribution rule is different from that of a normal video scenario, during coefficient encoding / decoding, the number of syntax elements to be encoded / decoded in the context mode is reduced or removed, for example, syntax elements such as the position of the last non-zero coefficient, sub-block encoding / decoding flags, and further, 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 of coefficient encoding / decoding and the encoding / decoding speed can be improved. In addition, since the syntax elements to be reduced or removed have a small effect in high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the 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 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 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 encoded, and bit information obtained by encoding, 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 encoding 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 encoding method of the embodiment of the present application is mainly applied to the "entropy encoding unit 115" in the encoder 100. The entropy encoding unit 115 can use an adaptive binary arithmetic encoding / decoding mode or a bypass mode based on a context model to entropy encode related flag information (or syntax elements), and then write them into a bitstream.

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

[0234] In normal circumstances, for normal video, the coefficient coding method is the same as the existing method in the related art. However, for certain circumstances, such as high bit depth, high quality, high bit rate, or lossless compression video coding and decoding scenarios, the embodiment of the present application can amend the method of deriving the position of the final 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, thereby identifying the position of the last non-zero coefficient, and then coding all coefficients before the position of the last non-zero coefficient in the current block according to a preset scanning order.

[0235] In the embodiment 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: determining that the value of the video flag information is a first value if the video satisfies a predetermined condition; or If the video does not satisfy the predetermined condition, determining that the value of the video flag information is 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] Moreover, the video flag information may be a sequence level flag, or may be a higher level flag (for example, VUI, SEI), etc. Whether or not a video satisfies a preset condition can be determined by determining whether or not the video satisfies high bit depth, whether or not the video satisfies high bit rate, whether or not the video satisfies high quality, whether or not the video satisfies 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 comprises: The method may further include determining, if the video meets the high bit depth, that the high bit depth flag information indicates that the video meets the preset condition.

[0241] In some embodiments, if the video flag information is high bitrate flag information, the method comprises: The method can further include determining, if the video meets the high bitrate, that the high bitrate flag information indicates that the video meets the preset condition.

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

[0243] In some embodiments, when the video flag information is lossless compression flag information, the method further 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), which is used to indicate whether the current video sequence is a high bit depth sequence; or the video flag information may be high bit rate flag information (represented by sps_high_bit_rate_flag), which is used to indicate whether the current video sequence is a high bit rate sequence; or the flag information may be other flag information indicating high bit depth, high bit rate, high quality, or lossless compression, and is not specifically limited in the embodiment of the present application.

[0245] In addition, regarding 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, 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, the method may include specifying that the value of the position reversal flag information of the last non-zero coefficient is 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 at least one of flag information of a sequence level, an image level, a slice level, and a block level, and may also be flag information of a higher level (for example, VUI, SEI, etc.). There is no limitation thereon.

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

[0248] Thus, taking the first value as 1 and the second value as 0 as an example, if the current block specifies that the positional reversal of the last non-zero coefficient is used, the value of reverse_last_sig_coeff_flag is 1. Alternatively, if the current block specifies that the positional 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 a horizontal distance from the position of the last non-zero coefficient to an upper left corner of the current block, and the initial vertical coordinate is a vertical distance from the position of the last non-zero coefficient to an 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 inversion 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 a 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: If the value of the position inversion flag information of the last non-zero coefficient is a 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 a second value, the method may further include determining the coordinate information of the last non-zero coefficient as horizontal and vertical distances from the position of the last non-zero coefficient to the top-left corner of the current block.

[0251] That is, the coordinate information of the last non-zero coefficient is usually the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block. 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 has zero coefficients. However, in high bit depth, high quality, and 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, it is necessary to perform a coordinate transformation (specifically, it can be a coordinate inversion calculation, i.e., the coordinate information of the last non-zero coefficient after coordinate inversion is the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block) during coefficient encoding. In this case, the decoder needs to perform a coordinate inversion calculation during coefficient decoding. After being inverted again, the coordinate information of the last non-zero coefficient can be restored to be the horizontal and vertical distances 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 identified.

[0252] Also, in some embodiments, 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 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. 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 the 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 last nonzero coefficient horizontal coordinate prefix information, the last nonzero coefficient vertical coordinate prefix information, the last nonzero coefficient horizontal coordinate suffix information, and the last nonzero coefficient vertical coordinate suffix information into the bitstream.

[0256] Note that the prefix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_prefix. The prefix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix. The suffix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix. The 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. Thereby, the decoder can identify the coordinate information of the last non-zero coefficient by analyzing the bitstream.

[0257] Thus, the embodiment of the present application provides a correction of the method of deriving the position of the last non-zero coefficient. That is, in a normal situation, the coefficient coding and decoding method is the same as the existing method in the related art. A certain situation may refer to, for example, high bit depth, high quality, high bit rate video coding and decoding or lossless compression video coding and 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 by last_sig_coeff_x_prefix, 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 by last_sig_coeff_y_prefix, 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 compression video encoding / decoding, the position of the last non-zero coefficient is generally close to 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 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 by 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 by last_sig_coeff_y_prefix, 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] Also, if the video flag information indicates that the video meets 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, the embodiment of the present application may also introduce last coefficient valid flag information 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 to the bitstream.

[0260] In addition, the last coefficient valid flag information can be represented by default_last_coeff_enabled_flag. In the embodiment of the present application, the last coefficient valid flag information may be at least one of flag information of a sequence level, an image level, a slice level, and a block level, and may also be flag information of 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 includes: 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, the first value is 1 and the second value is 0, if the current block uses the last coefficient position, the value of default_last_coeff_enabled_flag is 1. Or, if 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 this 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 can further include setting the position of the last non-zero coefficient to the last coefficient position.

[0266] That is, in an embodiment of the present application, the position of the last non-zero coefficient can still be utilized, in which 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] And the last coefficient position may be represented as (LastCoeffX, LastCoeffY), i.e., 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: The width and height of a transformation block obtained by performing a preset operation on the current block are determined. 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 lower right corner of the transform block after zero-out. The method of 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 can 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 can further include the following content: When setting the position of the last non-zero coefficient to the last coefficient position, the position of the last non-zero coefficient is determined based on the 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 derivation method of (LastSignificantCoeffX, LastSignificantCoeffY) is as follows: LastSignificantCoeffX=(1< <log2ZoTbWidth)-1であり、LastSignificantCoeffY=(1<<log2ZoTbHeight)-1である。

[0273] (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinate information of the lower 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: Identify last nonzero coefficient horizontal coordinate prefix information, last nonzero coefficient vertical coordinate prefix information, last nonzero coefficient horizontal coordinate suffix information, and last nonzero coefficient vertical coordinate suffix information. The position of the last nonzero coefficient is identified based on the prefix information of the horizontal coordinate of the last nonzero coefficient, the prefix information of the vertical coordinate of the last nonzero coefficient, the suffix information of the horizontal coordinate of the last nonzero coefficient, and the suffix information of the vertical coordinate of the last nonzero coefficient. According to a preset scanning order, all coefficients before the position of the last non-zero coefficient are encoded, and the horizontal coordinate prefix information of the last non-zero coefficient, the vertical coordinate prefix information of the last non-zero coefficient, the horizontal coordinate suffix information of the last non-zero coefficient, and the vertical coordinate suffix information of the last non-zero coefficient are written into the bitstream.

[0275] If the current block does not use the last coefficient position, it is necessary to identify the position of the last non-zero coefficient. 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, it is defaulted that all coefficients that may need to be encoded / decoded need to be encoded / decoded. That is, in normal circumstances, the coefficient encoding / decoding method is the same as the existing method in the related art. A certain situation may refer to, for example, high bit depth, high quality, high bit rate video encoding / decoding or lossless compression video encoding / decoding. It is defaulted that all coefficients that may need to be encoded / decoded need to be encoded / decoded, that is, the position of the last non-zero coefficient is no longer utilized, and all possible non-zero 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 non-zero 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 non-zero coefficients in the current block. Therefore, in the embodiment of the present application, by introducing default_last_coeff_enabled_flag, it is possible to reduce and even remove syntax elements related to the position of the last non-zero coefficient, thereby saving overhead and avoiding waste.

[0277] Also, if the video flag information indicates that the video meets the preset condition, then all scanned sub-blocks need to be coded by default, in which case there is no need to transmit sb_coded_flag in the bitstream, i.e., neither the encoder nor the decoder need to process the flag, thus improving the coding speed. Thus, in the embodiment of the present application, encoding Sub-block default encoding flag information can be further introduced, which is used to specify whether a pending sub-block is to be defaulted when encoded or not.

[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 it is 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] In addition, subblock default encoding The 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 (for example, VUI, SEI, etc.). There is no limitation thereon.

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

[0281] Thus, for example, the first value is 1 and the second value is 0. encoding To specify that the pending subblock should be coded by default, the value of default_sb_coded_flag is 1, or encoding To specify that the pending sub-block does not need to be coded by default, the value of default_sb_coded_flag is 0.

[0282] encoding If the pending sub-block needs to be coded 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 coded. encoding If the pending sub-block does not default to need to be encoded, i.e., if the sub-block default encoding flag information indicates that the pending sub-block will not default to being encoded, in some embodiments, the method may further include: determining sub-block encoding flag information of the pending sub-block, and writing the sub-block encoding 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, it 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. Or, when it is determined that a sub-block to be coded does not need to be coded, it means that all the 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 coding / decoding, it is defaulted that all scanned sub-blocks need to be coded / decoded, in other words, all scanned sub-blocks default to containing non-zero coefficients. That is, in normal circumstances, the coefficient coding / decoding method is the same as the existing method in the related art. A certain situation may refer to, for example, high bit depth, high quality, high bit rate video coding / decoding or lossless compression video coding / decoding. In this case, there are many non-zero coefficients, and most of the scanned sub-blocks need to be coded / decoded, in other words, most of the 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, which can improve the speed of coding / decoding. In addition, since the flag that rarely exists is removed, the compression performance is slightly improved at this time.

[0286] In an embodiment of the present application, a coefficient encoding method applied to an encoder is further provided: determining video flag information and a position of a last non-zero coefficient; if the video flag information indicates that the video satisfies a preset condition, determining position inversion flag information of the last non-zero coefficient; determining coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the 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 in the encoding, the video flag information, and the coordinate information of the last non-zero coefficient into a bitstream. In this way, in a high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding scenario, since the coefficient distribution rule is different from that of a normal video scenario, during coefficient encoding / decoding, the number of syntax elements to be encoded / decoded in the context mode is reduced or removed, for example, syntax elements such as the position of the last non-zero coefficient, sub-block encoding / decoding flags, and further, 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 of coefficient encoding / decoding and the encoding / decoding speed can be improved. In addition, since the syntax elements to be reduced or removed have a small effect in high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the 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, Fig. 12 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 can 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 in the 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 to be a first value if the video satisfies a predetermined condition, or to identify the value of the video flag information to be 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 identification unit 1201 is further configured to determine 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 a horizontal coordinate of the last non-zero coefficient by subtracting an initial horizontal coordinate of the last non-zero coefficient from the width of the current block, obtain 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, 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 identification unit 1201 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 bottom right corner of the current block when the value of the position reversal flag information of the last non-zero coefficient is a first value, or 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 top left corner of the current block when the value of the position reversal flag information of the last non-zero coefficient is a second value.

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

[0295] In some embodiments, the position inversion flag information of the last non-zero coefficient is at least one of flag information at 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 identification unit 1201 is further configured to determine that if the current block uses the last coefficient position, the value of the last coefficient valid flag information is a first value, or if the current block does not use the last coefficient position, the value of the last coefficient valid flag information is a second value.

[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 pre-set 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: identify, when the current block does not use a last coefficient position, the horizontal coordinate prefix information of the last non-zero coefficient, the vertical coordinate prefix information of the last non-zero coefficient, the horizontal coordinate suffix information of the last non-zero coefficient, and the vertical coordinate suffix information of the last non-zero coefficient; and identify the position of the last non-zero coefficient based on the horizontal coordinate prefix information of the last non-zero coefficient, the vertical coordinate prefix information of the last non-zero coefficient, the horizontal coordinate suffix information of the last non-zero coefficient, and the vertical coordinate suffix information of the 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 the preset scanning order, and write the horizontal coordinate prefix information of the last non-zero coefficient, the vertical coordinate prefix information of the last non-zero coefficient, the horizontal coordinate suffix information of the last non-zero coefficient, and the vertical coordinate suffix information 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, when the sub-block default encoding flag information indicates that the sub-block to be encoded is to be defaulted when encoded, encode all coefficients in the sub-block to be encoded and write bit information obtained in the encoding and the sub-block default encoding flag information to a bitstream.

[0306] In some embodiments, the first identification unit 1201 is further configured to identify sub-block encoding flag information of the sub-block awaiting encoding, and write the sub-block encoding flag information into the bitstream, when the sub-block default encoding flag information indicates that the sub-block awaiting encoding will not default when encoded.

[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 is defaulted 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 is not defaulted 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 if 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, picture level, slice level, and block level flag information.

[0310] In some embodiments, the first value is one and the second value is zero.

[0311] In some embodiments, the first identification unit 1201 is further configured to determine 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 a 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 determine that when 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 a 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 meets lossless compression, the lossless compression flag information indicates that the video meets a preset condition.

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

[0316] When the integrated unit is implemented as a software function 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, the essential part of the technical solution of the present application, or the part that can contribute 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 the present embodiment. The storage medium includes various kinds 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 applicable to the encoder 120. The computer storage medium stores a computer program, which, when executed by the first processor, performs any of the methods in the above embodiments.

[0318] Based on the above-mentioned structure of the encoder 120 and the computer storage medium, refer to FIG. 13, which is a schematic diagram showing a specific hardware structure of the encoder 120 according to an embodiment of the present application. As shown in FIG. 13, the encoder 120 can include a first communication interface 1301, a first memory 1302 and a first processor 1303. Each component is coupled through a first bus system 1304. The first bus system 1304 is used to realize the 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 the sake of clarity, various buses are marked as the first bus system 1304 in FIG. 13.

[0319] The first communication interface 1301 is used for sending and receiving 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; identifying position reversal flag information of a last non-zero coefficient when the video flag information indicates that the video satisfies a preset condition; 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 of the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memory. The non-volatile 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 examples, various RAMs are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch-link DRAM, SLDRAM), and direct rambus random access memory (direct rambus RAM, DRRAM). The first memory 1302 of the systems and methods described herein may 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 having 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 an instruction 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, a discrete hardware component. The processor can realize 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 ordinary 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 located 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, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the first memory 1302. The first processor 1303 reads the information in the first memory 1302 and completes the steps of the above method together with the hardware of the processor.

[0324] It may be understood that the embodiments described herein may be realized by hardware, software, firmware, middleware, microcode, or a combination thereof. When realized by hardware, the processing unit may be realized 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 realized by software, the techniques described herein may be realized by modules (e.g., procedures, functions, etc.) for performing the functions described herein. The software code is stored in a memory and executed by a processor. The memory may be realized within the processor or external to the processor.

[0325] Optionally, as 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 an encoding unit. In this way, in a scenario of high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the coefficient distribution rule is different from that of a normal video scenario, so that during coefficient encoding / decoding, the number of syntax elements encoded / decoded in the context mode can be reduced or removed, thereby reducing the overhead of encoding / decoding in the bitstream and improving the throughput and encoding / decoding speed of coefficient encoding / decoding. In addition, the syntax elements reduced or removed have a small effect in the video encoding / decoding of high bit depth, high bit rate, high quality, or lossless compression, so that the compression efficiency can 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 a structure of a decoder 140 according to an embodiment of the present application. As shown in Fig. 14, the decoder 140 can include a parsing 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 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 parsing 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 parsing 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 when the value of the video flag information is a first value, the video flag information indicates that the video satisfies the preset condition, or when 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 identification unit 1402 is further configured to determine 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 last non-zero coefficient horizontal coordinate prefix information, last non-zero coefficient vertical coordinate prefix information, last non-zero coefficient horizontal coordinate suffix information, and last non-zero coefficient vertical coordinate suffix information; The second identification unit 1402 is further configured to identify a 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 a 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 a horizontal distance and a vertical distance from a 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 a width and a height of the current block, obtain a horizontal coordinate of the last non-zero coefficient by subtracting a 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 a vertical coordinate of the last non-zero coefficient by subtracting a 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 identification 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, 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 top-left corner of the current block, 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 top-left corner of the current block.

[0335] In some embodiments, the position reversal flag information of the last non-zero coefficient is at least one of flag information at 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 valid flag information, and if the last coefficient valid flag information indicates that the current block utilizes the last coefficient position, decode all coefficients before the last coefficient position according to a preset scan 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 to, when the value of the last coefficient valid flag information is a second value, parse the bitstream to obtain last non-zero coefficient horizontal coordinate prefix information, last non-zero coefficient vertical coordinate prefix information, last non-zero coefficient horizontal coordinate suffix information, and last non-zero coefficient vertical coordinate suffix information; The second identification unit 1402 is further configured to identify the position of the last non-zero coefficient based on the horizontal coordinate prefix information of the last non-zero coefficient, the vertical coordinate prefix information of the last non-zero coefficient, the horizontal coordinate suffix information of the last non-zero coefficient, and the vertical coordinate suffix information 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 pre-set 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 a preset condition, and determine that the value of the sub-block decoding flag information is a first value when the sub-block default decoding flag information indicates that a sub-block awaiting decoding in the current block will default when decoded, 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 if 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 if 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 awaiting decoding 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 awaiting decoding 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 all coefficients in the sub-block to be decoded as being 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 one and the second value is zero.

[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 that the video meets 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 that the video meets the predetermined 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, identify that the video meets a preset condition if the high quality flag information indicates that the video meets high quality.

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

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

[0356] When the integrated unit is implemented as a software function 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, the essential part of the technical solution of the present application, or the part that can contribute 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 the present 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 the first processor, performs any of the methods in the above embodiments.

[0358] Based on the above-mentioned structure of the decoder 140 and the computer storage medium, refer to FIG. 15, which is a schematic diagram showing a specific hardware structure of the decoder 140 according to an embodiment of the present application. As shown in FIG. 15, the decoder 140 can include a second communication interface 1501, a second memory 1502 and a second processor 1503. Each component is coupled through a second bus system 1504. The second bus system 1504 is used to realize the 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 of explanation, in FIG. 15, various buses are marked as the second bus system 1504.

[0359] The second communication interface 1501 is used for sending and receiving 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] The second processor 1503, when executing the computer program, Parsing the bitstream to obtain video flag information; When 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 position reversal of the last non-zero coefficient, determining the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient; Decoding all coefficients prior to the position of the last non-zero coefficient according to a preset scanning order to identify the coefficients of the current block.

[0362] Optionally, as 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 a similar hardware function to the first memory 1302, and the second processor 1503 has a similar hardware function to the first processor 1303, so detailed description thereof will be omitted.

[0364] In an embodiment of the present application, a decoder is provided. The decoder may include an analysis unit and a second identification unit. In this way, in a high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding scenario, the coefficient distribution rule is different from that of a normal video encoding / decoding scenario, so that during coefficient encoding / decoding, the number of syntax elements encoded / decoded in the context mode can be reduced or removed, thereby reducing the overhead of encoding / decoding in the bitstream and improving the throughput and encoding / decoding speed of coefficient encoding / decoding. In addition, the syntax elements reduced or removed have a small effect in high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, so that the compression efficiency can be improved.

[0365] It should be noted that in this application, terms such as "comprises," "comprising," 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 limited, a process, method, article, or apparatus that includes an element limited by the phrase "comprises..." does not exclude the presence of other identical elements.

[0366] The sequence numbers of the embodiments of the present application above are not used to indicate superiority or inferiority of the embodiments, but are used for explanation 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, unless inconsistent.

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

[0369] The features disclosed in any method or apparatus embodiment of the present application may be combined in any manner, unless inconsistent, to arrive at 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 a person skilled in the art can easily think of 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 a decoder, in a scenario of high bit depth, high bit rate, high quality, or lossless compression video encoding / decoding, the coefficient distribution rule is different from that of a normal video scenario, so that during coefficient encoding / decoding, the number of syntax elements to be encoded / decoded in the context mode is reduced or removed, for example, syntax elements such as the position of the last non-zero coefficient, sub-block encoding / decoding flag, and further, 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. In addition, since the syntax elements to be reduced or removed have a small effect in the video encoding / decoding of high bit depth, high bit rate, high quality, or lossless compression, the compression efficiency can also be improved.

Claims

1. A coefficient decoding method applied to a decoder, comprising the steps of: Parsing the bitstream to obtain video flag information; If the video flag information indicates that the video satisfies a preset condition, parsing the bitstream to obtain position reversal flag information of a last non-zero coefficient and coordinate information of a 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 prior to the position of the last non-zero coefficient according to a preset scanning order to identify coefficients of the current block.

13. 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 determining the position of the last non-zero coefficient based on the coordinate information of the last non-zero coefficient; and decoding all coefficients prior to the position of the last non-zero coefficient according to the preset scanning order to identify coefficients of the current block.

2. The method of claim 1, wherein the coefficients are decoded in a stepwise manner.

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

2. The method of claim 1, wherein the coefficients are decoded in a stepwise manner.

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 method of claim 3, wherein the coefficients are decoded in a stepwise manner.

5. The coefficient decoding method includes: determining that 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 when the value of the position reversal flag information of the last non-zero coefficient is a first value; 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 method of claim 1, wherein the coefficients are decoded in a stepwise manner.

6. Parsing the bitstream to obtain coordinate information of the last non-zero coefficient includes: Parsing the bitstream to obtain 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; determining a 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; determining a 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 the 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.

2. The method of claim 1, wherein the coefficients are decoded in a stepwise manner.

7. 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 a 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: determining a width and height of the current block; obtaining a horizontal coordinate of the last non-zero coefficient by subtracting a horizontal distance from the position of the last non-zero coefficient to a lower right corner of the current block from a 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 a height of the current block; determining a location 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 method of claim 1, wherein the coefficients are decoded in a stepwise manner.

8. 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 a 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 a horizontal distance and a vertical distance from the location of the last non-zero coefficient to a top-left corner of the current block.

2. The method of claim 1, wherein the coefficients are decoded in a stepwise manner.

9. 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 method of claim 1, wherein the coefficients are decoded in a stepwise manner.

10. The coefficient decoding method includes: determining a width and a height of a transformation block obtained by performing a preset operation on the current block; Performing coordinate calculation based on the width and height of the transformation block to obtain coordinate information of the lower right corner of the transformation block; and determining the last coefficient position based on coordinate information of a lower right corner of the transformation block.

2. The method of claim 1, wherein the coefficients are decoded in a stepwise manner.

11. The preset operation includes at least a zero-out operation.

11. The method of claim 10, wherein the coefficients are decoded.

12. A coefficient coding method applied to an encoder, comprising: Identifying video flag information and the location of the last non-zero coefficient; determining position reversal flag information of a last non-zero coefficient when the video flag information indicates that the video satisfies a preset condition; 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; 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 coordinate information of the last non-zero coefficient into a bitstream.

4. A coefficient coding method comprising:

13. An 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 a 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 position inversion flag information of the last non-zero coefficient; the encoding unit is configured to encode all coefficients before a position of the last non-zero coefficient according to a preset scanning order, and write bit information obtained by encoding, the video flag information, and coordinate information of the last non-zero coefficient into a bitstream.

16. An encoder comprising:

14. A decoder comprising a parsing unit and a second identifying unit, The parsing unit is configured to parse a 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 a last non-zero coefficient and coordinate information of a 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 uses the position reversal of the last non-zero coefficient; the parsing 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 coefficients of the current block.

23. A decoder comprising:

15. 1. A computer storage medium, comprising: A computer program is stored in the computer storage medium, and when the computer program is executed, the coefficient decoding method according to any one of claims 1 to 11 or the coefficient encoding method according to claim 12 is executed. A computer storage medium 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