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

The coefficient encoding and decoding method addresses the challenges of high bit depth and high bit rate by analyzing bitstream video flag information to efficiently encode and decode coefficients, thereby improving throughput, speed, and compression efficiency.

JP2025081632AActive Publication Date: 2025-05-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies face challenges with high bit depth, high bit rate, high quality, and lossless compression, leading to increased overhead, waste, and decreased encoding and decoding speed and throughput.

Method used

A coefficient encoding and decoding method that analyzes bitstream video flag information to identify the position of the last non-zero coefficient, allowing for efficient encoding and decoding by reducing or removing syntax elements in the context mode and performing coordinate conversion to minimize overhead.

Benefits of technology

Improves the throughput and speed of coefficient encoding and decoding, while also enhancing compression efficiency in scenarios with high bit depth, high bit rate, high quality, or lossless compression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025081632000001_ABST
    Figure 2025081632000001_ABST
Patent Text Reader

Abstract

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

Description

Technical Field

[0001] Embodiments of the present application relate to the field of video encoding and decoding technologies, and in particular, to coefficient encoding and decoding methods, encoders, decoders, and computer storage media.

Background Art

[0002] As the requirements for video display quality increase, the fields related to computer vision are attracting attention. In recent years, image processing technologies have been successfully applied in various industries. In the process of video image encoding and decoding, on the encoding side, after converting and quantizing the image data waiting for encoding, it is compressed and encoded by an entropy encoding unit, and the bitstream generated by the entropy encoding is transmitted to the decoding side. On the decoding side, the bitstream can be analyzed, and after undergoing inverse quantization and inverse transformation processes, the original input image data can be restored.

[0003] Currently, compared with video encoding and decoding with low bit depth, low quality, and low bit rate (which can be referred to as "ordinary video"), video encoding and decoding with high bit depth, high quality, and high bit rate (abbreviated as "three-high video") usually requires encoding and decoding more and larger coefficients. Thus, in three-high video, according to existing related schemes, it may bring a larger overhead, cause waste, and further affect the encoding and decoding speed and throughput.

Summary of the Invention

[0004] In embodiments of the present application, a coefficient encoding and decoding method, an encoder, a decoder, and a computer storage media are provided. Thereby, in scenarios of video encoding and decoding with high bit depth, high bit rate, high quality, or lossless compression, the throughput of coefficient encoding and decoding and the encoding and decoding speed can be improved, and the compression efficiency can also be improved.

[0005] The technical solution of the embodiment of the present application can be realized as follows.

[0006] In a first aspect, in the embodiment of the present application, a coefficient decoding method applied to a decoder is provided. The method includes: analyzing a bitstream to obtain video flag information; when the video flag information indicates that the video meets a preset condition, analyzing the bitstream to obtain last non-zero coefficient position inversion flag information and last non-zero coefficient coordinate information; when the last non-zero coefficient position inversion flag information indicates that the current block uses the position inversion of the last non-zero coefficient, specifying the position of the last non-zero coefficient by calculating the last non-zero coefficient coordinate information; decoding all coefficients before the position of the last non-zero coefficient according to a preset scan order to specify the coefficients of the current block.

[0007] In a second aspect, in the embodiment of the present application, a coefficient encoding method applied to an encoder is provided. The method includes: specifying video flag information and the position of the last non-zero coefficient; when the video flag information indicates that the video meets a preset condition, specifying the last non-zero coefficient position inversion flag information; specifying the last non-zero coefficient coordinate information based on the position of the last non-zero coefficient and the last non-zero coefficient position inversion flag information; encoding all coefficients before the position of the last non-zero coefficient according to a preset scan order, and writing the bit information obtained by encoding, the video flag information, and the last non-zero coefficient coordinate information into a bitstream.

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

[0009] In a fourth aspect, in an embodiment of the present application, an encoder is provided. The encoder includes 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 execute the method described in the second aspect when executing the computer program.

[0010] In a fifth aspect, in an embodiment of the present application, a decoder is provided. The decoder includes an analysis unit and a second identification unit. The analysis unit is configured to analyze the bit stream to obtain video flag information, and when the video flag information indicates that the video satisfies a preset condition, analyze the bit stream to obtain the last non-zero coefficient position inversion flag information and the coordinate information of the last non-zero coefficient. The second identification unit is configured to identify the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient when the last non-zero coefficient position inversion flag information indicates that the current block uses the inversion of the position 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 the coefficients of the current block.

[0011] In a sixth aspect, in an embodiment of the present application, a decoder is provided. The decoder includes 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 execute the method described in the first aspect when executing the computer program.

[0012] In a seventh aspect, in an embodiment of the present application, a computer storage medium is provided. A computer program is stored in the computer storage medium, and when the computer program is executed, the method described in the first aspect or the method described in the second aspect is executed.

[0013] In an embodiment of the present application, a coefficient encoding / decoding method, an encoder, a decoder, and a computer storage medium are provided. In the encoder, video flag information and the position of the last non-zero coefficient are identified. When the video flag information indicates that the video satisfies a preset condition, the 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, the coordinate information of the last non-zero coefficient is identified. According to a preset scan order, all coefficients before the position of the last non-zero coefficient are encoded, and the bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient are written into a bit stream. In the decoder, the bit stream is analyzed to obtain the video flag information. When the video flag information indicates that the video satisfies a preset condition, the bit stream 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. When the position inversion flag information of the last non-zero coefficient indicates that the current block uses the 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 high bit depth, high bit rate, high quality, or reversible compression video encoding / decoding, since the coefficient distribution rule is different from that of a normal video scenario, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in the context mode is reduced or removed. For example, syntax elements such as the position of the last non-zero coefficient and the sub-block encoding / decoding flag are included. Further, when the value of the coordinate information of the last non-zero coefficient is large, coordinate conversion is performed to reduce the overhead due to encoding / decoding in the bit stream, and the throughput and encoding / decoding speed of coefficient encoding / decoding can be improved. Also, since the syntax elements to be reduced or removed have little impact on high bit depth, high bit rate, high quality, or reversible compression video encoding / decoding, the compression efficiency can also be improved.

Brief Description of the Drawings

[0014]

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8A

Figure 8B

Figure 9

Figure 10A

Figure 10B

Figure 11

Figure 12

Figure 13

Figure 14

Figure 15

Embodiments for Carrying Out the Invention

[0015] In order to more clearly understand the features and technical content 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 drawings. The attached drawings are used only for explanation and do not limit the embodiments of the present application.

[0016] All technical and scientific terms used in this specification have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs, unless otherwise defined. The terms used in this specification are for the purpose of explaining the embodiments of the present application and are not intended to limit the present application.

[0017] In the following description, although it relates to "some embodiments", which describe a subset of all possible embodiments, it can be understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and they may be combined with each other as long as there is no contradiction. It should be noted that the terms "first / second / third" according to the embodiments of the present application are merely used to distinguish similar objects and do not mean a specific order of the objects. So that the embodiments of the present application described in this specification can be implemented in an order other than the order illustrated or described in this specification, "first / second / third" can exchange a specific order or priority when permitted.

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

[0019] Before further elaborating on the embodiments of the present application, nouns and terms related to the embodiments of the present application will be described. The nouns and terms related to the embodiments of the present application are applied to the following interpretations. 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 coding / decoding standard H.266 / Multipurpose Video Coding (VVC), VVC reference software test platform (VVC Test Model, VTM), Audio Video Standard (AVS), AVS high-performance test model (High-Performance Model, HPM), Context-based Adaptive Binary Arithmetic Coding (CABAC) Regular Residual Coding (RRC) Transform Skip Residual Coding (TSRC)

[0020] Currently, a block-based hybrid encoding / decoding framework is used in general-purpose video encoding / decoding standards (e.g., VVC). Each image (frame) in a video picture is divided into the largest coding units (LCUs) of the same size of a square (e.g., 128×128, 64×64, etc.), and each LCU can also be divided into rectangular coding units (CUs) based on rules, and the CU can also be divided into smaller prediction units (PUs), transform units (TUs), etc. Specifically, as shown in FIG. 1, the hybrid encoding / 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. Since there is a strong correlation between adjacent samples in a video picture, in video encoding / decoding technology, the spatial redundancy between adjacent samples can be eliminated by using the intra prediction method. Since there is a strong similarity between adjacent images in a video, in video encoding / decoding technology, the inter prediction method can be used to eliminate the temporal redundancy between adjacent images and improve the encoding / decoding efficiency.

[0021] The basic flow of a video encoder / decoder is as follows. In the encoder, one image is divided into blocks, and a predicted block of the current block is generated by performing intra prediction or inter prediction on the current block. The predicted block is subtracted from the original block of the current block to obtain a residual block. The residual block is transformed and quantized to obtain a quantized coefficient matrix. The quantized coefficient matrix is entropy encoded and output to a bitstream. In the decoder, a predicted block of the current block is generated by performing intra prediction or inter prediction on the current block. On the other hand, the bitstream is decoded to obtain a quantized coefficient matrix. The quantized coefficient matrix is inverse quantized and inverse transformed to obtain a residual block. The predicted block and the residual block are added to obtain a reconstructed block. The reconstructed block forms a reconstructed image. The reconstructed image is loop-filtered based on the image or block to obtain a decoded image. In the encoder as well, in order to obtain a decoded image, processing similar to that of the decoder is required. The decoded image can be a reference image for inter prediction of subsequent images. The block division information specified in the encoder, and mode information or parameter information such as prediction, transformation, quantization, entropy encoding, loop filtering, etc. are output to the bitstream as necessary. The decoder analyzes and analyzes the existing information to identify the same block division information, mode information or parameter information such as prediction, transformation, quantization, entropy encoding, loop filtering, etc. as the encoder. Thereby, it is ensured 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 a reconstructed image. During prediction, the current block may be divided into prediction units, and during transformation, the current block may be divided into transformation units, and the divisions of the prediction units and the transformation units may be different. The above is the basic flow of a video encoder / decoder in a block-based hybrid encoding / decoding framework. With the development of technology, some modules or steps in the framework or flow may be optimized.Embodiments of the present application are applicable to the basic flow of video encoders and decoders in a hybrid encoding / decoding framework based on the block, but are not limited to the framework or the flow.

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

[0023] Block splitting information, and respective mode information and parameter information of prediction, transform, and quantization, coefficients, etc. are written into the bitstream by entropy encoding. Assuming that the probabilities of different elements are different, by assigning short codewords to elements with high appearance probabilities and long codewords to elements with low appearance probabilities, higher encoding efficiency can be obtained compared to fixed-length encoding. However, if the probabilities of different elements are close or almost the same, the compression space by entropy encoding will be limited. CABAC is a common entropy encoding method, and in HEVC and VCC, etc., CABAC is used for entropy encoding. CABAC can improve the compression efficiency by using a context model, but the operations become more complex in the use and update of the context mode. CABAC has a bypass mode. In the bypass mode, the use and update of the context model are not required, and higher throughput can be achieved. In the embodiments of the present application, in CABAC, the mode that requires the use and update of the context model can be called the context mode.

[0024] Generally, first, it is necessary to identify a context model based on a defined method. When calling a defined binary decision arithmetic decoding process, the parameters of the context model can be used as input. In the selection of the context model, there is a dependency relationship between adjacent coefficients. For example, FIG. 2 is a schematic diagram showing the positional relationship between the current coefficient and the adjacent coefficients according to the related art. In FIG. 2, the black blocks represent the current coefficients, and the grid-line blocks represent 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 determined based on the information of the five coefficients adjacent to the right, below, and bottom-right of the current coefficient. As can be further seen from FIG. 2, the operation of the context mode is much more complex than that of the bypass mode, and there is a dependency relationship between adjacent coefficients.

[0025] In the arithmetic encoding / decoding engine of CABAC, when the use of the context mode is required, it is necessary to call a defined binary decision arithmetic decoding process. The process includes a state transition process, that is, an update of the context model. In the binary decision arithmetic decoding process, a renormalization process of the arithmetic decoding engine is called. When using the bypass mode, it is necessary to call a bypass decoding process.

[0026] Hereinafter, the use of CABAC in VVC will be introduced as an example.

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

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

[0029] Figure 3 is a flowchart showing the arithmetic decoding process of bin according to the related art. As shown in Figure 3, in order to decode the value of bin, the context index table ctxTable, ctxIdx, and bypassFlag are transmitted as inputs to the arithmetic decoding process DecodeBin(ctxTable, ctxIdx, bypassFlag), and the details are as follows. If the value of bypassFlag is 1, call the bypass decoding process DecodeBypass(). Otherwise, if the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, call DecodeTerminate(). Otherwise (when 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] Figure 4 is a flowchart showing the binary decision arithmetic decoding process according to the related art. As shown in Figure 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 pStateIdx0 and pStateIdx1 related to 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 variable ivlCurrRange to ivlCurrRange - ivlLpsRange and perform the following operations. If ivlOffset is greater than or equal to ivlCurrRange, the value of 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 variable binVal is valMps.

[0034] Give the value of binVal and perform the defined state transition. Based on the current value of ivlCurrRange, the defined renormalization can be performed.

[0035] Furthermore, in the state transition process, the input of the process is the current pStateIdx0 and pStateIdx1, and the decoded value binVal, and the output of the process is the updated context variables pStateIdx0 and pStateIdx1 related to ctxTable and ctxIdx. Variables shift0 and shift1 are derived from shiftIdx, and the correspondence between shiftIdx and 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 related to ctxTable and ctxIdx are updated as follows. pStateIdx0 = pStateIdx0 - (pStateIdx0 >> shift0) + (1023 * binVal >> shift0), pStateIdx1 = pStateIdx1 - (pStateIdx1 >> shift1) + (16383 * binVal >> shift1).

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

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

[0039] In the overall process, due to the data in the bitstream, ivlOffset will not become greater than ivlCurrRange.

[0040] Furthermore, the input to the binary decision bypass decoding process is the bits in the slice data, and the variables ivlCurrRange and ivlOffset, and the output is the updated variable ivlOffset, and the decoded value binVal.

[0041] When bypassFlag is 1, the bypass decoding process is called, and FIG. 6 is a flowchart 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. The 1 bit obtained by read_bits(1) is shifted into ivlOffset. The value of ivlOffset is compared with the value of ivlCurrRange, and the subsequent steps are as follows. If ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1, and ivlOffset is equal to what is obtained by subtracting ivlCurrRange from ivlOffset. Otherwise (if ivlOffset is less than ivlCurrRange), the value of binVal is set to 0.

[0042] In the whole process, ivlOffset will not be greater than or equal to ivlCurrRange due to the data in the bit stream.

[0043] It should be understood that in the current video encoding and decoding standards, generally one or more types of transform and transform skip are supported for the residual. The transform includes, for example, the Discrete Cosine Transform (DCT). The residual block using the transform generally exhibits certain characteristics after being transformed (and quantized). For example, after some transformation (and quantization), energy is concentrated more in the low-frequency region, so the coefficients in the upper left corner region become larger, the coefficients in the lower right corner region become smaller, and there are also many zero coefficients. On the other hand, transform skip literally means not performing the transform. Since the coefficients after transform skip have a different distribution rule from the coefficients after transform, different coefficient encoding and decoding methods can be used. For example, in VCC, RRC is used for the coefficients after transform, and TSRC is used for the coefficients after transform skip.

[0044] In a general transform, for example, in the DCT transform, in the transformed block, the frequency gradually increases from left to right and gradually increases 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 not particularly sensitive to high-frequency information. Utilizing this characteristic, processing or removing some high-frequency information more does not have much impact on vision. In some technologies, for example, in zero-out, some high-frequency information can be forced to be set to 0. As an example, for a 64×64 block, the coefficients at positions where the abscissa is 32 or more, or the ordinate is 32 or more, are forced to be set to 0. The above is just an example, and since the zero-out range can be derived in a more complex way, the explanation here is omitted. As shown in FIG. 7, there may be non-zero coefficients (also called significant coefficients) in the upper left corner (i.e., the region where non-zero coefficients can exist), and all the coefficients in the lower right corner are set to zero (i.e., the zero-out region). In this way, for subsequent coefficient encoding and decoding, since the coefficients in the zero-out region are always 0, there is no need to be encoded.

[0045] Furthermore, after converting (and quantizing) the residuals in normal video, since the coefficient distribution shows the characteristic that the coefficients in the upper left corner are large and there are many zero coefficients in the lower right corner, during coefficient encoding / decoding, several methods are used to make the coefficients within a certain range in the upper left corner require encoding / decoding and the coefficients within a certain range in the lower right corner do not require encoding / decoding (i.e., default these coefficients to be 0). In one method, when encoding / decoding the coefficients of a block, first identify the position of the last non-zero coefficient of that block according to the scan order. After identifying this position, all the coefficients after the position of the last non-zero coefficient according to the scan order are considered to be 0, that is, they do not require encoding / decoding. Only the position of the last non-zero coefficient and the coefficients before that position require encoding / decoding. For example, in VVC, last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix are used to identify the position (LastSignificantCoeffX, LastSignificantCoeffY) of the last non-zero coefficient.

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

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

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

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

[0050] (c) last_sig_coeff_x_suffix specifies the suffix of the horizontal (or column) coordinate of the last non-zero coefficient in the current block according to the 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 (including these two boundary values).

[0051] The value LastSignificantCoeffX of the horizontal (or column) coordinate of the last non-zero coefficient in the current transform block according to the scan order is derived as follows. If last_sig_coeff_x_suffix does not exist, LastSignificantCoeffX = last_sig_coeff_x_prefix. Otherwise (if last_sig_coeff_x_suffix exists), LastSignificantCoeffX = (1 << ((last_sig_coeff_x_prefix >> 1) - 1)) * (2 + (last_sig_coeff_x_prefix & 1)) + last_sig_coeff_x_suffix.

[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 according to the scan order. The value of last_sig_coeff_y_suffix should be in the range from 0 to (1<<((last_sig_coeff_y_prefix>>1)-1))-1, inclusive of these two boundary values.

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

[0054] Also, the last non-zero coefficient and all the coefficients before the last non-zero coefficient need to be encoded and decoded. However, in normal video, a certain percentage of these coefficients are still 0. In VVC, the flag sb_coded_flag indicating the necessity of encoding and decoding of the current sub-block is used to determine whether the coefficients in the current sub-block need to be encoded and decoded. If encoding and decoding are 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 at position (xS, yS) in the current transform block, and the sub-block is an array of transform coefficient levels. If the value of sb_coded_flag[xS][yS] is 0, all transform coefficient levels in the sub-block at position (xS, yS) in the current transform block become 0. If sb_coded_flag[xS][yS] does not exist, the value of sb_coded_flag[xS][yS] is 1.

[0056] Furthermore, when processing coefficient encoding / decoding, the compression efficiency can be improved by utilizing the characteristics of the coefficients. For example, in normal video, among the coefficients that require encoding / decoding, a certain percentage of the coefficients are 0. Therefore, whether the current coefficient is 0 can be represented 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 been completed; otherwise, it is necessary to continue the encoding / decoding of the current coefficient. As another example, in normal video, among the non-zero coefficients, a certain percentage of the coefficients have an absolute value of 1. Therefore, whether the absolute value of the current coefficient is greater than 1 can be represented by one syntax element, and this syntax element is usually one binary symbol. If the absolute value of the current coefficient is 1 or less, it means that the encoding / decoding of the current coefficient has been completed; otherwise, it is necessary to continue the encoding / decoding of the current coefficient. For example, the syntax elements related to VCC are as follows.

[0057] sig_coeff_flag[xC][yC] is used to identify whether the corresponding transform coefficient level at position (xC, yC) in 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 position (xC, yC) 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 assumed to be 0.

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

[0060] Thus, after processing the above flag (or what is called a syntax element), if the encoding / decoding of the current coefficient has not yet been completed, it is necessary to encode the remaining value of the absolute value of the coefficient (e.g., abs_remainder in VVC).

[0061] abs_remainder[n] is the remaining absolute value of the transform coefficient level that is encoded / decoded with the Golomb-Rice code at scan position n. If abs_remainder[n] does not exist, the value of abs_remainder[n] is 0.

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

[0063] dec_abs_level[n] is an intermediate value encoded and decoded with the Golomb-Rice code at the scan position n. When analyzing dec_abs_level[n], ZeroPos[n] can be derived. The absolute value AbsLevel[xC][yC] of the transform coefficient level at the position (xC, yC) is derived in the following way. If dec_abs_level[n] does not exist or 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] All of the above are absolute values of coefficients, and the sign of non-zero coefficients can be specified by the coefficient sign flag `coeff_sign_flag` or some sign derivation methods. `coeff_sign_flag[n]` can be used to specify the sign of the conversion coefficient at the scan position `n` based on the following method. If the value of `coeff_sign_flag[n]` is 0, the corresponding conversion coefficient is a positive value. Otherwise (if the value of `coeff_sign_flag[n]` is 1), the corresponding conversion coefficient is a negative value.

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

[0066] Note that `CoeffSignLevel[xC][yC]` may be derived by some other methods, but the description here is omitted.

[0067] In addition, the VVC also uses the parity flag `par_level_flag` of the coefficient value. With this flag, the parity of the current coefficient value can be known, and this flag is used for the specification of the current coefficient value and 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] does not exist, the value of par_level_flag[n] is 0.

[0069] par_level_flag can be used to identify the parity of the transform coefficient, and together with abs_level_gtx_flag, abs_remainder, etc., it can also be used to identify the magnitude of the coefficient.

[0070] Here, context mode encoding / decoding needs to select, utilize, and update the context mode, while bypass mode encoding / decoding does not need to select, utilize, and update the context mode. Usually, within a certain range, it is more hardware design-friendly to place the syntax elements encoded / decoded in the context mode together and the syntax elements encoded / decoded in the bypass mode together. 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 also be further divided into several groups.

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

[0072]

Table 1

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

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

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

[0076]

Table 2

[0077] After entering the function residual_ts_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx), it is necessary to identify some information about the block size. Next, the value of RemCcbs is identified, that is, it is identified based on the equation RemCcbs = ((1 << (log2TbWidth + log2TbHeight)) × 7) >> 2. RemCcbs specifies the number of syntax elements encoded and decoded in the context mode in the current block. In the embodiments of the present application, RemCcbs can be understood as remaining context coded binaries, that is, the remaining number of binary symbols encoded and decoded in the context mode. Whether the current sub-block needs to be encoded and decoded is specified for each sub-block. If it needs to be encoded and decoded, different from the above RRC, in the TSRC method, the syntax elements encoded and decoded in the context mode in one sub-block are set in the second round, and for each coefficient, at most four syntax elements encoded and decoded in the context mode are processed in the first round and the second round respectively. The syntax elements encoded and decoded in the bypass mode are set later. In the first round and the second round, each time a syntax element encoded and decoded in the context mode is processed, 1 is subtracted from remBinsPass1. If one coefficient is large enough, after processing some syntax elements encoded and decoded in the context mode in the first round and the second round, it is necessary to process the remaining value (that is, abs_remainder). If remBinsPass1 is small enough (when it does not satisfy remBinsPass1 >= 4), the first two rounds are completed, and the remaining coefficients are directly processed in the bypass mode, and in this case, it is still abs_remainder.

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

[0079] Compared with low-bit-depth, low-quality, low-bitrate video (ordinary video), high-bit-depth, high-quality, high-bitrate video ("three-high video") usually has more coefficients that require encoding and decoding, and the coefficients are larger. For example, for one block of the same size, the number of coefficients that require encoding and decoding in three-high video is much larger than that in ordinary video. This is because in the blocks of ordinary video, many coefficients after prediction, transformation, and quantization become zero, while in the blocks of three-high video, many coefficients after prediction, transformation, and quantization are non-zero coefficients. In the blocks of ordinary video, since the proportion of coefficients that require encoding and decoding among the coefficients after prediction, transformation, and quantization is large, it is very effective to distinguish the region of coefficients that require encoding and decoding or not at the position of the last significant coefficient (LastSignificantCoeffX, LastSignificantCoeffY). Since the proportion of coefficients before the position of the last significant coefficient being zero is large, it is very effective to further distinguish whether the current sub-block requires encoding and decoding with a flag sb_coded_flag indicating the necessity of encoding and decoding of the sub-block. However, when there are a very large number of non-zero coefficients in the current block, and most coefficients, even all coefficients, are non-zero coefficients, filtering a large number of non-zero coefficients with the position of the last significant coefficient and the flag indicating the necessity of encoding and decoding of the sub-block is not possible. Also, encoding and decoding the position of non-zero coefficients and the flag indicating the necessity of encoding and decoding of the sub-block in the bitstream itself occupies a certain overhead and causes waste.

[0080] In another aspect, the position of the last significant coefficient, the flag indicating the necessity of encoding and decoding of the sub-block, etc. are all encoded and decoded in the context mode. Context mode encoding and decoding is more complex than the bypass mode, and processing this information also affects the encoding and decoding speed and throughput of software and hardware.

[0081] In other cases, 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 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. Therefore, the values of LastSignificantCoeffX and LastSignificantCoeffY are generally small. In high-definition videos, there are also many non-zero coefficients in the lower right corner. Therefore, the values of LastSignificantCoeffX and LastSignificantCoeffY generally become large. Encoding and decoding large values in the bitstream will result in a larger overhead. In addition, this method may also be used for lossless compression. This is because quantization cannot be used during lossless compression. In this case, generally, the coefficients are relatively numerous and relatively large. In this case, using existing related schemes will result in a larger overhead, causing waste, and further affecting the speed and throughput of encoding and decoding.

[0082] In an embodiment of the present application, a coefficient decoding method applied to a decoder is provided. Analyze the bitstream to obtain video flag information. When the video flag information indicates that the video meets a preset condition, analyze the bitstream to obtain the position inversion flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. When the position inversion flag information of the last non-zero coefficient indicates that the current block uses the position inversion of the last non-zero coefficient, calculate the coordinate information of the last non-zero coefficient to identify the position of the last non-zero coefficient. Decode all the coefficients before the position of the last non-zero coefficient according to a preset scan order to identify 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. Video flag information and the position of the last non-zero coefficient are identified. When the video flag information indicates that the video satisfies a preset condition, last non-zero coefficient position inversion flag information is identified. Based on the position of the last non-zero coefficient and the last non-zero coefficient position inversion flag information, the coordinate information of the last non-zero coefficient is identified. According to a preset scan order, all coefficients before the position of the last non-zero coefficient are encoded, and the bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient are written into a bit stream.

[0084] Thus, in scenarios of high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, since the coefficient distribution rule is different from that of normal video scenarios, during coefficient encoding and decoding, the number of syntax elements encoded and decoded in the context mode is reduced or removed. For example, syntax elements such as the position of the last non-zero coefficient and the sub-block encoding / decoding flag are included. Further, when the value of the coordinate information of the last non-zero coefficient is large, coordinate conversion is performed to reduce the overhead due to encoding and decoding in the bit stream, and the throughput and speed of coefficient encoding and decoding can be improved. Also, since the syntax elements to be reduced or removed have little impact on high bit-depth, high bit-rate, high-quality, or lossless video encoding and 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 splitting unit 101, a prediction unit 102, a first adder 107, a conversion unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse conversion unit 111, a second adder 112, a filtering unit 113, a decoded picture buffer (DPB) unit 114, and an entropy encoding unit 115. Here, the input of the encoder 100 may be a video consisting of a series of images or a single still image, and the output of the encoder 100 may be a bitstream (which may also be referred to as a "code stream") representing a compressed version of the input video.

[0087] The splitting unit 101 splits the images in the input video into one or more coding tree units (CTUs). The splitting unit 101 may split the image into a plurality of tiles, and further split one tile into one or more bricks. Here, one tile or one brick may include one or more complete and / or partial CTUs. Also, the splitting unit 101 may form one or more slices. One slice may include one or more tiles in the image arranged in raster order, or one or more tiles in the image covering a rectangular region. The splitting unit 101 may further form one or more sub-images, and the sub-images may include one or more slices, tiles, or bricks.

[0088] In the encoding process of the symbolizer 100, the splitting unit 101 transmits the CTU to the prediction unit 102. The prediction unit 102 generally can include a block splitting unit 103, a motion estimation (ME) unit 104, a motion compensation (MC) unit 105, and an intra prediction unit 106. Specifically, the block splitting unit 103 further splits the input CTU into smaller coding units (CUs) by repeatedly using quadtree splitting, binary tree splitting, and ternary tree splitting. The prediction unit 102 can obtain an inter prediction block of the CU by using the ME unit 104 and the MC unit 105. The intra prediction unit 106 can obtain an intra prediction block of the CU by using various intra prediction modes including the MIP mode. By way of example, a rate-distortion optimized motion estimation method can be called by the ME unit 104 and the MC unit 105 to obtain an inter prediction block, and a rate-distortion optimized mode determination method can be called by the intra prediction unit 106 to obtain an inter prediction block.

[0089] The prediction unit 102 outputs a predicted block of the CU, and the first adder 107 calculates the difference between the CU and the predicted block of the CU in the output of the splitting unit 101, i.e., the residual CU. The conversion unit 108 reads out the residual CU and performs one or more conversion operations on the residual CU to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs the quantized coefficients (i.e., levels). The inverse quantization unit 110 outputs the reconstructed coefficients by performing a scaling operation on the quantized coefficients. The inverse conversion unit 111 performs one or more inverse conversions corresponding to the conversion in the conversion unit 108 and outputs the reconstructed residual. The second adder 112 calculates the reconstructed CU by adding the reconstructed residual and the predicted block of the CU from the prediction unit 102. Also, the second adder 112 sends its output to the prediction unit 102 for use as a reference for intra prediction. After all the CUs in the image or sub-image are reconstructed, the filtering unit 113 performs in-loop filtering on the reconstructed image or sub-image. Here, the filtering unit 113 includes one or more filters, for example, 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 113 determines that the CU is not used as a reference for encoding / decoding other CUs, it performs in-loop filtering on one or more target samples in the CU.

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

[0091] Furthermore, the encoder 100 can include a first processor and a first memory for recording a computer program. When the first processor reads and executes the computer program, the encoder 100 reads the input video and generates the corresponding bitstream. Also, the encoder 100 may be a computing device including one or more chips. The units implemented as integrated circuits in the chips have connection and data exchange functions similar to the corresponding units in FIG. 8A.

[0092] Referring to FIG. 8B, FIG. 8B shows a block diagram of an example of the structure of the decoder system according to the 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 transformation 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 may be a decoded video consisting of a series of images or a single decoded still image.

[0093] The input bit stream of the decoder 200 may be the bit stream generated by the encoder 100. The analysis unit 201 analyzes the input bit stream and obtains the values of the syntax elements from the input bit stream. The analysis unit 201 converts the binary representation of the syntax elements into numerical values and sends the numerical values to the units in the decoder 200 in order to obtain one or more decoded images. The analysis unit 201 can further analyze one or more syntax elements from the input bit stream in order to display the decoded images.

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

[0095] The prediction unit 202 identifies the prediction block of the current decoding block (e.g., CU). Here, the prediction unit 202 can include a motion compensation unit 203 and an intra prediction unit 204. Specifically, when it is shown that the inter decoding mode is used to decode the current decoding block, the prediction unit 202 sends the relevant parameters from the analysis unit 201 to the motion compensation unit 203 in order to obtain the inter prediction block. When it is shown that the intra prediction mode (including the MIP mode indicated based on the MIP mode index value) is used to decode the current decoding block, the prediction unit 202 sends the relevant parameters from the analysis unit 201 to the intra prediction unit 204 in order to obtain the 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 quantization coefficients (i.e., levels) from the analysis unit 201 in order to obtain the reconstruction coefficients.

[0097] The inverse transformation unit 206 has the same function as the inverse transformation unit 111 in the coder 100. The inverse transformation unit 206 performs one or more transformation operations (i.e., the inverse operations of one or more transformation operations by the inverse transformation unit 111 in the coder 100) to obtain the reconstruction residual.

[0098] The adder 207 performs an addition operation on its inputs (the prediction block from the prediction unit 202 and the reconstruction residual from the inverse transformation unit 206) to obtain the reconstruction block of the current decoded block. The reconstruction block is also sent to the prediction unit 202 for use as a reference for other blocks encoded and decoded in the intra prediction mode.

[0099] After all CUs in the 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. Alternatively, when the filtering unit 208 determines that the reconstruction block is not used as a reference for decoding other blocks, it performs in-loop filtering on one or more target samples in the reconstruction block. Here, the output of the filtering unit 208 is the 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 the timing and control information. The images stored in the DPB unit 209 can further be used as references for inter prediction or intra prediction by the prediction unit 202.

[0100] Furthermore, the decoder 200 can 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. Also, the decoder 200 may be a computing device including one or more chips. The units implemented as integrated circuits in the chips have connection and data exchange functions similar to the corresponding units in FIG. 8B.

[0101] Also, when the embodiments of the present application are applied to the encoder 100, "the current block" specifically refers to the current image block to be encoded in the video image (which may also be referred to as the "encoding block"), and when the embodiments of the present application are applied to the decoder 200, it should be noted that "the current block" specifically refers to the current image block to be decoded in the video image (which may also be referred to as the "decoding block").

[0102] In one embodiment of the present application, referring to FIG. 9, FIG. 9 is a flowchart showing a coefficient decoding method according to an embodiment of the present application. As shown in FIG. 9, this method can include the following content.

[0103] S901: Analyze the bitstream to obtain video flag information.

[0104] Note that the coefficient decoding method of the embodiments of the present application is applied to the decoder. Specifically, based on the structure of the decoder 200 shown in FIG. 8B, the coefficient decoding method of the embodiments 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 elements), and identify the coefficients of the current block.

[0105] Note that since the coefficient encoding and decoding generally described in video standards can include two parts: encoding and decoding, the coefficient encoding and decoding includes a coefficient encoding method on the encoder side and a coefficient decoding method on the decoder side. Embodiments of the present application will describe the coefficient decoding method on the decoder side.

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

[0107] In the embodiments of the present application, first, it is necessary to determine whether the current video meets the preset conditions, which can be represented by video flag information. In some embodiments, parsing the bitstream to obtain the video flag information When the value of the video flag information is the first value, it can be specified that the video flag information indicates that the video meets the preset conditions, or When the value of the video flag information is the second value, it can be specified that the video flag information indicates that the video does not meet the preset conditions.

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

[0109] Note that 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, 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. It is not limited thereto.

[0110] Note that the predefined 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 ordinary 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] Also, the video flag information may be a flag at the sequence level, and may further be a flag with a higher level. For example, VUI (Video Usability Information), supplemental enhancement information SEI (Supplemental enhancement information), etc. may be mentioned. The determination of whether the video meets the predefined conditions can be made by determining whether the video meets the high bit depth, whether the video meets the high bit rate, whether the video meets the high quality, whether the video meets the lossless compression, etc. Hereinafter, these four cases will be described as examples respectively.

[0113] In some embodiments, when the video flag information is high bit depth flag information, the method may further include: When the high bit depth flag information indicates that the video meets the high bit depth, specifying that the video meets the predefined conditions.

[0114] In some embodiments, when the video flag information is high bit rate flag information, the method may further include: When the high bit rate flag information indicates that the video meets the high bit rate, specifying that the video meets the predefined conditions.

[0115] In some embodiments, when the video flag information is high quality flag information, the method may include: When high-quality flag information indicates that the video meets the high-quality requirement, it can further include identifying that the video meets the preset conditions.

[0116] In some embodiments, when the video flag information is reversible compression flag information, the method When the reversible compression flag information indicates that the video meets the reversible compression requirement, it can further include identifying that the video meets the preset conditions.

[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 reversible compression, and is not specifically limited in the embodiments of the present application.

[0118] S902: When the video flag information indicates that the video meets the preset conditions, analyze the bitstream to obtain the position inversion flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient.

[0119] In addition, when the video flag information indicates that the video meets the preset conditions, 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 can be determined based on last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix. Therefore, in some embodiments, parsing the bitstream to obtain the coordinate information of the last non-zero coefficient can include the following. Parse the bitstream to obtain the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. Determine the horizontal coordinate of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the horizontal coordinate of the last non-zero coefficient. Determine the vertical coordinate of the last non-zero coefficient based on the prefix information of the vertical coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient. Determine 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.

[0121] Note that 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 in the currently processed 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 in the currently processed 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 in the currently processed 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 in the currently processed 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. 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, the coordinate information of the last non-zero coefficient can be obtained.

[0123] The position reversal flag information of the last non-zero coefficient can be represented by reverse_last_sig_coeff_flag. In the embodiments of the present application, the position reversal flag information of the last non-zero coefficient may be at least one of the flag information at the sequence level, picture level, slice level, and block level, and further may be the flag information at a higher level (e.g., VUI, SEI, etc.). It is not limited thereto.

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

[0125] In some embodiments, the method specifies that when the value of the position reversal flag information of the last non-zero coefficient is the first value, the position reversal flag information of the last non-zero coefficient instructs that the current block uses the position reversal of the last non-zero coefficient, or specifies that when the value of the position reversal flag information of the last non-zero coefficient is the second value, the position reversal flag information of the last non-zero coefficient instructs that the current block does not use the position reversal of the last non-zero coefficient, and can further include this.

[0126] That is, taking the case where the first value is 1 and the second value is 0 as an example, when the value of reverse_last_sig_coeff_flag is 1, it can be specified that reverse_last_sig_coeff_flag instructs that the current block uses the position inversion of the last non-zero coefficient. Or, when the value of reverse_last_sig_coeff_flag is 0, it can be specified that reverse_last_sig_coeff_flag instructs that the current block does not use the position inversion of the last non-zero coefficient.

[0127] S903: When the position inversion flag information of the last non-zero coefficient instructs that the current block uses the position inversion of the last non-zero coefficient, the position of the last non-zero coefficient is specified by calculating the coordinate information of the last non-zero coefficient.

[0128] S904: Decode all the coefficients before the position of the last non-zero coefficient according to a preset scan order to specify the coefficients of the current block.

[0129] In the embodiments of the present application, when the position inversion flag information of the last non-zero coefficient instructs that the current block uses the position inversion of the last non-zero coefficient, the coordinate information of the last non-zero coefficient can be specified 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.

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

[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 a 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, 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, the position of the last non-zero coefficient is identified, and all the coefficients before the position of the last non-zero coefficient in the current block are decoded according to the preset scan order.

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

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

[0134] In the embodiments of the present application, when the value of reverse_last_sig_coeff_flag is 0, in some embodiments, the method may further include the following content. When the position inversion flag information of the last non-zero coefficient indicates that the current block does not use the position inversion of the last non-zero coefficient, specify 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 upper left corner of the current block. Based on 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, specify the position of the last non-zero coefficient.

[0135] Note that when reverse_last_sig_coeff_flag indicates that the current block does not use the position inversion 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 embodiments of the present application, the target coordinate information of the last non-zero coefficient is 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.

[0136] Also, in some embodiments, the method may further include the following content. If the position reversal flag information of the last non-zero coefficient indicates that the current block does not utilize the position reversal of the last non-zero coefficient, the position of the last non-zero coefficient is directly determined based on 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.

[0137] Note that the preset scan order may be a diagonal order, a zigzag order, a horizontal order, a vertical order, a 4×4 sub-block scan order, or any other arbitrary 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 and the position reversal of the last non-zero coefficient needs to be used, after obtaining the coordinate information of the last non-zero coefficient by decoding, it is necessary to calculate the coordinate information of the last non-zero coefficient to determine the position of the last non-zero coefficient. Next, decode all coefficients before the position of the last non-zero coefficient according to the preset scan order. If the value of reverse_last_sig_coeff_flag is 0, that is, when the position reversal of the last non-zero coefficient does not need to be used, after obtaining the coordinate information of the last non-zero coefficient by decoding, based on the coordinate information of the last non-zero coefficient, the position of the last non-zero coefficient can be directly determined. Next, decode all coefficients before the position of the last non-zero coefficient according to the preset scan order.

[0139] Thus, in certain specific situations, the embodiments of the present application provide a correction to the method for deriving the position of the last non-zero coefficient during coefficient encoding / decoding. That is, in normal situations, the coefficient encoding / decoding method is the same as the existing method in the related art. Certain specific situations can refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless video encoding / decoding. In normal situations, as shown in FIG. 10A, the horizontal coordinate of the position of the last non-zero coefficient, that is, the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix and encoded, and the vertical coordinate of the position of the last non-zero coefficient, that is, the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix and encoded. On the other hand, in the case of high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless video encoding / decoding, the position of the last non-zero coefficient is generally 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 by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix and encoded, 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 by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix and encoded.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 of the horizontal (or column) coordinate of the last non-zero coefficient, LastSignificantCoeffX, according to the preset scan order, is derived based on the following method. If last_sig_coeff_x_suffix does not exist, LastSignificantCoeffX = last_sig_coeff_x_prefix. Otherwise (if last_sig_coeff_x_suffix exists), LastSignificantCoeffX = (1 << ((last_sig_coeff_x_prefix >> 1) - 1)) * (2 + (last_sig_coeff_x_prefix & 1)) + last_sig_coeff_x_suffix. If the value of reverse_last_sig_coeff_flag is 1, LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1 - LastSignificantCoeffX. In the current block, the value of the vertical (or row) coordinate of the last non-zero coefficient, LastSignificantCoeffY, according to the preset scan order, is derived based on the following method. If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY = last_sig_coeff_y_prefix. Otherwise (if last_sig_coeff_y_suffix exists), then LastSignificantCoeffY = (1 << ((last_sig_coeff_y_prefix >> 1) - 1)) * (2 + (last_sig_coeff_y_prefix & 1)) + last_sig_coeff_y_suffix. If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1 << log2ZoTbHeight) - 1 - LastSignificantCoeffY.

[0142] reverse_last_sig_coeff_flag is the position inversion flag of the last non-zero coefficient, indicating whether it is necessary to invert the position of the last non-zero coefficient. If the value of reverse_last_sig_coeff_flag is 1, it indicates that it is necessary to invert the position of the last non-zero coefficient; otherwise, it indicates that there is no need to invert the position of the last non-zero coefficient.

[0143] Note that reverse_last_sig_coeff_flag may be a flag at the sequence level or above, or it may be a flag at the image level, slice level, block level, or other levels. Also, the block-level flag includes the LCU-level flag, CU-level flag, or other block-level flags.

[0144] Also, reverse_last_sig_coeff_flag may depend on several other flags, such as high bit-depth flag information or high bit-rate flag information. That is, when the value of the high bit-depth flag information or the high bit-rate flag information is 1, it is necessary to decode reverse_last_sig_coeff_flag, and if not, it is not necessary to decode reverse_last_sig_coeff_flag.

[0145] In one specific example, taking the sequence level as an example, assume there is a sequence level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence, and if not, 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, it is necessary to decode sps_reverse_last_sig_coeff_flag. Here, sps_reverse_last_sig_coeff_flag is the 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 blocks within the current sequence utilize the position reversal of the last non-zero coefficient, and if not (i.e., if the value of sps_reverse_last_sig_coeff_flag is 0), it indicates that the blocks within the current sequence do not utilize the position reversal of the last non-zero coefficient. The reverse_last_sig_coeff_flag in the above syntax table is changed to sps_reverse_last_sig_coeff_flag.

[0146] The syntax element is as follows (Sequence parameter set RBSP syntax), please refer to Table 3.

[0147]

Table 3

[0148] In another specific example, taking the slice level as an example, assume that there is a slice-level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, it is necessary to decode sh_reverse_last_sig_coeff_flag. 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 blocks within the current slice utilize the 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 blocks within the current slice do not utilize the position reversal of the last non-zero coefficient. The reverse_last_sig_coeff_flag in the above syntax table is changed to sh_reverse_last_sig_coeff_flag.

[0149] The syntax element is as follows (Slice header syntax), please refer to Table 4.

[0150]

Table 4

[0151] In addition, when the video flag information indicates that the video satisfies a preset condition, it can be defaulted that all coefficients that may require decoding 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 embodiments of the present application, it is also possible to introduce last-coefficient enabled flag information for specifying whether the current block uses the last coefficient position.

[0152] In some embodiments, when the video flag information indicates that the video satisfies a preset condition, the method may further include the following. Analyze the bitstream to obtain the last-coefficient enabled flag information. When the last-coefficient enabled flag information indicates that the current block uses 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.

[0153] Note that the last-coefficient enabled flag information can be represented by default_last_coeff_enabled_flag. In the embodiments of the present application, the last-coefficient enabled flag information may be at least one of the flag information at the sequence level, picture level, slice level, and block level, and may further be the flag information at a higher level (such as VUI, SEI, etc.). It is not limited thereto.

[0154] That is, default_last_coeff_enabled_flag may be a flag at the sequence level or higher, or a flag at the picture level, slice level, block level, or other levels. The block-level flag may include a flag at the LCU level, a flag at the CU level, or other block-level flags, and is not limited in the embodiments of the present application.

[0155] In some embodiments, the method identifies that when the value of the last coefficient valid flag information is a first value, the last coefficient valid flag information instructs that the current block uses the last coefficient position, or identifies that when the value of the last coefficient valid flag information is a second value, the last coefficient valid flag information instructs that the current block does not use the last coefficient position, and may further include this.

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

[0157] Note that in another specific example, the first value may be set to true, and the second value may be set to false. In still another specific example, the first value may be set to 0, 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. It is not limited thereto.

[0158] Thus, taking the first value being 1 and the second value being 0 as an example, when the value of default_last_coeff_enabled_flag is 1, it can be identified that default_last_coeff_enabled_flag instructs that the current block uses the last coefficient position. Or, when the value of default_last_coeff_enabled_flag is 0, it can be identified that default_last_coeff_enabled_flag instructs that the current block does not use the last coefficient position.

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

[0160] Furthermore, when the current block does not utilize the last coefficient position, i.e., when the value of the last coefficient valid flag information is 0, in some embodiments, the method may further include the following. Analyze the bitstream to obtain the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. Identify the position of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. Decode all coefficients before the position of the last non-zero coefficient according to a preset scan order to identify the coefficients of the current block.

[0161] Note that when the current block does not utilize the last coefficient position, it is necessary to decode and obtain the position of the last non-zero coefficient. Specifically, by analyzing the bitstream, last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix are obtained, and then, based on last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix, the position of the last non-zero coefficient is identified. Otherwise, when the current block utilizes the last coefficient position, it is no longer necessary to identify the position of the last non-zero coefficient, and it is no longer necessary to decode and obtain last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix.

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

[0163] Furthermore, regarding the last coefficient position, in some embodiments, the last coefficient position is the lower right corner of the matrix consisting of all possible non-zero coefficients in the current block, or the last coefficient position is the last position to scan all possible non-zero coefficients in the current block according to the preset scan order.

[0164] Note that the last coefficient position in the embodiments of the present application does not represent the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position may be 0, but the coefficient at the position of the last non-zero coefficient is not necessarily 0.

[0165] In one specific example, the method can further include setting the position of the last non-zero coefficient as the last coefficient position.

[0166] That is, in the embodiments of the present application, the position of the last non-zero coefficient can still be used. In this case, it is necessary to set the position of the last non-zero coefficient at the last position of all possible non-zero coefficients in the current block according to the preset scan order.

[0167] Also, the last coefficient position can be represented by (LastCoeffX, LastCoeffY), that is, the last position of all possible non-zero coefficients in the current block according to the preset scan order. In some embodiments, the method can further include the following content. Identify the width and height of the transformed block obtained by performing a preset operation on the current block. By performing coordinate calculation based on the width and height of the transformed block, obtain the coordinate information of the lower right corner of the transformed block. Based on the coordinate information of the lower right corner of the transformed block, identify the last coefficient position.

[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 transformed block after zero-out. The derivation method of (LastCoeffX, LastCoeffY) is as follows. LastCoeffX = (1 << log2ZoTbWidth) - 1 and LastCoeffY = (1 << log2ZoTbHeight) - 1.

[0170] In this way, when 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 used. 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 the preset scan order. In some embodiments, the method may further include the following. When setting the position of the last non-zero coefficient to the last coefficient position, identify the position of the last non-zero coefficient based on the coordinate information of the lower right corner of the transformed block.

[0172] That is, the position of the last non-zero coefficient can be represented by (LastSignificantCoeffX, LastSignificantCoeffY). That is, the derivation method of (LastSignificantCoeffX, LastSignificantCoeffY) is as follows. LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1 and LastSignificantCoeffY = (1 << log2ZoTbHeight) - 1.

[0173] (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinate information of the lower right corner of the conversion 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 specified based on (LastSignificantCoeffX, LastSignificantCoeffY).

[0174] Thus, in certain specific situations, by default, all coefficients that may need to be encoded and decoded during coefficient encoding and decoding need to be encoded and decoded. That is, in normal situations, the coefficient encoding and decoding method is the same as the existing methods in the related art. A certain specific situation can refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding and decoding or reversible compression video encoding and decoding. By default, all coefficients that may need to be encoded and decoded need to be encoded and decoded, that is, no longer utilize the position of the last non-zero coefficient, and scan all possible non-zero coefficients in the current block according to the preset scan order. In other words, set the position of the last coefficient that needs to be encoded and decoded at the last position of all possible non-zero coefficients in the current block according to the preset scan order. This position is usually the lower right corner of the matrix composed of all possible non-zero coefficients in the current block. Here, utilize the position of the last coefficient that needs to be encoded and decoded instead of the position of the last non-zero coefficient. This is because the coefficient at the position of the last coefficient that needs to be encoded and decoded may be 0, while the coefficient at the position of the last non-zero coefficient is not necessarily 0.

[0175] In one special example, still utilize the position of the last non-zero coefficient. In this case, set the position of the last non-zero coefficient at the last position of all possible non-zero coefficients in the current block according to the preset scan order.

[0176] Also, the reason for referring to all possible non-zero coefficients in the current block according to the preset scan order is that according to some other techniques (such as zero-out mentioned above), some coefficients in one block are defaulted to be 0 in addition to the last non-zero coefficient.

[0177] The correction to the semantics is as shown in Table 5.

[0178]

Table 5

[0179] In an embodiment of the present application, conditions can be added before decoding the information required for the last non-zero coefficient. That is, when 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, and last_sig_coeff_y_suffix. When 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, and last_sig_coeff_y_suffix.

[0180] Here, default_last_coeff_enabled_flag is a default last coefficient enable flag used to indicate whether the default last coefficient is used. When 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 at 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 the default_last_coeff_enabled_flag is 1, the default last coefficient position (LastCoeffX, LastCoeffY) is the last position of all possible non-zero coefficients in the current block according to the preset scan order. It is necessary to scan all the coefficients before (LastCoeffX, LastCoeffY) according to the preset scan order. In the embodiments of the present application, the method for deriving (LastCoeffX, LastCoeffY) is as follows. LastCoeffX = (1 << log2ZoTbWidth) - 1 and LastCoeffY = (1 << log2ZoTbHeight) - 1.

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

[0183] In a special example, the position of the last non-zero coefficient is still used. In this case, the position of the last non-zero coefficient is set to the last position of all possible non-zero coefficients in the current block according to the preset scan order. In the embodiments of the present application, the method for deriving the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is as follows. LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1 and LastSignificantCoeffY = (1 << log2ZoTbHeight) - 1.

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

[0185] Note that the default_last_coeff_enabled_flag may be a flag at the sequence level or higher, or it may be a flag at the picture level, slice level, block level, or other levels. Also, the block-level flag includes the LCU-level flag, CU-level flag, or other block-level flags.

[0186] Also, the default_last_coeff_enabled_flag may depend on several other flags, such as high-bit-depth flag information or high-bit-rate flag information. That is, when the value of the high-bit-depth flag information or high-bit-rate flag information is 1, it is necessary to decode the default_last_coeff_enabled_flag; otherwise, it is not necessary to decode the default_last_coeff_enabled_flag.

[0187] In one specific example, taking the sequence level as an example, assume there is a flag sps_high_bit_depth_flag at the sequence level that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, it is necessary to decode sps_default_last_coeff_enabled_flag. Here, sps_default_last_coeff_enabled_flag is the default last coefficient enable flag for the current sequence. If the value of sps_default_last_coeff_enabled_flag is 1, it indicates that the blocks within the current sequence use the default last coefficient; otherwise (i.e., if the value of sps_default_last_coeff_enabled_flag is 0), it indicates that the blocks within the current sequence do not use the default last coefficient. The default_last_coeff_enabled_flag in the above syntax table is changed to sps_default_last_coeff_enabled_flag.

[0188] The syntax element is as follows (Sequence parameter set RBSP syntax), please refer to Table 6.

[0189] [Table 6]

[0190] In another specific example, taking the slice level as an example, assume that there is a slice level flag sps_high_bit_depth_flag that indicates whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, it is necessary to decode sh_default_last_coeff_enabled_flag. Here, sh_default_last_coeff_enabled_flag is the default last coefficient enable flag of the current slice. If the value of sh_default_last_coeff_enabled_flag is 1, it indicates that the blocks within the current slice use the default last coefficient; otherwise (i.e., if the value of sh_default_last_coeff_enabled_flag is 0), it indicates that the blocks within the current slice do 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 element is as follows (Slice header syntax), please refer to Table 7.

[0192] [Table 7]

[0193] In addition, when the video flag information indicates that the video satisfies the preset conditions, all scanned sub-blocks need to be decoded by default. In this case, it is not necessary to transmit sb_coded_flag in the bitstream. That is, neither the encoder nor the decoder needs to process the flag, which improves the decoding speed. Therefore, in the embodiments of the present application, sub-block default decoding flag information (default sub-block coded flag) can be further introduced to determine whether to default when the sub-block waiting for decoding in the current block is decoded.

[0194] In some embodiments, when the video flag information indicates that the video satisfies the preset conditions, the method can further include the following. Analyze the bitstream to obtain sub-block default decoding flag information. When the sub-block default decoding flag information indicates that it defaults when the sub-block waiting for decoding in the current block is decoded, identify that the value of the sub-block decoding flag information is the first value, and decode all coefficients in the sub-block waiting for decoding.

[0195] Note that the sub-block default decoding flag information can be represented by default_sb_coded_flag. In the embodiments of the present application, the sub-block default decoding flag information is at least one of the flag information at the sequence level, picture level, slice level, and block level, and may further be the flag information at a higher level (for example, VUI, SEI, etc.). It is not limited thereto.

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

[0197] In some embodiments, the method identifying that when the value of the sub-block default decoding flag information is a first value, it instructs to default when the sub-block waiting for decoding of the sub-block default decoding flag information is decoded, or identifying that when the value of the sub-block default decoding flag information is a second value, it instructs not to default when the sub-block waiting for decoding of the sub-block default decoding flag information is decoded, and may further include this.

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

[0199] In addition, in another specific example, the first value may be set to true, and the second value may be set to false. In still another specific example, the first value may be set to 0, 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. It is not limited thereto.

[0200] Thus, taking as an example that the first value is 1 and the second value is 0, when the value of default_sb_coded_flag is 1, it can be specified that it is necessary to default that the sub-block waiting for decoding with default_sb_coded_flag needs to be decoded. Or, when the value of default_sb_coded_flag is 0, it can be specified that it is necessary to default that the sub-block waiting for decoding with default_sb_coded_flag does not need to be decoded.

[0201] When it is defaulted that the sub-block waiting for decoding needs to be decoded, the value of default_sb_coded_flag is 1, which means that the value of sb_coded_flag is 1, that is, it is not necessary to decode sb_coded_flag. In this case, it is defaulted that all coefficients in the sub-block waiting for decoding need to be decoded.

[0202] Also, when it is not defaulted that the sub-block waiting for decoding needs to be decoded, that is, when the value of default_sb_coded_flag is 0, in some embodiments, the method may further include the following. Analyze the bitstream to obtain sub-block decoding flag information. When the value of the sub-block decoding flag information is the first value, decode all coefficients in the sub-block waiting for decoding.

[0203] Note that when it is not defaulted that the sub-block waiting for decoding needs to be decoded, it is necessary to decode and obtain the sub-block decoding flag information, and then, according to the sub-block decoding flag information, specify whether to decode all coefficients in the sub-block waiting for decoding.

[0204] Also, regarding the sub-block decoding flag information, the method When the value of the sub-block decoding flag information is the first value, it is specified that all coefficients in the sub-block waiting for decoding are to be decoded, or, When the value of the sub-block decoding flag information is the second value, it can further include specifying that all coefficients in the sub-block waiting for decoding are zero.

[0205] In an embodiment of the present application, the sub-block decoding flag information can be represented by sb_coded_flag. Taking the first value as 1 and the second value as 0 as an example, when the value of sb_coded_flag is 1, it can be specified that all coefficients in the sub-block waiting for decoding need to be decoded. Or, when the value of sb_coded_flag is 0, it can be specified that it is not necessary to decode all coefficients in the sub-block waiting for decoding. In this case, all coefficients in the sub-block waiting for decoding are zero.

[0206] In this way, in a specific situation, during coefficient encoding / decoding, by default, all scanned sub-blocks need to be encoded / decoded, in other words, by default, 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 way, it is no longer necessary to transmit sb_coded_flag in the bitstream, the encoder / decoder does not need to process the flag, and the encoding / decoding speed can be improved. Also, since the almost non-existent flag is removed, at this time, the compression performance can be slightly improved.

[0207] The correction to the semantics is as shown in Table 8.

[0208]

Table 8

[0209] The default_sb_coded_flag is a flag that indicates whether to default that a sub-block needs to be decoded. When the value of the default_sb_coded_flag is 1, it can be determined that the value of sb_coded_flag[xS][yS] is 1. In this case, it is not necessary to decode sb_coded_flag[xS][yS] from the bitstream. Otherwise (when the value of the default_sb_coded_flag is 0), it is still necessary to decode sb_coded_flag[xS][yS] from the bitstream.

[0210] Note that the default_sb_coded_flag may be a flag at the sequence level or above, or it may be a flag at the picture level, slice level, block level, or other level. Also, the block-level flag includes the LCU-level flag, CU-level flag, or other block-level flags.

[0211] The default_sb_coded_flag may depend on several other flags, such as high bit-depth flag information or high bit-rate flag information. That is, when the value of the high bit-depth flag information or high bit-rate flag information is 1, it is necessary to decode the default_sb_coded_flag, and otherwise, it is not necessary to decode the default_sb_coded_flag.

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

[0213] The syntax element is as follows (Sequence parameter set RBSP syntax), please refer to Table 9.

[0214]

Table 9

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

[0216] The syntax element is as follows (Slice header syntax), please refer to Table 10.

[0217]

Table 10

[0218] Note that the embodiments of this application relate to three optimization methods, and the three optimization methods are as follows respectively.

[0219] Method 1 is as follows. In a specific situation, by default, all coefficients that may need to be encoded / decoded during coefficient encoding / decoding need to be encoded / decoded. That is, in a normal situation, the coefficient encoding / decoding method is the same as the existing methods in the related art. A specific situation can refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding / decoding or reversible compression video encoding / decoding. By default, 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 the preset scan order. In other words, the position of the last coefficient that needs to be encoded / decoded is set at the last position of all possible non-zero coefficients in the current block according to the preset scan order. 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 position of the last coefficient that needs to be encoded / decoded may be 0, but the coefficient at the position of the last non-zero coefficient is not necessarily 0.

[0220] Also, in one specific example, the position of the last non-zero coefficient is still used. In this case, the position of the last non-zero coefficient is set at 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 specific situation, during coefficient encoding and decoding, the method for deriving the position of the last non-zero coefficient is corrected. That is, in the normal situation, the coefficient encoding and decoding method is the same as the existing method in the related art. A specific situation can refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding and decoding or reversible compression video encoding and decoding. In the normal situation, the abscissa of the position of the last non-zero coefficient, that is, the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, encoded, and the ordinate of the position of the last non-zero coefficient, that is, the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix, encoded. On the other hand, in the case of high-bit-depth, high-quality, high-bit-rate video encoding and decoding or reversible compression video encoding and decoding, the position of the last non-zero coefficient is generally close to the lower right corner of the area of all possible non-zero coefficients of the current block. In this case, the horizontal distance from the position of the last non-zero coefficient to the lower right corner of the area of all possible non-zero coefficients of the current block is represented by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, encoded, and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the area of all possible non-zero coefficients of the current block is represented by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix, encoded.For example, if all possible non-zero coefficient regions of the current block are rectangular regions from (0, 0) to ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1), last_sig_coeff_x_prefix and last_sig_coeff_x_suffix are encoded, representing the horizontal distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1), and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix are encoded, representing the vertical distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1).

[0222] Method 3 is as follows. In a specific situation, 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 method 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 that flag.

[0223] For the above three methods, in scenarios of high bit depth, high bit rate, high quality, or lossless video encoding and decoding, since the coefficient distribution rule is different from that of normal videos, during coefficient encoding and decoding, the number of syntax elements encoded and decoded in the context mode is reduced or removed. Examples of such syntax elements include the position of the last non-zero coefficient, sub-block encoding and decoding flags, etc. Thereby, the throughput of coefficient encoding and decoding and the encoding and decoding speed can be improved. Also, since the above flags play a minor role in high bit depth, high bit rate, high quality, or lossless video encoding and decoding, not using these flags can, instead of reducing the compression efficiency, improve the compression efficiency to a certain extent.

[0224] In addition, in the embodiments 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 the sps_high_bit_rate_flag indicating whether the current video sequence is a high bit rate sequence. Furthermore, it may be replaced by other flags indicating high bit depth, high bit rate, high quality, or lossless encoding, etc.

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

[0226] In this embodiment, a coefficient decoding method applied to a decoder is provided. Analyze the bitstream to obtain video flag information. When the video flag information indicates that the video satisfies a preset condition, analyze the bitstream to obtain the position inversion flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. When the position inversion flag information of the last non-zero coefficient indicates that the current block uses the position inversion of the last non-zero coefficient, calculate the coordinate information of the last non-zero coefficient to identify the position 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 identify the coefficients of the current block. In this way, in scenarios of high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, since the coefficient distribution rule is different from that of normal video scenarios, during coefficient encoding and decoding, reduce or remove the number of syntax elements encoded and decoded in the context mode. For example, syntax elements such as the position of the last non-zero coefficient and the sub-block encoding and decoding flag are included. Furthermore, when the value of the coordinate information of the last non-zero coefficient is large, perform coordinate transformation to reduce the overhead due to encoding and decoding in the bitstream, and improve the throughput and speed of coefficient encoding and decoding. Also, since the syntax elements to be reduced or removed have little impact in high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, the compression efficiency can also be improved.

[0227] In another embodiment of the present application, referring to FIG. 11, FIG. 11 is a flowchart showing a coefficient encoding method according to an embodiment of the present application. As shown in FIG. 11, the method may include the following content.

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

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

[0230] S1103: Identify 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.

[0231] S1104: Encode all coefficients before the position of the last non-zero coefficient according to a preset scan order, and write the bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient into the bitstream.

[0232] Note that the coefficient encoding method of the embodiments 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 embodiments 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 perform entropy encoding on related flag information (or syntax elements), and then write it into the bitstream.

[0233] Note that the coefficient encoding and decoding generally described in video standards can include two parts: encoding and decoding. Therefore, the coefficient encoding and decoding includes a coefficient encoding method on the encoder side and a coefficient decoding method on the decoder side. The embodiments of the present application describe the coefficient encoding method on the encoder side.

[0234] In normal situations, for normal videos, the coefficient encoding method is the same as the existing methods in related technologies. However, for specific situations such as high bit-depth, high-quality, high bit-rate, or lossless video encoding and decoding scenarios, in the embodiments of the present application, the method for deriving the position of the last non-zero coefficient can be corrected. In this case, it is necessary to introduce video flag information and the position inversion flag information of the last non-zero coefficient in the embodiments of the present application, thereby identifying the position of the last non-zero coefficient, and then encoding all coefficients before the position of the last non-zero coefficient in the current block according to a preset scan order.

[0235] In an embodiment of the present application, first, it is necessary to determine whether the current video meets a preset condition, which can be represented by video flag information. In some embodiments, specifying the video flag information When the video meets the preset condition, specifying that the value of the video flag information is a first value, or When the video does not meet the preset condition, specifying that the value of the video flag information is a second value, can be included.

[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 still another specific example, the first value may be set to 0, 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. It is not limited thereto.

[0238] The preset condition includes at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0239] Also, the video flag information may be a sequence level flag, and further, it may be a flag with a higher level (for example, VUI, SEI), etc. The determination of whether the video meets the preset condition can be made by determining whether the video meets the high bit depth, whether the video meets the high bit rate, whether the video meets the high quality, whether the video meets the lossless compression, etc. Hereinafter, these four cases will be described as examples respectively.

[0240] In some embodiments, when the video flag information is high bit depth flag information, the method When the video meets the high bit depth, it can further include specifying that the high bit depth flag information indicates that the video meets the preset conditions.

[0241] In some embodiments, when the video flag information is high bit rate flag information, the method When the video meets the high bit rate, it can further include specifying that the high bit rate flag information indicates that the video meets the preset conditions.

[0242] In some embodiments, when the video flag information is high quality flag information, the method When the video meets the high quality, it can further include specifying that the high quality flag information indicates that the video meets the preset conditions.

[0243] In some embodiments, when the video flag information is reversible compression flag information, the method When the video meets the reversible compression, it can further include specifying that the reversible compression flag information indicates that the video meets the preset conditions.

[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 reversible compression, and is not specifically limited in the embodiments of the present application.

[0245] Also, regarding the position inversion flag information of the last non-zero coefficient, specifying the position inversion flag information of the last non-zero coefficient if the current block uses the position inversion of the last non-zero coefficient, specifying that the value of the position inversion flag information of the last non-zero coefficient is the first value, or if the current block does not use the position inversion of the last non-zero coefficient, specifying that the value of the position inversion flag information of the last non-zero coefficient is the second value, can be included.

[0246] In the embodiments of the present application, the position inversion flag information of the last non-zero coefficient can be represented by reverse_last_sig_coeff_flag. Here, the position inversion flag information of the last non-zero coefficient may be at least one of the flag information at the sequence level, image level, slice level, and block level, and may further be the flag information at a higher level (for example, VUI, SEI, etc.). It is not limited thereto.

[0247] That is, reverse_last_sig_coeff_flag may be a flag at the sequence level or above, or a flag at the image level, slice level, block level, or other level. Also, the block-level flag may include a flag at the LCU level, a flag at the CU level, or other block-level flags, and is not limited in the embodiments of the present application.

[0248] Thus, taking the example that the first value is 1 and the second value is 0, when it is specified that the current block uses the position inversion of the last non-zero coefficient, the value of reverse_last_sig_coeff_flag becomes 1. Or, when it is specified that the current block does not use the position inversion of the last non-zero coefficient, the value of reverse_last_sig_coeff_flag becomes 0.

[0249] In addition, the position of the last non-zero coefficient can include the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient. When the initial horizontal coordinate is the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, and the initial vertical coordinate is the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, specifying 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 is When the value of the position inversion flag information of the last non-zero coefficient is the first value, specifying the coordinate information of the last non-zero coefficient by performing calculations based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient, or When the value of the position inversion flag information of the last non-zero coefficient is the second value, directly specifying 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, can be included.

[0250] In other words, in some embodiments, the method When the value of the position inversion flag information of the last non-zero coefficient is the first value, specifying the coordinate information of the last non-zero coefficient as the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block, or When the value of the position inversion flag information of the last non-zero coefficient is the second value, specifying the coordinate information of the last non-zero coefficient as 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, can be further included.

[0251] That is, 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 a 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, during coefficient encoding, it is necessary to perform a coordinate transformation (specifically, it can be a coordinate inversion calculation, that is, the coordinate information of the last non-zero coefficient after coordinate inversion is the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block). In that case, in the decoder, it is necessary 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 so that it is the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block. In this way, the position of the last non-zero coefficient is specified.

[0252] Also, in some embodiments, specifying 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 can include the following content. Specify the width and height of the current block. Subtract the initial horizontal coordinate of the last non-zero coefficient from the width of the current block to obtain the horizontal coordinate of the last non-zero coefficient. Subtract the initial vertical coordinate of the last non-zero coefficient from the height of the current block to obtain the vertical coordinate 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, specify the coordinate information 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 prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient into the bit stream.

[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. Write last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix into the bit stream. Thereby, the decoder can identify the coordinate information of the last non-zero coefficient by analyzing the bit stream.

[0257] Thus, the embodiments of the present application provide a correction to the method for deriving the position of the last non-zero coefficient. That is, in normal situations, the coefficient encoding / decoding method is the same as the existing method in the related art. A particular situation can refer to, for example, high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless video encoding / decoding. In normal situations, as shown in FIG. 10A, the abscissa of the position of the last non-zero coefficient, that is, the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, encoded, and the ordinate of the position of the last non-zero coefficient, that is, the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block, is represented by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix, encoded. On the other hand, in the case of high-bit-depth, high-quality, high-bit-rate video encoding / decoding or lossless video encoding / decoding, the position of the last non-zero coefficient is generally 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 by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, encoded, 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 by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix, encoded. Therefore, by introducing reverse_last_sig_coeff_flag in the embodiments of the present application, the problem of relatively large overhead caused by encoding relatively large values in the bitstream can be solved.

[0258] Also, when the video flag information indicates that the video satisfies a preset condition, it can be defaulted that all coefficients that may need to be encoded need to be encoded. 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 the preset scan order. Therefore, in the embodiments of the present application, it is also possible to introduce last coefficient valid flag information for specifying whether the current block uses the last coefficient position.

[0259] In some embodiments, when the video flag information indicates that the video satisfies a preset condition, the method may further include the following. Specify the last coefficient valid flag information. 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 the preset scan order, and write the bit information obtained by encoding, the video flag information, and the last coefficient valid flag information into the bit stream.

[0260] Note that the last coefficient valid flag information can be represented by default_last_coeff_enabled_flag. In the embodiments of the present application, the last coefficient valid flag information may be at least one of the flag information at the sequence level, picture level, slice level, and block level, and may further be the flag information at a higher level (for example, VUI, SEI, etc.). It is not limited thereto.

[0261] Note that for the last coefficient valid flag information, in some embodiments, specifying the last coefficient valid flag information may include specifying that the value of the last coefficient valid flag information is the first value when the current block uses the last coefficient position, or specifying that the value of the last coefficient valid flag information is the second value when the current block does not use the last coefficient position.

[0262] That is, taking as an example that the first value is 1 and the second value is 0, when the current block uses the last coefficient position, the value of default_last_coeff_enabled_flag becomes 1. Or, when the current block does not use the last coefficient position, the value of default_last_coeff_enabled_flag becomes 0.

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

[0264] Note that the last coefficient position in the embodiments of this application does not represent the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position may be 0, but the coefficient at the position of the last non-zero coefficient is not necessarily 0.

[0265] In one specific example, the method can further include setting the position of the last non-zero coefficient as the last coefficient position.

[0266] That is, in the embodiments of this application, the position of the last non-zero coefficient can still be used. In this case, it is necessary to set the position of the last non-zero coefficient at the last position of all possible non-zero coefficients in the current block according to a preset scan order.

[0267] Also, the last coefficient position can be represented by (LastCoeffX, LastCoeffY), that is, the last position of all possible non-zero coefficients in the current block according to a preset scan order. In some embodiments, the method can further include the following. Identifying the width and height of the transformed block obtained by performing a preset operation on the current block. By performing coordinate calculation based on the width and height of the conversion block, the coordinate information of the lower right corner of the conversion block is obtained. Based on the coordinate information of the lower right corner of the conversion block, the last coefficient position is identified.

[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 conversion block after zero - out. The derivation method of (LastCoeffX, LastCoeffY) is as follows. LastCoeffX = (1 << log2ZoTbWidth)-1 and LastCoeffY = (1 << log2ZoTbHeight)-1.

[0270] In this way, when 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 used. 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 the preset scan order. In some embodiments, the method may further include the following. When setting the position of the last non - zero coefficient to the last coefficient position, the position of the last non - zero coefficient is identified based on the coordinate information of the lower right corner of the conversion block.

[0272] That is, the position of the last non - zero coefficient can be represented by (LastSignificantCoeffX, LastSignificantCoeffY), that is, the derivation method of (LastSignificantCoeffX, LastSignificantCoeffY) is as follows. LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1, and LastSignificantCoeffY = (1 << log2ZoTbHeight) - 1.

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

[0274] Also, when the current block does not utilize the last coefficient position, that is, when the value of the last coefficient valid flag information is 0, in some embodiments, the method may further include the following. Identify 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. Based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient, determine the position of the last non-zero coefficient. According to the preset scan order, encode all the coefficients before the position of the last non-zero coefficient, and write the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient into the bitstream.

[0275] In addition, when the current block does not use the last coefficient position, it is necessary to identify the position of the last non-zero coefficient. Specifically, last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix need to be identified, and then last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix need to be written into the bitstream.

[0276] In this way, during coefficient encoding and decoding, it is defaulted that all coefficients that may need encoding and decoding need to be encoded and decoded. That is, in normal situations, the coefficient encoding and decoding method is the same as the existing methods in the related art. A certain specific situation can refer to, for example, high bit-depth, high-quality, high bit-rate video encoding and decoding or reversible compression video encoding and decoding. It is defaulted that all coefficients that may need encoding and decoding need to be encoded and 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 the preset scan order. In other words, the position of the last coefficient that needs encoding and decoding is set at the last position of all possible non-zero coefficients in the current block according to the preset scan order. This position is usually the lower right corner of the matrix composed of all possible non-zero coefficients in the current block. Therefore, in the embodiments of this application, by introducing default_last_coeff_enabled_flag, the syntax elements related to the position of the last non-zero coefficient can be further reduced and removed, thereby saving overhead and avoiding waste.

[0277] Also, when the video flag information indicates that the video satisfies the preset conditions, all scanned sub-blocks need to be encoded by default. In this case, it is not necessary to transmit sb_coded_flag in the bitstream. That is, neither the encoder nor the decoder needs to process the flag, improving the encoding speed. Therefore, in the embodiments of the present application, sub-block default encoding flag information can be further introduced to determine whether the sub-blocks waiting for encoding in the current block are default encoded when they are encoded.

[0278] In some embodiments, when the video flag information indicates that the video satisfies the preset conditions, the method can further include the following. Identify the sub-block default encoding flag information of the sub-blocks waiting for encoding in the current block. When the sub-block default encoding flag information indicates that the sub-blocks waiting for encoding are default encoded when they are encoded, encode all the coefficients in the sub-blocks waiting for encoding, and write the bit information obtained by encoding and the sub-block default encoding flag information into the bitstream.

[0279] Note that the sub-block default encoding flag information can be represented by default_sb_coded_flag. In the embodiments of the present application, the sub-block default encoding flag information is at least one flag information among the sequence level, picture level, slice level, and block level, and may further be flag information at a higher level (such as VUI, SEI, etc.). It is not limited thereto.

[0280] Regarding the sub-block default flag information, in some embodiments, identifying the sub-block default encoding flag information of the sub-blocks waiting for encoding is When a sub-block waiting to be coded defaults when coded, identifying that the value of the sub-block default coding flag information is a first value, or, When a sub-block waiting to be coded does not default when coded, identifying that the value of the sub-block default coding flag information is a second value, can be included.

[0281] Thus, taking as an example that the first value is 1 and the second value is 0, when it is identified that a sub-block waiting to be coded defaults to being required to be coded, the value of default_sb_coded_flag becomes 1. Or, when it is identified that a sub-block waiting to be coded does not default to being required to be coded, the value of default_sb_coded_flag becomes 0.

[0282] When a sub-block waiting to be coded defaults to being required to be coded, the value of default_sb_coded_flag becomes 1, which means that the value of sb_coded_flag is 1, that is, it is not necessary to code sb_coded_flag. When a sub-block waiting to be coded does not default to being required to be coded, that is, when the sub-block default coding flag information indicates that a sub-block waiting to be coded does not default when coded, in some embodiments, the method can further include the following. Identifying the sub-block coding flag information of the sub-block waiting to be coded and writing the sub-block coding flag information to the bit stream.

[0283] Also, in some embodiments, identifying the sub-block coding flag information of the sub-block waiting to be coded is When coding is required for the sub-block, identifying that the value of the sub-block coding flag information is a first value, or, When all coefficients in the sub-block are zero, identifying that the value of the sub-block coding flag information is a second value, is included.

[0284] In an embodiment of the present application, the sub-block encoding flag information can be represented by sb_coded_flag. Taking the case where the first value is 1 and the second value is 0 as an example, when it is determined that the sub-block waiting to be encoded needs to be encoded, it means that the sub-block waiting to be encoded contains non-zero coefficients waiting to be encoded, and the value of sb_coded_flag becomes 1. Or, when it is determined that the sub-block waiting to be encoded does not need to be encoded, it means that all the coefficients in the sub-block waiting to be encoded are zero, and the value of sb-coded-flag becomes 0.

[0285] In this way, 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 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 way, it is no longer necessary to transmit sb_coded_flag in the bit stream, the encoder does not need to process the flag, and the encoding / decoding speed can be improved. Also, since the rarely existing flag is removed, at this time, the compression performance can be slightly improved.

[0286] In an embodiment of the present application, a coefficient encoding method applied to an encoder is further provided. Video flag information and the position of the last non-zero coefficient are identified. When the video flag information indicates that the video satisfies a preset condition, the 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, the coordinate information of the last non-zero coefficient is identified. According to a preset scan order, all coefficients before the position of the last non-zero coefficient are encoded, and the bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient are written into a bit stream. In this way, in scenarios of high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, since the coefficient distribution rule is different from that of normal video scenarios, during coefficient encoding and decoding, the number of syntax elements encoded and decoded in the context mode is reduced or removed. For example, syntax elements such as the position of the last non-zero coefficient and the sub-block encoding / decoding flag are included. Further, when the value of the coordinate information of the last non-zero coefficient is large, coordinate conversion is performed to reduce the overhead due to encoding and decoding in the bit stream, and the throughput and speed of coefficient encoding and decoding can be improved. Also, since the syntax elements to be reduced or removed have little impact on high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, the compression efficiency can also be improved.

[0287] In other embodiments of the present application, based on the same inventive concept as the above embodiment, referring 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 identification unit 1201 and an encoding unit 1202. The first identification unit 1201 is configured to identify video flag information and the position of the last non-zero coefficient, and when the video flag information indicates that the video satisfies a preset condition, identify the position inversion flag information of the last non-zero coefficient. The first specific unit 1201 is further configured to identify 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. The encoding unit 1202 is configured to encode all coefficients before the position of the last non-zero coefficient according to a preset scan order, and write the bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient into the bit stream.

[0288] In some embodiments, the first specific unit 1201 is further configured to identify that the value of the video flag information is the first value when the video meets a preset condition, or identify that the value of the video flag information is the second value when the video does not meet the preset condition.

[0289] In some embodiments, the preset condition includes at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0290] In some embodiments, the first specific unit 1201 is further configured to identify that the value of the position inversion flag information of the last non-zero coefficient is the first value when the current block uses the position inversion of the last non-zero coefficient, or identify that the value of the position inversion flag information of the last non-zero coefficient is the second value when the current block does not use the position inversion of the last non-zero coefficient.

[0291] In some embodiments, the position of the last non-zero coefficient includes the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient. The initial horizontal coordinate is the horizontal distance from the position of the last non-zero coefficient to the upper left corner of the current block, and the initial vertical coordinate is the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block. Accordingly, when the value of the position inversion flag information of the last non-zero coefficient is the first value, the first specifying unit 1201 further calculates based on the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient to specify the coordinate information of the last non-zero coefficient, or when the value of the position inversion flag information of the last non-zero coefficient is the second value, it is configured to directly specify 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.

[0292] In some embodiments, the first specifying unit 1201 further specifies the width and height of the current block, obtains 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, obtains the vertical coordinate of the last non-zero coefficient by subtracting the initial vertical coordinate of the last non-zero coefficient from the height of the current block, and is configured to specify 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.

[0293] In some embodiments, when the value of the position inversion flag information of the last non-zero coefficient is the first value, the first specifying unit 1201 further specifies 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 when the value of the position inversion flag information of the last non-zero coefficient is the second value, it is configured to specify 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 upper left corner of the current block.

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

[0295] In some embodiments, the position inversion flag information of the last non-zero coefficient is at least one flag information among sequence level, picture level, slice level, and block level.

[0296] In some embodiments, the first identification unit 1201 is further configured to identify the last coefficient valid flag information when the video flag information indicates that the video meets a preset condition. 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 the coefficients before the last coefficient position according to a preset scan order, and write the bit information obtained by encoding, the video flag information, and the last coefficient valid flag information into the bitstream.

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

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

[0299] In some embodiments, the first specific 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 specific unit 1201 further identifies the width and height of the transformed block obtained by performing a preset operation on the current block, calculates coordinates based on the width and height of the transformed block, obtains the coordinate information of the lower right corner of the transformed block, and is configured to identify the last coefficient position based on the coordinate information of the lower right corner of the transformed block.

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

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

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

[0304] In some embodiments, the last coefficient valid flag information is at least one flag information among sequence level, picture level, slice level, and block level.

[0305] In some embodiments, the first specific unit 1201 is further configured to identify the sub-block default encoding flag information of the sub-block waiting for encoding in the current block when the video flag information indicates that the video meets a preset condition. The symbolization unit 1202 is further configured to encode all coefficients in the sub-block waiting for encoding and write the bit information obtained by encoding and the sub-block default encoding flag information into the bitstream when the sub-block default encoding flag information indicates that it defaults when the sub-block waiting for encoding is encoded.

[0306] In some embodiments, the first specific unit 1201 is further configured to identify the sub-block encoding flag information of the sub-block waiting for encoding and write the sub-block encoding flag information into the bitstream when the sub-block default encoding flag information indicates that it does not default when the sub-block waiting for encoding is 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 the first value when the sub-block waiting to be encoded is default encoded, or to identify that the value of the sub-block default encoding flag information is the second value when the sub-block waiting to be encoded is not default encoded.

[0308] In some embodiments, the first identification unit 1201 is further configured to identify that the value of the sub-block encoding flag information is the first value when encoding of the sub-block is necessary, or to identify that the value of the sub-block encoding flag information is the second value when all coefficients in the sub-block are zero.

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

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

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

[0312] In some embodiments, the first identification unit 1201 is further configured to identify that when the video flag information is high bit-rate flag information, if the video satisfies the high bit-rate, the high bit-rate flag information indicates that the video satisfies the preset condition.

[0313] In some embodiments, the first specific unit 1201 is further configured to specify that when the video flag information is high-quality flag information, if the video meets the high-quality standard, the high-quality flag information indicates that the video meets the preset conditions.

[0314] In some embodiments, the first specific unit 1201 is further configured to specify that when the video flag information is lossless compression flag information, if the video meets the lossless compression standard, the lossless compression flag information indicates that the video meets the preset conditions.

[0315] In the embodiments of the present application, it can be understood that the "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, the "unit" can also be a module or a non-module. In addition, each constituent unit according to this embodiment may be integrated into one processing unit, each unit may physically exist alone, or two or more units may be integrated into one unit. The above integrated unit can be realized in the form of a hardware or software function module.

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

[0317] Therefore, in the embodiment of this application, a computer storage medium applied to the encoder 120 is provided. A computer program is stored in the computer storage medium. When the computer program is executed by a first processor, any method in the above embodiment is executed.

[0318] Based on the structure of the above-described encoder 120 and the computer storage medium, referring to FIG. 13, FIG. 13 is a schematic diagram showing the 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 via a first bus system 1304. The first bus system 1304 is used to realize the connection and communication between these components. The first bus system 1304 further includes a power bus, a control bus, and a status signal bus in addition to a data bus. However, for clarity of explanation, in FIG. 13, various buses are marked as the first bus system 1304.

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

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

[0321] When the first processor 1303 executes a computer program, identify video flag information and the position of the last non-zero coefficient, when the video flag information indicates that the video meets a preset condition, identify the position inversion flag 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, identify the coordinate information of the last non-zero coefficient, encode all coefficients before the position of the last non-zero coefficient according to a preset scan order, and write the bit information obtained by encoding, the video flag information, and the coordinate information of the last non-zero coefficient into a bit stream.

[0322] In addition, 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 a volatile memory and a non-volatile memory. The non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (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 example and not limitation, various RAMs are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synch-link DRAM (SLDRAM), direct rambus RAM (DRRAM). The first memory 1302 of the systems and methods described in the present application can include these and any other suitable types of memory, but is not limited thereto.

[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 hardware form or an instruction in software form 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 devices, discrete gates, or transistor logic devices, discrete hardware components. The processor can implement or execute various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any ordinary processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly executed and completed by a hardware decoding processor, or can be executed and completed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the technical field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, 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 in combination with the hardware of the processor.

[0324] It can be understood that these embodiments described in the present application can be realized by hardware, software, firmware, middleware, microcode, or a combination thereof. When realized by hardware, the processing unit can be realized by one or more application specific integrated circuits (ASICs), digital signal processing (DSP), DSP devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units used to execute the functions described in the present application, or a combination thereof. When realized by software, the technology described in the present application can be realized by modules (for example, procedures, functions, etc.) for executing the functions described in the present application. The software code is stored in the memory and executed by the processor. The memory can be realized inside or outside 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 can include a first specific unit and an encoding unit. Thus, in scenarios of high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, since the coefficient distribution rule is different from that of normal video scenarios, during coefficient encoding and decoding, by reducing or removing the number of syntax elements encoded and decoded in the context mode, the overhead due to encoding and decoding in the bitstream can be reduced, and the throughput of coefficient encoding and decoding and the speed of encoding and decoding can be improved. Also, since the syntax elements to be reduced or removed have little impact on high bit-depth, high bit-rate, high-quality, or lossless video encoding and decoding, the compression efficiency can also be improved.

[0327] In another embodiment of the present application, based on the same inventive concept as the above embodiment, referring to FIG. 14, FIG. 14 is a schematic diagram showing the structure of a decoder 140 according to an embodiment of the present application. As shown in FIG. 14, the decoder 140 can include an analysis unit 1401 and a second specific unit 1402. The analysis unit 1401 is configured to analyze the bitstream to obtain video flag information, and when the video flag information indicates that the video satisfies a preset condition, analyze the bitstream to obtain the position inversion flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. The second specific unit 1402 is configured to identify the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient when the position inversion flag information of the last non-zero coefficient indicates that the current block uses the position inversion of the last non-zero coefficient. The analysis unit 1401 is further configured to decode all the coefficients before the position of the last non-zero coefficient according to a preset scan order to identify the coefficients of the current block.

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

[0329] In some embodiments, the second specifying unit 1402 is further configured to specify that when the value of the video flag information is the first value, the video flag information indicates that the video meets a preset condition, or when the value of the video flag information is the second value, the video flag information indicates that the video does not meet a preset condition.

[0330] In some embodiments, the preset condition includes at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

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

[0332] In some embodiments, the analysis unit 1401 is further configured to analyze the bitstream to obtain prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient. The second specifying unit 1402 is further configured to specify the horizontal coordinate of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the horizontal coordinate of the last non-zero coefficient, and to specify the vertical coordinate of the last non-zero coefficient based on the prefix information of the vertical coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient. Also, the second specifying unit 1402 is configured to specify 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.

[0333] In some embodiments, when the position inversion flag information of the last non-zero coefficient indicates that the current block uses the position inversion of the last non-zero coefficient, the second specifying unit 1402 is further configured to specify 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. Furthermore, the second specifying unit 1402 is further configured to specify the width and height of the current block, subtract the horizontal distance from the position of the last non-zero coefficient to the lower right corner of the current block from the width of the current block to obtain the horizontal coordinate of the last non-zero coefficient, subtract 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 to obtain the vertical coordinate of the last non-zero coefficient, and specify 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 specifying unit 1402 is further configured to, when the last non-zero coefficient position inversion flag information indicates that the current block does not utilize the last non-zero coefficient position inversion, specify the coordinates 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 upper left corner of the current block, and further configured to specify the position of the last non-zero coefficient based on 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.

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

[0336] In some embodiments, the analysis unit 1401 is further configured to analyze the bitstream to obtain the last coefficient valid flag information, and when the last coefficient valid flag information indicates that the current block utilizes the last coefficient position, decode all the coefficients before the last coefficient position according to a preset scan order to specify the coefficients of the current block.

[0337] In some embodiments, the second specifying unit 1402 is further configured to specify that when the value of the last coefficient valid flag information is the first value, the last coefficient valid flag information indicates that the current block utilizes the last coefficient position, or specify that when the value of the last coefficient valid flag information is the second value, the last coefficient valid flag information indicates that the current block does not utilize the last coefficient position.

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

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

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

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

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

[0343] In some embodiments, when the second specifying unit 1402 sets the position of the last non-zero coefficient to the position of the last coefficient, it is further configured to specify the position of the last non-zero coefficient based on the coordinate information of the lower right corner of the transformed block.

[0344] In some embodiments, the last coefficient valid flag information is at least one flag information among sequence level, picture level, slice level, and block level.

[0345] In some embodiments, when the video flag information indicates that the video meets the preset conditions, the analysis unit 1401 further analyzes the bitstream to obtain sub-block default decoding flag information, and when the sub-block default decoding flag information indicates that it defaults when the sub-block waiting for decoding in the current block is decoded, determines that the value of the sub-block decoding flag information is the first value, and is configured to decode all coefficients in the sub-block waiting for decoding.

[0346] In some embodiments, when the sub-block default decoding flag information indicates that it does not default when the sub-block waiting for decoding is decoded, the analysis unit 1401 further analyzes the bitstream to obtain sub-block decoding flag information, and when the value of the sub-block decoding flag information is the first value, is configured to decode all coefficients in the sub-block waiting for decoding.

[0347] In some embodiments, when the value of the sub-block default decoding flag information is the first value, the second determination unit 1402 further determines that the sub-block default decoding flag information defaults when the sub-block waiting for decoding is decoded, or when the value of the sub-block default decoding flag information is the second value, determines that the sub-block default decoding flag information does not default when the sub-block waiting for decoding is decoded.

[0348] In some embodiments, when the value of the sub-block decoding flag information is the first value, the second determination unit 1402 further determines that all coefficients in the sub-block waiting for decoding are decoded, or When the value of the sub-block decoding flag information is the second value, it is configured to identify that all coefficients in the sub-block waiting for decoding are zero.

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

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

[0351] In some embodiments, the second identifying unit 1402 is further configured to identify that the video satisfies a preset condition if the video flag information is high bit-depth flag information and the high bit-depth flag information indicates that the video satisfies the high bit-depth.

[0352] In some embodiments, the second identifying unit 1402 is further configured to identify that the video satisfies a preset condition if the video flag information is high bit-rate flag information and the high bit-rate flag information indicates that the video satisfies the high bit-rate.

[0353] In some embodiments, the second identifying unit 1402 is further configured to identify that the video satisfies a preset condition if the video flag information is high quality flag information and the high quality flag information indicates that the video satisfies the high quality.

[0354] In some embodiments, the second identifying unit 1402 is further configured to identify that the video satisfies a preset condition if the video flag information is reversible compression flag information and the reversible compression flag information indicates that the video satisfies the reversible 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 also be a module or a non-module. In addition, each constituent unit according to this embodiment may be integrated into one processing unit, each unit may physically exist alone, or two or more units may be integrated into one unit. The above integrated unit can be realized in the form of a hardware or software functional module.

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

[0357] Therefore, in the embodiments of the present application, a computer storage medium applied to the decoder 140 is provided. A computer program is stored in the computer storage medium. When the computer program is executed by a first processor, any method in the above embodiment is executed.

[0358] Based on the structure of the decoder 140 and the computer storage medium described above, referring to FIG. 15, FIG. 15 is a schematic diagram showing the 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 via a second bus system 1504. The second bus system 1504 is used to realize the connection and communication between these components. The second bus system 1504 further includes a power bus, a control bus, and a status signal bus in addition to the data 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 to transmit and receive signals in the process of transmitting and receiving information with other external network elements.

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

[0361] When the second processor 1503 executes a computer program, it analyzes the bitstream to obtain video flag information, and when the video flag information indicates that the video meets the preset conditions, it analyzes the bitstream to obtain the position inversion flag information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient, and when the position inversion flag information of the last non-zero coefficient indicates that the current block uses the position inversion of the last non-zero coefficient, it calculates the coordinate information of the last non-zero coefficient to identify the position of the last non-zero coefficient, and decodes all the coefficients before the position of the last non-zero coefficient according to the preset scan order to identify the coefficients of the current block.

[0362] Alternatively, 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] Note that the second memory 1502 is similar to the first memory 1302 in terms of hardware functions, and the second processor 1503 is similar to the first processor 1303 in terms of hardware functions, and detailed descriptions thereof are omitted.

[0364] In the embodiments of the present application, a decoder is provided. The decoder can include an analysis unit and a second specific unit. In this way, in scenarios of high bit depth, high bit rate, high quality, or lossless compression video encoding and decoding, since the coefficient distribution rule is different from that of normal video encoding and decoding scenarios, during coefficient encoding and decoding, by reducing or removing the number of syntax elements encoded and decoded in the context mode, the overhead due to encoding and decoding in the bitstream can be reduced, and the throughput of coefficient encoding and decoding and the speed of encoding and decoding can be improved. Also, since the syntax elements to be reduced or removed have little impact on high bit depth, high bit rate, high quality, or lossless compression video encoding and decoding, the compression efficiency can also be improved.

[0365] Note that in the present application, terms such as "including", "comprising", or other variants do not exclude including other components and are intended to cover. Therefore, a process, method, article, or device including a series of elements includes not only those elements but also other elements not explicitly listed or other elements inherent to the process, method, article, or device. Unless limited, the presence of another same element in a process, method, article, or device including elements limited by the phrase "comprising..." is not excluded.

[0366] The sequence numbers of the embodiments of the present application above do not indicate the superiority or inferiority of the embodiments and are only used for illustration.

[0367] The methods disclosed in some method embodiments according to this application can be arbitrarily combined to obtain new method embodiments as long as there is no conflict.

[0368] The features disclosed in some product embodiments according to this application can be arbitrarily combined to obtain new product embodiments as long as there is no conflict.

[0369] The features disclosed in some method or apparatus embodiments according to this application can be arbitrarily combined to obtain new method embodiments or apparatus embodiments as long as there is no conflict.

[0370] The above are only specific embodiments of this application, and the protection scope of this application is not limited thereto. All changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Industrial Applicability

[0371] In the embodiments of this application, for encoders and decoders, in scenarios of high bit depth, high bit rate, high quality, or lossless video encoding and decoding, since the coefficient distribution rule is different from that of normal video scenarios, during coefficient encoding and decoding, the number of syntax elements encoded and decoded in the context mode is reduced or removed. Examples of such syntax elements include the position of the last non-zero coefficient, sub-block encoding and decoding flags, etc. Further, when the value of the coordinate information of the last non-zero coefficient is large, coordinate transformation is performed to reduce the overhead due to encoding and decoding in the bitstream, and the throughput and speed of coefficient encoding and decoding can be improved. Also, since the syntax elements to be reduced or removed have little impact on high bit depth, high bit rate, high quality, or lossless video encoding and decoding, 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 sequence level flags; If the sequence level flag indicates that the video satisfies a preset condition, parsing the bitstream to obtain position reversal flag information of a last non-zero coefficient; Parsing the bitstream to obtain horizontal coordinate prefix information of a last non-zero coefficient, vertical coordinate prefix information of the last non-zero coefficient, horizontal coordinate suffix information of the last non-zero coefficient, and vertical coordinate suffix information of the last non-zero coefficient; 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 coordinate information of the last non-zero coefficient based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient; If the position reversal flag information of the last non-zero coefficient indicates that the current block uses the position reversal of the last non-zero coefficient, calculating coordinate information of the last non-zero coefficient to identify the position of the last non-zero coefficient; and decoding all coefficients prior to the position of the last non-zero coefficient according to a preset scanning order to identify coefficients of the current block; The horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_x_suffix is ​​not present, then LastSignificantCoeffX=last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX=(1<<log2ZoTbWidth)-1-LastSignificantCoeffX; The vertical coordinate value of the last non-zero coefficient in the current block according to the preset scanning order is derived as follows: If last_sig_coeff_y_suffix is ​​not present, then LastSignificantCoeffY=last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1<<log2ZoTbHeight)-1-LastSignificantCoeffY; LastSignificantCoeffX represents a horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scanning order, LastSignificantCoeffY represents a vertical coordinate value of the last non-zero coefficient in the current block according to the preset scanning order, last_sig_coeff_x_prefix represents prefix information of the horizontal coordinate of the last non-zero coefficient, and last_sig_coeff_x_prefix represents a value of the horizontal coordinate of the last non-zero coefficient in the current block according to the preset scanning order. sig_coeff_y_prefix represents prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents position inversion flag information of the last non-zero coefficient.

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 the sequence-level flag indicates that the video satisfies the predefined condition if the value of the sequence-level flag is a first value; or determining that the sequence-level flag indicates that the video does not satisfy the preset condition if the value of the sequence-level flag is a second value.

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

4. The preset 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. 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.

7. The coefficient decoding method includes: if the position reversal flag information of the last non-zero coefficient indicates that the current block does not use the position reversal of the last non-zero coefficient, specifying the coordinate information of the last non-zero coefficient as horizontal and vertical distances from 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.

8. The position inversion flag information of the last non-zero coefficient is at least one of flag information at a sequence level, a picture level, a slice level, and a block level.

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

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

4. A coefficient coding method comprising:

10. Identifying the sequence-level flag comprises: determining that the value of the sequence-level flag is a first value if the video satisfies the preset condition; or determining if the video does not satisfy the preset condition, the value of the sequence-level flag is a second value; 10. The method of claim 9, wherein the coefficients are coded in a multiplicity of bits.

11. The preset conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression; The method of claim 10 .

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

10. The method of claim 9, wherein the coefficients are coded in a multiplicity of bits.

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

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

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

14. The method of claim 13, wherein the coefficients are coded in a multiplicity of bits.

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

16. An encoder comprising:

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

23. A decoder 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