Coefficient coding and decoding methods, encoders, decoders, and computer storage media

By optimizing coefficient encoding and decoding methods for high-bit-depth, high-bit-rate, high-quality video, the method reduces syntax elements and overhead, enhancing throughput and compression efficiency.

JP2026076317APending Publication Date: 2026-05-11GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2026-02-13
Publication Date
2026-05-11

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies face inefficiencies in high-bit-depth, high-bit-rate, high-quality scenarios, leading to increased overhead, reduced speed, and decreased throughput.

Method used

A method and apparatus for coefficient encoding and decoding that identifies video flag information and the position of the last non-zero coefficient, utilizing position inversion flag information to optimize encoding and decoding processes, reducing the number of syntax elements encoded/decoded and performing coordinate transformations to minimize overhead.

Benefits of technology

Improves throughput and speed of coefficient encoding/decoding, while enhancing compression efficiency in high-bit-depth, high-bit-rate, high-quality video scenarios by optimizing encoding/decoding processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026076317000001_ABST
    Figure 2026076317000001_ABST
Patent Text Reader

Abstract

This invention provides a method for improving coefficient coding / decoding throughput, coding / decoding speed, and compression efficiency in high-bit-depth, high-bit-rate, high-quality, or lossless video coding / decoding scenarios. [Solution] The method analyzes the bitstream to obtain video flag information. If the video flag information indicates that the video satisfies a predetermined condition, the bitstream is analyzed to obtain the position inversion flag information for the last non-zero coefficient and the coordinate information for the last non-zero coefficient. If the position inversion flag information for the last non-zero coefficient indicates that the position inversion of the last non-zero coefficient is to be used, the position of the last non-zero coefficient is determined by calculating the coordinate information for the last non-zero coefficient. According to a predetermined scan order, all coefficients prior to the position of the last non-zero coefficient are decoded to determine the coefficient of the current block.
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 is 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 speed and throughput of encoding and decoding.

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 medium 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 speed of encoding and decoding can be improved, and the compression efficiency can also be improved.

[0005] The technical invention of the embodiment of this application can be realized as follows.

[0006] In the first aspect, an embodiment of the present application provides a coefficient decoding method to be applied to a decoder. The method is The bitstream is analyzed to obtain video flag information, and If the video flag information indicates that the video satisfies pre-set conditions, the bitstream is parsed to obtain the position inversion flag information and the coordinate information of the last non-zero coefficient, If the position inversion flag information for the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, then the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient. This includes decoding all coefficients prior to the position of the last non-zero coefficient according to a predetermined scan order to identify the coefficients of the current block.

[0007] In a second aspect, embodiments of the present application provide a coefficient coding method applicable to an encoder. The method is: Identifying video flag information and the position of the last non-zero coefficient, When video flag information indicates that the video satisfies pre-set conditions, it identifies the last non-zero coefficient position inversion flag information, 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, This includes encoding all coefficients prior to the position of the last non-zero coefficient according to a predetermined scan order, and writing the bit information obtained by encoding, video flag information, and the coordinate information of the last non-zero coefficient to the bitstream.

[0008] In a third aspect, an embodiment of the present application provides an encoder comprising a first specific unit and an encoding unit. The first identification unit is configured to identify video flag information and the position of the last non-zero coefficient, and to identify the position inversion flag information of the last non-zero coefficient if the video flag information indicates that the video satisfies a predetermined condition. The first identifying 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 position inversion flag information of the last non-zero coefficient. The encoding unit is configured to encode all coefficients prior to the position of the last non-zero coefficient according to a pre-set scan order, and to write the bit information obtained by encoding, video flag information, and the coordinate information of the last non-zero coefficient to the bitstream.

[0009] In a fourth aspect, an embodiment of the present application provides an encoder comprising a first memory and a first processor. The first memory is configured to store computer programs that can be executed by the first processor. The first processor is configured to perform the method described in the second mode when executing a computer program.

[0010] In the fifth aspect, an embodiment of the present application provides a decoder comprising an analysis unit and a second identification unit. The analysis unit is configured to analyze the bitstream to obtain video flag information, and if the video flag information indicates that the video satisfies a pre-set condition, 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. The second specific unit is configured to determine the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient if the position inversion flag information of the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient. The analysis unit is further configured to decode all coefficients prior to the position of the last non-zero coefficient, according to a pre-configured scan order, to identify the coefficients of the current block.

[0011] In the sixth aspect, an embodiment of the present application provides a decoder comprising a second memory and a second processor. The second memory is configured to store computer programs that can be executed by the second processor. The second processor is configured to perform the method described in the first mode when executing a computer program.

[0012] In the seventh 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 of the first embodiment or the method of the second embodiment is executed.

[0013] Embodiments of this application provide a coefficient coding and decoding method, an encoder, a decoder, and a computer storage medium. The encoder identifies video flag information and the position of the last non-zero coefficient. If the video flag information indicates that the video satisfies a preset condition, it identifies a flag information for the position inversion of the last non-zero coefficient. Based on the position of the last non-zero coefficient and the flag information for the position inversion of the last non-zero coefficient, it identifies the coordinate information of the last non-zero coefficient. According to a preset scan order, it encodes all coefficients prior to the position of the last non-zero coefficient and writes the bit information obtained by coding, the video flag information, and the coordinate information of the last non-zero coefficient to the bitstream. The decoder analyzes the bitstream to obtain video flag information. If the video flag information indicates that the video satisfies a preset condition, it analyzes the bitstream to obtain a flag information for the position inversion of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. If the flag information for the position inversion of the last non-zero coefficient indicates that the current block will utilize the position inversion of the last non-zero coefficient, it identifies the position of the last non-zero coefficient by calculating the coordinate information of the last non-zero coefficient. According to a pre-configured scan order, all coefficients prior to the position of the last non-zero coefficient are decoded to identify the coefficients of the current block. In this way, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those of normal video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing coordinate transformations when the coordinate information value of the last non-zero coefficient is large, the overhead caused by encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. In addition, since the impact of the reduced or removed syntax elements is small in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved. [Brief explanation of the drawing]

[0014] [Figure 1] FIG. 1 is a schematic diagram showing an application of an encoding framework according to the related art. [Figure 2] FIG. 2 is a schematic diagram showing the positional relationship between a current coefficient and an adjacent coefficient according to the related art. [Figure 3] FIG. 3 is a flowchart showing an arithmetic decoding process of a bin according to the related art. [Figure 4] FIG. 4 is a flowchart showing an arithmetic decoding process of a binary decision according to the related art. [Figure 5] FIG. 5 is a flowchart showing renormalization of an arithmetic decoding engine according to the related art. [Figure 6] FIG. 6 is a flowchart showing a bypass decoding process according to the related art. [Figure 7] FIG. 7 is a schematic diagram showing the positional relationship between a region where a non-zero coefficient may exist and a zero setting region according to the related art. [Figure 8A] FIG. 8A is a schematic diagram showing a system structure of an encoder according to an embodiment of the present application. [Figure 8B] FIG. 8B is a schematic diagram showing a system structure of a decoder according to an embodiment of the present application. [Figure 9] FIG. 9 is a flowchart showing a coefficient decoding method according to an embodiment of the present application. [Figure 10A] FIG. 10A is a schematic diagram showing the position of the last non-zero coefficient with respect to the upper left corner of the current block according to an embodiment of the present application. [Figure 10B] FIG. 10B is a schematic diagram showing the position of the last non-zero coefficient with respect to the lower right corner of the current block according to an embodiment of the present application. [Figure 11] FIG. 11 is a flowchart showing a coefficient encoding method according to an embodiment of the present application. [Figure 12] FIG. 12 is a schematic diagram showing the structure of an encoder according to an embodiment of the present application. [Figure 13]FIG. 13 is a schematic diagram showing a specific hardware structure of an encoder according to an embodiment of the present application. [Figure 14] FIG. 14 is a schematic diagram showing the structure of a decoder according to an embodiment of the present application. [Figure 15] FIG. 15 is a schematic diagram showing a specific hardware structure of a decoder according to an embodiment of the present application.

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 realization of the embodiments of the present application will be described in detail below with reference to the drawings. The attached drawings are for illustrative purposes only 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 art belonging to the technical field of the present application, 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. Note 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, the coding block (CB) is generally represented by a first, second, and third image component. The first, second, and third image components are the lumen component, blue chroma component, and red chroma component, respectively. Specifically, the lumen component is generally represented by the symbol Y, the blue chroma component by the symbol Cb or U, and the red chroma component by the symbol Cr or V. Thus, video images may be represented in either the YCbCr format or the YUV format.

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

[0020] Currently, block-based mixed coding and decoding frameworks are used in general-purpose video coding and decoding standards (e.g., VVC). Each image (frame) in a video image is divided into the largest coding unit (LCU) of the same size square (e.g., 128x128, 64x64, etc.). Each LCU can also be divided into rectangular coding units (CU) based on rules, and the CUs can be further divided into smaller prediction units (PU), transform units (TU), etc. Specifically, as shown in Figure 1, the mixed coding and decoding framework can include modules such as prediction, transform, quantization, entropy coding, and in-loop filtering. The prediction module can include intra-prediction and inter-prediction, and inter-prediction can include motion estimation and motion compensation. Because there is a strong correlation between adjacent samples in a video image, spatial redundancy between adjacent samples can be eliminated in video coding and decoding techniques by using intra-prediction methods. Similarly, because there is a strong similarity between adjacent images in a video, temporal redundancy between adjacent images can be eliminated in video coding and decoding techniques by using inter-prediction methods, thereby improving coding and decoding efficiency.

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

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

[0023] Block partitioning information, as well as mode information, parameter information, and coefficients for prediction, transformation, and quantization, are written to the bitstream by entropy coding. By assuming that the probabilities of different elements are different, assigning shorter codewords to elements with a higher probability of appearing and longer codewords to elements with a lower probability of appearing, higher coding efficiency can be obtained than with fixed-length coding. However, if the probabilities of different elements are close or nearly the same, the compression space by entropy coding becomes limited. CABAC is a standard entropy coding method, and HEVC and VCC, among others, use CABAC for entropy coding. CABAC can improve compression efficiency by using a context model, but the use and updating of the context mode makes the operation more complex. CABAC has a bypass mode. In bypass mode, the use and updating of the context model is not required, and higher throughput can be achieved. In the embodiments of this application, the mode in CABAC that requires the use and updating of the context model can be called the context mode.

[0024] Generally, it is necessary to first identify the context model based on a defined method. When calling the arithmetic decoding process for a defined binary decision, the parameters of the context model can be taken as input. In selecting the context model, there are dependencies between adjacent coefficients. For example, Figure 2 is a schematic diagram showing the positional relationship between the current coefficient and adjacent coefficients related to the relevant technology. In Figure 2, the blacked-out blocks represent the current coefficient, and the grid line blocks represent adjacent coefficients. As shown in Figure 2, which context model to select for the sig_coeff_flag of the current coefficient needs to be determined based on information from the five coefficients adjacent to the right, below, and to the lower right of the current coefficient. As can be seen further from Figure 2, the context mode operation is far more complex than the bypass mode operation, and there are dependencies between adjacent coefficients.

[0025] In the CABAC arithmetic coding and decoding engine, when using context mode, it is necessary to invoke the defined binary decision arithmetic decoding process. This process includes a state transition process, i.e., an update of the context model. The binary decision arithmetic decoding process invokes the renormalization process of the arithmetic decoding engine. When using bypass mode, it is necessary to invoke the bypass decoding process.

[0026] The following example illustrates the use of CABAC in VVC.

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

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

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

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

[0031] Figure 4 is a flowchart showing the arithmetic decoding process for binary decisions related to the relevant technology. As shown in Figure 4, pStateIdx0 and pStateIdx1 are the 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, ctxTable, and pStateIdx0 and pStateIdx1 associated with ctxIdx, valMps and ivlLpsRange are derived based on the following method. pState = pStateIdx1 + 16 × pStateIdx0, valMps=pState>>14, ivlLpsRange = (qRangeIdx × ((valMps?32767-pState:pState)>>9)>>1) + 4.

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

[0034] Provide a value for binVal and execute a defined state transition. Based on the current value of ivlCurrRange, a defined renormalization can be performed.

[0035] Furthermore, in the state transition process, the inputs of the process are the current pStateIdx0 and pStateIdx1, and the decoded value binVal, and the output of the process is the updated context variables pStateIdx0 and pStateIdx1, which are related to ctxTable and ctxIdx. The 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, the two variables pStateIdx0 and pStateIdx1, which are related to ctxTable and ctxIdx, are updated as follows: pStateIdx0 = pStateIdx0 - (pStateIdx0 >> shift0) + (1023 × binVal >> shift0), pStateIdx1 = pStateIdx1 - (pStateIdx1 >> shift1) + (16383 × binVal >> shift1).

[0037] Furthermore, the input to the renormalization process of the arithmetic decoding engine is the bits in the slice data, as well as the variables ivlCurrRange and ivlOffset, and the output is the updated variables ivlCurrRange and ivlOffset.

[0038] Figure 5 is a flowchart showing the renormalization of the arithmetic decoding engine related to the relevant technology. 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 greater, renormalization is not required, and the RenormD process terminates. Otherwise (if ivlCurrRange is less than 256), the renormalization loop is entered. 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 from read_bits(1) is shifted to ivlOffset.

[0039] In the overall process, the data in the bitstream will ensure that ivlOffset never exceeds ivlCurrRange.

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

[0041] If bypassFlag is 1, the bypass decoding process is invoked, and Figure 6 is a flowchart of the bypass decoding process related to the relevant technology. As shown in Figure 6, first, the value of ivlOffset is multiplied by 2, i.e., shifted to the left by 1 bit. The 1 bit obtained by read_bits(1) is shifted to ivlOffset. The value of ivlOffset and the value of ivlCurrRange are compared, 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 the value obtained by subtracting ivlCurrRange from ivlOffset. Otherwise (if ivlOffset is less than ivlCurrRange), set the value of binVal to 0.

[0042] In the overall process, the data in the bitstream will ensure that ivlOffset never exceeds ivlCurrRange.

[0043] It should be understood that current video encoding and decoding standards typically support one or more types of transforms and transform skips for residuals. Transforms include discrete cosine transforms (DCTs), etc. Residual blocks that utilize transforms generally exhibit certain characteristics after being transformed (and quantized). For example, after some transformation (and quantization), a large amount of energy is concentrated in the low-frequency region, resulting in larger coefficients in the upper left corner region, smaller coefficients in the lower right corner region, and a large number of zero coefficients. On the other hand, transform skipping literally means not performing a transformation. Since the coefficients after transform skipping have a different distribution rule than the transformed coefficients, different coefficient encoding and decoding methods can be used. For example, in VCC, RRC is used for the transformed coefficients, and TSRC is used for the coefficients after transform skipping.

[0044] In a typical transformation, such as the DCT transformation, the frequency in the transformed block gradually increases from left to right and from top to bottom. The upper left corner represents low frequencies, and the lower right corner represents high frequencies. The human eye is more sensitive to low-frequency information but not particularly sensitive to high-frequency information. This characteristic can be used to process or remove some high-frequency information with minimal impact on vision. In some techniques, such as zero-out, some high-frequency information can be forced to be set to 0. For example, in a 64x64 block, coefficients at positions where the horizontal coordinate is 32 or greater, or the vertical coordinate is 32 or greater, can be forced to be set to 0. The above is just one example, and the zero-out range can be derived in more complex ways, so the explanation is omitted here. As shown in Figure 7, non-zero coefficients (also called significant coefficients) may exist in the upper left corner (i.e., the region where non-zero coefficients can exist), and all coefficients in the lower right corner are set to zero (i.e., the zero-out region). Thus, for subsequent coefficient coding and decoding, the coefficients in the zero-setting region are always 0 and therefore do not need to be coded.

[0045] Furthermore, after transforming (and quantizing) the residuals in a typical video, the coefficient distribution exhibits the characteristic of having large coefficients in the upper left corner and many zero coefficients in the lower right corner. Therefore, during coefficient coding and decoding, several methods are used to ensure that coefficients within a certain range in the upper left corner require coding and decoding, while coefficients within a certain range in the lower right corner do not (i.e., these coefficients are defaulted to 0). One method involves first identifying the position of the last non-zero coefficient in a block, according to the scan order, when coding and decoding the coefficients of a block. After identifying this position, all coefficients after the position of the last non-zero coefficient according to the scan order are considered to be 0, i.e., do not require coding and decoding. Only the position of the last non-zero coefficient and the coefficients before that position require coding and decoding. For example, in VVC, the positions of the last non-zero coefficients (LastSignificantCoeffX, LastSignificantCoeffY) are identified using last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix.

[0046] (a) last_sig_coeff_x_prefix specifies the prefix of the horizontal (or column) coordinate of the last non-zero coefficient in the current block, according to the scan order. The value of last_sig_coeff_x_prefix should be in the range of 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 will be 0.

[0048] (b) last_sig_coeff_y_prefix specifies the prefix of the vertical (or row) coordinates 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 of 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 will be 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 of 0 to (1 << ((last_sig_coeff_x_prefix>>1)-1))-1 (including these two boundary values).

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

[0052] (d) last_sig_coeff_y_suffix specifies the suffix of the vertical (or row) coordinate of the last non-zero coefficient in the current transformation block, according to the scan order. The value of last_sig_coeff_y_suffix should be in the range of 0 to (1 << ((last_sig_coeff_y_prefix>>1)-1))-1 (including these two boundary values).

[0053] The value of the vertical (or row) coordinate of the last non-zero coefficient in the current transformation block, according to the scan order, LastSignificantCoeffY, is derived in the following way: 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.

[0054] Furthermore, the last non-zero coefficient and all coefficients prior to the last non-zero coefficient need to be encoded and decoded, but in normal video, a certain percentage of these coefficients remain 0. VVC uses the flag sb_coded_flag, which indicates whether encoding and decoding of the current subblock is necessary, to determine whether encoding and decoding of the coefficients in the current subblock is required. If encoding and decoding are not required, all coefficients in the current subblock are considered to be 0. Here, a subblock is usually an n×n subblock, for example, a 4×4 subblock.

[0055] sb_coded_flag[xS][yS] specifies the following information for the subblock located at (xS, yS) in the current transformation block, where the subblock is an array of transform coefficient levels. If the value of sb_coded_flag[xS][yS] is 0, then all transformation coefficient levels in the subblock located at (xS, yS) in the current transformation block will be 0. If sb_coded_flag[xS][yS] does not exist, the value of sb_coded_flag[xS][yS] will be 1.

[0056] Furthermore, when processing coefficient coding and decoding, the properties of the coefficients can be used to improve compression efficiency. For example, in typical video, a certain percentage of the coefficients that need coding and decoding are zero, so whether the current coefficient is zero or not can be represented by a single syntax element, and this syntax element is usually a single binary symbol. If the current coefficient is zero, it means that coding and decoding of the current coefficient is complete; otherwise, coding and decoding of the current coefficient needs to be continued. As another example, in typical video, a certain percentage of the non-zero coefficients have an absolute value of 1, so whether the absolute value of the current coefficient is greater than 1 can be represented by a single syntax element, and this syntax element is usually a single binary symbol. If the absolute value of the current coefficient is 1 or less, it means that coding and decoding of the current coefficient is complete; otherwise, coding and decoding of the current coefficient needs to be continued. For example, the syntax element related to VCC is as follows:

[0057] sig_coeff_flag[xC][yC] is used to determine whether the corresponding transformation coefficient level at position (xC, yC) of the current transformation block is a non-zero coefficient. If the value of sig_coeff_flag[xC][yC] is 0, the transformation 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 the 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 presumed to be 0.

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

[0060] Thus, after processing the above flags (or syntax elements), if the encoding and decoding of the coefficients is not yet complete, the remaining absolute values ​​of the coefficients (e.g., abs_remainder in VVC) need to be encoded.

[0061] abs_remainder[n] is the remaining absolute value of the transformation coefficient level encoded and decoded using the Golomb-Rice code at scan position n. If abs_remainder[n] does not exist, its value will be 0.

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

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

[0064] The above all represent the absolute values ​​of the coefficients, and the sine of non-zero coefficients can be identified by the coefficient sine flag coeff_sign_flag, or by several sine derivation methods. coeff_sign_flag[n] can be used to identify the sine of the transformation coefficient at scan position n based on the following method. If the value of coeff_sign_flag[n] is 0, the corresponding conversion coefficient will be a positive value. Otherwise (if the value of coeff_sign_flag[n] is 1), the corresponding conversion coefficient will be a negative value.

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

[0066] Note that CoeffSignLevel[xC][yC] may be derived in several other ways, but these explanations are omitted here.

[0067] Furthermore, VVC also uses a parity flag, par_level_flag, for the coefficient values. This flag indicates the parity of the current coefficient values, and this flag is used to identify the current coefficient values ​​and perform dependent quantization.

[0068] par_level_flag[n] specifies the parity of the transformation coefficient level at position n according to the scan order. If par_level_flag[n] does not exist, its value is 0.

[0069] In addition to identifying the parity of the transformation coefficients, `par_level_flag` can also be used, along with `abs_level_gtx_flag` and `abs_remainder`, to identify the magnitude of the coefficients.

[0070] Here, context-mode encoding and decoding require selecting, using, and updating the context mode, while bypass-mode encoding and decoding do not require selecting, using, or updating the context mode. Typically, it is more hardware-friendly to group together syntax elements encoded and decoded in context mode and syntax elements encoded and decoded in bypass mode within a certain range. For example, first, all syntax elements encoded and decoded in context mode in one block are processed, and then the syntax elements encoded and decoded in bypass mode are processed. All syntax elements encoded and decoded in context mode in the current block may be further divided into several groups, and all syntax elements encoded and decoded in bypass mode in 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] JPEG2026076317000003.jpg220150JPEG2026076317000004.jpg228150JPEG2026076317 000005.jpg222150JPEG2026076317000006.jpg226150JPEG2026076317000007.jpg61150

[0073] The array AbsLevel[xC][yC] represents an array of absolute values ​​of the transformation coefficients of the current transformation block. The array AbsLevelPass1[xC][yC] represents an array of absolute values ​​of the partial reconstructions of the transformation coefficients of the current transformation block. The array indices xC and yC represent the (xC, yC) position in the current transformation 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 remaining binaries inpass1, that is, the number of remaining binary symbols in the first round. Coefficients before the last non-zero coefficient according to the scan order need to be encoded and decoded. For sub-blocks containing those coefficients, sequentially identify whether each current sub-block needs to be encoded and decoded. If it needs to be encoded and decoded, in this method, set the syntax elements encoded and decoded in the context mode in one sub-block in the first round, and set the syntax elements encoded and decoded in the bypass mode later.For each coefficient, it may be necessary to process up to four syntax elements that are encoded and decoded in context mode (i.e., one sig_coeff_flag, two abs_level_gtx_flag, and one par_level_flag). In the first round, 1 is subtracted from remBinsPass1 each time a syntax element encoded and decoded in context mode is processed. If one coefficient is large enough, after processing several syntax elements encoded and decoded in context mode in the first round, the remaining value (i.e., abs_remainder) needs to be processed. If remBinsPass1 is small enough (i.e., remBinsPass1 >= 4), the first round ends, and the remaining coefficients are processed directly in 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] JPEG2026076317000009.jpg228150JPEG2026076317000010.jpg227150TIFF2026076317000011.tif55150

[0077] After entering the function residual_ts_coding(x0,y0,log2TbWidth,log2TbHeight,cIdx), some information about the block size needs to be determined. Next, the value of RemCcbs is determined, i.e., based on the equation RemCcbs=((1<<(log2TbWidth+log2TbHeight))×7)>>2. RemCcbs specifies the number of syntax elements in the current block to be coded and decoded in context mode. In embodiments of this application, RemCcbs can be understood as remaining context coded binaries, i.e., the remaining number of binary symbols to be coded and decoded in context mode. Whether the current subblock needs to be coded and decoded is determined for each subblock. Unlike the RRC described above, in the TSRC method, if encoding and decoding are required, syntax elements to be encoded and decoded in context mode within a subblock are set in the second round, and for each coefficient, a maximum of four syntax elements to be encoded and decoded in context mode are processed in the first and second rounds, respectively. Syntax elements to be encoded and decoded in bypass mode are set later. In the first and second rounds, 1 is subtracted from remBinsPass1 each time a syntax element to be encoded and decoded in context mode is processed. If one coefficient is sufficiently large, after processing several syntax elements to be encoded and decoded in context mode in the first and second rounds, the remaining value (i.e., abs_remainder) needs to be processed. If remBinsPass1 is sufficiently small (i.e., remBinsPass1 >= 4 is not satisfied), the first two rounds are completed, and the remaining coefficient is processed directly in bypass mode, in which case it is still abs_remainder.

[0078] In short, in related technologies, conventional coefficient coding and decoding methods offer superior compression efficiency for conventional, commonly used videos, such as consumer videos. Consumer videos typically have a bit depth of 8 or 10 bits per pixel and a relatively low bitrate (usually a few megabytes / second (MB / s) or less). However, some videos to which this method is applied require higher bit depths, for example, 12 bits, 14 bits, 16 bits or more per pixel. Higher bit depths typically result in larger coefficients, more non-zero coefficients, and higher bitrates. Some videos to which this method is applied require higher quality, and higher quality typically results in larger coefficients, more non-zero coefficients, and higher bitrates. Higher bitrates require higher processing power (e.g., throughput) from the decoder.

[0079] Compared to low-bit-depth, low-quality, low-bitrate video (normal video), high-bit-depth, high-quality, high-bitrate video ("triple-high video") typically has more and larger coefficients that require encoding and decoding. For example, for a single block of the same size, triple-high video has far more coefficients that require encoding and decoding than normal video. This is because normal video blocks have many coefficients that are 0 after prediction, transformation, and quantization, while triple-high video blocks have many non-zero coefficients after prediction, transformation, and quantization. In normal video blocks, a large proportion of the coefficients that require encoding and decoding are 0 after prediction, transformation, and quantization, so it is very effective to distinguish the region of coefficients that require encoding and decoding at the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY). Because the proportion of coefficients that are 0 before the position of the last non-zero coefficient is large, it is very effective to further distinguish whether the current subblock needs to be coded or decoded using the flag sb_coded_flag, which indicates whether the subblock needs to be coded or decoded. However, if there are a very large number of non-zero coefficients in the current block, and most, or even all, of the coefficients are non-zero, the above-mentioned position of the last non-zero coefficient and the flag indicating whether the subblock needs to be coded or decoded will not filter out many non-zero coefficients. Furthermore, coding and decoding the position of the non-zero coefficient and the flag indicating whether the subblock needs to be coded or decoded in the bitstream itself occupies a certain overhead, resulting in inefficiency.

[0080] In another mode, the position of the last non-zero coefficient, and flags indicating whether or not a subblock needs to be coded / decoded, are all coded / decoded in context mode. Context mode coding / decoding is more complex than bypass mode, and processing this information affects the coding / decoding speed and throughput of both software and hardware.

[0081] In other modes, the current method for encoding and decoding the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) involves encoding and decoding the coordinates at the position of the last non-zero coefficient. In normal video, the majority of non-zero coefficients are concentrated in the upper left corner, and a large area in the lower right corner has zero coefficients, so the values ​​of LastSignificantCoeffX and LastSignificantCoeffY are generally small. In triple-high video, there are also many non-zero coefficients in the lower right corner, so the values ​​of LastSignificantCoeffX and LastSignificantCoeffY are generally large, and encoding and decoding large values ​​in the bitstream results in greater overhead. There is also the possibility of using this method for lossless compression, because quantization cannot be used during lossless compression, and in this case the coefficients are generally relatively numerous and relatively large. In this case, using existing related schemes results in greater overhead and waste, and also affects the encoding and decoding speed and throughput.

[0082] Embodiments of this application provide a coefficient decoding method applicable to a decoder. The bitstream is analyzed to obtain video flag information. If the video flag information indicates that the video satisfies a predetermined condition, the bitstream is analyzed to obtain the position inversion flag information and the coordinate information of the last non-zero coefficient. If the position inversion flag information indicates that the current block utilizes the position inversion of the last non-zero coefficient, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient. All coefficients prior to the position of the last non-zero coefficient are decoded according to a predetermined scan order to determine the coefficients of the current block.

[0083] Embodiments of this application further provide a coefficient coding method applicable to an encoder. Video flag information and the position of the last non-zero coefficient are identified. If the video flag information indicates that the video satisfies a predetermined condition, a flag information for the position inversion of the last non-zero coefficient is identified. Based on the position of the last non-zero coefficient and the flag information for the position inversion of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is identified. All coefficients prior to the position of the last non-zero coefficient are coded according to a predetermined scan order, and the bit information obtained by coding, the video flag information, and the coordinate information of the last non-zero coefficient are written to a bitstream.

[0084] Thus, in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those in typical video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing coordinate transformations when the coordinate information value of the last non-zero coefficient is large, the overhead caused by encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. In addition, since the reduced or removed syntax elements have little impact in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved.

[0085] The embodiments of this application will be described in detail below with reference to the drawings.

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

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

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

[0089] The prediction unit 102 outputs the prediction block of CU, and the first adder 107 calculates the difference between CU and the prediction block of CU at the output of the division unit 101, i.e., the residual CU. The transformation unit 108 reads the residual CU and performs one or more transformation operations on the residual CU to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs the quantization coefficients (i.e., levels). The inverse quantization unit 110 outputs the reconstruction coefficients by performing a scaling operation on the quantization coefficients. The inverse transformation unit 111 performs one or more inverse transformations corresponding to the transformation in the transformation unit 108 and outputs the reconstruction residual. The second adder 112 calculates the reconstruction CU by adding the reconstruction residual and the prediction block of CU from the prediction unit 102. The second adder 112 also sends its output to the prediction unit 102 to be used as a reference for intra-prediction. After all CUs in the image or sub-image have been 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, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping with chroma scaling (LMCS) filter, and a neural-network-based filter. Alternatively, if the filtering unit 113 determines that a CU is not used as a reference for encoding and 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 a decoded image or sub-image, which is buffered in the DPB unit 114. The DPB unit 114 outputs the decoded image or sub-image based on timing and control information. The image stored in the DPB unit 114 can then be used as a reference for inter-prediction or intra-prediction by the prediction unit 102. Finally, the entropy coding unit 115 converts the parameters necessary for image decoding (such as control parameters and supplementary information) from the encoder 100 into binary format and writes this binary format to a bitstream based on the syntax structure of each data unit, so that the encoder 100 finally outputs a bitstream.

[0091] Furthermore, the encoder 100 may include a first processor and a first memory for storing a computer program. When the first processor reads and executes the computer program, the encoder 100 reads the input video and generates a corresponding bitstream. The encoder 100 may also be a computing device comprising one or more chips. The above unit, implemented as an integrated circuit on a chip, has connection and data exchange functions similar to the corresponding unit in Figure 8A.

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

[0093] The input bitstream to the decoder 200 may be the bitstream generated by the encoder 100. The analysis unit 201 analyzes the input bitstream and obtains the values ​​of the syntax elements from the input bitstream. The analysis unit 201 converts the binary representation of the syntax elements into numerical values ​​and sends the numerical values ​​to the unit 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 bitstream in order to display the decoded images.

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

[0095] The prediction unit 202 identifies the prediction block for the current decoding block (e.g., CU). Here, the prediction unit 202 may include a motion compensation unit 203 and an intra-prediction unit 204. Specifically, if it is indicated that an inter-decoding mode will be 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 to obtain the inter-prediction block. If it is indicated that an intra-prediction mode (including an MIP mode indicated based on the MIP mode index value) will be 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 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 transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The inverse transform unit 206 performs one or more transform operations (i.e., the inverse operations of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain the reconstruction residual.

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

[0099] After all CUs in the image or sub-images have been reconstructed, the filtering unit 208 performs in-loop filtering on the reconstructed image or sub-images. 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 chroma-scaling luma mapping (LMCS) filter, and a neural network-based filter. Alternatively, if the filtering unit 208 determines that the reconstructed block is not to be used as a reference for decoding other blocks, it performs in-loop filtering on one or more target samples in the reconstructed block. Here, the output of the filtering unit 208 is the decoded image or sub-images, which are buffered in the DPB unit 209. The DPB unit 209 outputs the decoded image or sub-images based on 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 may include a second processor and a second memory for storing a computer program. When the first processor reads and executes the computer program, the decoder 200 reads the input bitstream and generates the corresponding decoded video. The decoder 200 may also be a computing device comprising one or more chips. The above unit, implemented as an integrated circuit on a chip, has connectivity and data exchange functions similar to the corresponding unit in Figure 8B.

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

[0102] Referring to Figure 9 in one embodiment of this application, Figure 9 is a flowchart of a coefficient decoding method according to an embodiment of this application. As shown in Figure 9, this method may include the following:

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

[0104] The coefficient decoding method of the embodiment of this application is applied to a decoder. Specifically, based on the structure of the decoder 200 shown in Figure 8B, the coefficient decoding method of the embodiment of this application is mainly applied to the "analysis unit 201" in the decoder 200. The analysis unit 201 performs decoding using an adaptive binary arithmetic coding / decoding mode or bypass mode based on a context model, obtains the value of the relevant flag information (or syntax element), and can identify the coefficients of the current block.

[0105] Furthermore, coefficient coding and decoding as generally described in video standards can include two parts: coding and decoding. Therefore, coefficient coding and decoding include a coefficient coding method on the encoder side and a coefficient decoding method on the decoder side. Embodiments of this application describe the coefficient decoding method on the decoder side.

[0106] Under normal circumstances, the coefficient decoding method for regular video is the same as existing methods in related technologies. However, for specific situations such as high-bit-depth, high-quality, high-bit-rate, or lossless compressed video encoding / decoding scenarios, embodiments of this application can modify the method for deriving the final non-zero coefficient positions.

[0107] In embodiments of this application, it is first necessary to determine whether the current video satisfies pre-set conditions, which can be represented by video flag information. In some embodiments, the video flag information is obtained by analyzing the bitstream. If the value of the video flag information is the first value, it indicates that the video flag information indicates that the video meets a predetermined condition, or If the value of the video flag information is the second value, it may be specified, including, that the video flag information indicates that the video does not meet a predetermined condition.

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

[0109] In another specific example, the first value may be set to true and the second value to false. Furthermore, in yet another specific example, the first value may be set to 0 and the second value to 1, or the first value may be set to false and the second value to true. This is not limited to these examples.

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

[0111] In other words, compared to ordinary video, the video according to the embodiment of this application has characteristics such as high bit depth, high quality, high bit rate, high frame rate, and lossless compression.

[0112] Furthermore, video flag information may be sequence-level flags, or even higher-level flags, such as VUI (Video Usability Information) and SEI (Supplemental Enhancement Information). Whether a video satisfies pre-set conditions can be determined by checking whether the video meets high bit depth, high bitrate, high quality, or lossless compression requirements. These four cases will be explained below as examples.

[0113] In some embodiments, when the video flag information is high-bit-depth flag information, the method If the high bit depth flag information indicates that the video satisfies high bit depth, this may further include identifying that the video satisfies a pre-set condition.

[0114] In some embodiments, when the video flag information is high-bitrate flag information, the method If the high bitrate flag information indicates that the video meets a high bitrate, this may further include identifying that the video meets a pre-set condition.

[0115] In some embodiments, when the video flag information is high-quality flag information, the method If the high-quality flag information indicates that the video meets high-quality criteria, this may further include identifying that the video meets pre-set conditions.

[0116] In some embodiments, when the video flag information is lossless compression flag information, the method If the lossless compression flag information indicates that the video satisfies lossless compression, this may further include identifying that the video meets pre-set 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 bit-depth sequence. Alternatively, 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. Alternatively, the flag information may be other flag information indicating high bit depth, high bit rate, high quality, or lossless compression, and is not specifically limited to the embodiments of this application.

[0118] S902: If the video flag information indicates that the video satisfies a pre-set condition, the bitstream is analyzed to obtain the position inversion flag information for the last non-zero coefficient and the coordinate information for the last non-zero coefficient.

[0119] Furthermore, if the video flag information indicates that the video satisfies pre-set conditions, the position inversion flag information for the last non-zero coefficient and the coordinate information for the last non-zero coefficient can be obtained by further analyzing the bitstream.

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

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

[0122] Note that last_sig_coeff_x_prefix and last_sig_coeff_x_suffix specify the horizontal coordinate of the last non-zero coefficient. last_sig_coeff_y_prefix and last_sig_coeff_y_suffix specify the vertical coordinate of the last non-zero coefficient. This allows us to obtain the coordinate information of the last non-zero coefficient.

[0123] The last non-zero coefficient position reversal flag information can be represented by reverse_last_sig_coeff_flag. In embodiments of this application, the last non-zero coefficient position reversal flag information may be at least one of the sequence level, picture level, slice level, and block level flag information, and may also be 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 sequence-level or higher flag, and may be an image-level flag, a slice-level flag, a block-level flag, or a flag at any other level. Furthermore, a block-level flag may include an LCU-level flag, a CU-level flag, or any other block-level flag, and is not limited to the embodiments of this application.

[0125] In some embodiments, the method If the value of the last non-zero coefficient position inversion flag information is the first value, then the last non-zero coefficient position inversion flag information indicates that the current block will utilize the last non-zero coefficient position inversion, or This may further include identifying that if the value of the last non-zero coefficient position inversion flag information is the second value, then the last non-zero coefficient position inversion flag information indicates that the current block does not utilize the last non-zero coefficient position inversion.

[0126] That is, taking the case where the first value is 1 and the second value is 0 as an example, if the value of reverse_last_sig_coeff_flag is 1, we can identify that reverse_last_sig_coeff_flag indicates that the current block should utilize the position inversion of the last non-zero coefficient. Alternatively, if the value of reverse_last_sig_coeff_flag is 0, we can identify that reverse_last_sig_coeff_flag indicates that the current block should not utilize the position inversion of the last non-zero coefficient.

[0127] S903: If the last non-zero coefficient position inversion flag information indicates that the current block should utilize the last non-zero coefficient position inversion, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient.

[0128] S904: According to a pre-configured scan order, decode all coefficients prior to the position of the last non-zero coefficient to identify the coefficient of the current block.

[0129] In the embodiments of this application, if the position inversion flag information for the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, the coordinate information for the last non-zero coefficient can be specified as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block.

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

[0131] Note that the coordinate information of the last non-zero coefficient is usually the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the upper left corner of the current block. In 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 a coordinate inversion calculation, that is, the coordinate information of the last non-zero coefficient after coordinate inversion is the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block) needs to be performed. In that case, during coefficient decoding, a coordinate inversion calculation needs to be performed. After being inverted again, the coordinate information of the last non-zero coefficient can be restored 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 specified, and all the coefficients before the position of the last non-zero coefficient in the current block are decoded according to the preset scan order.

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

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

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

[0135] Furthermore, if reverse_last_sig_coeff_flag indicates that the current block does not utilize the position reversal of the last non-zero coefficient, the coordinate information of the last non-zero coefficient obtained by decoding can be considered as the target coordinate information of the last non-zero coefficient. In the embodiments of this application, the target coordinate information of the last non-zero coefficient is the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block.

[0136] Furthermore, in some embodiments, the method may further include the following: If the position inversion flag information for the last non-zero coefficient indicates that the current block does not utilize the position inversion 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. According to a pre-configured scan order, all coefficients prior to the position of the last non-zero coefficient are decoded to identify the coefficient of the current block.

[0137] The pre-set scan order may be a diagonal order, a zigzag order, a horizontal order, a vertical order, a 4x4 subblock scan order, or any other arbitrary scan order, and is not limited to the embodiments of this application.

[0138] If the value of reverse_last_sig_coeff_flag is 1, and it is necessary to reverse the position of the last non-zero coefficient, then after obtaining the coordinate information of the last non-zero coefficient through decoding, it is necessary to calculate the coordinate information of the last non-zero coefficient and determine its position. Next, all coefficients prior to the position of the last non-zero coefficient are decoded according to the pre-configured scan order. If the value of reverse_last_sig_coeff_flag is 0, i.e., it is not necessary to reverse the position of the last non-zero coefficient, then after obtaining the coordinate information of the last non-zero coefficient through decoding, the position of the last non-zero coefficient can be directly determined based on the coordinate information of the last non-zero coefficient. Next, all coefficients prior to the position of the last non-zero coefficient are decoded according to the pre-configured scan order.

[0139] Thus, in certain circumstances, embodiments of the present application provide a correction to the method for deriving the position of the last non-zero coefficient during coefficient coding and decoding. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in the relevant art. Certain circumstances may refer, for example, to high-bit-depth, high-quality, high-bitrate video coding and decoding or lossless compressed video coding and decoding. Under normal circumstances, as shown in Figure 10A, the horizontal coordinate of the position of the last non-zero coefficient, i.e., the horizontal distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, and the vertical coordinate of the position of the last non-zero coefficient, i.e., the vertical distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_y_prefix, last_sig_coeff_y_suffix. On the other hand, in the case of high-bit-depth, high-quality, high-bitrate video encoding / decoding or lossless compressed video encoding / 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 in the current block. In this case, as shown in Figure 10B, 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 in the current block is represented and encoded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the area of ​​all possible non-zero coefficients in the current block is represented and encoded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix.For example, if all possible non-zero coefficient regions of the current block are rectangular regions from (0, 0) to ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), last_sig_coeff_x_prefix and last_sig_coeff_x_suffix are encoded to represent the horizontal distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix are encoded to represent the vertical distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1).

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

[0141] In the current block, the value LastSignificantCoeffX of the horizontal (or column) coordinate of the last non-zero coefficient according to the preset scan order is derived based on the following method. If last_sig_coeff_x_suffix 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 last non-zero coefficient vertical (or row) coordinate, LastSignificantCoeffY, according to a predetermined 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), LastSignificantCoeffY = (1 << ((last_sig_coeff_y_prefix>>1) - 1)) * (2 + (last_sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix. If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY=(1< <log2ZoTbHeight)-1-LastSignificantCoeffYである。

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

[0143] Note that reverse_last_sig_coeff_flag may be a sequence-level or higher flag, and may be an image-level flag, slice-level flag, block-level flag, or flag at any other level. Block-level flags may include LCU-level flags, CU-level flags, or other block-level flags.

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

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

[0146] The syntax elements are as follows (Sequence parameter set RBSP syntax); please refer to Table 3.

[0147] [Table 3]

[0148] In another concrete example, let's assume 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, then sh_reverse_last_sig_coeff_flag needs to be decoded. Here, sh_reverse_last_sig_coeff_flag is the position reversal flag for the last non-zero coefficient in the current slice. If the value of sh_reverse_last_sig_coeff_flag is 1, it indicates that the block in the current slice will utilize the position reversal for the last non-zero coefficient; otherwise (i.e., if the value of sh_reverse_last_sig_coeff_flag is 0), it indicates that the block in the current slice will not utilize the position reversal for the last non-zero coefficient. In the syntax table above, reverse_last_sig_coeff_flag will be changed to sh_reverse_last_sig_coeff_flag.

[0149] The syntax elements are as follows (Slice header syntax); please refer to Table 4.

[0150] [Table 4]

[0151] Furthermore, if the video flag information indicates that the video satisfies a pre-set condition, it can be defaulted that all coefficients that may require decoding should be decoded. That is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients in the current block are scanned according to a pre-set scan order. Accordingly, embodiments of this application may also introduce a last-coefficient enabled flag to determine whether the current block uses the last coefficient position.

[0152] In some embodiments, if video flag information indicates that the video satisfies a predetermined condition, the method may further include the following: The bitstream is analyzed to obtain the last coefficient valid flag information. If the last coefficient valid flag information indicates that the current block should use the last coefficient position, then, according to the pre-configured scan order, all coefficients prior to the last coefficient position are decoded to determine the coefficient of the current block.

[0153] The last coefficient enabled flag information can be represented by default_last_coeff_enabled_flag. In embodiments of this application, the last coefficient enabled flag information may be at least one flag information from sequence level, image level, slice level, and block level, and may also be flag information at a higher level (e.g., VUI, SEI, etc.). It is not limited thereto.

[0154] That is, default_last_coeff_enabled_flag may be a sequence-level or higher flag, and may be an image-level flag, a slice-level flag, a block-level flag, or a flag at any other level. Furthermore, a block-level flag may include an LCU-level flag, a CU-level flag, or any other block-level flag, and is not limited to the embodiments of this application.

[0155] In some embodiments, the method If the value of the last coefficient valid flag information is the first value, then the last coefficient valid flag information indicates that the current block will use the last coefficient position, or This may further include identifying that if the value of the last coefficient valid flag information is the second value, then the last coefficient valid flag information indicates that the current block does not utilize the last coefficient position.

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

[0157] In another specific example, the first value may be set to true and the second value to false. Furthermore, in yet another specific example, the first value may be set to 0 and the second value to 1, or the first value may be set to false and the second value to true. This is not limited to these examples.

[0158] Thus, using the example where the first value is 1 and the second value is 0, we can determine that when the value of default_last_coeff_enabled_flag is 1, default_last_coeff_enabled_flag indicates that the current block should use the last coefficient position. Alternatively, when the value of default_last_coeff_enabled_flag is 0, we can determine that default_last_coeff_enabled_flag indicates that the current block should not use the last coefficient position.

[0159] If the current block uses the last coefficient position, the coefficients of the current block can be identified by decoding all coefficients prior to the last coefficient position according to a pre-configured scan order.

[0160] Furthermore, if the current block does not utilize the last coefficient position, i.e., if the value of the last coefficient valid flag information is 0, in some embodiments the method may further include the following: The bitstream is analyzed to obtain the prefix information for the last non-zero horizontal coordinate, the prefix information for the last non-zero vertical coordinate, the suffix information for the last non-zero horizontal coordinate, and the suffix information for the last non-zero vertical coordinate. The position of the last non-zero coefficient is determined based on the prefix information of the last non-zero coefficient's horizontal coordinate, the prefix information of the last non-zero coefficient's vertical coordinate, the suffix information of the last non-zero coefficient's horizontal coordinate, and the suffix information of the last non-zero coefficient's vertical coordinate. According to a pre-configured scan order, all coefficients prior to the position of the last non-zero coefficient are decoded to identify the coefficient of the current block.

[0161] If the current block does not use the last coefficient position, it is necessary to decode and obtain the position of the last non-zero coefficient. Specifically, 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 the position of the last non-zero coefficient is determined based on last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix. Otherwise, if the current block uses the last coefficient position, it is no longer necessary to determine the position of the last non-zero coefficient, and therefore 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] Furthermore, if the current block is using the last coefficient position, all coefficients prior to the last coefficient position can be decoded according to a preset scan order. If the current block is not using the last coefficient position, all coefficients prior to the last non-zero coefficient position can be decoded according to a preset scan order. Here, the preset scan order may be a diagonal order, a zigzag order, a horizontal order, a vertical order, a 4x4 subblock scan order, or any other arbitrary scan order, and is not limited to the embodiments of this application.

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

[0164] 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.

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

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

[0167] Furthermore, the last coefficient position can be represented as (LastCoeffX,LastCoeffY), that is, the last position of all possible non-zero coefficients in the current block according to a predetermined scan order. In some embodiments, the method may further include the following: The width and height of the transformed block are determined by performing a pre-configured operation on the current block. The coordinate information of the lower right corner of the transformation block is obtained by performing coordinate calculations based on the width and height of the transformation block. Based on the coordinate information of the lower right corner of the transformation block, the position of the last coefficient is determined.

[0168] Here, the pre-configured operations include at least a zero-out operation.

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

[0170] Thus, if the value of default_last_coeff_enabled_flag is 1, the last coefficient position can be determined based on (LastCoeffX,LastCoeffY).

[0171] In one particular 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 a predetermined 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 determined based on the coordinate information of the lower right corner of the transformation block.

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

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

[0174] Thus, in certain situations, it is assumed that all coefficients that may need to be coded or decoded should be coded or decoded during coefficient coding and decoding. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in the relevant technology. Certain situations can refer to, for example, high-bit-depth, high-quality, high-bitrate video coding and decoding or lossless compressed video coding and decoding. It is assumed that all coefficients that may need to be coded or decoded should be coded or decoded, that is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients in the current block are scanned according to a predetermined scan order. In other words, the position of the last coefficient that needs to be coded or decoded is set at the last position of all possible non-zero coefficients in the current block according to a predetermined scan order. This position is usually the lower right corner of the matrix consisting of all possible non-zero coefficients in the current block. Here, the position of the last coefficient that needs to be coded or decoded is used, rather than the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position requiring encoding / decoding may be 0, but the coefficient at the last non-zero coefficient position is not necessarily 0.

[0175] In one special case, we still utilize the position of the last non-zero coefficient. 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 a predetermined scan order.

[0176] Furthermore, the reason for mentioning all possible non-zero coefficients in the current block according to a pre-configured scan order is that, in addition to the last non-zero coefficient, several other techniques (for example, the zero-out method mentioned above) default to 0 for some coefficients in a block.

[0177] The semantic adjustments are shown in Table 5.

[0178] [Table 5]

[0179] In the embodiments of this application, a condition can be added before decoding the information required for the last non-zero coefficient, namely, if default_last_coeff_enabled_flag is false (i.e., the value of default_last_coeff_enabled_flag is equal to 0), then 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. If default_last_coeff_enabled_flag is true (i.e., the value of default_last_coeff_enabled_flag is equal to 1), then 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 flag used to indicate whether the default last coefficient is used or not. If the value of `default_last_coeff_enabled_flag` is 1, it indicates that the default last coefficient position will be used, that is, the last coefficient position that needs to be decoded will be set to the last position of all possible non-zero coefficients in the current block, according to the pre-configured scan order. Otherwise, it indicates that the default last coefficient position will not be used.

[0181] If the value of default_last_coeff_enabled_flag is 1, the default last coefficient position (LastCoeffX,LastCoeffY) is the last position of all possible non-zero coefficients in the current block according to a predetermined scan order. All coefficients prior to (LastCoeffX,LastCoeffY) must be scanned according to the predetermined scan order. In embodiments of this application, the derivation of (LastCoeffX,LastCoeffY) is as follows: LastCoeffX=(1< <log2ZoTbWidth)-1であり、LastCoeffY=(1<<log2ZoTbHeight)-1である。

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

[0183] In one particular case, the position of the last non-zero coefficient is still utilized. In this case, the position of the last non-zero coefficient is set to the last position of all possible non-zero coefficients in the current block, according to a predetermined scan order. In embodiments of this application, the method for deriving the positions of the last non-zero coefficients (LastSignificantCoeffX,LastSignificantCoeffY) is as follows: LastSignificantCoeffX=(1< <log2ZoTbWidth)-1であり、LastSignificantCoeffY=(1<<log2ZoTbHeight)-1である。

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

[0185] Note that default_last_coeff_enabled_flag may be a sequence-level or higher flag, and may be an image-level flag, slice-level flag, block-level flag, or flag at any other level. Block-level flags may include LCU-level flags, CU-level flags, or other block-level flags.

[0186] Furthermore, `default_last_coeff_enabled_flag` may depend on several other flags, such as the high bit depth flag information or the high bit rate flag information. That is, if the value of the high bit depth flag information or the high bit rate flag information is 1, `default_last_coeff_enabled_flag` needs to be decoded; otherwise, `default_last_coeff_enabled_flag` does not need to be decoded.

[0187] In one specific example, let's assume there is a sequence-level flag, sps_high_bit_depth_flag, that indicates whether the current video sequence is a high-bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high-bit-depth sequence; otherwise, it indicates that the current video sequence is not a high-bit-depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, then sps_default_last_coeff_enabled_flag must be decoded. Here, sps_default_last_coeff_enabled_flag is the default last coefficient enabled flag for the current sequence. If the value of sps_default_last_coeff_enabled_flag is 1, it indicates that the blocks in the current sequence will 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 in the current sequence will not use the default last coefficient. In the syntax table above, default_last_coeff_enabled_flag will be changed to sps_default_last_coeff_enabled_flag.

[0188] The syntax elements are as follows (Sequence parameter set RBSP syntax); please refer to Table 6.

[0189] [Table 6]

[0190] In another specific example, let's assume 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, we need to decode sh_default_last_coeff_enabled_flag, where sh_default_last_coeff_enabled_flag is the default last coefficient enabled flag for the current slice. If the value of sh_default_last_coeff_enabled_flag is 1, it indicates that the blocks in the current slice will 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 in the current slice will not use the default last coefficient. In the syntax table above, default_last_coeff_enabled_flag will be changed to sh_default_last_coeff_enabled_flag.

[0191] The syntax elements are as follows (Slice header syntax); please refer to Table 7.

[0192] [Table 7]

[0193] Furthermore, if the video flag information indicates that the video satisfies pre-set conditions, all scanned subblocks must be decoded by default. In this case, there is no need to transmit the sb_coded_flag in the bitstream; that is, neither the encoder nor the decoder needs to process the flag, thereby improving the decoding speed. Accordingly, embodiments of this application may further introduce a default sub-block coded flag used to determine whether or not a subblock currently awaiting decoding within a block will default once it is decoded.

[0194] In some embodiments, if video flag information indicates that the video satisfies a predetermined condition, the method may further include the following: The bitstream is analyzed to obtain the subblock default decoding flag information. If the subblock default decryption flag information indicates that the system should default once the subblocks awaiting decryption within the current block are decrypted, the system identifies the value of the subblock decryption flag information as the first value and decrypts all coefficients within the subblocks awaiting decryption.

[0195] The subblock default decoding flag information can be represented by default_sb_coded_flag. In embodiments of this application, the subblock default decoding flag information is at least one flag information from sequence level, image level, slice level, and block level, and may also be flag information at a higher level (e.g., VUI, SEI, etc.). It is not limited thereto.

[0196] That is, default_sb_coded_flag may be a sequence-level or higher flag, and may be an image-level flag, a slice-level flag, a block-level flag, or a flag at any other level. Furthermore, a block-level flag may include an LCU-level flag, a CU-level flag, or any other block-level flag, and is not limited to the embodiments of this application.

[0197] In some embodiments, the method If the value of the subblock default decryption flag information is the first value, it indicates that the subblock default decryption flag information instructs to default once the subblock awaiting decryption is decrypted, or This may further include specifying that if the value of the subblock default decryption flag information is the second value, the subblock default decryption flag information indicates that the subblock awaiting decryption should not default once it has been decrypted.

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

[0199] In another specific example, the first value may be set to true and the second value to false. Furthermore, in yet another specific example, the first value may be set to 0 and the second value to 1, or the first value may be set to false and the second value to true. This is not limited to these examples.

[0200] Thus, using the example where the first value is 1 and the second value is 0, we can identify that when the value of default_sb_coded_flag is 1, it indicates that default_sb_coded_flag should default to decrypting the subblocks awaiting decryption. Alternatively, when the value of default_sb_coded_flag is 0, it can be identified that default_sb_coded_flag should not default to decrypting the subblocks awaiting decryption.

[0201] If the default is to assume that a subblock awaiting decryption needs to be decrypted, the value of default_sb_coded_flag is 1, which means that the value of sb_coded_flag is 1, i.e., sb_coded_flag does not need to be decrypted. In this case, the default is to assume that all coefficients within the subblock awaiting decryption need to be decrypted.

[0202] Furthermore, if the default value of default_sb_coded_flag is not to indicate that a subblock awaiting decryption needs to be decrypted, i.e., when the default_sb_coded_flag value is 0, in some embodiments the method may further include the following: The bitstream is analyzed to obtain subblock decoding flag information. If the value of the subblock decryption flag information is the first value, all coefficients in the subblock awaiting decryption are decrypted.

[0203] If the default setting is not that the subblocks awaiting decryption need to be decrypted, the subblock decryption flag information must be decrypted and obtained. Then, based on the subblock decryption flag information, it is determined whether or not to decrypt all coefficients within the subblocks awaiting decryption.

[0204] Furthermore, regarding the subblock decryption flag information, this method is: If the value of the subblock decryption flag information is the first value, it specifies that all coefficients in the subblock awaiting decryption will be decrypted, or If the value of the subblock decryption flag information is the second value, it may further include identifying that all coefficients in the subblock awaiting decryption are zero.

[0205] In the embodiments of this application, the subblock decryption flag information can be represented by sb_coded_flag. Taking the first value as 1 and the second value as 0, if the value of sb_coded_flag is 1, it can be determined that all coefficients in the subblock awaiting decryption need to be decrypted. Alternatively, if the value of sb_coded_flag is 0, it can be determined that all coefficients in the subblock awaiting decryption do not need to be decrypted. In this case, all coefficients in the subblock awaiting decryption are zero.

[0206] Thus, in certain circumstances, during coefficient coding and decoding, it is assumed that all scanned subblocks must be coded and decoded; in other words, it is assumed that all scanned subblocks contain non-zero coefficients. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in related technologies. Certain circumstances can refer to, for example, high-bit-depth, high-quality, high-bit-rate video coding and decoding or lossless compressed video coding and decoding. In this case, there are many non-zero coefficients, and most of the scanned subblocks must be coded and decoded; in other words, most of the scanned subblocks contain non-zero coefficients. Thus, it is no longer necessary to transmit the sb_coded_flag in the bitstream, and the encoder / decoder does not need to process that flag, which can improve the coding and decoding speed. Also, since flags that are almost nonexistent are removed, the compression performance is slightly improved in this case.

[0207] The semantic corrections are shown in Table 8.

[0208] [Table 8]

[0209] `default_sb_coded_flag` is a flag that indicates whether or not to default to the need to decode a subblock. If the value of `default_sb_coded_flag` is 1, we can determine that the value of `sb_coded_flag[xS][yS]` is 1, and in this case, it is not necessary to decode `sb_coded_flag[xS][yS]` from the bitstream. Otherwise (if the value of `default_sb_coded_flag` is 0), it is still necessary to decode `sb_coded_flag[xS][yS]` from the bitstream.

[0210] Note that default_sb_coded_flag may be a sequence-level or higher flag, and may be an image-level flag, slice-level flag, block-level flag, or flag at any other level. Block-level flags may include LCU-level flags, CU-level flags, or other block-level flags.

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

[0212] In one specific example, let's assume there is a sequence-level flag, sps_high_bit_depth_flag, that indicates whether the current video sequence is a high-bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high-bit-depth sequence; otherwise, it indicates that the current video sequence is not a high-bit-depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, then sps_default_sb_coded_flag needs to be decoded. Here, sps_default_sb_coded_flag is a flag that indicates whether to default to decode a subblock of the current sequence. If the value of sps_default_sb_coded_flag is 1, it indicates that to default, a subblock of a block in the current sequence needs to be decoded; otherwise (i.e., if the value of sps_default_sb_coded_flag is 0), it indicates that to default, a subblock of a block in the current sequence does not need to be decoded. In the syntax table above, default_sb_coded_flag will be changed to sps_default_sb_coded_flag.

[0213] The syntax elements are as follows (Sequence parameter set RBSP syntax); please refer to Table 9.

[0214] [Table 9]

[0215] In another concrete example, let's assume 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, then sh_default_sb_coded_flag needs to be decoded. Here, sh_default_sb_coded_flag is a flag that indicates whether to default to decode a subblock of the current slice. If the value of sh_default_sb_coded_flag is 1, it indicates that to default, a subblock of a block in the current slice needs to be decoded; otherwise (i.e., if the value of sh_default_sb_coded_flag is 0), it indicates that to default, a subblock of a block in the current slice does not need to be decoded. In the syntax table above, default_sb_coded_flag will be changed to sh_default_sb_coded_flag.

[0216] The syntax elements are as follows (Slice header syntax); please refer to Table 10.

[0217] [Table 10]

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

[0219] Method 1 is as follows: In certain circumstances, it is assumed that all coefficients that may need to be coded or decoded should be coded or decoded during coefficient coding / decoding. That is, under normal circumstances, the coefficient coding / decoding method is the same as existing methods in the relevant technology. Certain circumstances can refer to, for example, high-bit-depth, high-quality, high-bitrate video coding / decoding or lossless compressed video coding / decoding. It is assumed that all coefficients that may need to be coded or decoded should be coded or decoded, that is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients in the current block are scanned according to a predetermined scan order. In other words, the last coefficient position that needs to be coded or decoded is set at the last position of all possible non-zero coefficients in the current block according to a predetermined scan order. Here, the last coefficient position that needs to be coded or decoded is used, not the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position that needs to be coded or decoded may be 0, but the coefficient at the last non-zero coefficient position is not necessarily 0.

[0220] Furthermore, in one particular example, the position of the last non-zero coefficient is still used, in which 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 a predetermined scan order.

[0221] Method 2 is as follows: In certain circumstances, the method for deriving the position of the last non-zero coefficient is corrected during coefficient coding / decoding. That is, under normal circumstances, the coefficient coding / decoding method is the same as existing methods in the relevant technology. Certain circumstances can refer to, for example, high-bit-depth, high-quality, high-bitrate video coding / decoding or lossless compressed video coding / decoding. Under normal circumstances, the x-coordinate of the position of the last non-zero coefficient, i.e., the horizontal distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the y-coordinate of the position of the last non-zero coefficient, i.e., the vertical distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix. On the other hand, in the case of high-bit-depth, high-quality, high-bitrate video encoding / decoding or lossless compressed video encoding / 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 in 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 in the current block is represented and encoded as last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the area of ​​all possible non-zero coefficients in the current block is represented and encoded as last_sig_coeff_y_prefix and last_sig_coeff_y_suffix.For example, if all possible non-zero coefficient regions of the current block are rectangular regions from (0, 0) to ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1), last_sig_coeff_x_prefix and last_sig_coeff_x_suffix are encoded to represent the horizontal distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1), and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix are encoded to represent the vertical distance from the position of the last non-zero coefficient to the current block ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1).

[0222] Method 3 is as follows. In a specific situation, it is defaulted that all scanned sub-blocks need to be encoded / decoded during coefficient encoding / decoding. In other words, it is defaulted that all scanned sub-blocks contain non-zero coefficients. That is, in 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 case, it is not necessary to transmit sb_coded_flag in the bitstream, and the encoder / decoder does not need to process that flag.

[0223] In contrast to the three methods described above, in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those of typical video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as the position of the last non-zero coefficient and subblock encoding / decoding flags. This can improve the throughput and speed of coefficient encoding / decoding. Furthermore, since these flags play a smaller role in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding, not utilizing them can improve compression efficiency to some extent without reducing it.

[0224] In addition, in the embodiments of this application, for example, the sequence level flag sps_high_bit_depth_flag, which indicates whether the current video sequence is a high-bit-depth sequence, may be replaced with sps_high_bit_rate_flag, which indicates whether the current video sequence is a high-bit-rate sequence, or it may be replaced with other flags that indicate high bit depth, high bit rate, high quality, or lossless encoding, etc.

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

[0226] This embodiment provides a coefficient decoding method applicable to a decoder. The bitstream is analyzed to obtain video flag information. If the video flag information indicates that the video satisfies a predetermined condition, the bitstream is analyzed to obtain the position inversion flag information and the coordinate information of the last non-zero coefficient. If the position inversion flag information indicates that the current block utilizes the position inversion of the last non-zero coefficient, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient. All coefficients prior to the position of the last non-zero coefficient are decoded according to a predetermined scan order to determine the coefficients of the current block. Thus, in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those in typical video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing coordinate transformations when the coordinate information value of the last non-zero coefficient is large, the overhead caused by encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. In addition, since the reduced or removed syntax elements have little impact in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved.

[0227] Referring to another embodiment of this application, Figure 11, is a flowchart of a coefficient coding method according to an embodiment of this application. As shown in Figure 11, the method may include the following:

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

[0229] S1102: If the video flag information indicates that the video satisfies a pre-set condition, identify the position inversion flag information for 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: Encrypt all coefficients before the position of the last non-zero coefficient according to the preset scan order, and write the bit information obtained by the encryption, the video flag information, and the coordinate information of the last non-zero coefficient into the bit stream.

[0232] Note that the coefficient encryption method of the embodiment of this application is applied to the encoder. Specifically, based on the structure of the encoder 100 shown in FIG. 8A, the coefficient encryption method of the embodiment of this application is mainly applied to the "entropy encryption unit 115" in the encoder 1 hundred. The entropy encryption unit 115 can use an adaptive binary arithmetic encryption / decryption mode or a bypass mode based on a context model to perform entropy encryption on relevant flag information (or syntax elements), and then write it into the bit stream.

[0233] Note that the coefficient encryption / decryption generally described in video standards can include two parts: encryption and decryption. Therefore, the coefficient encryption / decryption includes the coefficient encryption method on the encoder side and the coefficient decryption method on the decoder side. The embodiment of this application describes the coefficient encryption method on the encoder side.

[0234] Under normal circumstances, for normal videos, the coefficient encryption 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 reversible compression video encryption / decryption scenarios, in the embodiment of this application, the method for deriving the position of the final 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 embodiment of this application, thereby identifying the position of the last non-zero coefficient, and then encrypting all coefficients before the position of the last non-zero coefficient in the current block according to the preset scan order.

[0235] In an embodiment of the present application, first, it is necessary to determine whether the current video satisfies preset conditions, which can be represented by video flag information. In some embodiments, specifying the video flag information is When the video satisfies the preset conditions, specifying that the value of the video flag information is the first value, or When the video does not satisfy the preset conditions, specifying that the value of the video flag information is the second value, can be included. [[ID=_{8}]]

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

[0237] In addition, 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.

[0238] The preset conditions include 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). Whether the video satisfies the preset conditions can be determined by determining whether the video satisfies high bit depth, whether the video satisfies high bit rate, whether the video satisfies high quality, whether the video satisfies 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 is If the video satisfies high bit depth, this may further include specifying that high bit depth flag information indicates that the video satisfies a pre-defined condition.

[0241] In some embodiments, when the video flag information is high-bitrate flag information, the method This may further include specifying that if the video meets the high bitrate requirement, the high bitrate flag information indicates that the video meets a pre-defined condition.

[0242] In some embodiments, when the video flag information is high-quality flag information, the method If the video meets the high-quality criteria, this may further include specifying that the high-quality flag information indicates that the video meets pre-set conditions.

[0243] In some embodiments, when the video flag information is lossless compression flag information, the method If the video satisfies lossless compression, this may further include specifying that the lossless compression flag information indicates that the video satisfies a predetermined condition.

[0244] For example, taking the sequence level as an example, the video flag information may be high bit depth flag information (represented by sps_high_bit_depth_flag), which is used to indicate whether the current video sequence is a high bit depth sequence or not. Alternatively, 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 not. Alternatively, the flag information may be other flag information indicating high bit depth, high bit rate, high quality, or lossless compression, and is not specifically limited to the embodiments of this application.

[0245] Furthermore, regarding the position inversion flag information for the last non-zero coefficient, identifying the position inversion flag information for the last non-zero coefficient is possible. If the current block utilizes the position inversion of the last non-zero coefficient, it is necessary to identify that the value of the position inversion flag information for the last non-zero coefficient is the first value, or If the current block does not utilize the last non-zero coefficient position inversion, it may include specifying that the value of the last non-zero coefficient position inversion flag information is the second value.

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

[0247] That is, reverse_last_sig_coeff_flag may be a sequence-level or higher flag, and may be an image-level flag, a slice-level flag, a block-level flag, or a flag at any other level. Furthermore, a block-level flag may include an LCU-level flag, a CU-level flag, or any other block-level flag, and is not limited to the embodiments of this application.

[0248] Thus, taking the example where the first value is 1 and the second value is 0, if the current block is determined to utilize the position reversal of the last non-zero coefficient, the value of reverse_last_sig_coeff_flag will be 1. Alternatively, if the current block is determined not to utilize the position reversal of the last non-zero coefficient, the value of reverse_last_sig_coeff_flag will be 0.

[0249] Furthermore, the position of the last non-zero coefficient can include the initial horizontal and initial vertical coordinates of the last non-zero coefficient. If 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, then determining the coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient is possible. If the value of the position inversion flag information for the last non-zero coefficient is the first value, the coordinate information for the last non-zero coefficient can be identified by performing calculations based on the initial horizontal and vertical coordinates of the last non-zero coefficient, or If the value of the position inversion flag information for the last non-zero coefficient is the second value, it may include directly determining the coordinate information of the last non-zero coefficient based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient.

[0250] In other words, in some embodiments, the method is If the value of the position inversion flag information for the last non-zero coefficient is the first value, the coordinate information for the last non-zero coefficient is identified as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block, or If the value of the position inversion flag information for the last non-zero coefficient is the second value, this may further include specifying the coordinate information for the last non-zero coefficient as the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block.

[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 normal videos, most of the non-zero coefficients are concentrated in the upper left corner, and most of the areas in the lower right corner have 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, coordinate transformation (specifically, it can be a coordinate inversion calculation, that is, the coordinate information of the last non-zero coefficient after coordinate inversion is the horizontal distance and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block) needs to be performed. In that case, the decoder needs to perform a coordinate inversion calculation during coefficient decoding. After being inverted again, the coordinate information of the last non-zero coefficient can be restored 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. Obtain the horizontal coordinate of the last non-zero coefficient by subtracting the initial horizontal coordinate of the last non-zero coefficient from the width of the current block. Obtain the vertical coordinate of the last non-zero coefficient by subtracting the initial vertical coordinate of the last non-zero coefficient from the height of the current block. 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.

[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. The prefix information for the last non-zero horizontal coordinate, the prefix information for the last non-zero vertical coordinate, the suffix information for the last non-zero horizontal coordinate, and the suffix information for the last non-zero vertical coordinate are written to the bitstream.

[0256] The prefix information for the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_prefix. The prefix information for the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix. The suffix information for the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix. The suffix information for the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_suffix. last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix are written to the bitstream. The decoder can then identify the coordinate information of the last non-zero coefficient by analyzing the bitstream.

[0257] Thus, embodiments of this application provide a modification to the method for deriving the position of the last non-zero coefficient. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in the relevant art. Certain circumstances may refer, for example, to high-bit-depth, high-quality, high-bit-rate video coding and decoding or lossless compressed video coding and decoding. Under normal circumstances, as shown in Figure 10A, the horizontal coordinate of the position of the last non-zero coefficient, i.e., the horizontal distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, and the vertical coordinate of the position of the last non-zero coefficient, i.e., the vertical distance from the position of the last non-zero coefficient to the upper-left corner of the current block, is represented and coded as last_sig_coeff_y_prefix, last_sig_coeff_y_suffix. On the other hand, in the case of high-bit-depth, high-quality, high-bitrate video encoding / decoding or lossless compressed video encoding / 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 in the current block. In this case, as shown in Figure 10B, 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 in the current block is represented and encoded by last_sig_coeff_x_prefix and last_sig_coeff_x_suffix, and the vertical distance from the position of the last non-zero coefficient to the lower right corner of the area of ​​all possible non-zero coefficients in the current block is represented and encoded by last_sig_coeff_y_prefix and last_sig_coeff_y_suffix. Therefore, the introduction of reverse_last_sig_coeff_flag in embodiments of this application solves the problem of relatively large overhead caused by encoding relatively large values ​​in the bitstream.

[0258] Furthermore, if the video flag information indicates that the video satisfies a predetermined condition, it can be defaulted that all coefficients that may need to be encoded should be encoded. That is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients in the current block are scanned according to a predetermined scan order. Accordingly, embodiments of this application may also introduce last coefficient valid flag information to determine whether the current block uses the last coefficient position.

[0259] In some embodiments, if video flag information indicates that the video satisfies a predetermined condition, the method may further include the following: Identify the last coefficient validity flag information. If the last coefficient valid flag information indicates that the current block should use the last coefficient position, all coefficients prior to the last coefficient position are encoded according to a pre-configured scan order, and the bit information obtained from the encoding, along with the video flag information and the last coefficient valid flag information, are written to the bitstream.

[0260] The last coefficient enabled flag information can be represented by default_last_coeff_enabled_flag. In embodiments of this application, the last coefficient enabled flag information may be at least one flag information from sequence level, image level, slice level, and block level, and may also be flag information at a higher level (e.g., VUI, SEI, etc.). It is not limited thereto.

[0261] Furthermore, regarding the last coefficient validity flag information, in some embodiments, identifying the last coefficient validity flag information is possible. The current block may include specifying that the value of the last coefficient valid flag information is the first value if the current block uses the last coefficient position, or specifying that the value of the last coefficient valid flag information is the second value if the current block does not use the last coefficient position.

[0262] In other words, taking the example where the first value is 1 and the second value is 0, if the current block uses the last coefficient position, the value of default_last_coeff_enabled_flag will be 1. Alternatively, if the current block does not use the last coefficient position, the value of default_last_coeff_enabled_flag will be 0.

[0263] 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 in scanning all possible non-zero coefficients in the current block according to a predetermined 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 particular example, the method may further include setting the position of the last non-zero coefficient to the position of the last coefficient.

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

[0267] Furthermore, the last coefficient position can be represented as (LastCoeffX,LastCoeffY), that is, the last position of all possible non-zero coefficients in the current block according to a predetermined scan order. In some embodiments, the method may further include the following: The width and height of the transformed block are determined by performing a pre-configured operation on the current block. The coordinate information of the lower right corner of the transformation block is obtained by performing coordinate calculations based on the width and height of the transformation block. Based on the coordinate information of the lower right corner of the transformation block, the position of the last coefficient is determined.

[0268] Here, the pre-configured operations include at least a zero-setting operation.

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

[0270] Thus, if the value of default_last_coeff_enabled_flag is 1, the last coefficient position can be determined based on (LastCoeffX,LastCoeffY).

[0271] In one particular 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 a predetermined 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 determined based on the coordinate information of the lower right corner of the transformation block.

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

[0273] (LastSignificantCoeffX,LastSignificantCoeffY) represents the coordinate information of the bottom right corner of the transformation 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 determined based on (LastSignificantCoeffX,LastSignificantCoeffY).

[0274] Furthermore, if the current block does not utilize the last coefficient position, i.e., if 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 for the last non-zero horizontal coordinate, the prefix information for the last non-zero vertical coordinate, the suffix information for the last non-zero horizontal coordinate, and the suffix information for the last non-zero vertical coordinate. The position of the last non-zero coefficient is determined based on the prefix information of the last non-zero coefficient's horizontal coordinate, the prefix information of the last non-zero coefficient's vertical coordinate, the suffix information of the last non-zero coefficient's horizontal coordinate, and the suffix information of the last non-zero coefficient's vertical coordinate. According to a pre-configured scan order, all coefficients prior to the position of the last non-zero coefficient are encoded, and the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are written to the bitstream.

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

[0276] Thus, during coefficient coding and decoding, it is defaulted that all coefficients that may need coding and decoding should be coded and decoded. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in the relevant art. Certain circumstances may refer to, for example, high-bit-depth, high-quality, high-bitrate video coding and decoding or lossless compressed video coding and decoding. By defaulting that all coefficients that may need coding and decoding should be coded 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 a preset scan order. In other words, the position of the last coefficient that needs coding and decoding is set at the last position of all possible non-zero coefficients in the current block according to a preset scan order. This position is usually the lower right corner of the matrix consisting of all possible non-zero coefficients in the current block. Therefore, in this embodiment of the application, by introducing default_last_coeff_enabled_flag, the syntax elements related to the position of the last non-zero coefficient can be reduced and further eliminated, thereby saving overhead and avoiding waste.

[0277] Furthermore, if the video flag information indicates that the video satisfies pre-set conditions, then all scanned subblocks must be encoded by default. In this case, there is no need to transmit the sb_coded_flag in the bitstream; that is, neither the encoder nor the decoder needs to process the flag, thus improving the encoding speed. Accordingly, in the embodiments of this application, subblock default encoding flag information can be further introduced, which is used to determine whether or not a subblock currently awaiting encoding in a block will default once it is encoded.

[0278] In some embodiments, if video flag information indicates that the video satisfies a predetermined condition, the method may further include the following: Identify the default encoding flag information for the subblocks of the subblocks currently awaiting encoding within the block. If the subblock default encoding flag information indicates that the subblock awaiting encoding should default once it is encoded, then all coefficients within the awaiting subblock are encoded, and the bit information obtained from the encoding, along with the subblock default encoding flag information, is written to the bitstream.

[0279] The subblock default coding flag information can be represented by default_sb_coded_flag. In embodiments of this application, the subblock default coding flag information is at least one flag information from sequence level, image level, slice level, and block level, and may also be flag information at a higher level (e.g., VUI, SEI, etc.). It is not limited thereto.

[0280] Furthermore, regarding the subblock default flag information, in some embodiments, it is possible to identify the subblock default encoding flag information of subblocks awaiting encoding. When a subblock awaiting encoding is to default to being encoded, the value of the subblock default encoding flag information must be identified as the first value, or If a subblock awaiting encoding is not encoded by default, this may include specifying that the value of the subblock default encoding flag information is the second value.

[0281] Thus, using the example where the first value is 1 and the second value is 0, if you specify that a subblock awaiting coding should be coded by default, the value of default_sb_coded_flag will be 1. Alternatively, if you specify that a subblock awaiting coding should not be coded by default, the value of default_sb_coded_flag will be 0.

[0282] If a subblock awaiting coding defaults to needing to be coded, the value of default_sb_coded_flag is 1, which means that the value of sb_coded_flag is 1, i.e., sb_coded_flag does not need to be coded. If a subblock awaiting coding does not default to needing to be coded, i.e., if the subblock default coding flag information indicates that the subblock awaiting coding will not default to being coded, then in some embodiments the method may further include: identifying the subblock coding flag information of the subblock awaiting coding and writing the subblock coding flag information to the bitstream.

[0283] Furthermore, in some embodiments, identifying the subblock coding flag information of a subblock awaiting coding is possible. If encoding is required for a subblock, specify that the value of the subblock encoding flag information is the first value, or This includes identifying the value of the subblock coding flag information as the second value if all coefficients within the subblock are zero.

[0284] In the embodiments of this application, the subblock coding flag information can be represented by sb_coded_flag. For example, if the first value is 1 and the second value is 0, it means that the subblock awaiting coding needs to be coded, which means that the subblock awaiting coding contains non-zero coefficients awaiting coding, and the value of sb_coded_flag is 1. Alternatively, if it means that the subblock awaiting coding does not need to be coded, it means that all coefficients in the subblock awaiting coding are zero, and the value of sb-coded-flag is 0.

[0285] Thus, during coefficient coding and decoding, it is assumed that all scanned subblocks must be coded and decoded; in other words, it is assumed that all scanned subblocks contain non-zero coefficients. That is, under normal circumstances, the coefficient coding and decoding method is the same as existing methods in related technologies. Certain circumstances can refer to, for example, high-bit-depth, high-quality, high-bit-rate video coding and decoding or lossless compressed video coding and decoding. In this case, there are many non-zero coefficients, and most of the scanned subblocks must be coded and decoded; in other words, most of the scanned subblocks contain non-zero coefficients. Thus, it is no longer necessary to transmit the sb_coded_flag in the bitstream, the encoder does not need to process that flag, and the coding and decoding speed can be improved. Also, since flags that are almost nonexistent are removed, the compression performance is slightly improved at this time.

[0286] Embodiments of this application further provide a coefficient coding method applicable to an encoder. Video flag information and the position of the last non-zero coefficient are identified. If the video flag information indicates that the video satisfies a predetermined condition, a flag information for the position inversion of the last non-zero coefficient is identified. Based on the position of the last non-zero coefficient and the flag information for the position inversion of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is identified. All coefficients prior to the position of the last non-zero coefficient are coded according to a predetermined scan order, and the bit information obtained by coding, the video flag information, and the coordinate information of the last non-zero coefficient are written to a bitstream. Thus, in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those in typical video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing coordinate transformations when the coordinate information value of the last non-zero coefficient is large, the overhead caused by encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. In addition, since the reduced or removed syntax elements have little impact in high-bit-depth, high-bitrate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved.

[0287] In other embodiments of this application, based on the same inventive concept as the embodiments described above, with reference to Figure 12, which is a schematic diagram showing the structure of an encoder 120 according to an embodiment of this application. As shown in Figure 12, the encoder 120 may comprise a first specific 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 to identify the position inversion flag information of the last non-zero coefficient if the video flag information indicates that the video satisfies a predetermined condition. The first identification 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 prior to the position of the last non-zero coefficient according to a preset scan order, and to write the bit information obtained by encoding, video flag information, and coordinate information of the last non-zero coefficient to the bitstream.

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

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

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

[0291] In some embodiments, the position of the last non-zero coefficient includes the initial horizontal and initial vertical coordinates of the last non-zero coefficient, where 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, the first identifying unit 1201 is further configured to identify the coordinate information of the last non-zero coefficient by performing calculations based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient when the value of the position inversion flag information of the last non-zero coefficient is a first value, or to directly identify the coordinate information of the last non-zero coefficient based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient when the value of the position inversion flag information of the last non-zero coefficient is a second value.

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

[0293] In some embodiments, the first identifying unit 1201 is further configured to identify the coordinate information of the last non-zero coefficient as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block if the value of the position inversion flag information of the last non-zero coefficient is a first value, or to identify the coordinate information of the last non-zero coefficient as the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block if the value of the position inversion flag information of the last non-zero coefficient is a second value.

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

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

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

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

[0298] In some embodiments, the last coefficient position is the lower right corner of the matrix of all possible non-zero coefficients in the current block, or the last coefficient position is the last position in scanning all possible non-zero coefficients in the current block according to a predetermined 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 is further configured to identify the width and height of the transformed block obtained by performing a preset operation on the current block, obtain coordinate information of the lower right corner of the transformed block by performing coordinate calculations based on the width and height of the transformed block, and identify the last coefficient position based on the coordinate information of the lower right corner of the transformed block.

[0301] In some embodiments, the pre-configured operations include at least a zero-setting operation.

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

[0303] In some embodiments, the first specific unit 1201 is further configured to 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, if the block does not currently utilize the last coefficient position, and 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 encoding unit 1202 is further configured to encode all coefficients prior to the position of the last non-zero coefficient according to a preset scan order, and to 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 to the bitstream.

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

[0305] In some embodiments, the first specific unit 1201 is further configured to identify the subblock default encoding flag information of the subblock awaiting encoding in the current block when the video flag information indicates that the video satisfies a predetermined condition. The encoding unit 1202 is further configured to encode all coefficients in the subblock awaiting encoding when the subblock default encoding flag information indicates that it should default once the subblock awaiting encoding is encoded, and to write the bit information obtained by encoding and the subblock default encoding flag information to the bitstream.

[0306] In some embodiments, the first specific unit 1201 is further configured to identify the subblock encoding flag information of a subblock awaiting encoding and write the subblock encoding flag information to the bitstream if the subblock default encoding flag information indicates that the subblock awaiting encoding will not default once it is encoded.

[0307] In some embodiments, the first specific unit 1201 is further configured to identify that the value of the subblock default encoding flag information is a first value if the subblock awaiting encoding defaults when encoded, or to identify that the value of the subblock default encoding flag information is a second value if the subblock awaiting encoding does not default when encoded.

[0308] In some embodiments, the first specific unit 1201 further identifies that if encoding is required for the subblock, the value of the subblock encoding flag information is a first value, or The system is configured to identify the value of the subblock coding flag information as the second value if all coefficients within the subblock are zero.

[0309] In some embodiments, the subblock default coding flag information is at least one flag information from the sequence level, image 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 identifying unit 1201 is further configured to identify that if the video flag information is high bit depth flag information, then if the video satisfies high bit depth, the high bit depth flag information indicates that the video satisfies a preset condition.

[0312] In some embodiments, the first identifying unit 1201 is further configured to identify that if the video flag information is high bitrate flag information, then if the video satisfies the high bitrate, the high bitrate flag information indicates that the video satisfies a pre-set condition.

[0313] In some embodiments, the first identifying unit 1201 is further configured to identify that if the video flag information is high-quality flag information, then if the video meets high quality requirements, the high-quality flag information indicates that the video meets a pre-set condition.

[0314] In some embodiments, the first identifying unit 1201 is further configured to identify that if the video flag information is lossless compression flag information, then if the video satisfies lossless compression, the lossless compression flag information indicates that the video satisfies a predetermined condition.

[0315] In the embodiments of this application, it can be understood that a “unit” may be part of a circuit, part of a processor, part of a program, or part of software. Naturally, a “unit” may be a module or a non-module. Furthermore, each component unit according to this embodiment may be integrated into a single processing unit, each unit may exist physically independently, or two or more units may be integrated into a single unit. The integrated unit may be implemented in the form of a hardware or software functional module.

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

[0317] Accordingly, an embodiment of this application provides a computer storage medium to be applied to the encoder 120. A computer program is stored in the computer storage medium. When the computer program is executed by the first processor, any of the methods in the above embodiment is performed.

[0318] Referring to Figure 13, based on the structure of the encoder 120 and the computer storage medium described above, Figure 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 Figure 13, the encoder 120 may 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 enable connection and communication between these components. In addition to the data bus, the first bus system 1304 further includes a power bus, a control bus, and a status signal bus. However, for clarity of explanation, in Figure 13, the various buses are marked as the first bus system 1304.

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

[0320] The first memory 1302 is used to store computer programs that can be executed by the first processor 1303.

[0321] The first processor 1303, when executing a computer program, Identifying video flag information and the position of the last non-zero coefficient, When video flag information indicates that the video satisfies pre-set conditions, it identifies the last non-zero coefficient position inversion flag information, 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, The process involves encoding all coefficients prior to the position of the last non-zero coefficient according to a pre-configured scan order, and then writing the encoded bit information, video flag information, and the coordinate information of the last non-zero coefficient to the bitstream.

[0322] The first memory 1302 in the embodiments of this application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (erasable PROM, EPROM), an electrically erasable programmable read-only memory (electrically EPROM, EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM) that functions as an external high-speed cache. Examples of various RAMs available include, but are not limited to, static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synch-link dynamic random access memory (synch-link DRAM, SLDRAM), and direct rambus random access memory (direct rambus RAM, DRRAM). The first memory 1302 of the system and method described in this application may include, but is not limited to, these and any other suitable types of memory.

[0323] The first processor 1303 may be an integrated circuit chip having signal processing capabilities. In the implementation process, each step of the method may be completed by an integrated logic circuit in hardware form or by instructions in software form in the first processor 1303. The first processor 1303 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The processor may implement or execute the various methods, steps and logic block diagrams disclosed in embodiments of this application. The general-purpose processor may be a microprocessor or any ordinary processor. The steps of the methods disclosed in embodiments of this application may be executed and completed directly by a hardware decoding processor, or by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, or registers. The storage medium is located in the first memory 1302. The first processor 1303 reads the information in the first memory 1302 and, in conjunction with the processor hardware, completes the steps of the method described above.

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

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

[0326] In embodiments of this application, an encoder is provided. The encoder may comprise a first specific unit and an encoding unit. Thus, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those in typical video scenarios. Therefore, by reducing or removing the number of syntax elements encoded / decoded in context mode during coefficient encoding / decoding, the overhead of encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. Furthermore, since the reduced or removed syntax elements have little impact in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved.

[0327] In other embodiments of this application, based on the same inventive concept as the embodiments described above, with reference to Figure 14, which is a schematic diagram showing the structure of a decoder 140 according to an embodiment of this application. As shown in Figure 14, the decoder 140 may comprise an analysis unit 1401 and a second identification unit 1402. The analysis unit 1401 is configured to analyze the bitstream to obtain video flag information, and if the video flag information indicates that the video satisfies a pre-set condition, 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. The second identification unit 1402 is configured to determine 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 should utilize the position inversion of the last non-zero coefficient. The analysis unit 1401 is further configured to decode all coefficients prior to the position of the last non-zero coefficient according to a preset scan order, in order to identify the coefficients of the current block.

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

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

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

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

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

[0333] In some embodiments, the second identifying unit 1402 is further configured to identify the coordinate information of the last non-zero coefficient as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block, if the last non-zero coefficient position inversion flag information indicates that the current block should utilize the last non-zero coefficient position inversion. Furthermore, the second identifying unit 1402 is configured to further identify the width and height of the current block, obtain the horizontal coordinate of the last non-zero coefficient by subtracting the horizontal distance from the position of the last non-zero coefficient to the lower right corner of the current block from the width of the current block, obtain the vertical coordinate of the last non-zero coefficient by subtracting the vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block from the height of the current block, and to identify the position of the last non-zero coefficient based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.

[0334] In some embodiments, the second identifying unit 1402 is further configured to identify the coordinate information of the last non-zero coefficient as the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block, if 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, and to identify the position of the last non-zero coefficient based on the horizontal and vertical distances from the position of the last non-zero coefficient to the upper left corner of the current block.

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

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

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

[0338] In some embodiments, the analysis unit 1401 is further configured to analyze the bitstream to obtain prefix information for the horizontal coordinate of the last non-zero coefficient, prefix information for the vertical coordinate of the last non-zero coefficient, suffix information for the horizontal coordinate of the last non-zero coefficient, and suffix information for the vertical coordinate of the last non-zero coefficient, if the value of the last coefficient valid flag information is a second value. The second identification unit 1402 is further configured to identify the position of the last non-zero coefficient based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient, and to identify the coefficient of the current block by decoding all coefficients prior to the position of the last non-zero coefficient according to a preset scan order.

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

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

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

[0342] In some embodiments, the pre-configured operations include at least a zero-setting operation.

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

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

[0345] In some embodiments, the analysis unit 1401 is further configured to analyze the bitstream to obtain subblock default decryption flag information if the video flag information indicates that the video satisfies a preset condition, and to identify the value of the subblock decryption flag information to be a first value if the subblock default decryption flag information indicates that it will default when the subblocks awaiting decryption in the current block are decrypted, and to decrypt all coefficients in the subblocks awaiting decryption.

[0346] In some embodiments, the analysis unit 1401 is further configured to analyze the bitstream to obtain subblock decryption flag information if the subblock default decryption flag information indicates that it will not default once the subblock awaiting decryption is decrypted, and to decrypt all coefficients in the subblock awaiting decryption if the value of the subblock decryption flag information is a first value.

[0347] In some embodiments, the second identifying unit 1402 is further configured to identify that, if the value of the subblock default decryption flag information is a first value, the subblock default decryption flag information indicates that it should default when a subblock awaiting decryption is decrypted, or, if the value of the subblock default decryption flag information is a second value, the subblock default decryption flag information indicates that it should not default when a subblock awaiting decryption is decrypted.

[0348] In some embodiments, the second identifying unit 1402 further identifies that if the value of the subblock decoding flag information is a first value, all coefficients in the subblock awaiting decoding should be decoded, or If the value of the subblock decryption flag information is the second value, it is configured to identify that all coefficients in the subblock awaiting decryption are zero.

[0349] In some embodiments, the subblock default decoding flag information is at least one flag information from the sequence level, image level, slice level, and 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 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 bitrate flag information and the high bitrate flag information indicates that the video satisfies a high bitrate.

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

[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 lossless compression flag information and the lossless compression flag information indicates that the video satisfies lossless compression.

[0355] In the embodiments of this application, it can be understood that a “unit” may be part of a circuit, part of a processor, part of a program, or part of software. Naturally, a “unit” may be a module or a non-module. Furthermore, each component unit according to this embodiment may be integrated into a single processing unit, each unit may exist physically independently, or two or more units may be integrated into a single unit. The integrated unit may be implemented in the form of a hardware or software functional module.

[0356] The integrated unit may be stored on a computer-readable recording medium when implemented as a software function module rather than being sold or used as a standalone product. Under this understanding, the essential parts of the technical solution of this application, or parts that contribute to the prior art, or all or part of the technical solution, may be expressed as a software product. This computer software product is stored on a storage medium and includes a number of instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the method described in this embodiment. The storage medium includes various types of media capable of storing program code, such as USB flash disks, mobile hard disks, ROMs, RAMs, magnetic disks, or optical disks.

[0357] Accordingly, embodiments of this application provide a computer storage medium to be applied to the decoder 140. A computer program is stored in the computer storage medium. When the computer program is executed by the first processor, any of the methods in the above embodiments is performed.

[0358] Referring to Figure 15, based on the structure of the decoder 140 and the computer storage medium described above, Figure 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 Figure 15, the decoder 140 may 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 enable connection and communication between these components. In addition to the data bus, the second bus system 1504 further includes a power bus, a control bus, and a status signal bus. However, for clarity of explanation, in Figure 15, the various buses are marked as the second bus system 1504.

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

[0360] The second memory 1502 is used to store computer programs that can be executed by the second processor 1503.

[0361] The second processor 1503, when executing a computer program, The bitstream is analyzed to obtain video flag information, and If the video flag information indicates that the video satisfies pre-set conditions, the bitstream is parsed to obtain the position inversion flag information and the coordinate information of the last non-zero coefficient, If the position inversion flag information for the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, then the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient. The process involves decoding all coefficients prior to the last non-zero coefficient according to a pre-configured scan order to identify the coefficients of the current block.

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

[0363] Furthermore, the second memory 1502 has hardware functionality similar to the first memory 1302, and the second processor 1503 has hardware functionality similar to the first processor 1303; therefore, a detailed explanation of these is omitted.

[0364] In embodiments of this application, a decoder is provided. The decoder may comprise an analysis unit and a second specific unit. Thus, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rules differ from those in typical video encoding / decoding scenarios. Therefore, by reducing or removing the number of syntax elements encoded / decoded in context mode during coefficient encoding / decoding, the overhead of encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. Furthermore, since the reduced or removed syntax elements have little impact in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, compression efficiency can also be improved.

[0365] In this application, terms such as “includes,” “equipment,” or other variants are intended to cover, not exclude, the inclusion of other components. Therefore, a process, method, article, or apparatus that includes a set of elements may include not only those elements but also other elements not explicitly listed, or other elements specific to the process, method, article, or apparatus. Unless otherwise limited, the phrase “includes…” does not exclude the existence of other identical elements in a process, method, article, or apparatus that includes the elements limited by that phrase.

[0366] The sequence numbers of the embodiments described above in this application are not intended to indicate the superiority or inferiority of the embodiments, but are used solely for illustrative purposes.

[0367] The methods disclosed in some of the method embodiments of this application can be arbitrarily combined, insofar as they do not conflict, to obtain new method embodiments.

[0368] The features disclosed in some product embodiments relating to this application can be arbitrarily combined, as long as they do not contradict each other, to obtain new product embodiments.

[0369] The features disclosed in some embodiments of the method or apparatus relating to this application can be arbitrarily combined, insofar as they do not conflict, to obtain new embodiments of the method or apparatus.

[0370] The above are merely specific embodiments of the present application, and the scope of protection of this application is not limited thereto. Any modifications or substitutions that a person skilled in the art could easily conceive within the scope of the art disclosed in this application should be included within the scope of protection of this application. Accordingly, the scope of protection of this application should be determined by the scope of protection of the claims. [Industrial applicability]

[0371] In embodiments of this application, for the encoder and decoder, in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding scenarios, the coefficient distribution rule differs from that of normal video scenarios. Therefore, during coefficient encoding / decoding, the number of syntax elements encoded / decoded in context mode can be reduced or removed, such as the position of the last non-zero coefficient and subblock encoding / decoding flags. Furthermore, by performing a coordinate transformation when the coordinate information value of the last non-zero coefficient is large, the overhead caused by encoding / decoding in the bitstream can be reduced, improving the throughput and speed of coefficient encoding / decoding. In addition, since the reduced or removed syntax elements have little impact in high-bit-depth, high-bit-rate, high-quality, or lossless video encoding / decoding, the compression efficiency can also be improved.

Claims

1. A coefficient decoding method applied to a decoder, The bitstream is analyzed to obtain sequence-level flags, and If the sequence-level flag indicates that the video satisfies a predetermined condition, the bitstream is analyzed to obtain the position inversion flag information for the last non-zero coefficient, The bitstream is analyzed to obtain the prefix information of the last non-zero horizontal coordinate, the prefix information of the last non-zero vertical coordinate, the suffix information of the last non-zero horizontal coordinate, and the suffix information of the last non-zero vertical coordinate. Identifying the last non-zero coefficient horizontal coordinate based on the prefix information of the last non-zero coefficient horizontal coordinate and the suffix information of the last non-zero coefficient horizontal coordinate, Identifying the last non-zero coefficient vertical coordinate based on the prefix information of the last non-zero coefficient vertical coordinate and the suffix information of the last non-zero coefficient vertical coordinate, Based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is identified. When the position inversion flag information for the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient, wherein the coordinate information of the last non-zero coefficient is the horizontal and vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block. This includes decoding all coefficients prior to the position of the last non-zero coefficient according to a predetermined scan order to identify the coefficient of the current block, The last non-zero coefficient horizontal coordinate value is derived as follows: If last_sig_coeff_x_suffix does not exist, 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 value of the last non-zero coefficient vertical coordinate is derived as follows: If last_sig_coeff_y_suffix does not exist, 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 the value of the horizontal coordinate of the last non-zero coefficient, LastSignificantCoeffY represents the value of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, and last_sig_coeff_y_prefix represents the vertical coordinate of the last non-zero coefficient. Represents the prefix information of the Cartesian coordinates, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position reversal flag information of the last non-zero coefficient. A coefficient decoding method characterized by the following:

2. The coefficient decoding method is, If the position inversion flag information for the last non-zero coefficient indicates that the current block does not utilize the position inversion for the last non-zero coefficient, Based on the coordinate information of the last non-zero coefficient, the position of the last non-zero coefficient is directly identified, The process further includes decoding all coefficients prior to the position of the last non-zero coefficient according to the predetermined scan order to identify the coefficient of the current block, The coefficient decoding method according to feature 1.

3. The coefficient decoding method is, If the value of the sequence level flag is a first value, then the sequence level flag indicates that the video satisfies the predetermined condition, or The further includes identifying that if the value of the sequence level flag is a second value, the sequence level flag indicates that the video does not satisfy the predetermined condition, The coefficient decoding method according to feature 1.

4. The aforementioned pre-set conditions include at least one of high bit depth, high quality, high bit rate, high frame rate, and lossless compression. The coefficient decoding method according to feature 3.

5. The coefficient decoding method is, If the value of the position inversion flag information for the last non-zero coefficient is a first value, then the position inversion flag information for the last non-zero coefficient indicates that the current block should utilize the position inversion for the last non-zero coefficient, or The further includes specifying that if the value of the last non-zero coefficient position inversion flag information is a second value, the last non-zero coefficient position inversion flag information indicates that the current block does not utilize the last non-zero coefficient position inversion, The coefficient decoding method according to feature 1.

6. A coefficient coding method applied to an encoder, Identifying the sequence level flag and the position of the last non-zero coefficient, If the sequence-level flag indicates that the video satisfies a predetermined condition, then the last non-zero coefficient position inversion flag information is identified, The coordinate information of the last non-zero coefficient is determined based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient, wherein if the position inversion flag information of the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is determined as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block. Based on the coordinate information of the last non-zero coefficient, the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are identified. The process includes encoding all coefficients prior to the position of the last non-zero coefficient according to a pre-set scan order, and writing the bit information obtained by encoding, the sequence level flag, 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 to a bitstream, The last non-zero coefficient horizontal coordinate value is derived as follows: If last_sig_coeff_x_suffix does not exist, 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 value of the last non-zero coefficient vertical coordinate is derived as follows: If last_sig_coeff_y_suffix does not exist, 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 the value of the horizontal coordinate of the last non-zero coefficient, LastSignificantCoeffY represents the value of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, and last_sig_coeff_y_prefix represents the vertical coordinate of the last non-zero coefficient. Represents the prefix information of the Cartesian coordinates, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position reversal flag information of the last non-zero coefficient. A coefficient coding method characterized by the following:

7. Identifying the sequence level flags means that If the video satisfies the pre-set conditions, the value of the sequence level flag is identified as a first value, or If the video does not satisfy the pre-set conditions, the value of the sequence level flag is determined to be a second value, including: The coefficient coding method according to feature 6.

8. A decoder comprising memory and a processor, The memory is configured to store computer programs, When the computer program is executed by the processor, the processor will: The bitstream is analyzed to obtain sequence-level flags, and If the sequence-level flag indicates that the video satisfies a predetermined condition, the bitstream is analyzed to obtain the position inversion flag information for the last non-zero coefficient, The bitstream is analyzed to obtain the prefix information of the last non-zero horizontal coordinate, the prefix information of the last non-zero vertical coordinate, the suffix information of the last non-zero horizontal coordinate, and the suffix information of the last non-zero vertical coordinate. Identifying the last non-zero coefficient horizontal coordinate based on the prefix information of the last non-zero coefficient horizontal coordinate and the suffix information of the last non-zero coefficient horizontal coordinate, Identifying the last non-zero coefficient vertical coordinate based on the prefix information of the last non-zero coefficient vertical coordinate and the suffix information of the last non-zero coefficient vertical coordinate, Based on the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is identified. When the position inversion flag information for the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, the position of the last non-zero coefficient is determined by calculating the coordinate information of the last non-zero coefficient, wherein the coordinate information of the last non-zero coefficient is the horizontal and vertical distance from the position of the last non-zero coefficient to the lower right corner of the current block. Decode all coefficients prior to the position of the last non-zero coefficient according to a predetermined scan order to identify the coefficient of the current block, Make it run, The last non-zero coefficient horizontal coordinate value is derived as follows: If last_sig_coeff_x_suffix does not exist, 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 value of the last non-zero coefficient vertical coordinate is derived as follows: If last_sig_coeff_y_suffix does not exist, 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 the value of the horizontal coordinate of the last non-zero coefficient, LastSignificantCoeffY represents the value of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, and last_sig_coeff_y_prefix represents the vertical coordinate of the last non-zero coefficient. Represents the prefix information of the Cartesian coordinates, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position reversal flag information of the last non-zero coefficient. A decoder characterized by the following features.

9. A encoder comprising memory and a processor, The memory is configured to store computer programs, When the computer program is executed by the processor, the processor will: Identifying the sequence level flag and the position of the last non-zero coefficient, If the sequence-level flag indicates that the video satisfies a predetermined condition, then the last non-zero coefficient position inversion flag information is identified, The coordinate information of the last non-zero coefficient is determined based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient, wherein if the position inversion flag information of the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is determined as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block. Based on the coordinate information of the last non-zero coefficient, the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are identified. Encode all coefficients prior to the position of the last non-zero coefficient according to a pre-set scan order, write the bit information obtained by encoding, the sequence level flag, 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 to the bitstream. Make it run, The last non-zero coefficient horizontal coordinate value is derived as follows: If last_sig_coeff_x_suffix does not exist, 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 value of the last non-zero coefficient vertical coordinate is derived as follows: If last_sig_coeff_y_suffix does not exist, 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 the value of the horizontal coordinate of the last non-zero coefficient, LastSignificantCoeffY represents the value of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, and last_sig_coeff_y_prefix represents the vertical coordinate of the last non-zero coefficient. Represents the prefix information of the Cartesian coordinates, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position reversal flag information of the last non-zero coefficient. An encoder characterized by the following features.

10. A method for transmitting a bitstream, The bitstream is generated based on a coefficient coding method, The transmission of the aforementioned bitstream, Includes, The coefficient coding method is, Identifying the sequence level flag and the position of the last non-zero coefficient, If the sequence-level flag indicates that the video satisfies a predetermined condition, then the last non-zero coefficient position inversion flag information is identified, The coordinate information of the last non-zero coefficient is determined based on the position of the last non-zero coefficient and the position inversion flag information of the last non-zero coefficient, wherein if the position inversion flag information of the last non-zero coefficient indicates that the current block should utilize the position inversion of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is determined as the horizontal and vertical distances from the position of the last non-zero coefficient to the lower right corner of the current block. Based on the coordinate information of the last non-zero coefficient, the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are identified. The process includes encoding all coefficients prior to the position of the last non-zero coefficient according to a pre-set scan order, and writing the bit information obtained by encoding, the sequence level flag, 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 to the bitstream, The last non-zero coefficient horizontal coordinate value is derived as follows: If last_sig_coeff_x_suffix does not exist, 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 value of the last non-zero coefficient vertical coordinate is derived as follows: If last_sig_coeff_y_suffix does not exist, 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 the value of the horizontal coordinate of the last non-zero coefficient, LastSignificantCoeffY represents the value of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, and last_sig_coeff_y_prefix represents the vertical coordinate of the last non-zero coefficient. Represents the prefix information of the Cartesian coordinates, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position reversal flag information of the last non-zero coefficient. A method for transmitting a bitstream characterized by the following.