Encoding and decoding method, code stream, encoder, decoder and computer storage medium
By optimizing the video encoding and decoding method, determining and controlling the position and distribution pattern of the last non-zero coefficient, the problem of large bitstream overhead in high-bit-width, high-bit-rate, and high-quality video encoding and decoding is solved, and compression efficiency is improved.
Patent Information
- Application Number
- CN202511684952.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-29
- Publication Date
- 2026-02-06
AI Technical Summary
Existing high-bit-width, high-bit-rate, and high-quality video encoding and decoding schemes have significant overhead waste in the bitstream and low compression efficiency.
By determining the component identification information of the current slice and the position of the last non-zero coefficient, all coefficients before the non-zero coefficient are encoded or decoded according to the preset scanning order. The component identification information is used to control the position flip of the last non-zero coefficient, thereby optimizing the distribution pattern of non-zero coefficients and reducing bitstream overhead.
In high-bit-width, high-bit-rate, and high-quality video encoding and decoding scenarios, compression efficiency is improved, encoding overhead in the bitstream is reduced, and the derivation method of the last non-zero coefficient is controlled according to the distribution law of non-zero coefficients of each image component, further improving compression efficiency.
Smart Images

Figure CN121486571A_ABST
Abstract
Description
[0001] Case Analysis This application is a divisional application of Chinese patent application No. 202180099798.8, which entered the Chinese national phase of PCT international patent application PCT / CN2021 / 103250, filed on June 29, 2021, and entitled "Encoding / Decoding Method, Bitstream, Encoder, Decoder and Computer Storage Medium". Technical Field
[0002] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, a bitstream, an encoder, a decoder, and a computer storage medium. Background Technology
[0003] With increasing demands for video display quality, the field of computer vision has received growing attention. In recent years, image processing technology has been successfully applied across various industries. In the video image encoding and decoding process, at the encoding end, the image data to be encoded undergoes transformation and quantization processing, followed by compression encoding via entropy coding units. The resulting bitstream is then transmitted to the decoding end. After parsing the bitstream and performing inverse quantization and inverse transform processing, the original input image data can be recovered.
[0004] Currently, high-bit-width, high-quality, and high-bit-rate video encoding and decoding (referred to as "high-three-high video") typically requires more and larger encoding / decoding coefficients compared to low-bit-width, low-quality, and low-bit-rate video encoding and decoding (which can be called "regular video"). Therefore, existing solutions for high-three-high video may incur greater overhead and waste in the bitstream. Summary of the Invention
[0005] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a computer storage medium, which can be applied to video encoding / decoding scenarios with high bit width, high bit rate, high quality, or lossless compression, and can improve compression efficiency.
[0006] The technical solution of this application embodiment can be implemented as follows: In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising: Parse the bitstream to determine the component identifier information of the current slice, and determine the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice; When the component identification information indicates that the component of the current block is flipped using the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block. Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0007] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising: Determine the component identification information of the current slice, and determine the position of the last non-zero coefficient of the current block corresponding to the component of the current slice; Based on the component identifier information and the position of the last non-zero coefficient, determine the coordinate information of the last non-zero coefficient of the current block; All coefficients before the last non-zero coefficient are encoded according to the preset scanning order, and the encoded bit information, component identification information, and coordinate information of the last non-zero coefficient are written into the bit stream.
[0008] Thirdly, embodiments of this application provide a bitstream generated by bit encoding information to be encoded, the information to be encoded including at least one of the following: first syntax element identifier information, second syntax element identifier information, third syntax element identifier information, component identifier information, last coefficient enable identifier information, and sub-block default encoding identifier information; wherein... The first syntax element identifier is used to indicate whether the current sequence is allowed to use the last non-zero coefficient position for flipping. The second syntax element identifier is used to indicate whether the current sequence uses the standard extended version. The third syntax element identifier is used to indicate whether the current sequence uses range extension. The component identifier is used to indicate whether the components of the current slice are flipped using the last non-zero coefficient position. The last coefficient enable identifier is used to indicate whether the current block uses the last coefficient position. The sub-block default encoding identifier is used to indicate whether the sub-blocks to be encoded within the current block are encoded by default. Here, the current sequence includes the current slice, and the current slice includes the current block.
[0009] Fourthly, embodiments of this application provide an encoder, which includes a first determining unit and an encoding unit; wherein, The first determining unit is configured to determine the component identification information of the current slice, and to determine the position of the last non-zero coefficient of the current block corresponding to the component of the current slice; The first determining unit is further configured to determine the coordinate information of the last non-zero coefficient of the current block based on the component identification information and the position of the last non-zero coefficient. The encoding unit is configured to encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write the encoded bit information, component identification information and coordinate information of the last non-zero coefficient into the bit stream.
[0010] Fifthly, embodiments of this application provide an encoder, which includes a first memory and a first processor; wherein, A first memory for storing computer programs that can run on a first processor; A first processor is configured to execute the method described in the second aspect when running a computer program.
[0011] Sixthly, embodiments of this application provide a decoder, which includes a parsing unit and a second determining unit; wherein, The parsing unit is configured to parse the bitstream, determine the component identifier information of the current slice, and determine the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice; The second determining unit is configured to calculate the coordinate information of the last non-zero coefficient when the component identification information indicates that the component of the current block is flipped using the position of the last non-zero coefficient, so as to obtain the position of the last non-zero coefficient of the current block. The parsing unit is also configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine the coefficients of the current block.
[0012] In a seventh aspect, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein, The second memory is used to store computer programs that can run on the second processor; The second processor is configured to execute the method described in the first aspect when running a computer program.
[0013] Eighthly, embodiments of this application provide a computer storage medium storing a computer program that, when executed, implements the method described in the first aspect or the method described in the second aspect.
[0014] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a computer storage medium. In the encoder, the component identification information of the current slice is determined, as well as the position of the last non-zero coefficient of the current block corresponding to the component of the current slice. Based on the component identification information and the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient of the current block is determined. All coefficients before the position of the last non-zero coefficient are encoded according to a preset scanning order, and the encoded bit information, component identification information, and coordinate information of the last non-zero coefficient are written into the bitstream. In the decoder, the bitstream is parsed to determine the component identification information of the current slice, as well as the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice. When the component identification information indicates that the component of the current slice is flipped using the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block. All coefficients before the position of the last non-zero coefficient are decoded according to a preset scanning order to determine the coefficients of the current block. In this way, in high-bit-width, high-bit-rate, high-quality or lossless video encoding and decoding scenarios, setting a reasonable method for deriving the last non-zero coefficient based on the distribution pattern of the non-zero coefficients can reduce the overhead of encoding in the bitstream and improve compression efficiency. In addition, since the distribution patterns of the non-zero coefficients of each image component are different, the method for deriving the last non-zero coefficient of each image component can be controlled separately using component identification information. That is, each image component can be controlled separately to control whether to use the last non-zero coefficient position flipping technique, thereby further improving compression efficiency. Attached Figure Description
[0015] Figure 1 An application diagram illustrating a coding framework provided for related technologies; Figure 2 A schematic diagram illustrating the positional relationship between the current coefficient and adjacent coefficients, provided for related technologies; Figure 3 A flowchart illustrating the arithmetic decoding process of a bin object, provided for related technologies; Figure 4 A flowchart illustrating the arithmetic decoding process of binary symbols, provided for related technologies; Figure 5 A flowchart illustrating the renormalization process of an arithmetic decoding engine for related technologies; Figure 6 A flowchart illustrating a bypass decoding process for related technologies; Figure 7 A schematic diagram illustrating the positional relationship between regions that may have non-zero coefficients and regions that are forced to be 0, provided for related technologies; Figure 8A This application provides a schematic diagram of the system composition of an encoder according to an embodiment of the present application. Figure 8B This application provides a schematic diagram of the system composition of a decoder according to an embodiment of the present application; Figure 9 A flowchart illustrating a decoding method provided in an embodiment of this application; Figure 10A This application provides a schematic diagram illustrating the position of the last non-zero coefficient relative to the top left corner of the current block. Figure 10B This application provides a schematic diagram illustrating the position of the last non-zero coefficient relative to the lower right corner of the current block. Figure 11 A flowchart illustrating an encoding method provided in an embodiment of this application; Figure 12 A schematic diagram of the composition structure of an encoder provided in an embodiment of this application; Figure 13 This is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application; Figure 14 A schematic diagram of the composition structure of a decoder provided in an embodiment of this application; Figure 15 This is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application. Detailed Implementation
[0016] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0018] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. It should also be noted that the terms "first, second, third" used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0019] In video images, a coding block (CB) is typically represented by a first image component, a second image component, and a third image component. These three image components are a luma component, a blue chroma component, and a red chroma component, respectively. Specifically, the luma component is usually represented by the symbol Y, the blue chroma component is usually represented by the symbol Cb or U, and the red chroma component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.
[0020] Before providing a further detailed description of the embodiments of this application, 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 shall be interpreted as follows: Moving Picture Experts Group (MPEG) Joint Video Experts Team (JVET) Alliance for Open Media (AOM) The next-generation video coding standard H.266 / Versatile Video Coding (VVC) VVC Reference Software Testing Platform (VVC Test Model, VTM) Audio Video Standard (AVS) AVS High-Performance Model (HPM) Context-based Adaptive Binary Arithmetic Coding (CABAC) Raw Byte Sequence Payload (RBSP) Regular Residual Coding (RRC) Transform Skip Residual Coding (TSRC) Understandably, current common video codec standards (such as VVC) all employ a block-based hybrid coding framework. Each frame in a video image is divided into square Largest Coding Units (LCUs) of the same size (e.g., 128×128, 64×64, etc.). Each LCU can be further subdivided into rectangular Coding Units (CUs) according to rules; moreover, Coding Units may be further subdivided into smaller Prediction Units (PUs), Transform Units (TUs), etc. Specifically, such as... Figure 1 As shown, the hybrid coding framework can include modules such as prediction, transformation, quantization, entropy coding, and in-loop filtering. The prediction module can include intra-prediction and inter-prediction, with inter-prediction further comprising motion estimation and motion compensation. Because there is a strong correlation between adjacent pixels within a video frame, intra-prediction can eliminate spatial redundancy between adjacent pixels in video encoding and decoding technology. However, because there is also a strong similarity between adjacent frames in a video image, inter-prediction can eliminate temporal redundancy between adjacent frames, thereby improving encoding and decoding efficiency.
[0021] The basic workflow of a video codec is as follows: In the encoder, a frame is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block. The prediction block is subtracted from the original block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is entropy encoded and output to the bitstream. In the decoder, intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block. Simultaneously, the bitstream is decoded to obtain a quantization coefficient matrix. The quantization coefficient matrix is dequantized and inversely transformed to obtain a residual block. The prediction block and the residual block are added to obtain a reconstructed block. The reconstructed blocks form a reconstructed image. Loop filtering is performed on the reconstructed image based on the image or based on the blocks to obtain the decoded image. The encoder also requires similar operations to the decoder to obtain the decoded image. The decoded image can serve as a reference frame for inter-frame prediction in subsequent frames. The encoder determines block partitioning information, and mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, which may be output to the bitstream if necessary. Then, the decoder analyzes and resolves this information to determine the same block partitioning information, prediction, transform, quantization, entropy coding, and loop filtering mode information or parameter information as the encoder, ensuring that the decoded image obtained by the encoder and the decoder are identical. The decoded image obtained by the encoder is also commonly called the reconstructed image. During prediction, the current block can be divided into prediction units; during transform, the current block can be divided into transform units. The division of prediction units and transform units can be different. The above describes the basic flow of a video encoder and decoder under a block-based hybrid coding framework. With technological advancements, some modules or steps of this framework or process may be optimized. The embodiments in this application are applicable to the basic flow of a video codec under this block-based hybrid coding framework, but are not limited to this framework and process.
[0022] In this embodiment, the current block can be the current coding unit (CU), the current prediction unit (PU), or the current transform block (TU), etc. Block partitioning information, various modes and parameter information for prediction, transform, and quantization, and coefficients are written into the bitstream through entropy coding. Assuming different elements have different probabilities, assigning shorter codewords to elements with higher probabilities and longer codewords to elements with lower probabilities achieves higher coding efficiency than fixed-length coding. However, if the probabilities of different elements are similar or essentially the same, the compression space of entropy coding is limited. CABAC is a commonly used entropy coding method; HEVC and VVC, 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 model also makes the operation more complex. CABAC has a bypass mode, in which the context model does not need to be used and updated, achieving higher throughput. In this embodiment, the mode in CABAC that requires the use and updating of the context model can be called the context mode.
[0023] Generally, the context model needs to be determined first according to the defined method. When invoking the arithmetic decoding process of the defined binary symbols, the parameters of the context model can be used as input. The selection of the context model also has dependencies between adjacent coefficients. For example, Figure 2 This diagram illustrates the positional relationship between a current coefficient and its adjacent coefficients, provided by relevant technologies. Figure 2 In the diagram, black-filled blocks represent the current coefficient, and grid-line-filled blocks represent adjacent coefficients. As shown in Figure 2, the selection of which context model to use for the current coefficient's sig_coeff_flag depends on the information of the five coefficients adjacent to it to the right, below, and to the bottom right. Figure 2 It can be further seen that the operation of the context mode is much more complex than that of the bypass mode, and there is also a dependency between adjacent coefficients.
[0024] For the CABAC arithmetic encoding engine, if context mode is required, the defined arithmetic decoding process for binary symbols needs to be invoked, which includes a state transition process, i.e., updating the context model. The arithmetic decoding process for binary symbols also calls the renormalization process of the arithmetic decoding engine. When using bypass mode, the bypass decoding process needs to be invoked.
[0025] The following example uses CABAC in VVC for illustration: For the CABAC arithmetic encoding engine, the inputs to the arithmetic decoding process are ctxTable, ctxIdx, bypassFlag, and the state variables ivlCurrRange and ivlOffset of the arithmetic decoding engine. The output of the arithmetic decoding process is the value of bin.
[0026] Here, ctxTable is the table used when selecting the context mode, and ctxIdx is the context model index.
[0027] Figure 3 A flowchart illustrating an arithmetic decoding process for bin provided by related technologies is shown. For example... Figure 3 As shown, in order to decode the value of bin, the context index table ctxTable, the context model index ctxIdx, and the bypass mode enable flag bypassFlag are passed as input to the arithmetic decoding process DecodeBin(ctxTable, ctxIdx, bypassFlag), as follows: If the value of bypassFlag is 1, then the bypass decoding procedure DecodeBypass() is called. Otherwise, if the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, then call DecodeTerminate() to end the decoding process. Otherwise (if the value of bypassFlag is 0 and the value of ctxTable is not 0), the defined binary symbol arithmetic decoding procedure DecodeDecision(ctxTable, ctxIdx) is called.
[0028] Furthermore, for the arithmetic decoding process of binary symbols, the inputs of the process are the variables ctxTable, ctxIdx, ivlCurrRange, and ivlOffset, and the output of the process is the decoded value binVal, and the updated variables ivlCurrRange and ivlOffset.
[0029] Figure 4 A flowchart illustrating an arithmetic decoding process for binary symbols provided by related technologies is shown. For example... Figure 4 As shown, the DecodeDecision(ctxTable, ctxIdx) can be used to input the context index table ctxTable and the context model index ctxIdx, as well as the state variables ivlCurrRange and ivlOffset of the arithmetic decoding engine. Among them, pStateIdx0 and pStateIdx1 are the two states of the current context model.
[0030] (1) The value of the variable ivlLpsRange is derived as follows: Given the current value of ivlCurrRange, the variable qRangeIdx is derived as follows: qRangeIdx=ivlCurrRange>>5 Given qRangeIdx, ctxTable, and the corresponding pStateIdx0 and pStateIdx1 of ctxIdx, valMps and ivlLpsRange are derived as follows: pState=pStateIdx1+16×pStateIdx0; valMps=pState>>14; ivlLpsRange=(qRangeIdx×((valMps? 32767–pState:pState)>>9)>>1)+4.
[0031] (2) Set the value of variable ivlCurrRange to ivlCurrRange – ivlLpsRange, and perform the following operation: If ivlOffset is greater than or equal to ivlCurrRange, then the value of variable binVal is 1 – valMps, and variables ivlOffset and ivlCurrRange are updated, where the value of ivlOffset is ivlOffset minus ivlCurrRange, and the value of ivlCurrRange is ivlLpsRange. Otherwise (ivlOffset is less than ivlCurrRange), the value of the variable binVal is valMps.
[0032] Given the value of binVal, perform the defined state transition. Based on the current value of ivlCurrRange, perform the defined renormalization.
[0033] Furthermore, for the state transition process, the inputs are the current pStateIdx0 and pStateIdx1, and the solved value binVal; the outputs are the updated ctxTable and the context variables pStateIdx0 and pStateIdx1 corresponding to ctxIdx. Here, 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.
[0034] Based on the solved value binVal, the updates to the two variables pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx are as follows: pStateIdx0=pStateIdx0 (pStateIdx0>>shift0)+(1023×binVal>>shift0); pStateIdx1=pStateIdx1 (pStateIdx1>>shift1) + (16383×binVal>>shift1).
[0035] Furthermore, the input to the renormalization process of the arithmetic decoding engine is the bits in the slice data and the variables ivlCurrRange and ivlOffset, and the output is the updated variables ivlCurrRange and ivlOffset.
[0036] Figure 5 This diagram illustrates a normalization process for an arithmetic decoding engine provided by related technologies, such as... Figure 5 As shown, upon entering the ReNormD procedure, the current value of ivlCurrRange is first compared with 256, and the subsequent steps are as follows: If ivlCurrRange is greater than or equal to 256, then no renormalization is needed, and the RenormD process ends. Otherwise (ivlCurrRange is less than 256), enter the renormalization loop. In this loop, the value of ivlCurrRange is multiplied by 2, which is shifted left by one bit. The value of ivlOffset is multiplied by 2, which is shifted left by one bit. The bit obtained by read_bits(1) is shifted into ivlOffset, as follows: ivlCurrRange=ivlCurrRange<<1; ivlOffset = ivlOffset << 1; ivlOffset=ivlOffset|read_bits(1).
[0037] Throughout the process, the data in the bitstream should not cause ivlOffset to be greater than or equal to ivlCurrRange.
[0038] Furthermore, the input to the bypass decoding process of the binary symbol is the bits of the slice data and the variables ivlCurrRange and ivlOffset, and the output is the updated variable ivlOffset and the solved value binVal.
[0039] The bypass decoding process is invoked when bypassFlag is 1. Figure 6 A flowchart illustrating a bypass decoding process provided by related technologies is shown, such as... Figure 6 As shown, first update the variable ivlOffset, that is, multiply the value of ivlOffset by 2, which is to shift it left by one bit. The bit obtained using read_bits(1) is then shifted into ivlOffset, as follows: ivlOffset = ivlOffset << 1; ivlOffset=ivlOffset|read_bits(1).
[0040] Then, the value of ivlOffset will be compared with the value of ivlCurrRange, and the subsequent steps are as follows: If ivlOffset is greater than or equal to ivlCurrRange, then the value of binVal is set to 1, and ivlOffset is equal to ivlOffset minus ivlCurrRange; Otherwise (ivlOffset is less than ivlCurrRange), the value of binVal is set to 0.
[0041] Throughout the process, the data in the bitstream should not cause ivlOffset to be greater than or equal to ivlCurrRange.
[0042] It should also be understood that current video codec standards typically support one or more transforms and transform skipping for residuals. Transforms include Discrete Cosine Transform (DCT), etc. Residual blocks using transforms often exhibit certain characteristics after the transform (and quantization). For example, after some transforms (and quantization), the energy is mostly concentrated in the low-frequency region, resulting in larger coefficients in the upper left corner and smaller coefficients, or even many zero coefficients, in the lower right corner. Transform skipping, as the name suggests, does not involve a transform. The distribution of coefficients after transform skipping is different from that after the transform, thus allowing the use of different coefficient encoding methods. For example, in VVC, RRC is used for transformed coefficients, and TSRC is used for transformed-skipped coefficients.
[0043] In general transformations, such as DCT transforms, the transformed block represents frequencies from low to high from left to right and from low to high from top to bottom. The top left corner represents low frequencies, and the bottom right corner represents high frequencies. The human eye is more sensitive to low-frequency information and less sensitive to high-frequency information. Utilizing this characteristic, some high-frequency information can be processed more extensively or removed with less visual impact. Some techniques, such as zero-out, can force certain high-frequency information to be set to 0. For example, in a 64x64 block, the coefficients at positions with an x-coordinate greater than or equal to 32, or a y-coordinate greater than or equal to 32, can be forced to be set to 0. The above is just a simple example; the range of zero-out may have more complex derivation methods, which will not be elaborated here. Figure 7 As shown, the upper left corner may contain non-zero coefficients (i.e., the region where non-zero coefficients may exist), while the lower right corner will be entirely set to zero (i.e., the region forced to be 0). Thus, for subsequent coefficient encoding, the coefficients in the zero-out region are guaranteed to be 0 and do not need to be encoded.
[0044] Furthermore, because the coefficient distribution of typical video residuals after transformation (and quantization) exhibits a characteristic of larger coefficients in the upper left corner and many zero coefficients in the lower right corner, coefficient encoding typically employs methods to ensure that coefficients within a certain range in the upper left corner require encoding, while coefficients within a certain range in the lower right corner do not require encoding, essentially defaulting to zero. One method is to determine the position of the last non-zero coefficient in the scan order when encoding the coefficients of a block. After determining this position, all coefficients after the last non-zero coefficient in the scan order are considered zero and do not require encoding; only the coefficients at and before the last non-zero coefficient position need to be encoded. For example, in VVC, last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix are used to determine the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY).
[0045] (a) `last_sig_coeff_x_prefix` determines the prefix of the horizontal (or column) coordinate of the last non-zero coefficient in the current block in scan order. The value of `last_sig_coeff_x_prefix` should be between 0 and (log2ZoTbWidth << 1). 1. Within the range of these two boundary values.
[0046] If last_sig_coeff_x_prefix does not exist, then the value of last_sig_coeff_x_prefix is 0.
[0047] (b) `last_sig_coeff_y_prefix` determines the prefix of the vertical (or row) coordinate of the last non-zero coefficient in the current block in scan order. The value of `last_sig_coeff_y_prefix` should be between 0 and (log2ZoTbHeight << 1). 1. Within the range of these two boundary values.
[0048] If last_sig_coeff_y_prefix does not exist, then the value of last_sig_coeff_y_prefix is 0.
[0049] (c) `last_sig_coeff_x_suffix` determines the suffix of the horizontal (or column) coordinate of the last non-zero coefficient in the current block in scan order. The value of `last_sig_coeff_x_suffix` should be between 0 and (1 << ((last_sig_coeff_x_prefix >> 1)). 1))–1, within the range of these two boundary values.
[0050] The value of the horizontal (or column) coordinate of the last non-zero coefficient in the current transform block, in scan order, is LastSignificantCoeffX, derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX = last_sig_coeff_x_prefix; Otherwise (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.
[0051] (d) `last_sig_coeff_y_suffix` determines the suffix of the vertical (or row) coordinate of the last non-zero coefficient in the current transform block in scan order. The value of `last_sig_coeff_x_suffix` should be between 0 and (1 << ((last_sig_coeff_y_prefix >> 1)). 1))–1, within the range of these two boundary values.
[0052] The value of the vertical (or row) coordinate of the last non-zero coefficient in the current transform block, in scan order, is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY = last_sig_coeff_y_prefix; Otherwise (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.
[0053] Furthermore, all coefficients up to and including the last non-zero coefficient must be encoded. However, in normal video, even among these coefficients, a certain percentage are still 0. VVC uses the flag `sb_coded_flag` to determine whether the coefficients in the current sub-block need encoding. If no encoding is needed, all coefficients in the current sub-block are considered to be 0. Here, a sub-block is typically n. Sub-blocks of n, such as 4 4 is a sub-block.
[0054] sb_coded_flag[xS][yS] determines the following information about the sub-block at position (xS, yS) in the current transform block, where the sub-block is an array of transform coefficient values: If the value of sb_coded_flag[xS][yS] is 0, then the values of all transform coefficients in the sub-block at position (xS, yS) in the current transform block are 0. If sb_coded_flag[xS][yS] does not exist, then the value of sb_coded_flag[xS][yS] is 1.
[0055] Furthermore, when processing coefficient encoding, leveraging the characteristics of coefficients can improve compression efficiency. For example, in typical video, a certain proportion of the coefficients to be encoded are 0. Therefore, a syntax element can be used to indicate whether the current coefficient is 0. This syntax element is usually a binary symbol. If the current coefficient is 0, it means that the encoding of the current coefficient has ended; otherwise, the encoding of the current coefficient needs to continue. Similarly, in typical video, a certain proportion of the non-zero coefficients have an absolute value of 1. Therefore, a syntax element can be used to indicate whether the absolute value of the current coefficient is greater than 1. This syntax element is usually a binary symbol. If the absolute value of the current coefficient is not greater than 1, it means that the encoding of the current coefficient has ended; otherwise, the encoding of the current coefficient needs to continue. For example, the syntax elements involved in VVC are as follows... sig_coeff_flag[xC][yC] is used to determine whether the transform coefficients at the transform coefficient positions (xC, yC) of the current transform block are non-zero coefficients. If the value of sig_coeff_flag[xC][yC] is 0, then the value of the transformation coefficient at position (xC, yC) is set to 0; Otherwise (the value of sig_coeff_flag[xC][yC] is 1), the transformation coefficients at the (xC, yC) positions are non-zero coefficients.
[0056] If sig_coeff_flag[xC][yC] does not exist, then the following inference is made: If the value of transform_skip_flag[x0][y0][cIdx] is 0 or the value of sh_ts_residual_coding_disabled_flag is 1: If (xC, yC) is the position of the last non-zero coefficient in the scan order (LastSignificantCoeffX, LastSignificantCoeffY) or all of the following conditions are true, then the value of sig_coeff_flag[xC][yC] is inferred to be 1: (xC&((1< <log2SbW) 1), yC&((1< <log2SbH) 1)) equals (0, 0); The value of inferSbDcSigCoeffFlag is equal to 1; The value of sb_coded_flag[xS][yS] is 1; Otherwise, the value of sig_coeff_flag[xC][yC] is inferred to be 0; Otherwise (the value of transform_skip_flag[x0][y0][cIdx] is 1 and the value of sh_ts_residual_coding_disabled_flag is 0): If all of the following conditions are true, then the value of sig_coeff_flag[xC][yC] is inferred to be 1: (xC&((1< <log2SbW) 1), yC&((1< <log2SbH) 1)) equals ((1< <log2SbW) 1, (1<< log2SbH) 1); The value of inferSbSigCoeffFlag is 1; The value of sb_coded_flag[xS][yS] is 1; Otherwise, the value of sig_coeff_flag[xC][yC] is inferred to be 0.
[0057] abs_level_gtx_flag[n][j] is used to determine whether the absolute value of the nth transform coefficient (in the scan order) is greater than (j<<1)+1. If abs_level_gtx_flag[n][j] does not exist, then the value of abs_level_gtx_flag[n][j] is 0.
[0058] Therefore, if the current coefficient has not been fully encoded after processing the above flags (or syntax elements), then the remaining value of the coefficient's absolute value needs to be encoded. For example, `abs_remainder` in VVC.
[0059] abs_remainder[n] is used to determine the Golomb-Rice encoded residual absolute value of the nth transform coefficient in the scan order. If abs_remainder[n] does not exist, then the value of abs_remainder[n] is 0.
[0060] Furthermore, in VVC, syntax elements such as `sig_coeff_flag` and `abs_level_gtx_flag` use context mode encoding, while `abs_remainder` uses bypass mode encoding. As mentioned above, context mode encoding is more complex than bypass mode encoding, which intuitively means it's slower to process. If there are many coefficients to encode, using too much context mode encoding will affect decoding speed. Therefore, the number of syntax elements using context mode encoding can be limited. For example, if the number of binary symbols using context mode encoding exceeds a certain threshold, subsequent coefficient encoding is forced to use bypass mode encoding. This is exemplified by `dec_abs_level` in VVC.
[0061] dec_abs_level[n] is an intermediate value encoded in Golomb-Rice at scan position n. When parsing dec_abs_level[n], ZeroPos[n] can be derived. The absolute value of the quantization coefficient at position (xC, yC), AbsLevel[xC][yC], is derived as follows: If dec_abs_level[n] does not exist or 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].
[0062] The above refers to the absolute values of the coefficients. The sign of non-zero coefficients can be determined using the coefficient sign flag `coeff_sign_flag` or some methods for deriving the sign. `coeff_sign_flag[n]` can determine the sign of the transform coefficients at scan position n as follows: If the value of coeff_sign_flag[n] is 0, then the corresponding transformation coefficient is positive; Otherwise (coeff_sign_flag[n] is 1), the corresponding transformation coefficient is negative.
[0063] If coeff_sign_flag[n] does not exist, then the value of coeff_sign_flag[n] is 0; in this case, the sign of the transformation coefficients on coordinates (xC, yC) is determined according to CoeffSignLevel[xC][yC]. If the value of CoeffSignLevel[xC][yC] is 0, then the corresponding transformation coefficient is 0; Otherwise, if the value of CoeffSignLevel[xC][yC] is 1, then the corresponding transformation coefficient is positive; otherwise (the value of CoeffSignLevel[xC][yC] is...). 1), the corresponding transformation coefficients are negative.
[0064] It should also be noted that CoeffSignLevel[xC][yC] can be exported using other methods, which will not be elaborated here.
[0065] Additionally, VVC uses a parity flag, `par_level_flag`, to indicate the parity of a coefficient's value. This flag is used to determine the parity of the current coefficient's value and is applied in determining the current coefficient's value and in dependent quantization.
[0066] `par_level_flag[n]` determines the parity of the transform coefficients at position n in the scan order. If `par_level_flag[n]` does not exist, then the value of `par_level_flag[n]` is 0.
[0067] In addition to determining the parity of the transform coefficients, par_level_flag can also be used together with abs_level_gtx_flag, abs_remainder, etc., to determine the magnitude of the coefficients.
[0068] Here, since context mode encoding requires selecting, using, and updating the context mode, while bypass mode encoding does not, the common practice is to group context mode encoded syntax elements together and bypass mode encoded syntax elements together within a certain range. This is more hardware-friendly. For example, all context mode encoded syntax elements in a block can be processed first, followed by bypass mode encoded syntax elements. The context mode encoded syntax elements in the current block may be further divided into several groups, and the bypass mode encoded syntax elements in a block may also be divided into several groups.
[0069] In a specific example, the specific syntax of RRC is shown in Table 1.
[0070] Table 1
[0071] Here, the array AbsLevel[xC][yC] represents an array of absolute values of the transform coefficients of the current transform block. The array AbsLevelPass1[xC][yC] represents an array of partially reconstructed absolute values of the transform coefficients of the current transform block. The array indices xC and yC represent the (xC, yC) positions within the current transform block.
[0072] After entering the residual_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx) function, it is necessary to determine some information about the block size, such as determining the logarithms log2ZoTbWidth and log2ZoTbHeight of the block size after zero-out. The coefficients with the abscissa in the range [0, (1 << log2ZoTbWidth) – 1] and the ordinate in the range [0, (1 << log2ZoTbHeight) – 1] may be non-zero coefficients. Here, (1 << log2ZoTbWidth) represents the width of the transformed block after zero-out, and (1 << log2ZoTbHeight) represents the height of the transformed block after zero-out. Then, determine the position of the last non-zero coefficient according to last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, etc. The coefficients before the last non-zero coefficient in the scanning order may be non-zero coefficients. Then, determine the value of remBinsPass1, which is determined using the equation remBinsPass1 = ((1 << (log2TbWidth + log2TbHeight)) × 7) >> 2. remBinsPass1 determines the number of syntax elements encoded using the context mode in the current block. In the embodiments of this application, remBinsPass1 can be understood as the meaning of remaining binaries in pass1, that is, the number of binary symbols remaining in the first round. The coefficients before the last non-zero coefficient in the scanning order need to be encoded. For the sub-blocks where these coefficients are located, determine whether the current sub-block needs to be encoded in turn. If it needs to be encoded, in this method, the syntax elements encoded using the context mode in a sub-block are placed in the first round, and the syntax elements encoded using the bypass mode are placed later. Each coefficient may need to process up to 4 syntax elements encoded using the context mode: 1 sig_coeff_flag, 2 abs_level_gtx_flag, and 1 par_level_flag. In the first round, each time a syntax element encoded using the context mode is processed, remBinsPass1 will be decremented by 1. If a coefficient is large enough, after processing several syntax elements encoded using the context mode in the first round, the remaining value, that is, abs_remainder, still needs to be processed. And if remBinsPass1 is small enough (not satisfying remBinsPass1 >= 4), the first round will end, and the remaining coefficients will be directly processed using the bypass mode, that is, dec_abs_level.
[0073] In another specific example, the specific syntax of TSRC is shown in Table 2.
[0074] Table 2
[0075] After entering the `residual_ts_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx)` function, some block size information needs to be determined. Then, the value of `RemCcbs` is determined using the equation `RemCcbs = ((1 << (log2TbWidth + log2TbHeight)) × 7) >> 2`. `RemCcbs` determines the number of context-coded syntax elements used in the current block. In this embodiment, `RemCcbs` can be understood as remaining context-coded binaries, that is, the number of remaining context-coded binary symbols. For each sub-block, it is determined whether the current sub-block needs encoding. If encoding is required, unlike the above RRC method, the TSRC method places the context-coded syntax elements in a sub-block in two rounds. Each coefficient processes a maximum of four context-coded syntax elements in the first and second rounds respectively. Bypass-mode encoded syntax elements are placed later. In the first and second rounds, `remBinsPass1` is decremented by 1 after each context-mode encoded syntax element is processed. If a coefficient is large enough, the remaining value, `abs_remainder`, needs to be processed after processing several context-mode encoded syntax elements in the first and second rounds. However, if `remBinsPass1` is already small enough (not satisfying `remBinsPass1>=4`), the first two rounds will end, and the remaining coefficients will be processed directly using the bypass mode, which is still `abs_remainder`.
[0076] In short, existing coefficient encoding methods offer good compression efficiency for commonly used videos, such as consumer-grade videos. Consumer-grade videos typically have a bit width of 8 or 10 bits per pixel, and their bitrates are usually not very high, typically a few megabytes per second (MB / s) or lower. However, some applications require higher bit widths, such as 12, 14, or 16 bits per pixel or more. Higher bit widths usually result in larger coefficients and more non-zero coefficients, thus leading to higher bitrates. Some applications also require higher video quality, which typically also results in larger coefficients and more non-zero coefficients, leading to higher bitrates. Higher bitrates place higher demands on the decoder's processing capabilities, such as throughput.
[0077] High-bit-width, high-quality, and high-bit-rate videos (the "three-high videos") typically require more and larger coefficients for encoding and decoding than lower-bit-width, low-quality, and low-bit-rate videos (the "regular videos"). For example, a block in a three-high video requires significantly more coefficients for encoding and decoding than a block of the same size in a regular video. This is because many coefficients in a regular video block become 0 after prediction, transformation, and quantization, while many coefficients in a three-high video block remain non-zero after these processes. Since a large proportion of the coefficients in a regular video block that need encoding after prediction, transformation, and quantization are 0, using the last non-zero coefficient position (LastSignificantCoeffX, LastSignificantCoeffY) to distinguish whether a coefficient region needs encoding is effective. Even before the last non-zero coefficient position, a large proportion of the coefficients are still 0, making the sub-block encoding flag (sb_coded_flag) highly effective for further distinguishing whether the current sub-block needs encoding. However, when there are a large number of non-zero coefficients in the current block, or even when the vast majority or all coefficients are non-zero, the aforementioned flag indicating the position of the last non-zero coefficient and whether the sub-block is encoded will not filter out too many non-zero coefficients. Moreover, encoding the position of non-zero coefficients and the flag indicating whether the sub-block is encoded in the bitstream will incur certain overhead and result in waste.
[0078] On the other hand, the last non-zero coefficient position and the flag indicating whether the sub-block is encoded are encoded using context mode. Context mode encoding is more complex than bypass mode, and processing this information will also affect the speed and throughput of software and hardware encoding and decoding.
[0079] On the other hand, current encoding methods for the last non-zero coefficient position (LastSignificantCoeffX, LastSignificantCoeffY) encode the coordinates of that position. In regular videos, since non-zero coefficients are mostly concentrated in the upper left corner while a large area in the lower right corner is 0, the values of LastSignificantCoeffX and LastSignificantCoeffY are usually small. However, in high-definition videos, a large number of non-zero coefficients also appear in the lower right corner, resulting in larger values for LastSignificantCoeffX and LastSignificantCoeffY. Encoding larger values in the bitstream leads to greater overhead. Furthermore, this method might be used in lossless compression, where quantization cannot be used, resulting in a larger number and size of coefficients. In this case, using existing related schemes might lead to greater overhead, waste, and low compression efficiency.
[0080] This application provides a decoding method that, by parsing the bitstream, determines the component identification information of the current slice and the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice; when the component identification information indicates that the component of the current slice is flipped using the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block; and all coefficients before the position of the last non-zero coefficient are decoded according to a preset scanning order to determine the coefficients of the current block.
[0081] This application provides another encoding method, which involves determining the component identification information of the current slice and the position of the last non-zero coefficient of the current block corresponding to the component of the current slice; determining the coordinate information of the last non-zero coefficient of the current block based on the component identification information and the position of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order; and writing the encoded bit information, component identification information, and coordinate information of the last non-zero coefficient into the bit stream.
[0082] In this way, in high-bit-width, high-bit-rate, high-quality or lossless video encoding and decoding scenarios, setting a reasonable method for deriving the last non-zero coefficient based on the distribution pattern of the non-zero coefficients can reduce the overhead of encoding in the bitstream and improve compression efficiency. In addition, since the distribution patterns of the non-zero coefficients of each image component are different, the method for deriving the last non-zero coefficient of each image component can be controlled separately using component identification information. That is, each image component can be controlled separately to control whether to use the last non-zero coefficient position flipping technique, thereby further improving compression efficiency.
[0083] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0084] See Figure 8A This illustrates a system composition block diagram example of an encoder provided in an embodiment of this application. Figure 8A As shown, the encoder 100 may include: a segmentation 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 of the encoder 100 can be a video consisting of a series of images or a single still image, and the output of the encoder 100 can be a bitstream (also called a "bitstream") representing a compressed version of the input video.
[0085] The segmentation unit 101 segments the images in the input video into one or more Coding Tree Units (CTUs). The segmentation unit 101 divides the image into one or more tiles, and can further divide a tile into one or more bricks. Here, a tile or a brick can include one or more complete and / or partial CTUs. Additionally, the segmentation unit 101 can form one or more slices, where a slice can include one or more tiles arranged in raster order in the image, or one or more tiles covering a rectangular area of the image. The segmentation unit 101 can also form one or more sub-images, where a sub-image can include one or more slices, tiles, or bricks.
[0086] During the encoding process of encoder 100, segmentation unit 101 transmits the CTU to prediction unit 102. Typically, prediction unit 102 may consist of block segmentation unit 103, motion estimation (ME) unit 104, motion compensation (MC) unit 105, and intra-prediction unit 106. Specifically, block segmentation unit 103 iteratively uses quadtree segmentation, binary tree segmentation, and ternary tree segmentation to further divide the input CTU into smaller coding units (CUs). Prediction unit 102 can use ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks of the CUs. Intra-prediction unit 106 can use various intra-prediction modes, including MIP modes, to obtain intra-frame prediction blocks of the CUs. In the example, rate-distortion optimized motion estimation can be invoked by ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks, and rate-distortion optimized mode determination can be invoked by intra-prediction unit 106 to obtain intra-frame prediction blocks.
[0087] Prediction unit 102 outputs the predicted block of the CU. First adder 107 calculates the difference between the CU in the output of segmentation unit 101 and the predicted block of the CU, i.e., the residual CU. Transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. Quantization unit 109 quantizes the coefficients and outputs quantization coefficients (i.e., levels). Inverse quantization unit 110 performs a scaling operation on the quantization coefficients to output reconstructed coefficients. Inverse transform unit 111 performs one or more inverse transforms corresponding to the transforms in transform unit 108 and outputs the reconstructed residual. Second adder 112 calculates the reconstructed CU by adding the reconstructed residual to the predicted block of the CU from prediction unit 102. Second adder 112 also sends its output to prediction unit 102 as an intra-frame prediction reference. After all CUs in the image or sub-image are reconstructed, filtering unit 113 performs 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, when the filtering unit 113 determines that the CU is not used as a reference for encoding other CUs, the filtering unit 113 performs loop filtering on one or more target pixels in the CU.
[0088] 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 according to timing and control information. Here, the image stored in the DPB unit 114 can also be used as a reference for the prediction unit 102 to perform inter-frame prediction or intra-frame prediction. Finally, the entropy coding unit 115 converts the parameters (such as control parameters and supplementary information) necessary for decoding the image from the encoder 100 into binary form, and writes such binary form into the bitstream according to the syntax structure of each data unit, which is the final output bitstream of the encoder 100.
[0089] Furthermore, the encoder 100 may be a first memory having a first processor and a computer program for recording. When the first processor reads and runs the computer program, the encoder 100 reads the input video and generates a corresponding bitstream. Additionally, the encoder 100 may also be a computing device having one or more chips. These units, implemented as integrated circuits on the chips, have... Figure 8A Similar connection and data exchange functions to the corresponding units in the middle.
[0090] See Figure 8B This illustrates a system block diagram example of a decoder provided in an embodiment of this application. Figure 8B As shown, the decoder 200 may include: a parsing unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transform unit 206, an adder 207, a filtering unit 208, and a decoded image buffer unit 209. Here, the input of the decoder 200 is a bitstream representing a compressed version of a video or a still image, and the output of the decoder 200 may be a decoded video consisting of a series of images or a decoded still image.
[0091] The input bitstream to the decoder 200 can be the bitstream generated by the encoder 100. The parsing unit 201 parses the input bitstream and obtains the values of the syntax elements. The parsing unit 201 converts the binary representation of the syntax elements into numerical values and sends these values to units in the decoder 200 to obtain one or more decoded images. The parsing unit 201 can also parse one or more syntax elements from the input bitstream to display the decoded images.
[0092] During the decoding process of decoder 200, parsing unit 201 sends the value of the syntax element and one or more variables set or determined according to the value of the syntax element for obtaining one or more decoded images to the unit in decoder 200.
[0093] Prediction unit 202 determines the prediction block of the current decoded block (e.g., CU). Here, prediction unit 202 may include motion compensation unit 203 and intra-frame prediction unit 204. Specifically, when an inter-frame prediction mode is indicated for decoding the current decoded block, prediction unit 202 passes relevant parameters from parsing unit 201 to motion compensation unit 203 to obtain inter-frame prediction blocks; when an intra-frame prediction mode (including MIP mode indicated by MIP mode index value) is indicated for decoding the current decoded block, prediction unit 202 passes relevant parameters from parsing unit 201 to intra-frame prediction unit 204 to obtain intra-frame prediction blocks.
[0094] The dequantization unit 205 has the same function as the dequantization unit 110 in the encoder 100. The dequantization unit 205 performs a scaling operation on the quantization coefficients (i.e., levels) from the parsing unit 201 to obtain the reconstruction coefficients.
[0095] 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 operation of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain the reconstructed residual.
[0096] Adder 207 performs an addition operation on its inputs (the predicted block from prediction unit 202 and the reconstructed residual from inverse transform unit 206) to obtain the reconstructed block of the current decoded block. The reconstructed block is also sent to prediction unit 202 as a reference for other blocks encoded in intra-frame prediction mode.
[0097] After all CUs in an image or sub-image are reconstructed, filtering unit 208 performs loop filtering on the reconstructed image or sub-image. Filtering unit 208 includes one or more filters, such as deblocking filters, sampling adaptive compensation filters, adaptive loop filters, luminance mapping and chroma scaling filters, and neural network-based filters. Alternatively, when filtering unit 208 determines that a reconstructed block is not used as a reference for decoding other blocks, filtering unit 208 performs loop filtering on one or more target pixels in the reconstructed block. Here, the output of filtering unit 208 is a decoded image or sub-image, which is buffered in DPB unit 209. DPB unit 209 outputs the decoded image or sub-image based on timing and control information. The image stored in DPB unit 209 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by prediction unit 202.
[0098] Furthermore, the decoder 200 can be a second memory having a second processor and a computer program for recording. When the second processor reads and runs the computer program, the decoder 200 reads the input bitstream and generates the corresponding decoded video. Alternatively, the decoder 200 can also be a computing device having one or more chips. These units, implemented as integrated circuits on the chips, have... Figure 8B Similar connection and data exchange functions to the corresponding units in the middle.
[0099] It should also be noted that when the embodiments of this application are applied to the encoder 100, the "current block" specifically refers to the block to be encoded in the video image (which can also be simply referred to as the "encoded block"); when the embodiments of this application are applied to the decoder 200, the "current block" specifically refers to the block to be decoded in the video image (which can also be simply referred to as the "decoded block").
[0100] In one embodiment of this application, see [link to embodiment]. Figure 9 The diagram illustrates a flowchart of a decoding method provided in an embodiment of this application. Figure 9 As shown, the method may include: S901: Parse the bitstream, determine the component identifier information of the current slice, and determine the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice.
[0101] It should be noted that the decoding method in this application specifically refers to a coefficient decoding method, which is applied to a decoder. Among them, based on... Figure 8B The decoder 200 shown is composed of a structure. This decoding method is mainly applied to the "parse unit 201" part of the decoder 200. For the parse unit 201, the adaptive binary arithmetic coding mode or the bypass mode based on the context model can be used for decoding to obtain the values of relevant identification information (or syntax elements) and then determine the coefficients of the current block.
[0102] It should also be noted that the encoding commonly referred to in video standards can include both encoding and decoding. Therefore, video encoding can include encoding methods on the encoder side and decoding methods on the decoder side. This application describes the decoding method on the decoder side.
[0103] In general, for example, for regular videos, the decoding method for coefficients is the same as the existing methods in related technologies; however, for certain situations, such as high bit width, high quality, high bit rate, or lossless compression video encoding and decoding scenarios, the embodiments of this application provide an export method that can modify the position of the last non-zero coefficient.
[0104] In this embodiment, the component identification information of the current slice is a slice-level flag. This component identification information is used to indicate whether the components of the current slice are flipped using the last non-zero coefficient position. Specifically, if the components of the current slice are flipped using the last non-zero coefficient position, it means that the current block corresponding to the components of the current slice is also flipped using the last non-zero coefficient position; if the components of the current slice are not flipped using the last non-zero coefficient position, it means that the current block corresponding to the components of the current slice is also not flipped using the last non-zero coefficient position.
[0105] Understandably, the current sequence may include the current slice, and the current slice may include the current block. In some embodiments, before parsing the bitstream and determining the component identification information of the current slice, the method may further include: Parse the bitstream to determine the identifier information of the first syntax element; When the first syntax element identifier indicates that the current sequence allows flipping using the last non-zero coefficient position, the step of parsing the bitstream and determining the component identifier information of the current slice is performed.
[0106] In this embodiment of the application, the method may further include: if the value of the first syntax element identification information is a first value, then determine that the first syntax element identification information indicates that the current sequence is allowed to be flipped using the last non-zero coefficient position; or, if the value of the first syntax element identification information is a second value, then determine that the first syntax element identification information indicates that the current sequence is not allowed to be flipped using the last non-zero coefficient position.
[0107] It should be noted that the first value and the second value are different, and both the first value and the second value can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a value of a flag; this application embodiment does not impose any limitations on this.
[0108] Taking a flag as the first syntax element identifier, the first and second values can be set to 1 and 0 respectively; or, the first value can be set to true and the second value to false; or, the first value can be set to 0 and the second value to 1; or, the first value can be set to false and the second value to true. For example, generally, for a flag, the first value can be 1 and the second value can be 0, but there are no restrictions.
[0109] It should also be noted that the first syntax element identifier is a sequence-level flag, represented by `sps_reverse_last_sig_coeff_flag`, which can be used to indicate whether the current sequence is allowed to use the last non-zero coefficient position for flipping. Thus, when decoding reveals that the current sequence is allowed to use the last non-zero coefficient position for flipping, the slice-level component identifier information can be further decoded to determine whether the components of the current slice use the last non-zero coefficient position for flipping.
[0110] Furthermore, before decoding to obtain the first syntax element identification information, in one possible embodiment, the method may further include: Parse the bitstream to determine the identifier information of the second syntax element; When the second syntax element identification information indicates that the current sequence uses the standard extended version, the step of parsing the code stream and determining the first syntax element identification information is performed.
[0111] In another possible embodiment, before decoding to obtain the first syntax element identification information, the method may further include: Parse the bitstream to determine the identifier information of the third syntax element; When the third syntax element identification information indicates that the current sequence uses a range extension, the step of parsing the code stream and determining the first syntax element identification information is performed.
[0112] In another possible embodiment, before decoding to obtain the first syntax element identification information, the method may further include: Parse the bitstream to determine the identifier information of the second syntax element; When the second syntax element identification information indicates that the current sequence uses the standard extended version, the code stream is parsed to determine the third syntax element identification information; When the third syntax element identification information indicates that the current sequence uses a range extension, the step of parsing the code stream and determining the first syntax element identification information is performed.
[0113] It should be noted that both the second and third syntax element identifiers are sequence-level flags. The second syntax element identifier, represented by `sps_extension_flag`, indicates whether the current sequence uses the standard extended version; the third syntax element identifier, represented by `sps_range_extension_flag`, indicates whether the current sequence uses range extension.
[0114] In other words, before decoding to obtain the first syntax element identifier information (sps_reverse_last_sig_coeff_flag), it can be done after parsing the bitstream to obtain sps_extension_flag. If sps_extension_flag indicates that the current sequence uses the standard extension version, then sps_reverse_last_sig_coeff_flag is decoded to obtain sps_reverse_last_sig_coeff_flag; or it can be done after parsing the bitstream to obtain sps_range_extension_flag. If sps_range_extension_flag indicates that the current sequence uses the range extension, then sps_reverse_last_sig_coeff_flag is decoded to obtain sps_reverse_last_sig_coeff_flag; or even after parsing the bitstream to obtain sps_extension_flag. If sps_extension_flag indicates that the current sequence uses the standard extension version, then sps_range_extension_flag is parsed to obtain sps_range_extension_flag; if sps_range_extension_flag indicates that the current sequence uses the range extension, then sps_reverse_last_sig_coeff_flag is decoded to obtain sps_reverse_last_sig_coeff_flag. However, this application embodiment does not impose any limitations.
[0115] Furthermore, in some embodiments, the method may further include: if the value of the second syntax element identification information is a first value, then determining that the second syntax element identification information indicates that the current sequence uses the standard extended version; or, if the value of the second syntax element identification information is a second value, then determining that the second syntax element identification information indicates that the current sequence does not use the standard extended version.
[0116] Furthermore, in some embodiments, the method may further include: if the value of the third syntax element identification information is a first value, then determining that the third syntax element identification information indicates that the current sequence uses range extension; or, if the value of the third syntax element identification information is a second value, then determining that the third syntax element identification information indicates that the current sequence does not use range extension.
[0117] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0118] It should also be noted that the second syntax element identifier is represented by `sps_extension_flag`, and the third syntax element identifier is represented by `sps_range_extension_flag`. Thus, at the sequence level, if `sps_extension_flag` is 1, meaning the current sequence uses the standard extended version, then `sps_range_extension_flag` needs to be decoded; if `sps_range_extension_flag` is 1, meaning the current sequence uses range extension, then `sps_reverse_last_sig_coeff_flag` needs to be decoded; if `sps_reverse_last_sig_coeff_flag` is 1, meaning the current sequence allows flipping using the last non-zero coefficient position, then further decoding of the slice-level component identifier information is needed to determine whether the components of the current slice use flipping using the last non-zero coefficient position.
[0119] In some embodiments, the current sequence uses range extension, which may include: the current sequence satisfying at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0120] In other words, compared to conventional videos, the videos described in this application embodiment have characteristics such as high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0121] Furthermore, the first, second, and third syntax element identifiers can be sequence-level identifiers, or even higher-level identifiers, such as Video Usability Information (VUI) and Supplemental Enhancement Information (SEI).
[0122] In a specific example, for the current sequence of the video, the second syntax element identifier (sps_extension_flag) is used to determine whether the current sequence uses a standard extended version; in other words, it determines whether the current sequence can be opened in a standard extended version, such as the extended version specified in VVC for high bit width and high bit rate encoding. When the value of sps_extension_flag is 1, the first syntax element identifier (sps_reverse_last_sig_coeff_flag) needs to be decoded; otherwise, the first syntax element identifier (sps_reverse_last_sig_coeff_flag) does not need to be decoded.
[0123] In another specific example, for the current video sequence, when the value of `sps_extension_flag` is 1, it is also necessary to decode the third syntax element identifier information (`sps_range_extension_flag`) to determine whether the current sequence uses range extension, such as flags for high bit width, high bit rate, high frame rate, and lossless compression. The following will describe four cases as examples.
[0124] In one possible implementation, when the third syntax element identification information is high-width identification information, the method may further include: if the high-width identification information indicates that the current sequence meets the high-width requirement, then determine that the current sequence uses an extended range.
[0125] In another possible implementation, when the third syntax element identification information is high bitrate identification information, the method may further include: if the high bitrate identification information indicates that the current sequence meets the high bitrate, then determine that the current sequence usage range is extended.
[0126] In another possible implementation, when the third syntax element identification information is high quality identification information, the method may further include: if the high quality identification information indicates that the current sequence meets the high quality requirement, then determining that the scope of use of the current sequence is extended.
[0127] In another possible implementation, when the third syntax element identification information is lossless compression identification information, the method may further include: if the lossless compression identification information indicates that the current sequence satisfies lossless compression, then determine that the scope of use of the current sequence is extended.
[0128] For example, taking the sequence level as an example, the third syntax element identification information can also be high bit width identification information (represented by sps_high_bit_depth_flag), used to indicate whether the current sequence is a high bit width sequence; or it can be replaced by high bit rate identification information (represented by sps_high_bit_rate_flag), used to indicate whether the current sequence is a high bit rate sequence; or it can be replaced by other identification information indicating high bit width, high bit rate, high quality or lossless compression. The embodiments of this application do not make specific limitations.
[0129] Furthermore, in some embodiments, for S901, the parsing of the bitstream to determine the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice may include: Parse the bitstream to obtain the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient in the current block. The horizontal coordinate of the last non-zero coefficient is determined based on the prefix information and the suffix information of the horizontal coordinate of the last non-zero coefficient. The vertical coordinate of the last non-zero coefficient is determined based on the prefix information and the suffix information of the vertical coordinate of the last non-zero coefficient. The coordinate information of the last non-zero coefficient of the current block is determined based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0130] It should be noted that the prefix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_prefix, which determines the prefix of the horizontal (or column) coordinate of the last non-zero coefficient of the current block according to the preset scan order; the prefix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix, which determines the prefix of the vertical (or row) coordinate of the last non-zero coefficient of the current block according to the preset scan order; the suffix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix, which determines the suffix of the horizontal (or column) coordinate of the last non-zero coefficient of the current block according to the preset scan order; and the suffix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_suffix, which determines the suffix of the vertical (or row) coordinate of the last non-zero coefficient of the current block according to the preset scan order. In other words, the coordinate information of the last non-zero coefficient can be determined by last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix.
[0131] It should also be noted that last_sig_coeff_x_prefix and last_sig_coeff_x_suffix determine the x-coordinate (i.e., horizontal coordinate) of the last non-zero coefficient, while last_sig_coeff_y_prefix and last_sig_coeff_y_suffix determine the y-coordinate (i.e., vertical coordinate) of the last non-zero coefficient, thus obtaining the coordinate information of the last non-zero coefficient.
[0132] In this embodiment, the flip flag information of the last non-zero coefficient position can be represented by reverse_last_sig_coeff_flag. The flip flag information of the last non-zero coefficient position can be at least one of the following: sequence level, picture level, slice level, and block level; it can even be higher-level flag information (such as VUI, SEI, etc.), without any limitation here.
[0133] In other words, `reverse_last_sig_coeff_flag` may be a sequence-level or higher-level flag, or it may be an image-level flag, a slice-level flag, a block-level flag, or a flag at other levels. Furthermore, block-level flags may include maximum coding unit (LCU) level flags, coding tree unit (CTU) level flags, coding unit (CU) level flags, or other block-level flags; no limitations are imposed on these embodiments in this application.
[0134] In this embodiment, the last non-zero coefficient position flipping flag at the sequence level can be represented by sps_reverse_last_sig_coeff_flag, and the last non-zero coefficient position flipping flag at the slice level can be represented by sh_reverse_last_sig_coeff_flag.
[0135] It should also be noted that the flip identifier information of the last non-zero coefficient position at the slice level can also be referred to as the component identifier information of the current slice. In some embodiments, the method may further include: If the component identifier information takes the first value, then the component identifier information indicates that the component of the current slice is flipped using the last non-zero coefficient position; or, If the component identifier information takes the second value, then it is determined that the component identifier information indicates that the current slice's component does not use the last non-zero coefficient position for flipping.
[0136] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0137] Taking a first value of 1 and a second value of 0 as an example, if the value of the component identifier information obtained by decoding is 1, then it can be determined that the component identifier information indicates that the component of the current slice uses the last non-zero coefficient position for flipping; if the value of the component identifier information obtained by decoding is 0, then it can be determined that the component identifier information indicates that the component of the current slice does not use the last non-zero coefficient position for flipping.
[0138] S902: When the component identification information indicates that the component of the current block is flipped using the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block.
[0139] S903: Decode all coefficients before the last non-zero coefficient according to the preset scanning order to determine the coefficients of the current block.
[0140] It should be noted that, in the embodiments of this application, when the component identification information indicates that the component of the current slice is flipped using the last non-zero coefficient position, it means that the current block corresponding to the component of the current slice is also flipped using the last non-zero coefficient position. At this time, the coordinate information of the last non-zero coefficient of the current block can be determined as the horizontal and vertical distances between the position of the last non-zero coefficient and the lower right corner position of the current block.
[0141] In some embodiments, calculating the coordinate information of the last non-zero coefficient to obtain the position of the last non-zero coefficient of the current block may include: Determine the width and height of the current block; The horizontal coordinates of the last non-zero coefficient are obtained by subtracting the horizontal distance between the width of the current block and the position of the last non-zero coefficient relative to the bottom right corner of the current block; and The vertical coordinates of the last non-zero coefficient are obtained by subtracting the vertical distance between the height of the current block and the position of the last non-zero coefficient relative to the bottom right corner of the current block. The position of the last non-zero coefficient in the current block is determined based on the horizontal and vertical coordinates of the last non-zero coefficient.
[0142] It should be noted that the coordinate information of the last non-zero coefficient is usually the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner position of the current block. For conventional videos, since most non-zero coefficients are concentrated in the upper left corner and a large area in the lower right corner is 0; however, for high-bitwidth, high-quality, and high-bitrate video encoding and decoding, a large number of non-zero coefficients may also appear in the lower right corner, making the value of the coordinate information of the last non-zero coefficient usually large. At this time, in order to save overhead, coordinate transformation needs to be performed during coefficient encoding (specifically, it can be coordinate flipping calculation, that is, after coordinate flipping, the coordinate information of the last non-zero coefficient is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the lower right corner position of the current block). Then, coordinate flipping calculation also needs to be performed during coefficient decoding. After flipping again, the coordinate information of the last non-zero coefficient can be restored to be the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner position of the current block, so as to determine the position of the last non-zero coefficient, and encode all the coefficients before the position of the last non-zero coefficient in the current block according to the preset scanning order.
[0143] It should also be noted that for the current block corresponding to the component of the current slice, it can be a block without zero-out transformation or a block after zero-out transformation. Taking the block after zero-out transformation as an example, at this time, the width of the current block is 1<<log2ZoTbWidth, and the height of the current block is 1<<log2ZoTbHeight; then, when the component identification information indicates that the component of the current slice uses the flipping of the position of the last non-zero coefficient, LastSignificantCoeffX = (1<<log2ZoTbWidth)-1-LastSignificantCoeffX; LastSignificantCoeffY = (1<<log2ZoTbHeight)-1-LastSignificantCoeffY.
[0144] Among them, (LastSignificantCoeffX, LastSignificantCoeffY) on the right side of the equation represents the coordinate information of the last non-zero coefficient obtained by decoding, and (LastSignificantCoeffX, LastSignificantCoeffY) on the left side of the equation represents the position of the last non-zero coefficient (which can also be regarded as the target coordinate information of the last non-zero coefficient).
[0145] In addition, in some embodiments, the method may further include: When the component identification information indicates that the component of the current slice does not use the last non-zero coefficient position for flipping, the coordinate information of the last non-zero coefficient of the current block is determined as the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner of the current block. The position of the last non-zero coefficient of the current block is determined based on the horizontal and vertical distances between the position of the last non-zero coefficient and the position of the top left corner of the current block.
[0146] It should be noted that if the component identification information indicates that the component of the current slice does not use the last non-zero coefficient position for flipping, it means that the current block corresponding to the component of the current slice also does not use the last non-zero coefficient position for flipping. Therefore, the coordinate information of the last non-zero coefficient obtained through decoding can be regarded 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 distance between the position of the last non-zero coefficient and the upper left corner of the current block.
[0147] Furthermore, in some embodiments, the method may further include: When the component identification information indicates that the component of the current block does not use the last non-zero coefficient position for flipping, the position of the last non-zero coefficient of the current block is directly determined based on the coordinate information of the last non-zero coefficient. The coefficients of the current block are determined by decoding all coefficients before the last non-zero coefficient in a preset scanning order.
[0148] It should be noted that the preset scanning order can be diagonal, zigzag, horizontal, vertical, or 4-digit. The embodiments of this application do not limit the scanning order of sub-blocks or any other scanning order.
[0149] It should also be noted that after obtaining the component identifier information of the current slice, if the component identifier information of the current slice is 1, meaning that the component of the current slice needs to be flipped using the last non-zero coefficient position, then for the current block corresponding to the component of the current slice, after decoding to obtain the coordinate information of the last non-zero coefficient, the coordinate information of the last non-zero coefficient needs to be calculated to determine the position of the last non-zero coefficient of the current block; then, all coefficients before the position of the last non-zero coefficient are decoded according to the preset scanning order to obtain the coefficients of the current block. If the component identifier information of the current slice is 0, meaning that the component of the current slice does not need to be flipped using the last non-zero coefficient position, then for the current block corresponding to the component of the current slice, after decoding to obtain the coordinate information of the last non-zero coefficient, the position of the last non-zero coefficient of the current block can be directly determined based on the coordinate information of the last non-zero coefficient; then, all coefficients before the position of the last non-zero coefficient are decoded according to the preset scanning order to obtain the coefficients of the current block.
[0150] Thus, for certain situations, this application provides a method for modifying the position of the last non-zero coefficient during coefficient encoding. That is, under normal circumstances, the coefficient encoding and decoding method is the same as existing methods in related technologies. In certain situations, this might refer to high-bit-width, high-quality, or high-bitrate video encoding and decoding, or lossless compressed video encoding and decoding. Typically, `last_sig_coeff_x_prefix` and `last_sig_coeff_x_suffix` encode the horizontal coordinate of the last non-zero coefficient position, which is the horizontal distance relative to the top-left corner of the current block; `last_sig_coeff_y_prefix` and `last_sig_coeff_y_suffix` encode the vertical coordinate of the last non-zero coefficient position, which is the vertical distance relative to the top-left corner of the current block, such as... Figure 10A As shown. However, in high-bit-width, high-quality, high-bit-rate, or lossless compression video codecs, the position of the last non-zero coefficient is generally close to the bottom right corner of all potentially non-zero coefficient regions in the current block. In this case, `last_sig_coeff_x_prefix` and `last_sig_coeff_x_suffix` encode the horizontal distance of the last non-zero coefficient position relative to the bottom right corner of all potentially non-zero coefficient regions in the current block; `last_sig_coeff_y_prefix` and `last_sig_coeff_y_suffix` encode the vertical distance of the last non-zero coefficient position relative to the bottom right corner of all potentially non-zero coefficient regions in the current block, as shown. Figure 10BAs shown. For example, if the area where all possible non-zero coefficients in the current block is the rectangular area from (0, 0) to ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1), then last_sig_coeff_x_prefix and last_sig_coeff_x_suffix encode the horizontal distance of the position of the last non-zero coefficient relative to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1). last_sig_coeff_y_prefix and last_sig_coeff_y_suffix encode the vertical distance of the position of the last non-zero coefficient relative to the current block ((1 << log2ZoTbWidth) - 1, (1 << log2ZoTbHeight) - 1).
[0151] The modifications for semantics are as follows: The value of the horizontal (or column) coordinate of the last non-zero coefficient in the current block in the preset scanning order, LastSignificantCoeffX, is derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX = last_sig_coeff_x_prefix; Otherwise (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, then LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1 - LastSignificantCoeffX; The value of the vertical (or row) coordinate of the last non-zero coefficient in the current block in the scanning order, LastSignificantCoeffY, is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY= last_sig_coeff_y_prefix; Otherwise (if last_sig_coeff_y_suffix exists): LastSignificantCoeffY= (1<<((last_sig_coeff_y_prefix>>1)-1)) * (2+(last_ sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY。
[0152] Here, `reverse_last_sig_coeff_flag` is a flag indicating whether the position of the last non-zero coefficient needs to be flipped. If `reverse_last_sig_coeff_flag` is 1, it means the position of the last non-zero coefficient needs to be flipped; otherwise, it means the position of the last non-zero coefficient does not need to be flipped.
[0153] It should also be noted that `reverse_last_sig_coeff_flag` can be a sequence-level or higher-level flag, or it can be a picture-level flag, a slice-level flag, a block-level flag, or a flag at other levels. Block-level flags include flags at the maximum coding unit (LCU) level, the coding tree unit (CTU) level, the coding unit (CU) level, or other block-level flags. For example, a sequence-level `reverse_last_sig_coeff_flag` can be represented by `sps_reverse_last_sig_coeff_flag`, and a slice-level `reverse_last_sig_coeff_flag` can be represented by `sh_reverse_last_sig_coeff_flag`.
[0154] Additionally, `reverse_last_sig_coeff_flag` may depend on other flags, such as high bit width identifiers, high bit rate identifiers, or second syntax element identifiers (SPS extension flag, `sps_extension_flag`). The SPS extension flag can be enabled in standard extension versions, such as the VVC extension for high bit width, high bit rate encoding. That is, when the high bit width identifier or high bit rate identifier is 1, the `reverse_last_sig_coeff_flag` flag needs to be decoded; otherwise, it does not need to be decoded.
[0155] In a specific example, assume the existence of sequence-level identifiers `sps_extension_flag`, `sps_range_extension_flag`, and `sps_reverse_last_sig_coeff_flag`. At the sequence level, if `sps_extension_flag` is 1, then `sps_range_extension_flag` needs to be decoded. If `sps_range_extension_flag` is 1, then `sps_reverse_last_sig_coeff_flag` needs to be decoded. `sps_reverse_last_sig_coeff_flag` represents a flag indicating whether the last non-zero coefficient position of the current sequence is flipped. If `sps_reverse_last_sig_coeff_flag` is 1, then it is determined that the block in the current sequence uses the last non-zero coefficient position for flipping; otherwise (i.e., `sps_reverse_last_sig_coeff_flag` is 0), it is determined that the block in the current sequence does not use the last non-zero coefficient position for flipping. The reverse_last_sig_coeff_flag in the existing syntax table has been changed to sps_reverse_last_sig_coeff_flag.
[0156] Understandably, `sps_extension_flag` indicates whether the current sequence uses a standard extended version. `sps_range_extension_flag` indicates whether the current sequence uses range extensions, such as high bit width, high bit rate, etc.
[0157] In one implementation, the syntax element table is modified as follows (Sequence parameter set RBSPsyntax), see Table 3.
[0158] Table 3
[0159] In another implementation, the syntax element table is modified as follows (Sequence parameter setrange extension syntax), see Table 4.
[0160] Table 4
[0161] Based on the syntax elements in Tables 3 and 4, a value of 1 for sps_extension_flag indicates that the syntax elements sps_range_extension_flag and sps_extension_7bits will appear in the SPS RBSP syntax structure; a value of 0 for sps_extension_flag indicates that these syntax elements will not appear.
[0162] The value of sps_range_extension_flag is 1, which means that the sps_range_extension() syntax structure will appear in the SPS RBSP syntax structure; if sps_range_extension_flag does not appear, then the value of sps_range_extension_flag is 0.
[0163] The value of sps_reverse_last_sig_coeff_flag is 1, which means that the block in the current sequence is flipped using the last non-zero coefficient position; otherwise (i.e., the value of sps_reverse_last_sig_coeff_flag is 0), it means that the block in the current sequence is not flipped using the last non-zero coefficient position.
[0164] In another specific example, assume the existence of sequence-level identifiers `sps_extension_flag`, `sps_range_extension_flag`, and `sps_reverse_last_sig_coeff_enabled_flag`. At the sequence level, if `sps_extension_flag` is 1, then `sps_range_extension_flag` needs to be decoded. If `sps_range_extension_flag` is 1, then `sps_reverse_last_sig_coeff_enabled_flag` needs to be decoded. `sps_reverse_last_sig_coeff_enabled_flag` is a flag indicating whether the last non-zero coefficient position flip technique is allowed in the current sequence. If `sps_reverse_last_sig_coeff_enabled_flag` is 1, it means that the block in the current sequence is allowed to use the last non-zero coefficient position flip; otherwise (i.e., `sps_reverse_last_sig_coeff_enabled_flag` is 0), it means that the block in the current sequence is not allowed to use the last non-zero coefficient position flip. If `sps_reverse_last_sig_coeff_enabled_flag` does not appear, then its value is 0. At the slice level, if `sps_reverse_last_sig_coeff_enabled_flag` is 1, then `sh_reverse_last_sig_coeff_flag` needs to be decoded. `sh_reverse_last_sig_coeff_flag` is a flag indicating whether the last non-zero coefficient position of the current slice is flipped. If `sh_reverse_last_sig_coeff_flag` is 1, it means that blocks in the current slice use the last non-zero coefficient position for flipping; otherwise (i.e., `sh_reverse_last_sig_coeff_flag` is 0), it means that blocks in the current slice do not use the last non-zero coefficient position for flipping. If `sh_reverse_last_sig_coeff_flag` does not appear, then its value is 0. The existing syntax table has changed reverse_last_sig_coeff_flag to sh_reverse_last_sig_coeff_flag.
[0165] It should be noted that for the flag that flips the last non-zero coefficient position, at the sequence level, its semantics is "whether it is allowed to be used"; at the slice level, its semantics is "whether it is determined to be used".
[0166] In another implementation, the syntax element table is modified as follows (Slice header syntax), see Table 5.
[0167] Table 5
[0168] Based on the syntax elements in Table 5, a value of 1 for sps_reverse_last_sig_coeff_enabled_flag indicates that the block in the current sequence is allowed to be flipped using the last non-zero coefficient position; otherwise (i.e., a value of 0 for sps_reverse_last_sig_coeff_enabled_flag), it indicates that the block in the current sequence is not allowed to be flipped using the last non-zero coefficient position.
[0169] The value of `sh_reverse_last_sig_coeff_flag` is 1, indicating that the blocks in the current slice are flipped using the last non-zero coefficient position; otherwise (i.e., the value of `sh_reverse_last_sig_coeff_flag` is 0), indicating that the blocks in the current slice are not flipped using the last non-zero coefficient position. If `sh_reverse_last_sig_coeff_flag` does not appear, then the value of `sh_reverse_last_sig_coeff_flag` is determined to be 0.
[0170] Understandably, regarding sh_reverse_last_sig_coeff_flag, which is the component identification information of the current slice, it can be reflected that each image component in the current slice can be individually controlled to flip using the last non-zero coefficient position.
[0171] In this embodiment of the application, the components may include a first image component, a second image component, and a third image component.
[0172] In a specific example, the first image component is the luminance component, the second image component is the first chrominance component, and the third image component is the second chrominance component. The luminance component is represented by the Y component, the first chrominance component by the U (Cb) component, and the second chrominance component by the V (Cr) component.
[0173] In another specific example, the first image component is the red component, the second image component is the green component, and the third image component is the blue component. The red component is represented by the R component, the green component by the G component, and the blue component by the B component.
[0174] Furthermore, in some embodiments, when the components include a first image component, a second image component, and a third image component, the method may further include: Based on the attribute relationship between the first image component, the second image component, and the third image component, determine whether there is shared component identification information among the first image component, the second image component, and the third image component in the current chip; Based on the judgment result, determine the number of component identification information of the current slice; wherein the number of component identification information is 1, 2 or 3.
[0175] Specifically, determining the number of component identifiers can include: If the first, second, and third image components of the current slice all share the same component identifier information, then the number of component identifier information for the current slice is determined to be 1; or, If two of the first, second, and third image components of the current slice share a single component identifier, then the number of component identifiers for the current slice is determined to be two; or, If the first image component, the second image component, and the third image component of the current slice each use one component identification information, then the number of component identification information for the current slice is determined to be 3.
[0176] In the embodiments of this application, on the one hand, since the attributes of each image component are different, image components such as R, G, B in RGB format video or Y, U, V (Y, Cb, Cr) in YUV format, and other possible formats. For YUV format, there can be formats such as YUV444, YUV422, YUV420, etc. For the human eye, changes in brightness are more sensitive than changes in chrominance. Therefore, formats such as YUV422 and YUV420 are sometimes used to downsample chrominance, and usually the quantization step size of chrominance is larger than that of brightness, which has the effect of reducing bit rate.
[0177] On the other hand, some cross-component coding techniques utilize the correlation between components to improve coding efficiency. For example, the Cross-Component Linear Model (CCLM) prediction technique uses the reconstructed values of the luminance component and a linear model to predict the chrominance component. CCLM can improve the prediction accuracy of the chrominance component, thereby reducing the residual of the chrominance component. Furthermore, some techniques further utilize information from one luminance component and one chrominance component to predict another component, thereby further improving compression efficiency. The Cross-Component Adaptive Loop Filter (CCALF) technique supplements the chrominance component with some details of the luminance component during loop filtering to improve compression efficiency. Since the details of the chrominance component can be supplemented by the luminance component, this also allows for greater distortion when encoding residuals.
[0178] Thus, due to the inherent differences in properties between image components and the use of cross-component techniques, the residual distribution patterns of each image component are not always consistent. For example, in video encoding and decoding with high bitrates and high quality requirements, the distribution of non-zero coefficients in different components is similar; for instance, non-zero coefficients tend to approach the lower right corner of the region where non-zero coefficients might be present. However, in video encoding and decoding with lower bitrates and lower quality requirements, the distribution of non-zero coefficients in different components may differ. For example, the non-zero coefficients of the Y component may approach the lower right corner of the region where non-zero coefficients might be present, while the non-zero coefficients of the U / V components may only be present in the upper left corner; or the non-zero coefficients of the U component may also be close to the lower right corner, while the non-zero coefficients of the V component may only be present in the upper left corner.
[0179] Therefore, embodiments of this application can use one or more component identification information to control the use of different image components in embodiments of this application. For example, one component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information can control whether three image components use the method of embodiments of this application. Alternatively, two component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information controls the luminance component, and the other component identification information controls the two chrominance components. Alternatively, three component identification information can be used to control whether each of the three image components uses the method of embodiments of this application; for example, the three image components can be R, G, B in RGB, or Y, U, V in YUV, or Y, Cb, Cr.
[0180] In one possible implementation, when the number of component identifiers is 1, the bitstream is parsed to determine the component identifiers of the current slice, including: parsing the bitstream to determine the first component identifier of the current slice; Accordingly, the method may further include: if the value of the first component identification information is a first value, then it is determined that the first image component, the second image component, and the third image component of the current slice are all flipped using the last non-zero coefficient position; or, if the value of the first component identification information is a second value, then it is determined that the first image component, the second image component, and the third image component of the current slice are not flipped using the last non-zero coefficient position.
[0181] In another possible implementation, when the number of component identification information is 2, the bitstream is parsed to determine the component identification information of the current slice, including: parsing the bitstream to determine the second component identification information and the third component identification information of the current slice; Accordingly, the method may further include: if the value of the second component identification information is a first value, then determining that two of the first, second, and third image components of the current slice are flipped using the last non-zero coefficient position; or, if the value of the second component identification information is a second value, determining that two of the first, second, and third image components of the current slice are not flipped using the last non-zero coefficient position; and If the value of the third component identifier is the first value, then it is determined that the remaining image components of the current slice, excluding two of them, are flipped using the last non-zero coefficient position; or, if the value of the third component identifier is the second value, then it is determined that the remaining image components of the current slice, excluding two of them, are not flipped using the last non-zero coefficient position.
[0182] In another possible implementation, when the number of component identification information is 3, the bitstream is parsed to determine the component identification information of the current slice, including: parsing the bitstream to determine the fourth component identification information, the fifth component identification information and the sixth component identification information of the current slice; Accordingly, the method may further include: if the value of the fourth component identification information is a first value, then determining that the first image component of the current slice is flipped using the last non-zero coefficient position; or, if the value of the fourth component identification information is a second value, then determining that the first image component of the current slice is not flipped using the last non-zero coefficient position; and If the value of the fifth component identifier is the first value, then it is determined that the second image component of the current slice is flipped using the last non-zero coefficient position; or, if the value of the fifth component identifier is the second value, then it is determined that the second image component of the current slice is not flipped using the last non-zero coefficient position; and If the value of the sixth component identifier is the first value, then the third image component of the current slice is determined to be flipped using the last non-zero coefficient position; or, if the value of the sixth component identifier is the second value, then the third image component of the current slice is determined not to be flipped using the last non-zero coefficient position.
[0183] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0184] It should also be noted that the component identification information here is a slice-level flag, which can be represented by sh_reverse_last_sig_coeff_flag[cIdx], where cIdx takes the values 0, 1, and 2. Specifically, when using three component identification information to control three image components respectively, these three component identification information can include: sh_reverse_last_sig_coeff_flag[0], sh_reverse_last_sig_coeff_flag[1], and sh_reverse_last_sig_coeff_flag[2]. The fourth component identifier is represented by sh_reverse_last_sig_coeff_flag[0], which indicates whether the current block corresponding to the first image component of the current slice is flipped using the last non-zero coefficient position; the fifth component identifier is represented by sh_reverse_last_sig_coeff_flag[1], which indicates whether the current block corresponding to the second image component of the current slice is flipped using the last non-zero coefficient position; and the sixth component identifier is represented by sh_reverse_last_sig_coeff_flag[2], which indicates whether the current block corresponding to the third image component of the current slice is flipped using the last non-zero coefficient position.
[0185] In a specific example, each of the three image components (YUV) is individually assigned a component identifier for control. Assume there are sequence-level identifiers: `sps_extension_flag`, `sps_range_extension_flag`, and `sps_reverse_last_sig_coeff_enabled_flag`. At the sequence level, `sps_extension_flag` is decoded. If its value is 1, then `sps_range_extension_flag` needs to be decoded; otherwise, `sps_reverse_last_sig_coeff_enabled_flag` needs to be decoded. Here, `sps_reverse_last_sig_coeff_enabled_flag` is a flag indicating that the flipping technique is allowed at the last non-zero coefficient position of the current sequence. If the value of sps_reverse_last_sig_coeff_enabled_flag is 1, it means that the block in the current sequence is allowed to be flipped using the last non-zero coefficient position; otherwise (i.e., the value of sps_reverse_last_sig_coeff_enabled_flag is 0), it means that the block in the current sequence is not allowed to be flipped using the last non-zero coefficient position. If sps_reverse_last_sig_coeff_enabled_flag does not appear, then the value of sps_reverse_last_sig_coeff_enabled_flag is 0. At the slice level, if the value of sps_reverse_last_sig_coeff_enabled_flag is 1, then further decoding is required to obtain component identification information (sh_reverse_last_sig_coeff_flag[0], sh_reverse_last_sig_coeff_flag[1], sh_reverse_last_sig_coeff_flag[2]). Wherein, sh_reverse_last_sig_coeff_flag[cIdx], where cIdx takes the values 0, 1, and 2, represents the flip flag of the last non-zero coefficient position of the cIdx component of the current slice.If sh_reverse_last_sig_coeff_flag[cIdx] is 1, it means that the block of the cIdx-th component in the current slice is flipped using the last non-zero coefficient position; otherwise (i.e., sh_reverse_last_sig_coeff_flag[cIdx] is 0), it means that the block of the cIdx-th component in the current slice is not flipped using the last non-zero coefficient position. If sh_reverse_last_sig_coeff_flag[cIdx] does not appear, then sh_reverse_last_sig_coeff_flag[cIdx] is 0.
[0186] In one possible implementation, for the YUV format, the 0th component corresponds to the Y component, the 1st component corresponds to the U (Cb) component, and the 2nd component corresponds to the V (Cr) component.
[0187] In another possible implementation, for the RGB format, the 0th component corresponds to the R component, the 1st component corresponds to the G component, and the 2nd component corresponds to the B component.
[0188] For example, taking the YUV format as an example, if the value of sh_reverse_last_sig_coeff_flag[0] is 1, then it is determined that the first image component (e.g., the Y component) of the current slice is flipped using the last non-zero coefficient position; if the value of sh_reverse_last_sig_coeff_flag[1] is 1, then it is determined that the second image component (e.g., the U component) of the current slice is flipped using the last non-zero coefficient position; if the value of sh_reverse_last_sig_coeff_flag[2] is 1, then it is determined that the third image component (e.g., the V component) of the current slice is flipped using the last non-zero coefficient position.
[0189] In one implementation, the syntax element table is modified as follows (Sequence parameter set RBSPsyntax), see Table 6.
[0190] Table 6
[0191]
[0192] In another implementation, the syntax element table is modified as follows (Sequence parameter setrange extension syntax), see Table 7.
[0193] Table 7
[0194] In another implementation, the syntax element table is modified as follows (Slice header syntax), see Table 8.
[0195] Table 8
[0196] In another implementation, there is another modified form of the Slice header syntax, with the following modification to the syntax element table (Slice header syntax), see Table 9.
[0197] Table 9
[0198] Here, one possible scenario is that startComp equals 0 and numComps equals 3.
[0199] The semantic modifications are as follows: The value of the horizontal (or column) coordinate of the last non-zero coefficient in the current block according to the preset scan order, LastSignificantCoeffX, is exported as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX= last_sig_coeff_x_prefix; Otherwise (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 sh_reverse_last_sig_coeff_flag[cIdx] is 1, then LastSignificantCoeffX = (1< <log2ZoTbWidth)-1-LastSignificantCoeffX; The value of the vertical (or row) coordinate of the last non-zero coefficient in the current block, in scan order, is LastSignificantCoeffY, derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY= last_sig_coeff_y_prefix; Otherwise (if last_sig_coeff_y_suffix exists): LastSignificantCoeffY= (1<<((last_sig_coeff_y_prefix>>1)-1)) * (2+(last_ sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix; If sh_reverse_last_sig_coeff_flag[cIdx] is 1, then LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY。
[0200] Here, sh_reverse_last_sig_coeff_flag[cIdx] represents the flip flag for the last non-zero coefficient position of the cIdx component of the current slice, where cIdx has values of 0, 1, and 2.
[0201] It can also be understood that when the third syntax element identification information indicates that the current sequence uses an expanded range, it is also possible to default to encode all coefficients that may need to be encoded, that is, no longer use the position of the last non-zero coefficient, but scan all possible non-zero coefficients of the current block according to the preset scanning order; therefore, the embodiments of this application can also introduce the last coefficient enable identification information to determine whether the current block uses the last coefficient position.
[0202] In some embodiments, when the third syntax element identification information indicates that the current sequence uses range expansion, the method may further include: Parse the bitstream to determine the last coefficient enable flag of the current block; When the last coefficient enable flag indicates that the current block uses the last coefficient position, all coefficients before the last coefficient position are decoded according to the preset scanning order to determine the coefficients of the current block.
[0203] It should be noted that the last coefficient enable flag can be represented by default_last_coeff_enabled_flag. In the embodiments of this application, the last coefficient enable flag can be at least one of the following: sequence level, image level, slice level, and block level; it can even be a higher level flag (such as VUI, SEI, etc.), without any limitation here.
[0204] In other words, `default_last_coeff_enabled_flag` may be a sequence-level or higher-level flag, or it may be an image-level flag, a slice-level flag, a block-level flag, or a flag at other levels. Furthermore, block-level flags may include maximum coding unit (LCU) level flags, coding tree unit (CTU) level flags, coding unit (CU) level flags, or other block-level flags; this application embodiment does not impose any limitations.
[0205] In some embodiments, the method may further include: If the value of the last coefficient enable flag is the first value, then the last coefficient enable flag indicates that the current block uses the position of the last coefficient; or, If the value of the last coefficient enable flag is the second value, then the last coefficient enable flag indicates that the current block does not use the last coefficient position.
[0206] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0207] Thus, taking a first value of 1 and a second value of 0 as an example, if the value of default_last_coeff_enabled_flag is 1, then it can be determined that default_last_coeff_enabled_flag indicates that the current block uses the last coefficient position; or, if the value of default_last_coeff_enabled_flag is 0, then it can be determined that default_last_coeff_enabled_flag indicates that the current block does not use the last coefficient position.
[0208] If the current block uses the last coefficient position, then all coefficients before the last coefficient position can be decoded according to the preset scanning order to determine the coefficients of the current block.
[0209] Furthermore, in cases where the last coefficient position is not used in the current block, i.e., the last coefficient enable flag is set to 0, in some embodiments, the method may further include: Parse the bitstream to obtain the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient in the current block. The position of the last non-zero coefficient is determined based on the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0210] It should be noted that if the current block does not use the position of the last coefficient, then decoding is required to obtain the position of the last non-zero coefficient. Specifically, by parsing 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; then, based on `last_sig_coeff_x_prefix`, `last_sig_coeff_x_suffix`, `last_sig_coeff_y_prefix`, and `last_sig_coeff_y_suffix`, the position of the last non-zero coefficient is determined. Otherwise, if the current block uses the position of the last coefficient, then it is no longer necessary to determine the position of the last non-zero coefficient, and therefore decoding is no longer required to obtain `last_sig_coeff_x_prefix`, `last_sig_coeff_x_suffix`, `last_sig_coeff_y_prefix`, and `last_sig_coeff_y_suffix`.
[0211] It should also be noted that if the current block uses the last coefficient position, then all coefficients before the last coefficient position can be decoded according to the preset scan order; if the current block does not use the last coefficient position, then all coefficients before the last non-zero coefficient position can be decoded according to the preset scan order. Here, the preset scan order can be diagonal, zigzag, horizontal, vertical, or 4. The embodiments of this application do not limit the scanning order of sub-blocks or any other scanning order.
[0212] Furthermore, regarding the position of the last coefficient, in some embodiments, the position of the last coefficient is the lower right corner of the matrix composed of all possible non-zero coefficients in the current block; or, the position of the last coefficient is the last position of the current block after scanning all possible non-zero coefficients according to a preset scanning order.
[0213] It should be noted that the position of the last coefficient in this embodiment does not represent the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position may be 0, while the coefficient at the last non-zero coefficient position is definitely not 0.
[0214] In one particular example, the method may also include setting the position of the last non-zero coefficient at the last coefficient position.
[0215] In other words, the position of the last non-zero coefficient can still be used in the embodiments of this application. In this case, the position of the last non-zero coefficient needs to be placed at the last position of all possible non-zero coefficients in the current block according to the preset scanning order.
[0216] Further, the position of the last coefficient can be represented by (LastCoeffX, LastCoeffY), which is the last position of all coefficients that may be non-zero in the current block according to a preset scan order. In some embodiments, the method may further include: Determine the width and height of the transformed block after the current block undergoes a preset operation; The coordinates of the lower right corner of the transform block are calculated based on its width and height. The position of the last coefficient is determined based on the coordinate information of the lower right corner of the transform block.
[0217] Here, the default operations include at least the forced zero-out operation.
[0218] It should be noted that (LastCoeffX, LastCoeffY) represent the coordinates of the bottom right corner of the transform block after zero-out; the method for deriving (LastCoeffX, LastCoeffY) is as follows: LastCoeffX = (1< <log2ZoTbWidth)-1; LastCoeffY = (1< <log2ZoTbHeight)-1。
[0219] Thus, if the value of default_last_coeff_enabled_flag is 1, then the position of the last coefficient can be determined based on (LastCoeffX, LastCoeffY).
[0220] 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 placed at the end of all possible non-zero coefficients in the current block according to a preset scan order. In some embodiments, the method may further include: When the position of the last non-zero coefficient is set to the last coefficient position, the position of the last non-zero coefficient is determined based on the coordinate information of the lower right corner of the transform block.
[0221] In other words, the position of the last non-zero coefficient can be represented by (LastSignificantCoeffX, LastSignificantCoeffY), which is derived as follows: LastSignificantCoeffX = (1< <log2ZoTbWidth)-1; LastSignificantCoeffY = (1< <log2ZoTbHeight)-1。
[0222] Here, (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinates of the bottom right corner of the transform block after zero-out. If the value of default_last_coeff_enabled_flag is 1, then the position of the last non-zero coefficient can be determined based on (LastSignificantCoeffX, LastSignificantCoeffY).
[0223] Thus, in certain situations, coefficient encoding defaults to encoding all coefficients that might need to be encoded. That is, under normal circumstances, the coefficient encoding and decoding method remains the same as existing methods in related technologies. These situations might refer to high-bit-width, high-quality, or high-bitrate video encoding and decoding, or lossless compressed video encoding and decoding. By default, all coefficients that might need to be encoded are required. This means that the position of the last non-zero coefficient is no longer used; instead, all possible non-zero coefficients in the current block are scanned according to a preset scanning order. In other words, the position of the last coefficient to be encoded is placed at the end of the sequence of all possible non-zero coefficients in the current block according to the preset scanning order. This position is usually the bottom right corner of the matrix formed by all possible non-zero coefficients in the current block. The position of the last coefficient to be encoded is used here instead of the position of the last non-zero coefficient because the coefficient at the position of the last coefficient to be encoded might be 0, while the coefficient at the position of the last non-zero coefficient is definitely not 0.
[0224] One special case is to still use the position of the last non-zero coefficient. In this case, the position of the last non-zero coefficient is placed at the end of all possible non-zero coefficients in the current block according to the preset scan order.
[0225] Additionally, all possible non-zero coefficients in the current block are included in the preset scan order because there are other techniques besides the last non-zero coefficient that make some coefficients in a block default to 0. For example, it could be zero-out, as mentioned above.
[0226] The semantic modifications are shown in Table 10.
[0227] Table 10
[0228] In this embodiment, a condition can be added before decoding the information required for the last non-zero coefficient. Specifically, 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 the 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 the 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`.
[0229] Here, `default_last_coeff_enabled_flag` is the default last coefficient enable flag, used to indicate whether to use the default last coefficient. If the value of `default_last_coeff_enabled_flag` is 1, it means that the default last coefficient position is used, that is, the last coefficient to be encoded is placed at the last position of all possible non-zero coefficients in the current block according to the preset scan order; otherwise, it means that the default last coefficient position is not used.
[0230] If the value of `default_last_coeff_enabled_flag` is 1, then by default, the last coefficient position (LastCoeffX, LastCoeffY) is the last position of all coefficients that may be non-zero in the current block according to the preset scan order. Coefficients before (LastCoeffX, LastCoeffY) in the preset scan order all need to be scanned. In this embodiment, the method for deriving (LastCoeffX, LastCoeffY) is as follows: LastCoeffX = (1< <log2ZoTbWidth)-1; LastCoeffY = (1< <log2ZoTbHeight)-1。
[0231] Where (LastCoeffX, LastCoeffY) are the coordinates of the lower right corner of the transform block after zero-out.
[0232] One special case is to still use the position of the last non-zero coefficient, placing it at the end of all possible non-zero coefficients in the current block according to a preset scan order. In this embodiment, the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is derived as follows: LastSignificantCoeffX = (1< <log2ZoTbWidth)-1; LastSignificantCoeffY = (1< <log2ZoTbHeight)-1。
[0233] Where (LastSignificantCoeffX, LastSignificantCoeffY) are the coordinates of the lower right corner of the transform block after zero-out.
[0234] It should also be noted that default_last_coeff_enabled_flag may be a sequence-level or higher-level flag, or it may be a picture-level flag, a slice-level flag, a block-level flag, or a flag at other levels. Block-level flags include flags at the maximum coding unit (LCU) level, or at the coding tree unit (CTU) level, or at the coding unit (CU) level, or other block-level flags.
[0235] Additionally, `default_last_coeff_enabled_flag` may depend on other flags, such as high bit width flags or high bit rate flags. Specifically, when the high bit width flag or high bit rate flag is 1, the `default_last_coeff_enabled_flag` flag needs to be decoded; otherwise, it does not.
[0236] In a specific example, taking the sequence level as an example, assume there is a sequence-level flag `sps_high_bit_depth_flag` indicating whether the current video sequence is a high-bit-width sequence. If `sps_high_bit_depth_flag` is 1, it means the current video sequence is a high-bit-width sequence; otherwise, it means the current video sequence is not a high-bit-width sequence. At the sequence level, if `sps_high_bit_depth_flag` is 1, then `sps_default_last_coeff_enabled_flag` needs to be decoded. Here, `sps_default_last_coeff_enabled_flag` is the default last coefficient enable flag for the current sequence. If `sps_default_last_coeff_enabled_flag` is 1, it means the block in the current sequence uses the default last coefficient; otherwise (i.e., `sps_default_last_coeff_enabled_flag` is 0), it means the block in the current sequence does not use the default last coefficient. The `default_last_coeff_enabled_flag` in the syntax table above is changed to `sps_default_last_coeff_enabled_flag`.
[0237] In the implementation, the syntax element table is modified as follows (Sequence parameter set RBSP syntax), see Table 11.
[0238] Table 11
[0239] In another specific example, taking the slice level as an example, assume there is a sequence-level flag `sps_high_bit_depth_flag` indicating whether the current video sequence is a high-bit-width sequence. If `sps_high_bit_depth_flag` is 1, it means the current video sequence is a high-bit-width sequence; otherwise, it means the current video sequence is not a high-bit-width sequence. At the slice level, if `sps_high_bit_depth_flag` is 1, then `sh_default_last_coeff_enabled_flag` needs to be decoded. Here, `sh_default_last_coeff_enabled_flag` is the default last coefficient enable flag for the current slice. If `sh_default_last_coeff_enabled_flag` is 1, it means the blocks within the current slice use the default last coefficient; otherwise (i.e., `sh_default_last_coeff_enabled_flag` is 0), it means the blocks within the current slice do not use the default last coefficient. The `default_last_coeff_enabled_flag` in the syntax table above is changed to `sh_default_last_coeff_enabled_flag`.
[0240] In the implementation, the syntax element table is modified as follows (Slice header syntax), see Table 12.
[0241] Table 12
[0242] In this embodiment, the default last coefficient enable flag for the current slice, sh_default_last_coeff_enabled_flag, can also be reflected in the fact that each image component in the current slice can be individually controlled to control whether to use the default last coefficient.
[0243] Specifically, the default last coefficient enable flag information of the current slice can also be represented by sh_default_last_coeff_enabled_flag[cIdx], where cIdx takes the values 0, 1, and 2. Specifically, when using 3 component flag information to control 3 image components respectively, these 3 component flag information can include: sh_default_last_coeff_enabled_flag[0], sh_default_last_coeff_enabled_flag[1], and sh_default_last_coeff_enabled_flag[2]. Among them, sh_default_last_coeff_enabled_flag[0] is used to indicate whether the current block corresponding to the first image component of the current slice uses the default last coefficient; sh_default_last_coeff_enabled_flag[1] is used to indicate whether the current block corresponding to the second image component of the current slice uses the default last coefficient; sh_default_last_coeff_enabled_flag[2] is used to indicate whether the current block corresponding to the third image component of the current slice uses the default last coefficient.
[0244] Here, embodiments of this application may also use one or more component identification information to control the use of different image components in embodiments of this application. For example, one component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information controls whether three image components use the method of embodiments of this application. Alternatively, two component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information controls the luminance component, and the other component identification information controls the two chrominance components. Alternatively, three component identification information can be used to control whether each of the three image components uses the method of embodiments of this application; for example, the three image components can be R, G, B in RGB, or Y, U, V in YUV, or Y, Cb, Cr.
[0245] For example, taking the YUV format as an example, three component identification information are used to control whether each of the three image components uses the method of the embodiment of this application. Specifically, if the value of sh_default_last_coeff_enabled_flag[0] is 1, then the block corresponding to the first image component (e.g., the Y component) of the current slice is determined to use the default last coefficient; if the value of sh_default_last_coeff_enabled_flag[1] is 1, then the block corresponding to the second image component (e.g., the U component) of the current slice is determined to use the default last coefficient; if the value of sh_default_last_coeff_enabled_flag[2] is 1, then the block corresponding to the third image component (e.g., the V component) of the current slice is determined to use the default last coefficient.
[0246] It can also be understood that when the third syntax element identifier indicates that the current sequence uses an expanded range, all sub-blocks that can still be scanned need to be encoded by default. In this case, there is no need to transmit the sb_coded_flag in the bitstream, meaning that neither the encoder nor the decoder needs to process this flag, thus speeding up the encoding and decoding process. Therefore, embodiments of this application can also introduce sub-block default encoding identifier information to determine whether the sub-block to be decoded within the current block is the default encoded sub-block.
[0247] In some embodiments, when the third syntax element identification information indicates that the current sequence uses range expansion, the method may further include: Parse the bitstream to determine the default encoding identifier information of the sub-blocks of the current block; When the sub-block default encoding identifier indicates the default encoding of the sub-block to be decoded in the current block, all coefficients in the sub-block to be decoded are decoded.
[0248] It should be noted that if the sub-block default encoding identifier indicates the default encoding of the sub-block to be decoded in the current block, then it can be determined that the value of the sub-block default encoding identifier is the first value. In this case, all coefficients in the sub-block to be decoded need to be decoded.
[0249] It should also be noted that the default encoding flag information for sub-blocks can be represented by `default_sb_coded_flag`. In the embodiments of this application, the default encoding flag information for sub-blocks is at least one of the following flag information: sequence level, image level, slice level, and block level; it can even be higher-level flag information (such as VUI, SEI, etc.), without any limitation here.
[0250] In other words, default_sb_coded_flag may be a sequence-level or higher-level flag, or it may be an image-level flag, a slice-level flag, a block-level flag, or a flag at other levels. In addition, block-level flags may include maximum coding unit (LCU) level flags, coding tree unit (CTU) level flags, coding unit (CU) level flags, or other block-level flags, and the embodiments of this application do not impose any limitations.
[0251] In some embodiments, the method may further include: if the value of the sub-block default encoding identifier information is a first value, then determining that the sub-block default encoding identifier information indicates that the sub-block to be decoded in the current block is encoded by default; or, if the value of the sub-block default encoding identifier information is a second value, then determining that the sub-block default encoding identifier information indicates that the sub-block to be decoded in the current block is not encoded by default.
[0252] It should be noted that the first value and the second value are different, and both the first value and the second value can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a value of a flag; this application embodiment does not impose any limitations on this.
[0253] Taking the first syntax element identifier as a flag as an example, for the first and second values, the first value can be set to 1 and the second value can be set to 0; or, the first value can also be set to true and the second value can also be set to false; or, the first value can also be set to 0 and the second value can also be set to 1; or, the first value can also be set to false and the second value can also be set to true; there are no restrictions here.
[0254] Thus, taking a first value of 1 and a second value of 0 as an example, if the value of default_sb_coded_flag is 1, then it can be determined that default_sb_coded_flag indicates that the sub-block to be decoded needs to be encoded by default; or, if the value of default_sb_coded_flag is 0, then it can be determined that default_sb_coded_flag indicates that the sub-block to be decoded does not need to be encoded by default.
[0255] If the sub-block to be decoded needs to be encoded by default, then the value of default_sb_coded_flag is 1, which means that the value of sb_coded_flag is 1, that is, sb_coded_flag no longer needs to be decoded. In this case, by default, all coefficients in the sub-block to be decoded need to be decoded.
[0256] Furthermore, in cases where the sub-block to be decoded does not require encoding by default (i.e., the value of default_sb_coded_flag is 0), in some embodiments, the method may further include: Analyze the bitstream to determine the sub-block encoding identifier information of the sub-block to be decoded; When the sub-block encoding identifier information takes the first value, all coefficients in the sub-block to be decoded are decoded.
[0257] It should be noted that if the sub-block to be decoded does not require encoding by default, then it is necessary to decode to obtain the sub-block encoding identifier information; and then determine whether to decode all coefficients in the sub-block to be decoded based on the sub-block encoding identifier information.
[0258] Furthermore, for the sub-block encoding identifier information, the method may also include: if the value of the sub-block encoding identifier information is a first value, then it is determined that all coefficients in the sub-block to be decoded are decoded; or, if the value of the sub-block encoding identifier information is a second value, then it is determined that all coefficients in the sub-block to be decoded are zero.
[0259] In this embodiment, the sub-block encoding identifier information can be represented by sb_coded_flag. Taking a first value of 1 and a second value of 0 as an example, if the value of sb_coded_flag is 1, it can be determined that all coefficients in the sub-block to be decoded need to be decoded; or, if the value of sb_coded_flag is 0, it can be determined that all coefficients in the sub-block to be decoded do not need to be decoded, and in this case, all coefficients in the sub-block to be decoded are zero.
[0260] Thus, in certain situations, during coefficient encoding, all scanned sub-blocks are assumed to require encoding, or in other words, all scanned sub-blocks are assumed to contain non-zero coefficients. That is, under normal circumstances, the coefficient encoding and decoding methods are the same as existing methods in related technologies. This situation might refer to high-bit-width, high-quality, or high-bitrate video encoding and decoding, or lossless compressed video encoding and decoding. In this case, there are many non-zero coefficients, and almost all scanned sub-blocks require encoding; or in other words, almost all scanned sub-blocks contain non-zero coefficients. This eliminates the need to transmit the `sb_coded_flag` in the bitstream, and the encoder / decoder does not need to process this flag, thereby speeding up encoding and decoding. Removing a flag that is almost non-existent also brings a slight improvement in compression performance.
[0261] The semantic modifications are shown in Table 13.
[0262] Table 13
[0263] Here, default_sb_coded_flag is a flag indicating that the default sub-block needs to be encoded. If the value of default_sb_coded_flag is 1, then it can be determined that the value of sb_coded_flag[xS][yS] is 1, and there is no need to decode it from the bitstream; otherwise (if the value of default_sb_coded_flag is 0), sb_coded_flag[xS][yS] still needs to be decoded from the bitstream.
[0264] It should also be noted that default_sb_coded_flag may be a sequence-level or higher-level flag, or it may be a picture-level flag, a slice-level flag, a block-level flag, or a flag at other levels. Block-level flags include flags at the maximum coding unit (LCU) level, or flags at the coding tree unit (CTU) level, or flags at the coding unit (CU) level, or other block-level flags.
[0265] Additionally, `default_sb_coded_flag` may depend on other flags, such as high bit width flags or high bit rate flags. Specifically, when the high bit width flag or high bit rate flag is 1, the `default_sb_coded_flag` flag needs to be decoded; otherwise, it does not.
[0266] In a specific example, taking the sequence level as an example, assume there is a sequence-level flag `sps_high_bit_depth_flag` indicating whether the current video sequence is a high-bit-width sequence. If `sps_high_bit_depth_flag` is 1, it means the current video sequence is a high-bit-width sequence; otherwise, it means the current video sequence is not a high-bit-width sequence. At the sequence level, if `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 indicating whether the default sub-blocks of the current sequence need to be encoded. If `sps_default_sb_coded_flag` is 1, it means that the default sub-blocks of the block in the current sequence need to be encoded; otherwise (i.e., `sps_default_sb_coded_flag` is 0), it means that the default sub-blocks of the block in the current sequence do not need to be encoded. The `default_sb_coded_flag` in the syntax table above is changed to `sps_default_sb_coded_flag`.
[0267] In the implementation, the syntax element table is modified as follows (Sequence parameter set RBSP syntax), see Table 14.
[0268] Table 14
[0269] In another specific example, taking the slice level as an example, assume there is a sequence-level flag `sps_high_bit_depth_flag` indicating whether the current video sequence is a high-bit-width sequence. If `sps_high_bit_depth_flag` is 1, it means the current video sequence is a high-bit-width sequence; otherwise, it means the current video sequence is not a high-bit-width sequence. At the slice level, if `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 indicating whether the default sub-blocks of the current slice need to be encoded. If `sh_default_sb_coded_flag` is 1, it means that the default sub-blocks of the blocks within the current slice need to be encoded; otherwise (i.e., `sh_default_sb_coded_flag` is 0), it means that the default sub-blocks of the blocks within the current slice do not need to be encoded. The `default_sb_coded_flag` in the syntax table above is changed to `sh_default_sb_coded_flag`.
[0270] In the implementation, the syntax element table is modified as follows (Slice header syntax), see Table 15.
[0271] Table 15
[0272] It should be noted that the sequence-level flag sps_high_bit_depth_flag indicates whether the current sequence is a high bit-width sequence, and can also be replaced with sps_high_bit_rate_flag to indicate whether the current sequence is a high bit-rate sequence; it can even be replaced with other flags indicating high bit-width, high bit-rate, high quality or lossless encoding, etc., without any restrictions here.
[0273] In this embodiment, the information required for encoding the default sub-block of the current slice, sh_default_sb_coded_flag, can also be reflected in the fact that each image component within the current slice can be individually controlled to determine whether the default sub-block needs to be encoded.
[0274] Specifically, the default sub-block of the current slice needs to be encoded with identification information, which can also be represented by sh_default_sb_coded_flag[cIdx], where cIdx takes the values 0, 1, and 2. Specifically, when using three component identification information to control three image components respectively, these three component identification information can include: sh_default_sb_coded_flag[0], sh_default_sb_coded_flag[1], and sh_default_sb_coded_flag[2]. Among them, sh_default_sb_coded_flag[0] is used to indicate whether the current block corresponding to the first image component of the current slice needs to be encoded using the default sub-block; sh_default_sb_coded_flag[1] is used to indicate whether the current block corresponding to the second image component of the current slice needs to be encoded using the default sub-block; sh_default_sb_coded_flag[2] is used to indicate whether the current block corresponding to the third image component of the current slice needs to be encoded using the default sub-block.
[0275] Here, embodiments of this application may also use one or more component identification information to control the use of different image components in embodiments of this application. For example, one component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information controls whether three image components use the method of embodiments of this application. Alternatively, two component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information controls the luminance component, and the other component identification information controls the two chrominance components. Alternatively, three component identification information can be used to control whether each of the three image components uses the method of embodiments of this application; for example, the three image components can be R, G, B in RGB, or Y, U, V in YUV, or Y, Cb, Cr.
[0276] For example, taking the YUV format as an example, three component identification information are used to control whether each of the three image components uses the method of the embodiment of this application. Specifically, if the value of sh_default_sb_coded_flag[0] is 1, then it is determined that the block corresponding to the first image component (e.g., the Y component) of the current slice needs to be encoded using the default sub-block; if the value of sh_default_sb_coded_flag[1] is 1, then it is determined that the block corresponding to the second image component (e.g., the U component) of the current slice needs to be encoded using the default sub-block; if the value of sh_default_sb_coded_flag[2] is 1, then it is determined that the block corresponding to the third image component (e.g., the V component) of the current slice needs to be encoded using the default sub-block.
[0277] In short, for all image components in a video, besides using a unified identifier to control the use of the embodiments of this application, it is also possible to use different identifiers to control the use of each image component in the embodiments of this application, or to use two identifiers to control the use of all image components in the embodiments of this application. That is, more than one identifier can be used to control the use of different image components in the embodiments of this application. Here, "all image components" can refer to, for example, R, G, B in RGB format video, or Y, U, V (Y, Cb, Cr) in YUV format, etc.
[0278] This embodiment provides a decoding method applied to a decoder. By parsing the bitstream, the component identification information of the current slice is determined, as well as the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice. When the component identification information indicates that the component of the current slice uses the last non-zero coefficient position flip, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block. All coefficients before the position of the last non-zero coefficient are decoded according to a preset scanning order to determine the coefficients of the current block. In this way, in high-bit-width, high-bit-rate, high-quality or lossless video encoding and decoding scenarios, setting a reasonable method for deriving the last non-zero coefficient based on the distribution pattern of non-zero coefficients can reduce the overhead caused by encoding in the bitstream and improve compression efficiency. In addition, since the distribution patterns of non-zero coefficients of each image component are different, the method for deriving the last non-zero coefficient of each image component can be controlled more finely, that is, whether each image component uses the last non-zero coefficient position flip technique, thereby further improving compression efficiency.
[0279] In another embodiment of this application, see Figure 11 This illustrates a flowchart of an encoding method provided in an embodiment of this application. Figure 11 As shown, the method may include: S1101: Determine the component identification information of the current slice, and determine the position of the last non-zero coefficient of the current block corresponding to the component of the current slice.
[0280] S1102: Determine the coordinate information of the last non-zero coefficient of the current block based on the component identification information and the position of the last non-zero coefficient.
[0281] S1103: Encode all coefficients before the position of the last non-zero coefficient according to the preset scanning order, and write the encoded bit information, component identification information and coordinate information of the last non-zero coefficient into the bit stream.
[0282] It should be noted that the encoding method in this application specifically refers to a coefficient encoding method applied to an encoder. Wherein, based on Figure 8A The encoder 100 shown has a structural composition. This encoding method is mainly applied to the "entropy encoding unit 115" part of the encoder 100. For the entropy encoding unit 115, the relevant identification information (or syntax elements) can be entropy encoded using the context model-based adaptive binary arithmetic encoding mode or the bypass mode, and then written into the bit stream.
[0283] It should also be noted that the encoding commonly referred to in video standards can include both encoding and decoding. Therefore, video encoding includes encoding methods on the encoder side and decoding methods on the decoder side. This application describes the encoding method on the encoder side.
[0284] In general, for example, for regular videos, the encoding method for coefficients is the same as the existing methods in related technologies; however, for certain situations, such as high-bit-width, high-quality, high-bit-rate, or lossless compression video encoding and decoding, this application embodiment provides an export method that can modify the position of the last non-zero coefficient. In this case, this application embodiment needs to introduce component identification information in order to determine whether the components of the current slice are flipped using the position of the last non-zero coefficient.
[0285] In this embodiment, the component identification information is a slice-level flag. This component identification information is used to indicate whether the components of the current slice are flipped using the last non-zero coefficient position. Specifically, if the components of the current slice are flipped using the last non-zero coefficient position, it means that the current block corresponding to the components of the current slice is also flipped using the last non-zero coefficient position; if the components of the current slice are not flipped using the last non-zero coefficient position, it means that the current block corresponding to the components of the current slice is also not flipped using the last non-zero coefficient position.
[0286] Understandably, the current sequence includes the current slice, and the current slice may include the current block. In some embodiments, before determining the component identification information of the current slice, the method may further include: Determine the identifier information of the first syntax element; When the first syntax element identifier information indicates that the current sequence allows flipping using the last non-zero coefficient position, the step of determining the component identifier information of the current slice is performed.
[0287] In this embodiment of the application, determining the first syntax element identification information may include: if the current sequence allows flipping using the last non-zero coefficient position, then determining the first syntax element identification information to take a first value; or, if the current sequence does not allow flipping using the last non-zero coefficient position, then determining the first syntax element identification information to take a second value.
[0288] Furthermore, the method may also include: writing the first syntax element identification information into the code stream.
[0289] It should be noted that the first value and the second value are different, and both the first value and the second value can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a value of a flag; this application embodiment does not impose any limitations on this.
[0290] Taking a flag as the first syntax element identifier, the first and second values can be set to 1 and 0 respectively; or, the first value can be set to true and the second value to false; or, the first value can be set to 0 and the second value to 1; or, the first value can be set to false and the second value to true. For example, generally, for a flag, the first value can be 1 and the second value can be 0, but there are no restrictions.
[0291] It should also be noted that the first syntax element is a sequence-level flag, represented by `sps_reverse_last_sig_coeff_flag`, which can be used to indicate whether the current sequence is allowed to use the last non-zero coefficient position for flipping. Thus, once it is determined that the current sequence is allowed to use the last non-zero coefficient position for flipping, the slice-level component identification information can be further determined to decide whether the components of the current slice are to use the last non-zero coefficient position for flipping.
[0292] Furthermore, before determining the first syntax element identification information, in one possible embodiment, the method may further include: Determine the identification information of the second syntax element; When the second syntax element identification information indicates that the current sequence uses the standard extended version, the step of determining the first syntax element identification information is performed.
[0293] Before determining the first syntax element identification information, in another possible embodiment, the method may further include: Determine the identification information of the third syntax element; When the third syntax element identification information indicates that the current sequence uses a scope extension, the step of determining the first syntax element identification information is performed.
[0294] In another possible embodiment, prior to determining the first syntax element identification information, the method may further include: Determine the identification information of the second syntax element; When the second syntax element identification information indicates that the current sequence uses the standard extended version, the third syntax element identification information is determined by parsing. When the third syntax element identification information indicates that the current sequence uses a scope extension, the step of determining the first syntax element identification information is performed.
[0295] It should be noted that both the second and third syntax element identifiers are sequence-level flags. The second syntax element identifier, represented by `sps_extension_flag`, indicates whether the current sequence uses the standard extended version; the third syntax element identifier, represented by `sps_range_extension_flag`, indicates whether the current sequence uses range extension.
[0296] In other words, before determining the first syntax element identifier information (sps_reverse_last_sig_coeff_flag), it can be determined after determining sps_extension_flag; if sps_extension_flag indicates that the current sequence uses the standard extended version, then sps_reverse_last_sig_coeff_flag is determined. Alternatively, it can be determined after determining sps_range_extension_flag; if sps_range_extension_flag indicates that the current sequence uses the range extension, then sps_reverse_last_sig_coeff_flag is determined. Or, it can even be determined after determining sps_extension_flag; if sps_extension_flag indicates that the current sequence uses the standard extended version, then sps_range_extension_flag is determined; if sps_range_extension_flag indicates that the current sequence uses the range extension, then sps_reverse_last_sig_coeff_flag is determined. However, this application embodiment does not impose any limitations.
[0297] In this embodiment of the application, determining the second syntax element identification information may include: if the current sequence uses the standard extended version, then determining the value of the second syntax element identification information to be a first value; or, if the current sequence does not use the standard extended version, then determining the value of the second syntax element identification information to be a second value.
[0298] Furthermore, the method may also include: writing the second syntax element identification information into the code stream.
[0299] In this embodiment of the application, determining the third syntax element identifier information may include: if the current sequence uses range expansion, then determining the value of the third syntax element identifier information to be a first value; or, if the current sequence does not use range expansion, then determining the value of the third syntax element identifier information to be a second value.
[0300] Furthermore, the method may also include: writing third syntax element identification information into the code stream.
[0301] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0302] It should also be noted that the second syntax element identification information is represented by `sps_extension_flag`, and the third syntax element identification information is represented by `sps_range_extension_flag`. Thus, at the sequence level, if `sps_extension_flag` is 1, meaning the current sequence uses the standard extended version, then `sps_range_extension_flag` needs to be determined; if `sps_range_extension_flag` is 1, meaning the current sequence uses range extension, then `sps_reverse_last_sig_coeff_flag` needs to be determined; if `sps_reverse_last_sig_coeff_flag` is 1, meaning the current sequence allows flipping using the last non-zero coefficient position, then further determination of the slice-level component identification information is needed to determine whether the components of the current slice use flipping using the last non-zero coefficient position.
[0303] In some embodiments, the current sequence uses range extension, which may include: the current sequence satisfying at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression. The following will describe these four cases as examples.
[0304] In one possible implementation, when the third syntax element identification information is high-width identification information, the method may further include: if the high-width identification information indicates that the current sequence meets the high-width requirement, then determine that the current sequence uses an extended range.
[0305] In another possible implementation, when the third syntax element identification information is high bitrate identification information, the method may further include: if the high bitrate identification information indicates that the current sequence meets the high bitrate, then determine that the current sequence usage range is extended.
[0306] In another possible implementation, when the third syntax element identification information is high quality identification information, the method may further include: if the high quality identification information indicates that the current sequence meets the high quality requirement, then determining that the scope of use of the current sequence is extended.
[0307] In another possible implementation, when the third syntax element identification information is lossless compression identification information, the method may further include: if the lossless compression identification information indicates that the current sequence satisfies lossless compression, then determine that the scope of use of the current sequence is extended.
[0308] For example, taking the sequence level as an example, the third syntax element identification information can also be high bit width identification information (represented by sps_high_bit_depth_flag), used to indicate whether the current sequence is a high bit width sequence; or it can be replaced by high bit rate identification information (represented by sps_high_bit_rate_flag), used to indicate whether the current sequence is a high bit rate sequence; or it can be replaced by other identification information indicating high bit width, high bit rate, high quality or lossless compression. The embodiments of this application do not make specific limitations.
[0309] In the embodiments of this application, the first syntax element identifier information, the second syntax element identifier information, and the third syntax element identifier information can be sequence-level identifiers, or even higher-level identifiers, such as video usability information (VUI) and supplemental enhancement information (SEI).
[0310] Furthermore, the flip flag information for the last non-zero coefficient position can be represented by `reverse_last_sig_coeff_flag`. This last non-zero coefficient position flip flag information can be at least one of the following: sequence level, picture level, slice level, and block level; it can even be higher-level flag information (such as VUI, SEI, etc.), without any limitations here.
[0311] In other words, `reverse_last_sig_coeff_flag` may be a sequence-level or higher-level flag, or it may be an image-level flag, a slice-level flag, a block-level flag, or a flag at other levels. Furthermore, block-level flags may include flags at the maximum coding unit (LCU) level, the coding tree unit (CTU) level, the coding unit (CU) level, or other block-level flags; no limitations are imposed on these embodiments in this application.
[0312] In this embodiment, the last non-zero coefficient position flipping flag at the sequence level can be represented by sps_reverse_last_sig_coeff_flag, and the last non-zero coefficient position flipping flag at the slice level can be represented by sh_reverse_last_sig_coeff_flag.
[0313] It should also be noted that the flip identifier information of the last non-zero coefficient position at the slice level can also be referred to as the component identifier information of the current slice. In some embodiments, determining the component identifier information of the current slice may include: If the component of the current slice is flipped using the last non-zero coefficient position, then the component identification information is determined to be the first value; or, If the component of the current slice is not flipped using the last non-zero coefficient position, then the component identification information is determined to be the second value.
[0314] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0315] Taking a first value of 1 and a second value of 0 as an example, if the component of the current slice is flipped using the last non-zero coefficient position, that is, the current block corresponding to the component of the current slice is flipped using the last non-zero coefficient position, then the component identification information can be determined to be 1; if the component of the current slice is not flipped using the last non-zero coefficient position, that is, the current block corresponding to the component of the current slice is not flipped using the last non-zero coefficient position, then the component identification information can be determined to be 0.
[0316] Furthermore, for the current block corresponding to the component belonging to the current slice, the position of the last non-zero coefficient may include the initial horizontal and initial vertical coordinates of the last non-zero coefficient. When the initial horizontal and initial vertical coordinates are the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner of the current block, determining the coordinate information of the last non-zero coefficient of the current block based on the component identification information and the position of the last non-zero coefficient may include: If the component identifier information takes the first value, then the coordinate information of the last non-zero coefficient is determined by calculating based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient; or, If the component identifier information takes the second value, then the coordinate information of the last non-zero coefficient is directly determined based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient.
[0317] In other words, in some embodiments, the method may further include: If the component identifier information takes the first value, then the coordinate information of the last non-zero coefficient is determined as the horizontal and vertical distances between the position of the last non-zero coefficient and the lower right corner of the current block; or, If the value of the component identification information is the second value, the coordinate information of the last non-zero coefficient is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner position of the current block.
[0318] That is to say, the coordinate information of the last non-zero coefficient is usually the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner position of the current block. For conventional videos, since most non-zero coefficients are concentrated in the upper left corner, and a large area in the lower right corner is 0; however, for high-bitwidth, high-quality, and high-bitrate video coding and decoding, a large number of non-zero coefficients also appear in the lower right corner, making the value of the coordinate information of the last non-zero coefficient usually large. At this time, in order to save overhead, coordinate transformation needs to be performed during coefficient coding (specifically, it can be coordinate flipping calculation, that is, after coordinate flipping, the coordinate information of the last non-zero coefficient is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the lower right corner position of the current block). Then, in the decoder later, coordinate flipping calculation also needs to be performed during coefficient decoding. After flipping again, the coordinate information of the last non-zero coefficient can be restored to be the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner position of the current block, so as to determine the position of the last non-zero coefficient.
[0319] Further, in some embodiments, the calculating according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient to determine the coordinate information of the last non-zero coefficient may include: Determine the width and height of the current block; Perform a subtraction calculation based on the width of the current block and the initial horizontal coordinate of the last non-zero coefficient to obtain the horizontal coordinate of the last non-zero coefficient; and Perform a subtraction calculation based on the height of the current block and the initial vertical coordinate of the last non-zero coefficient to obtain the vertical coordinate of the last non-zero coefficient; Determine the coordinate information of the last non-zero coefficient according to the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0320] It should be noted that for the current block corresponding to the component of the current slice, it can be a block without zero-out transformation or a block after zero-out transformation. Taking the block after zero-out transformation as an example, at this time, the width of the current block is 1 << log2ZoTbWidth, and the height of the current block is 1 << log2ZoTbHeight; then in the case where the component identification information indicates the use of the last non-zero coefficient position flipping, LastSignificantCoeffX = (1< <log2ZoTbWidth)-1-LastSignificantCoeffX; LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY。
[0321] In this equation, (LastSignificantCoeffX, LastSignificantCoeffY) on the right side represent the coordinate information of the last non-zero coefficient that is directly determined (i.e., the initial horizontal and initial vertical coordinates of the last non-zero coefficient), and (LastSignificantCoeffX, LastSignificantCoeffY) on the left side represent the coordinate information of the last non-zero coefficient obtained after coordinate flipping (i.e., the coordinate information of the last non-zero coefficient written to the bitstream when the position of the last non-zero coefficient is flipped in the current block).
[0322] In some embodiments, writing the coordinate information of the last non-zero coefficient into the bitstream may include: Based on the coordinate information of the last non-zero coefficient, determine 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 in the current block. The prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are written into the bitstream.
[0323] It should be noted that the prefix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_prefix, the prefix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix, the suffix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix, and the suffix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_suffix. Then, last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix are written into the bitstream so that the decoder can determine the coordinate information of the last non-zero coefficient by parsing the bitstream.
[0324] In this embodiment, the preset scanning order can be diagonal, zigzag, horizontal, vertical, or 4. The scanning order can be 4 sub-blocks or any other scanning order; no restrictions are imposed here.
[0325] Thus, this application provides a method for modifying the position of the last non-zero coefficient. That is, under normal circumstances, the coefficient encoding and decoding method is still the same as existing methods in related technologies. In some cases, this may refer to high-bit-width, high-quality, or high-bitrate video encoding and decoding, or lossless compressed video encoding and decoding. Because typically, `last_sig_coeff_x_prefix` and `last_sig_coeff_x_suffix` encode the horizontal coordinate of the last non-zero coefficient position, that is, the horizontal distance relative to the top-left corner of the current block; `last_sig_coeff_y_prefix` and `last_sig_coeff_y_suffix` encode the vertical coordinate of the last non-zero coefficient position, that is, the vertical distance relative to the top-left corner of the current block, such as... Figure 10A As shown. However, in the case of high-bit-width, high-quality, or high-bit-rate video encoding and decoding, or lossless compressed video encoding and decoding, the position of the last non-zero coefficient is generally close to the bottom right corner of all potentially non-zero coefficient regions in the current block. In this case, `last_sig_coeff_x_prefix` and `last_sig_coeff_x_suffix` encode the horizontal distance of the last non-zero coefficient position relative to the bottom right corner of all potentially non-zero coefficient regions in the current block; `last_sig_coeff_y_prefix` and `last_sig_coeff_y_suffix` encode the vertical distance of the last non-zero coefficient position relative to the bottom right corner of all potentially non-zero coefficient regions in the current block, as shown. Figure 10B As shown; therefore, the embodiments of this application can solve the problem that encoding larger values in the bitstream will bring greater overhead by introducing reverse_last_sig_coeff_flag.
[0326] Furthermore, regarding the slice-level reverse_last_sig_coeff_flag (i.e., the component identification information of the current slice, sh_reverse_last_sig_coeff_flag), it can be reflected that each image component in the current slice can be individually controlled to flip using the last non-zero coefficient position.
[0327] In this embodiment of the application, the components may include a first image component, a second image component, and a third image component.
[0328] In a specific example, the first image component is the luminance component, the second image component is the first chrominance component, and the third image component is the second chrominance component. The luminance component is represented by the Y component, the first chrominance component by the U (Cb) component, and the second chrominance component by the V (Cr) component.
[0329] In another specific example, the first image component is the red component, the second image component is the green component, and the third image component is the blue component. The red component is represented by the R component, the green component by the G component, and the blue component by the B component.
[0330] Furthermore, in some embodiments, when the components include a first image component, a second image component, and a third image component, the method may further include: Based on the attribute relationship between the first image component, the second image component, and the third image component, determine whether there is shared component identification information among the first image component, the second image component, and the third image component in the current chip; Based on the judgment result, determine the number of component identification information of the current slice; wherein the number of component identification information is 1, 2 or 3.
[0331] Specifically, determining the number of component identifiers can include: If the first, second, and third image components of the current slice all share the same component identifier information, then the number of component identifier information for the current slice is determined to be 1; or, If two of the first, second, and third image components of the current slice share a single component identifier, then the number of component identifiers for the current slice is determined to be two; or, If the first image component, the second image component, and the third image component of the current slice each use one component identification information, then the number of component identification information for the current slice is determined to be 3.
[0332] In the embodiments of this application, due to the inherent differences in the properties of each image component and the use of some cross-component techniques, the residual distribution patterns of each image component are not always consistent. For example, in video encoding and decoding with high bitrates and high quality requirements, the distribution of non-zero coefficients of different components is similar; for instance, the non-zero coefficients all approach the lower right corner of the region where non-zero coefficients might be. However, in video encoding and decoding with lower bitrates and lower quality requirements, the distribution of non-zero coefficients of different components may be different. For example, the non-zero coefficients of the Y component all approach the lower right corner of the region where non-zero coefficients might be, while the non-zero coefficients of the U / V components are only distributed in the upper left corner; or the non-zero coefficients of the U component are also close to the lower right corner, while the non-zero coefficients of the V component are only distributed in the upper left corner.
[0333] Therefore, embodiments of this application can use one or more component identification information to control the use of different image components in embodiments of this application. For example, one component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information can control whether three image components use the method of embodiments of this application. Alternatively, two component identification information can be used to control whether three image components use the method of embodiments of this application; for instance, one component identification information controls the luminance component, and the other component identification information controls the two chrominance components. Alternatively, three component identification information can be used to control whether each of the three image components uses the method of embodiments of this application; for example, the three image components can be R, G, B in RGB, or Y, U, V in YUV, or Y, Cb, Cr.
[0334] In one possible implementation, when the number of component identification information is 1, determining the component identification information of the current slice may include: determining the first component identification information of the current slice; Accordingly, the method may further include: if the value of the first component identification information is a first value, then it is determined that the first image component, the second image component, and the third image component of the current slice are all flipped using the last non-zero coefficient position; or, if the value of the first component identification information is a second value, then it is determined that the first image component, the second image component, and the third image component of the current slice are not flipped using the last non-zero coefficient position.
[0335] In another possible implementation, when the number of component identification information is two, determining the component identification information of the current slice may include: determining the second component identification information and the third component identification information of the current slice; Accordingly, the method may further include: if the value of the second component identification information is a first value, then determining that two image components of the current slice are flipped using the last non-zero coefficient position; or, if the value of the second component identification information is a second value, determining that two image components of the current slice are not flipped using the last non-zero coefficient position; and If the value of the third component identifier is the first value, then it is determined that the remaining image components of the current slice, excluding two of them, are flipped using the last non-zero coefficient position; or, if the value of the third component identifier is the second value, then it is determined that the remaining image components of the current slice, excluding two of them, are not flipped using the last non-zero coefficient position.
[0336] In another possible implementation, when the number of component identification information is 3, determining the component identification information of the current slice may include: determining the fourth component identification information, the fifth component identification information, and the sixth component identification information of the current slice; Accordingly, the method may further include: if the value of the fourth component identification information is a first value, then determining that the first image component of the current slice is flipped using the last non-zero coefficient position; or, if the value of the fourth component identification information is a second value, then determining that the first image component of the current slice is not flipped using the last non-zero coefficient position; and If the value of the fifth component identifier is the first value, then it is determined that the second image component of the current slice is flipped using the last non-zero coefficient position; or, if the value of the fifth component identifier is the second value, then it is determined that the second image component of the current slice is not flipped using the last non-zero coefficient position; and If the value of the sixth component identifier is the first value, then the third image component of the current slice is determined to be flipped using the last non-zero coefficient position; or, if the value of the sixth component identifier is the second value, then the third image component of the current slice is determined not to be flipped using the last non-zero coefficient position.
[0337] It should be noted that the first value and the second value are different, and both the first and second values can be in parameter form or in numeric form. In a specific example, the first value can be set to 1 and the second value can be set to 0, but there are no restrictions.
[0338] It should also be noted that the component identification information here is a slice-level flag, which can be represented by sh_reverse_last_sig_coeff_flag[cIdx], where cIdx takes the values 0, 1, and 2. Specifically, when using three component identification information to control three image components respectively, these three component identification information can include: sh_reverse_last_sig_coeff_flag[0], sh_reverse_last_sig_coeff_flag[1], and sh_reverse_last_sig_coeff_flag[2]. The fourth component identifier is represented by sh_reverse_last_sig_coeff_flag[0], which indicates whether the current block corresponding to the first image component of the current slice is flipped using the last non-zero coefficient position; the fifth component identifier is represented by sh_reverse_last_sig_coeff_flag[1], which indicates whether the current block corresponding to the second image component of the current slice is flipped using the last non-zero coefficient position; and the sixth component identifier is represented by sh_reverse_last_sig_coeff_flag[2], which indicates whether the current block corresponding to the third image component of the current slice is flipped using the last non-zero coefficient position.
[0339] For example, taking the YUV format as an example, three component identification information are used to control whether each of the three image components uses the method of the embodiment of this application. Specifically, if the value of sh_reverse_last_sig_coeff_flag[0] is 1, then it is determined that the block corresponding to the first image component (e.g., the Y component) of the current slice is flipped using the last non-zero coefficient position; if the value of sh_reverse_last_sig_coeff_flag[1] is 1, then it is determined that the block corresponding to the second image component (e.g., the U component) of the current slice is flipped using the last non-zero coefficient position; if the value of sh_reverse_last_sig_coeff_flag[2] is 1, then it is determined that the block corresponding to the third image component (e.g., the V component) of the current slice is flipped using the last non-zero coefficient position.
[0340] It can also be understood that when the third syntax element identification information indicates that the current sequence uses an expanded range, it is also possible to default to encode all coefficients that may need to be encoded, that is, no longer use the position of the last non-zero coefficient, but scan all possible non-zero coefficients of the current block according to the preset scanning order; therefore, the embodiments of this application can also introduce the last coefficient enable identification information to determine whether the current block uses the last coefficient position.
[0341] In some embodiments, when the third syntax element identification information indicates that the current sequence uses range expansion, the method may further include: Determine the enable flag for the last coefficient in the current block; When the last coefficient enable flag indicates that the current block uses the last coefficient position, all coefficients before the last coefficient position are encoded according to the preset scanning order, and the encoded bit information, video identifier information and last coefficient enable flag information are written into the bit stream.
[0342] It should be noted that the last coefficient enable flag can be represented by default_last_coeff_enabled_flag. In the embodiments of this application, the last coefficient enable flag can be at least one of the following: sequence level, image level, slice level, and block level; it can even be a higher level flag (such as VUI, SEI, etc.), without any limitation here.
[0343] It should also be noted that, regarding the last coefficient enable identifier information, in some embodiments, determining the last coefficient enable identifier information of the current block may include: If the current block uses the position of the last coefficient, then the value of the last coefficient enable identifier is determined to be the first value; or, If the current block does not use the last coefficient position, then the value of the last coefficient enable identifier information is determined to be the second value.
[0344] In other words, taking a first value of 1 and a second value of 0 as an example, if it is determined that the current block uses the last coefficient position, then the value of default_last_coeff_enabled_flag is 1; or, if it is determined that the current block does not use the last coefficient position, then the value of default_last_coeff_enabled_flag is 0.
[0345] Furthermore, regarding the position of the last coefficient, in some embodiments, the position of the last coefficient is the lower right corner of the matrix composed of all possible non-zero coefficients in the current block; or, the position of the last coefficient is the last position of the current block after scanning all possible non-zero coefficients according to a preset scanning order.
[0346] It should be noted that the position of the last coefficient in this embodiment does not represent the position of the last non-zero coefficient. This is because the coefficient at the last coefficient position may be 0, while the coefficient at the last non-zero coefficient position is definitely not 0.
[0347] In one particular example, the method may further include setting the position of the last non-zero coefficient at the last coefficient position.
[0348] In other words, the position of the last non-zero coefficient can still be used in the embodiments of this application. In this case, the position of the last non-zero coefficient needs to be placed at the last position of all possible non-zero coefficients in the current block according to the preset scanning order.
[0349] Further, the position of the last coefficient can be represented by (LastCoeffX, LastCoeffY), which is the last position of all coefficients that may be non-zero in the current block according to a preset scan order. In some embodiments, the method may further include: The width and height of the transformed block are determined after the current block undergoes a preset operation; The coordinates of the lower right corner of the transformation block are calculated based on its width and height. The position of the last coefficient is determined based on the coordinate information of the lower right corner of the transformation block.
[0350] Here, the default operations include at least the forced zero-out operation.
[0351] It should be noted that (LastCoeffX, LastCoeffY) represent the coordinates of the bottom right corner of the transform block after zero-out; the method for deriving (LastCoeffX, LastCoeffY) is as follows: LastCoeffX = (1< <log2ZoTbWidth)-1; LastCoeffY = (1< <log2ZoTbHeight)-1。
[0352] Thus, if the value of default_last_coeff_enabled_flag is 1, then the position of the last coefficient can be determined based on (LastCoeffX, LastCoeffY).
[0353] 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 placed at the end of all possible non-zero coefficients in the current block according to a preset scan order. In some embodiments, the method may further include: When the position of the last non-zero coefficient is set to the last coefficient position, the position of the last non-zero coefficient is determined according to the coordinate information of the lower right corner of the transformation block.
[0354] In other words, the position of the last non-zero coefficient can be represented by (LastSignificantCoeffX, LastSignificantCoeffY), which is derived as follows: LastSignificantCoeffX = (1< <log2ZoTbWidth)-1; LastSignificantCoeffY = (1< <log2ZoTbHeight)-1。
[0355] Here, (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinates of the bottom right corner of the transform block after zero-out. If the value of default_last_coeff_enabled_flag is 1, then the position of the last non-zero coefficient can be determined based on (LastSignificantCoeffX, LastSignificantCoeffY).
[0356] Furthermore, in some embodiments, if the last coefficient enable flag indicates that the current block does not use the last coefficient position (i.e., the last coefficient enable flag is set to 0), the method may further include: Determine 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 in the current block. The position of the last non-zero coefficient is determined 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. All coefficients before the position of the last non-zero coefficient are encoded according to a preset scanning order, and the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient are written into the bitstream.
[0357] It should be noted that if the position of the last coefficient is not used in the current block, then the position of the last non-zero coefficient needs to be determined. Specifically, it is necessary to determine last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix; then, last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix are written into the bitstream.
[0358] Thus, during coefficient encoding, all coefficients that might need to be encoded are required by default. In other words, the coefficient encoding / decoding method is usually the same as existing methods in related technologies. However, in certain cases, such as high-bit-width, high-quality, or high-bitrate video encoding / decoding, or lossless compressed video encoding / decoding, all coefficients that might need to be encoded are required by default. This means that the position of the last non-zero coefficient is no longer used; instead, all possible non-zero coefficients in the current block are scanned according to a preset scanning order. Alternatively, the position of the last coefficient to be encoded is placed at the end of all possible non-zero coefficients in the current block according to the preset scanning order. This position is usually the lower right corner of the matrix composed of all possible non-zero coefficients in the current block. Therefore, this application embodiment can reduce or even eliminate the syntax elements related to the position of the last non-zero coefficient by introducing `default_last_coeff_enabled_flag`, thus saving overhead and avoiding waste.
[0359] Furthermore, regarding sh_default_last_coeff_enabled_flag, which is the default last coefficient enable flag for the current slice, it can also be reflected in the fact that each image component within the current slice can individually control whether to use the default last coefficient.
[0360] Specifically, the default last coefficient enable flag information of the current slice can also be represented by sh_default_last_coeff_enabled_flag[cIdx], where cIdx takes the values 0, 1, and 2. Specifically, when using 3 component flag information to control 3 image components respectively, these 3 component flag information can include: sh_default_last_coeff_enabled_flag[0], sh_default_last_coeff_enabled_flag[1], and sh_default_last_coeff_enabled_flag[2]. Among them, sh_default_last_coeff_enabled_flag[0] is used to indicate whether the current block corresponding to the first image component of the current slice uses the default last coefficient; sh_default_last_coeff_enabled_flag[1] is used to indicate whether the current block corresponding to the second image component of the current slice uses the default last coefficient; sh_default_last_coeff_enabled_flag[2] is used to indicate whether the current block corresponding to the third image component of the current slice uses the default last coefficient.
[0361] Here, embodiments of this application may also use one or more component identification information to control the use of different image components in embodiments of this application. For example, one component identification information can be used to control whether three image components use the method of embodiments of this application; or two component identification information can be used to control whether three image components use the method of embodiments of this application; or three component identification information can be used to control whether each of the three image components uses the method of embodiments of this application.
[0362] For example, taking the YUV format as an example, three component identification information are used to control whether each of the three image components uses the method of the embodiment of this application. Specifically, if the value of sh_default_last_coeff_enabled_flag[0] is 1, then the block corresponding to the first image component (e.g., the Y component) of the current slice is determined to use the default last coefficient; if the value of sh_default_last_coeff_enabled_flag[1] is 1, then the block corresponding to the second image component (e.g., the U component) of the current slice is determined to use the default last coefficient; if the value of sh_default_last_coeff_enabled_flag[2] is 1, then the block corresponding to the third image component (e.g., the V component) of the current slice is determined to use the default last coefficient.
[0363] It can also be understood that when the third syntax element identifier indicates that the current sequence uses an expanded range, all sub-blocks that can still be scanned need to be encoded by default. In this case, there is no need to transmit the sb_coded_flag in the bitstream, meaning that neither the encoder nor the decoder needs to process this flag, thus speeding up the encoding and decoding process. Therefore, embodiments of this application can also introduce sub-block default encoding identifier information to determine whether the sub-blocks to be encoded within the current block are default encoded.
[0364] In some embodiments, when the third syntax element identification information indicates that the current sequence uses range expansion, the method may further include: Determine the default encoding identifier information of the sub-blocks to be encoded within the current block; When the sub-block default encoding identifier information indicates that the sub-block to be encoded has default encoding, all coefficients in the sub-block to be encoded are encoded, and the bit information obtained after encoding and the sub-block default encoding identifier information are written into the bit stream.
[0365] It should be noted that the default identification information for sub-blocks can be represented by `default_sb_coded_flag`. In the embodiments of this application, the default encoding identification information for sub-blocks is at least one of the following: sequence-level, image-level, slice-level, and block-level identification information; it can even be higher-level identification information (such as VUI, SEI, etc.), without any limitation here.
[0366] It should also be noted that, for the sub-block default identification information, in some embodiments, determining the sub-block default encoding identification information of the sub-block to be encoded may include: if the sub-block to be encoded is encoded by default, then the value of the sub-block default encoding identification information is determined to be a first value; or, if the sub-block to be encoded is not encoded by default, then the value of the sub-block default encoding identification information is determined to be a second value.
[0367] Thus, taking a first value of 1 and a second value of 0 as an example, if it is determined that the sub-block to be encoded needs to be encoded by default, then the value of default_sb_coded_flag is 1; or, if it is determined that the sub-block to be encoded does not need to be encoded by default, then the value of default_sb_coded_flag is 0.
[0368] When the sub-block to be encoded requires encoding by default, the value of `default_sb_coded_flag` is 1, meaning that the value of `sb_coded_flag` is 1, and that encoding `sb_coded_flag` is no longer required. However, when the sub-block to be encoded does not require encoding by default, i.e., when the sub-block default encoding identifier indicates that the sub-block to be encoded does not require encoding by default, in some embodiments, the method may further include: determining the sub-block encoding identifier information of the sub-block to be encoded and writing the sub-block encoding identifier information into the bitstream.
[0369] Furthermore, in some embodiments, determining the sub-block encoding identifier information of the sub-block to be encoded may include: if encoding is required within the sub-block, then determining the value of the sub-block encoding identifier information to be a first value; or, if all coefficients within the sub-block are zero, then determining the value of the sub-block encoding identifier information to be a second value.
[0370] In this embodiment, the sub-block encoding identifier information can be represented by sb_coded_flag. Taking a first value of 1 and a second value of 0 as an example, if it is determined that the sub-block to be encoded needs to be encoded, it means that the sub-block to be encoded contains non-zero coefficients to be encoded, then the value of sb_coded_flag is 1; or, if it is determined that the sub-block to be encoded does not need to be encoded, it means that all coefficients in the sub-block to be encoded are zero, then the value of sb_coded_flag is 0.
[0371] Thus, during coefficient encoding, all scanned sub-blocks are assumed to require encoding, or in other words, all scanned sub-blocks are assumed to contain non-zero coefficients. That is to say, under normal circumstances, the coefficient encoding method is the same as existing methods in related technologies. However, in certain cases, such as high-bit-width, high-quality, or high-bit-rate video encoding and decoding, or lossless compressed video encoding and decoding, there are many non-zero coefficients, and almost all scanned sub-blocks require encoding; or in other words, almost all scanned sub-blocks contain non-zero coefficients. This eliminates the need to transmit the `sb_coded_flag` in the bitstream, and the encoder does not need to process this flag, thereby speeding up encoding and decoding. Removing a flag that is almost non-existent also brings a slight improvement in compression performance.
[0372] Furthermore, regarding sh_default_sb_coded_flag, which indicates the default sub-block encoding flag for the current slice, this can also be reflected in the fact that each image component within the current slice can be individually controlled to determine whether the default sub-block encoding is required.
[0373] Specifically, the default sub-block of the current slice needs to be encoded with identification information, which can also be represented by sh_default_sb_coded_flag[cIdx], where cIdx takes the values 0, 1, and 2. Specifically, when using three component identification information to control three image components respectively, these three component identification information can include: sh_default_sb_coded_flag[0], sh_default_sb_coded_flag[1], and sh_default_sb_coded_flag[2]. Among them, sh_default_sb_coded_flag[0] is used to indicate whether the current block corresponding to the first image component of the current slice needs to be encoded using the default sub-block; sh_default_sb_coded_flag[1] is used to indicate whether the current block corresponding to the second image component of the current slice needs to be encoded using the default sub-block; sh_default_sb_coded_flag[2] is used to indicate whether the current block corresponding to the third image component of the current slice needs to be encoded using the default sub-block.
[0374] Here, embodiments of this application may also use one or more component identification information to control the use of different image components in embodiments of this application. For example, one component identification information can be used to control whether three image components use the method of embodiments of this application; or two component identification information can be used to control whether three image components use the method of embodiments of this application; or three component identification information can be used to control whether each of the three image components uses the method of embodiments of this application.
[0375] In a specific example, taking the YUV format as an example, three component identification information are used to control whether each of the three image components uses the method of this application embodiment. Specifically, if the value of sh_default_sb_coded_flag[0] is 1, then it is determined that the block corresponding to the first image component (e.g., the Y component) of the current slice needs to be encoded using the default sub-block; if the value of sh_default_sb_coded_flag[1] is 1, then it is determined that the block corresponding to the second image component (e.g., the U component) of the current slice needs to be encoded using the default sub-block; if the value of sh_default_sb_coded_flag[2] is 1, then it is determined that the block corresponding to the third image component (e.g., the V component) of the current slice needs to be encoded using the default sub-block.
[0376] In short, for all image components in a video, besides using a unified identifier to control the use of the embodiments of this application, it is also possible to use different identifiers to control the use of each image component in the embodiments of this application, or to use two identifiers to control the use of all image components in the embodiments of this application. That is, more than one identifier can be used to control the use of different image components in the embodiments of this application. Here, "all image components" can refer to, for example, R, G, B in RGB format video, or Y, U, V (Y, Cb, Cr) in YUV format, etc.
[0377] This embodiment also provides an encoding method applied to an encoder. By determining the component identification information of the current slice and the position of the last non-zero coefficient of the current block corresponding to the component of the current slice; based on the component identification information and the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient of the current block is determined; all coefficients before the position of the last non-zero coefficient are encoded according to a preset scanning order, and the encoded bit information, component identification information, and coordinate information of the last non-zero coefficient are written into the bitstream. Thus, in high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, setting a reasonable method for deriving the last non-zero coefficient based on the distribution pattern of non-zero coefficients can reduce the overhead of encoding in the bitstream and improve compression efficiency. Furthermore, since the distribution patterns of non-zero coefficients of different image components are different, more refined control of the deriving method of the last non-zero coefficient can be used for each image component separately, i.e., controlling whether each image component uses the last non-zero coefficient position flipping technique, thereby further improving compression efficiency.
[0378] In another embodiment of this application, a bitstream is provided, which may be generated by bit encoding based on information to be encoded. The information to be encoded includes at least one of the following: first syntax element identifier information, second syntax element identifier information, third syntax element identifier information, component identifier information, last coefficient enable identifier information, and sub-block default encoding identifier information; wherein, The first syntax element identifier is used to indicate whether the current sequence is allowed to use the last non-zero coefficient position for flipping. The second syntax element identifier is used to indicate whether the current sequence uses the standard extended version. The third syntax element identifier is used to indicate whether the current sequence uses range extension. The component identifier is used to indicate whether the components of the current slice are flipped using the last non-zero coefficient position. The last coefficient enable identifier is used to indicate whether the current block uses the last coefficient position. The sub-block default encoding identifier is used to indicate whether the sub-blocks to be encoded within the current block are encoded by default. Here, the current sequence includes the current slice, and the current slice includes the current block.
[0379] In this embodiment of the application, an encoding and decoding system is also provided, which may include an encoder and a decoder. The encoder, after generating a bitstream, transmits the bitstream to the decoder so that the decoder can obtain relevant decoding information by parsing the bitstream, such as first syntax element identifier information, second syntax element identifier information, third syntax element identifier information, component identifier information, last coefficient enable identifier information, sub-block default encoding identifier information, and coordinate information of the last non-zero coefficient of the current block.
[0380] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, see [link to previous embodiment]. Figure 12 This illustrates a schematic diagram of the composition structure of an encoder 120 provided in an embodiment of this application. Figure 12 As shown, the encoder 120 may include: a first determining unit 1201 and an encoding unit 1202; wherein, The first determining unit 1201 is configured to determine the component identification information of the current slice and to determine the position of the last non-zero coefficient of the current block corresponding to the component of the current slice. The first determining unit 1201 is further configured to determine the coordinate information of the last non-zero coefficient of the current block based on the component identification information and the position of the last non-zero coefficient. The encoding unit 1202 is configured to encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write the encoded bit information, component identification information and coordinate information of the last non-zero coefficient into the code stream.
[0381] In some embodiments, the first determining unit 1201 is further configured to determine first syntax element identification information; and when the first syntax element identification information indicates that the current sequence allows flipping using the last non-zero coefficient position, to perform the step of determining the component identification information of the current slice; wherein the current sequence includes the current slice.
[0382] In some embodiments, the first determining unit 1201 is further configured to determine second syntax element identification information; and when the second syntax element identification information indicates that the current sequence uses a standard extended version, determine third syntax element identification information; and when the third syntax element identification information indicates that the current sequence uses a scope extension, perform the step of determining the first syntax element identification information.
[0383] In some embodiments, the first determining unit 1201 is further configured to determine the value of the second syntax element identification information as a first value if the current sequence uses the standard extended version; or, if the current sequence does not use the standard extended version, determine the value of the second syntax element identification information as a second value.
[0384] In some embodiments, the encoding unit 1202 is further configured to write the second syntax element identification information into the code stream.
[0385] In some embodiments, the first determining unit 1201 is further configured to determine the value of the third syntax element identification information as a first value if the current sequence uses range expansion; or, if the current sequence does not use range expansion, determine the value of the third syntax element identification information as a second value.
[0386] In some embodiments, the encoding unit 1202 is further configured to write third syntax element identification information into the code stream.
[0387] In some embodiments, the current sequence uses a range extension, including: the current sequence satisfies at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0388] In some embodiments, the first determining unit 1201 is further configured to determine the value of the first syntax element identification information as a first value if the current sequence allows flipping using the last non-zero coefficient position; or, if the current sequence does not allow flipping using the last non-zero coefficient position, determine the value of the first syntax element identification information as a second value.
[0389] In some embodiments, the encoding unit 1202 is further configured to write the first syntax element identification information into the code stream.
[0390] In some embodiments, the first determining unit 1201 is further configured to determine the component identification information as a first value if the component of the current slice is flipped using the last non-zero coefficient position; or, if the component of the current slice is not flipped using the last non-zero coefficient position, determine the component identification information as a second value.
[0391] In some embodiments, the component includes at least one of the following: a first image component, a second image component, and a third image component; wherein, The first image component is the luminance component, the second image component is the first chrominance component, and the third image component is the second chrominance component; or... The first image component is the red component, the second image component is the green component, and the third image component is the blue component.
[0392] In some embodiments, the first determining unit 1201 is further configured to, when the component includes a first image component, a second image component, and a third image component, determine that the number of component identification information for the current slice is 1 if all the first image component, the second image component, and the third image component of the current slice share a component identification information; or, determine that the number of component identification information for the current slice is 2 if two of the first image component, the second image component, and the third image component of the current slice share a component identification information; or, determine that the number of component identification information for the current slice is 3 if each of the first image component, the second image component, and the third image component of the current slice uses a component identification information.
[0393] In some embodiments, the first determining unit 1201 is further configured to determine the first component identification information of the current slice; Accordingly, the first determining unit 1201 is further configured to determine the value of the first component identification information as the first value if the first image component, the second image component and the third image component of the current slice are all flipped using the last non-zero coefficient position.
[0394] In some embodiments, the first determining unit 1201 is further configured to determine the second component identification information and the third component identification information of the current slice; Accordingly, the first determining unit 1201 is further configured to determine the value of the second component identification information as a first value if two of the first, second, and third image components of the current slice are flipped using the last non-zero coefficient position; and to determine the value of the third component identification information as a first value if the remaining image components of the current slice, excluding two of the image components, are flipped using the last non-zero coefficient position.
[0395] In some embodiments, the first determining unit 1201 is further configured to determine the fourth component identification information, the fifth component identification information, and the sixth component identification information of the current slice; Accordingly, the first determining unit 1201 is further configured to determine the value of the fourth component identification information as a first value if the first image component of the current slice is flipped using the last non-zero coefficient position; and to determine the value of the fifth component identification information as a first value if the second image component of the current slice is flipped using the last non-zero coefficient position; and to determine the value of the sixth component identification information as a first value if the third image component of the current slice is flipped using the last non-zero coefficient position.
[0396] In some embodiments, the position of the last non-zero coefficient includes the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient, which are the horizontal and vertical distances between the position of the last non-zero coefficient and the position of the top left corner of the current block. Accordingly, the first determining unit 1201 is further configured to, if the component identification information is a first value, calculate and determine the coordinate information of the last non-zero coefficient based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient; or, if the component identification information is a second value, directly determine the coordinate information of the last non-zero coefficient based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient.
[0397] In some embodiments, the first determining unit 1201 is further configured to: determine the width and height of the current block; and perform a subtraction calculation based on the width of the current block and the initial horizontal coordinate of the last non-zero coefficient to obtain the horizontal coordinate of the last non-zero coefficient; and perform a subtraction calculation based on the height of the current block and the initial vertical coordinate of the last non-zero coefficient to obtain the vertical coordinate of the last non-zero coefficient; and determine the coordinate information of the last non-zero coefficient based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0398] In some embodiments, the first determining unit 1201 is further configured to determine the coordinate information of the last non-zero coefficient as the horizontal and vertical distances between the position of the last non-zero coefficient and the lower right corner of the current block if the component identification information is a first value; or, if the component identification information is a second value, the coordinate information of the last non-zero coefficient as the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner of the current block.
[0399] In some embodiments, the first determining unit 1201 is further configured to determine, 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 of the current block. The encoding unit 1202 is further configured 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 into the bitstream.
[0400] In some embodiments, the first determining unit 1201 is further configured to determine the last coefficient enable identifier information of the current block when the third syntax element identifier information indicates that the current sequence uses an expanded range. The encoding unit 1202 is further configured to encode all coefficients before the last coefficient position according to a preset scanning order when the last coefficient enable flag information indicates that the current block uses the last coefficient position, and write the encoded bit information and the last coefficient enable flag information into the bit stream.
[0401] In some embodiments, the first determining unit 1201 is further configured to determine the value of the last coefficient enable identifier information as a first value if the current block uses the last coefficient position; or, if the current block does not use the last coefficient position, determine the value of the last coefficient enable identifier information as a second value.
[0402] In some embodiments, the last coefficient position is the bottom right corner of the matrix composed of all possible non-zero coefficients in the current block; or, the last coefficient position is the last position of the current block when it performs a scan of all possible non-zero coefficients according to a preset scan order.
[0403] In some embodiments, the first determining unit 1201 is further configured to set the position of the last non-zero coefficient at the last coefficient position.
[0404] In some embodiments, the first determining unit 1201 is further configured to determine the width and height of the transformed block obtained after the current block undergoes a preset operation; and to perform coordinate calculation based on the width and height of the transformed block to obtain the coordinate information of the lower right corner of the transformed block; and to determine the position of the last coefficient based on the coordinate information of the lower right corner of the transformed block.
[0405] In some embodiments, the preset operation includes at least a forced zero-out operation.
[0406] In some embodiments, the first determining unit 1201 is further configured to determine the position of the last non-zero coefficient based on the coordinate information of the lower right corner of the transform block when the position of the last non-zero coefficient is set at the last coefficient position.
[0407] In some embodiments, the first determining unit 1201 is further configured to determine 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 when the last coefficient enable identifier information indicates that the current block does not use the position of the last coefficient; and to determine 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 before the position of the last non-zero coefficient according to a preset scanning order, and write the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient into the bit stream.
[0408] In some embodiments, the first determining unit 1201 is further configured to determine the sub-block default encoding identifier information of the sub-block to be encoded within the current block when the third syntax element identification information indicates that the current sequence uses an expanded scope; The encoding unit 1202 is also configured to encode all coefficients in the sub-block to be encoded when the sub-block default encoding identifier information indicates that the sub-block to be encoded has default encoding, and to write the bit information obtained after encoding and the sub-block default encoding identifier information into the bit stream.
[0409] In some embodiments, the first determining unit 1201 is further configured to determine the sub-block encoding identifier information of the sub-block to be encoded when the sub-block default encoding identifier information indicates that the sub-block to be encoded is not encoded by default; The encoding unit 1202 is also configured to write sub-block encoding identification information into the bit stream.
[0410] In some embodiments, the first determining unit 1201 is further configured to determine the value of the default encoding identifier information of the sub-block as a first value if the sub-block to be encoded is encoded by default; or, if the sub-block to be encoded is not encoded by default, determine the value of the default encoding identifier information of the sub-block as a second value.
[0411] In some embodiments, the first determining unit 1201 is further configured to determine the value of the sub-block encoding identifier information as a first value if encoding is required within the sub-block; or, if all coefficients within the sub-block are zero, determine the value of the sub-block encoding identifier information as a second value.
[0412] In some embodiments, the first value is 1 and the second value is 0.
[0413] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.
[0414] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0415] Therefore, this application provides a computer storage medium applied to an encoder 120, the computer storage medium storing a computer program that, when executed by a first processor, implements the method described in any of the foregoing embodiments.
[0416] Based on the composition of the encoder 120 and the computer storage medium described above, see [link to documentation]. Figure 13 This illustrates a schematic diagram of the specific hardware structure of the encoder 120 provided in an embodiment of this application. Figure 13 As shown, it may include: a first communication interface 1301, a first memory 1302, and a first processor 1303; the various components are coupled together through a first bus system 1304. It is understood that the first bus system 1304 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 1304 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 13 The general designated all buses as the first bus system 1304. Among them, The first communication interface 1301 is used for receiving and sending signals during the process of sending and receiving information with other external network elements; The first memory 1302 is used to store computer programs that can run on the first processor 1303; The first processor 1303 is configured to, when running the computer program, execute: Determine the component identification information of the current slice, and determine the position of the last non-zero coefficient of the current block corresponding to the component of the current slice; Based on the component identifier information and the position of the last non-zero coefficient, determine the coordinate information of the last non-zero coefficient of the current block; All coefficients before the last non-zero coefficient are encoded according to the preset scanning order, and the encoded bit information, component identification information, and coordinate information of the last non-zero coefficient are written into the bit stream.
[0417] It is understood that the first memory 1302 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous DRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The first memory 1302 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0418] The first processor 1303 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the first processor 1303 or by instructions in software form. 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 devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the first memory 1302. The first processor 1303 reads the information in the first memory 1302 and completes the steps of the above method in conjunction with its hardware.
[0419] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), DSP devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0420] Alternatively, as another embodiment, the first processor 1303 is further configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0421] This embodiment provides an encoder, which may include a first determining unit and an encoding unit. Thus, in high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, setting a reasonable derivation method for the last non-zero coefficient based on the distribution pattern of the non-zero coefficients can reduce the overhead of encoding in the bitstream and improve compression efficiency. Furthermore, since the distribution patterns of non-zero coefficients differ among the various image components, more refined control over the derivation method of the last non-zero coefficient for each image component can be used, i.e., controlling whether each image component uses the last non-zero coefficient position flipping technique, thereby further improving compression efficiency.
[0422] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, see [link to previous embodiment]. Figure 14 This illustrates a schematic diagram of the composition structure of a decoder 140 provided in an embodiment of this application. Figure 14 As shown, the decoder 140 may include: a parsing unit 1401 and a second determining unit 1402; wherein, The parsing unit 1401 is configured to parse the bitstream, determine the component identifier information of the current slice, and determine the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice; The second determining unit 1402 is configured to calculate the coordinate information of the last non-zero coefficient when the component identification information indicates that the component of the current block is flipped using the position of the last non-zero coefficient, so as to obtain the position of the last non-zero coefficient of the current block. The parsing unit 1401 is also configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine the coefficients of the current block.
[0423] In some embodiments, the parsing unit 1401 is further configured to parse the code stream and determine the first syntax element identification information; The second determining unit 1402 is further configured to perform the step of parsing the code stream and determining the component identification information of the current slice when the first syntax element identification information indicates that the current sequence allows the flipping of the last non-zero coefficient position; wherein the current sequence includes the current slice.
[0424] In some embodiments, the parsing unit 1401 is further configured to parse the code stream to determine second syntax element identification information; and when the second syntax element identification information indicates that the current sequence uses a standard extended version, to parse the code stream to determine third syntax element identification information; and when the third syntax element identification information indicates that the current sequence uses a range extension, to perform the step of parsing the code stream to determine first syntax element identification information.
[0425] In some embodiments, the second determining unit 1402 is further configured to determine that if the value of the second syntax element identification information is a first value, the second syntax element identification information indicates that the current sequence uses the standard extended version; or, if the value of the second syntax element identification information is a second value, the second syntax element identification information indicates that the current sequence does not use the standard extended version.
[0426] In some embodiments, the second determining unit 1402 is further configured to determine that if the value of the third syntax element identification information is a first value, the third syntax element identification information indicates that the current sequence uses range extension; or, if the value of the third syntax element identification information is a second value, the third syntax element identification information indicates that the current sequence does not use range extension.
[0427] In some embodiments, the current sequence uses a range extension, including: the current sequence satisfies at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0428] In some embodiments, the second determining unit 1402 is further configured to determine that if the value of the first syntax element identification information is a first value, the first syntax element identification information indicates that the current sequence is allowed to be flipped using the last non-zero coefficient position; or, if the value of the first syntax element identification information is a second value, the first syntax element identification information indicates that the current sequence is not allowed to be flipped using the last non-zero coefficient position.
[0429] In some embodiments, the second determining unit 1402 is further configured to determine that if the component identification information is a first value, the component identification information indicates that the component of the current slice is flipped using the last non-zero coefficient position; or, if the component identification information is a second value, the component identification information indicates that the component of the current slice is not flipped using the last non-zero coefficient position.
[0430] In some embodiments, the second determining unit 1402 is further configured to directly determine the position of the last non-zero coefficient of the current block based on the coordinate information of the last non-zero coefficient when the component identification information indicates that the component of the current block does not use the last non-zero coefficient position flip. The parsing unit 1401 is also configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine the coefficients of the current block.
[0431] In some embodiments, the component includes at least one of the following: a first image component, a second image component, and a third image component; wherein, The first image component is the luminance component, the second image component is the first chrominance component, and the third image component is the second chrominance component; or... The first image component is the red component, the second image component is the green component, and the third image component is the blue component.
[0432] In some embodiments, the second determining unit 1402 is further configured to, when the component includes a first image component, a second image component, and a third image component, determine that the number of component identification information for the current slice is 1 if all the first image component, the second image component, and the third image component of the current slice share a component identification information; or, determine that the number of component identification information for the current slice is 2 if two of the first image component, the second image component, and the third image component of the current slice share a component identification information; or, determine that the number of component identification information for the current slice is 3 if each of the first image component, the second image component, and the third image component of the current slice uses a component identification information.
[0433] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and determine the first component identification information of the current slice; Correspondingly, the second determining unit 1402 is also configured to determine that if the value of the first component identification information is the first value, the first image component, the second image component, and the third image component of the current slice are all flipped using the last non-zero coefficient position.
[0434] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and determine the second component identification information and the third component identification information of the current slice; Accordingly, the second determining unit 1402 is further configured to, if the value of the second component identification information is a first value, determine that two of the first image components, the second image components, and the third image components of the current slice are flipped using the last non-zero coefficient position; and if the value of the third component identification information is a first value, determine that the remaining image components of the current slice, excluding the two image components, are flipped using the last non-zero coefficient position.
[0435] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and determine the fourth component identification information, the fifth component identification information, and the sixth component identification information of the current slice; Accordingly, the second determining unit 1402 is further configured to determine that if the value of the fourth component identification information is a first value, the first image component of the current slice is flipped using the last non-zero coefficient position; and if the value of the fifth component identification information is a first value, the second image component of the current slice is flipped using the last non-zero coefficient position; and if the value of the sixth component identification information is a first value, the third image component of the current slice is flipped using the last non-zero coefficient position.
[0436] In some embodiments, the parsing unit 1401 is further configured to parse the code stream and 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 of the current block. The second determining unit 1402 is further configured to determine the horizontal coordinate of the last non-zero coefficient based on the prefix information and the suffix information of the horizontal coordinate of the last non-zero coefficient; and to determine the vertical coordinate of the last non-zero coefficient based on the prefix information and the suffix information of the vertical coordinate of the last non-zero coefficient; and to determine the coordinate information of the last non-zero coefficient of the current block based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0437] In some embodiments, the second determining unit 1402 is further configured to determine the coordinate information of the last non-zero coefficient of the current block as the horizontal and vertical distances between the position of the last non-zero coefficient and the lower right corner position of the current block when the component identification information indicates that the component of the current slice is flipped using the position of the last non-zero coefficient. Accordingly, the second determining unit 1402 is further configured to: determine the width and height of the current block; and subtract the horizontal distance between the width of the current block and the position of the last non-zero coefficient relative to the lower right corner of the current block to obtain the horizontal coordinate of the last non-zero coefficient; subtract the vertical distance between the height of the current block and the position of the last non-zero coefficient relative to the lower right corner of the current block to obtain the vertical coordinate of the last non-zero coefficient; and determine the position of the last non-zero coefficient of the current block based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0438] In some embodiments, the second determining unit 1402 is further configured to, when the component identification information indicates that the component of the current slice does not use the last non-zero coefficient position for flipping, determine the coordinate information of the last non-zero coefficient of the current block as the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner position of the current block; and determine the position of the last non-zero coefficient of the current block based on the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner position of the current block.
[0439] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and determine the last coefficient enable flag of the current block when the third syntax element identification information indicates that the current sequence uses an extended range; and to decode all coefficients before the last coefficient position according to a preset scanning order and determine the coefficients of the current block when the last coefficient enable flag indicates that the current block uses the last coefficient position.
[0440] In some embodiments, the second determining unit 1402 is further configured to determine that if the value of the last coefficient enabling identifier is a first value, the last coefficient enabling identifier indicates that the current block uses the last coefficient position; or, if the value of the last coefficient enabling identifier is a second value, the last coefficient enabling identifier indicates that the current block does not use the last coefficient position.
[0441] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream when the value of the last coefficient enable identifier information is a second value, and 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 of the current block. The second determining unit 1402 is further configured to determine 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 parsing unit 1401 is also configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine the coefficients of the current block.
[0442] In some embodiments, the last coefficient position is the bottom right corner of the matrix composed of all possible non-zero coefficients in the current block; or, the last coefficient position is the last position of the current block when it performs a scan of all possible non-zero coefficients according to a preset scan order.
[0443] In some embodiments, the second determining unit 1402 is further configured to set the position of the last non-zero coefficient at the last coefficient position.
[0444] In some embodiments, the second determining unit 1402 is further configured to determine the width and height of the transformed block obtained by the current block after a preset operation; and to perform coordinate calculation based on the width and height of the transformed block to obtain the coordinate information of the lower right corner of the transformed block; and to determine the position of the last coefficient based on the coordinate information of the lower right corner of the transformed block.
[0445] In some embodiments, the preset operation includes at least a forced zero-out operation.
[0446] In some embodiments, the second determining unit 1402 is further configured to determine the position of the last non-zero coefficient based on the coordinate information of the lower right corner of the transform block when the position of the last non-zero coefficient is set at the last coefficient position.
[0447] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and determine the sub-block default encoding identifier information of the current block when the third syntax element identifier information indicates that the current sequence uses an extended range; and to decode all coefficients in the sub-block to be decoded when the sub-block default encoding identifier information indicates the default encoding of the sub-block to be decoded in the current block.
[0448] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and determine the sub-block encoding identifier information of the sub-block to be decoded when the sub-block default encoding identifier information indicates that the sub-block to be decoded in the current block is not encoded by default; and to decode all coefficients in the sub-block to be decoded when the sub-block encoding identifier information is a first value.
[0449] In some embodiments, the second determining unit 1402 is further configured to determine that if the value of the sub-block default encoding identifier information is a first value, the sub-block default encoding identifier information indicates that the sub-block to be decoded in the current block is encoded by default; or, if the value of the sub-block default encoding identifier information is a second value, the sub-block default encoding identifier information indicates that the sub-block to be decoded in the current block is not encoded by default.
[0450] In some embodiments, the second determining unit 1402 is further configured to determine that all coefficients in the sub-block to be decoded are decoded if the value of the sub-block encoding identifier information is a first value; or, if the value of the sub-block encoding identifier information is a second value, determine that all coefficients in the sub-block to be decoded are zero.
[0451] In some embodiments, the first value is 1 and the second value is 0.
[0452] Understandably, in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional module.
[0453] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer storage medium applied to the decoder 140. This computer storage medium stores a computer program, which, when executed by a second processor, implements the method described in any of the foregoing embodiments.
[0454] Based on the composition of the decoder 140 and the computer storage medium described above, see [link to documentation]. Figure 15 This illustrates a schematic diagram of the specific hardware structure of the decoder 140 provided in an embodiment of this application. Figure 15 As shown, it may include: a second communication interface 1501, a second memory 1502, and a second processor 1503; the various components are coupled together via a second bus system 1504. It is understood that the second bus system 1504 is used to implement communication between these components. In addition to a data bus, the second bus system 1504 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 15 The various buses are all labeled as the second bus system 1504. Among them, The second communication interface 1501 is used for receiving and sending signals during the process of sending and receiving information with other external network elements; The second memory 1502 is used to store computer programs that can run on the second processor 1503; The second processor 1503 is configured to, when running the computer program, perform: Parse the bitstream to determine the component identifier information of the current slice, and determine the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice; When the component identification information indicates that the component of the current block is flipped using the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block. Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0455] Alternatively, as another embodiment, the second processor 1503 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0456] It is understood that the second memory 1502 has similar hardware functions to the first memory 1302, and the second processor 1503 has similar hardware functions to the first processor 1303; these will not be described in detail here.
[0457] This embodiment provides a decoder, which may include a parsing unit and a second determining unit. Thus, in high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, setting a reasonable derivation method for the last non-zero coefficient based on the distribution pattern of the non-zero coefficients can reduce the overhead of encoding in the bitstream and improve compression efficiency. Furthermore, since the distribution patterns of non-zero coefficients differ among the various image components, the derivation method of the last non-zero coefficient can be controlled more finely for each image component, i.e., whether each image component uses the last non-zero coefficient position flipping technique, thereby further improving compression efficiency.
[0458] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0459] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0460] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0461] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0462] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0463] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0464] Industrial applicability In this embodiment, the encoder determines the component identification information of the current slice and the position of the last non-zero coefficient of the current block corresponding to the component of the current slice. Based on the component identification information and the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient of the current block is determined. All coefficients before the position of the last non-zero coefficient are encoded according to a preset scanning order, and the encoded bit information, component identification information, and coordinate information of the last non-zero coefficient are written into the bitstream. In the decoder, the bitstream is parsed to determine the component identification information of the current slice and the coordinate information of the last non-zero coefficient of the current block corresponding to the component of the current slice. When the component identification information indicates that the component of the current slice is flipped using the position of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to obtain the position of the last non-zero coefficient of the current block. All coefficients before the position of the last non-zero coefficient are decoded according to a preset scanning order to determine the coefficients of the current block. In this way, in high-bit-width, high-bit-rate, high-quality or lossless video encoding and decoding scenarios, setting a reasonable method for deriving the last non-zero coefficient based on the distribution pattern of the non-zero coefficients can reduce the overhead of encoding in the bitstream and improve compression efficiency. In addition, since the distribution patterns of the non-zero coefficients of each image component are different, the component identification information can be used to control whether the last non-zero coefficient position flipping technique is used for each image component, thereby further improving compression efficiency.
Claims
1. A decoding method applied to a decoder, the method comprising: parsing a bitstream to determine last non-zero coefficient position flipping identification information and coordinate information of a last non-zero coefficient of a current block; performing operation on the coordinate information of the last non-zero coefficient to obtain a position of the last non-zero coefficient of the current block; wherein, if the last non-zero coefficient position flipping identification information indicates that the last non-zero coefficient position flipping is used, the coordinate information of the last non-zero coefficient of the current block is determined as a horizontal distance and a vertical distance between the position of the last non-zero coefficient and a lower right corner position of the current block; wherein, the performing operation on the coordinate information of the last non-zero coefficient to obtain the position of the last non-zero coefficient of the current block comprises: determining a width and a height of the current block; performing subtraction calculation on the width of the current block and a horizontal distance between the position of the last non-zero coefficient and the lower right corner position of the current block to obtain a horizontal coordinate of the last non-zero coefficient; performing subtraction calculation on the height of the current block and a vertical distance between the position of the last non-zero coefficient and the lower right corner position of the current block to obtain a vertical coordinate of the last non-zero coefficient; and determining the position of the last non-zero coefficient of the current block according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient; and decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine coefficients of the current block.
2. The method of claim 1, wherein, The method further comprises: parsing a bitstream to determine first syntax element identification information; when the first syntax element identification information indicates that the last non-zero coefficient position flipping is allowed to be used in a current sequence, performing the step of parsing the bitstream to determine the last non-zero coefficient position flipping identification information; wherein, the current sequence comprises a current slice.
3. The method of claim 2, wherein, The method further comprises: parsing a bitstream to determine second syntax element identification information; when the second syntax element identification information indicates that a standard extension version is used in the current sequence, parsing the bitstream to determine third syntax element identification information; when the third syntax element identification information indicates that a range extension is used in the current sequence, performing the step of parsing the bitstream to determine the first syntax element identification information.
4. The method of claim 3, wherein, The current sequence uses the range extension, comprising that the current sequence satisfies at least one of the following: high bit width, high quality, high code rate, high frame rate and lossless compression.
5. The method of claim 1, wherein, The component comprises at least one of the following: a first image component, a second image component and a third image component; wherein, the first image component is a luminance component, the second image component is a first chroma component, and the third image component is a second chroma component; or the first image component is a red component, the second image component is a green component, and the third image component is a blue component; wherein, the parsing the bitstream to determine the last non-zero coefficient position flipping identification information comprises parsing the bitstream to determine first last non-zero coefficient position flipping identification information; Correspondingly, the method further includes: If the value of the first last non-zero coefficient position flipping identification information is a first value, it is determined that the first image component, the second image component and the third image component all use last non-zero coefficient position flipping.
6. The method of claim 3 or 4, wherein, When the third syntax element identification information indicates that the current sequence uses range extension, the method further includes: parsing the code stream to determine last coefficient enable identification information of the current block; When the last coefficient enable identification information indicates that the current block uses last coefficient position, all coefficients before the last coefficient position are decoded according to a preset scanning order to determine the coefficients of the current block, The method further includes: determining the width and height of the transform block of the current block after a preset operation, wherein the preset operation at least includes a zero-out operation; performing coordinate calculation according to the width and height of the transform block to obtain right-bottom corner coordinate information of the transform block; determining the last coefficient position according to the right-bottom corner coordinate information of the transform block.
7. An encoding method applied to an encoder, the method comprising: determining last non-zero coefficient position flipping identification information and the position of the last non-zero coefficient of a current block; determining coordinate information of the last non-zero coefficient of the current block according to the last non-zero coefficient position flipping identification information and the position of the last non-zero coefficient; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing the bit information obtained after encoding, the last non-zero coefficient position flipping identification information and the coordinate information of the last non-zero coefficient into a code stream, wherein the position of the last non-zero coefficient includes an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient, and the initial horizontal coordinate and the initial vertical coordinate are horizontal and vertical distances between the position of the last non-zero coefficient and the top-left corner position of the current block; wherein the determination of the coordinate information of the last non-zero coefficient of the current block according to the last non-zero coefficient position flipping identification information and the position of the last non-zero coefficient includes: if the value of the last non-zero coefficient position flipping identification information is a first value, performing operation according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient to determine the coordinate information of the last non-zero coefficient; wherein the operation according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient to determine the coordinate information of the last non-zero coefficient includes: determining the width and height of the current block; performing subtraction operation according to the width of the current block and the initial horizontal coordinate of the last non-zero coefficient to obtain the horizontal coordinate of the last non-zero coefficient; performing subtraction operation according to the height of the current block and the initial vertical coordinate of the last non-zero coefficient to obtain the vertical coordinate of the last non-zero coefficient; and determining coordinate information of the last non-zero coefficient according to a horizontal coordinate of the last non-zero coefficient and a vertical coordinate of the last non-zero coefficient; The method further comprises: If the value of the last non-zero coefficient position flipping identification information is a first value, the coordinate information of the last non-zero coefficient is determined as a horizontal distance and a vertical distance between the position of the last non-zero coefficient and a lower right corner position of the current block.
8. The method of claim 7, wherein, Before the step of determining the last non-zero coefficient position flipping identification information, the method further comprises: determining first syntax element identification information; When the first syntax element identification information indicates that the current sequence allows using last non-zero coefficient position flipping, the step of determining the last non-zero coefficient position flipping identification information is performed; wherein the current sequence comprises a current slice.
9. The method of claim 8, wherein, Before the step of determining the first syntax element identification information, the method further comprises: determining second syntax element identification information; When the second syntax element identification information indicates that the current sequence uses a standard extension version, third syntax element identification information is determined; When the third syntax element identification information indicates that the current sequence uses range extension, the step of determining the first syntax element identification information is performed.
10. The method of claim 9, wherein, The current sequence uses range extension, comprising that the current sequence satisfies at least one of the following: high bit width, high quality, high code rate, high frame rate and lossless compression.
11. The method of claim 7, wherein, The component comprises at least one of the following: a first image component, a second image component and a third image component; wherein, The first image component is a luminance component, the second image component is a first chroma component, and the third image component is a second chroma component; or, The first image component is a red component, the second image component is a green component, and the third image component is a blue component, The step of determining the last non-zero coefficient position flipping identification information comprises determining first last non-zero coefficient position flipping identification information. Correspondingly, the method further comprises: If the first image component, the second image component and the third image component all use last non-zero coefficient position flipping, the value of the first last non-zero coefficient position flipping identification information is determined as a first value.
12. The method of claim 9 or 10, wherein, When the third syntax element identification information indicates that the current sequence uses range extension, the method further comprises: determining last coefficient enable identification information of the current block; When the last coefficient enable identification information indicates that the current block uses last coefficient position, all coefficients before the last coefficient position are encoded according to a preset scanning order, and the bit information obtained after encoding and the last coefficient enable identification information are written into a bitstream, The method further comprises: determining a width and a height of a transform block obtained after a preset operation of the current block, wherein the preset operation comprises at least a zero-out operation; performing coordinate calculation according to the width and the height of the transform block to obtain right lower corner coordinate information of the transform block; determining the last coefficient position according to the right lower corner coordinate information of the transform block.
13. An encoder comprising a first memory and a first processor; wherein, the first memory is configured to store a computer program capable of running on the first processor; the first processor is configured to perform the method according to any one of claims 7 to 12 when running the computer program.
14. A decoder comprising a second memory and a second processor; wherein, the second memory is configured to store a computer program capable of running on the second processor; the second processor is configured to perform the method according to any one of claims 1 to 6 when running the computer program.
15. A computer readable storage medium, wherein, The computer readable storage medium stores a computer program and a bitstream, and the computer program is executed by a processor to implement the steps of the encoding method according to any one of claims 7 to 12 to generate the bitstream.