Coefficient coding method, encoder, decoder, and computer storage medium
By determining the video identifier information and the position of the last non-zero coefficient during video encoding and decoding, and using a preset scanning order for coefficient encoding or decoding, the problem of high overhead in high-bit-width, high-bit-rate, and high-quality video encoding and decoding is solved, achieving higher throughput and compression efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2021-04-12
- Publication Date
- 2026-07-07
Smart Images

Figure CN120358362B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to a coefficient encoding and decoding method, an encoder, a decoder, and a computer storage medium. Background Technology
[0002] 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.
[0003] 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 "conventional video"). Therefore, existing solutions for high-three-high video may incur greater overhead, resulting in waste and even impacting encoding / decoding speed and throughput. Summary of the Invention
[0004] This application provides a coefficient encoding / decoding method, encoder, decoder, and computer storage medium, which can improve the throughput and encoding / decoding speed of coefficient encoding in high bit width, high bit rate, high quality or lossless video encoding / decoding scenarios, while also improving compression efficiency.
[0005] The technical solution of this application embodiment can be implemented as follows:
[0006] In a first aspect, embodiments of this application provide a coefficient decoding method applied to a decoder, the method comprising:
[0007] Parse the bitstream to obtain video identifier information;
[0008] When the video identifier information indicates that the video meets the preset conditions, the bitstream is parsed to obtain the flip identifier information of the last non-zero coefficient position and the coordinate information of the last non-zero coefficient.
[0009] When the last non-zero coefficient position flipping flag indicates that the current block is flipped using the last non-zero coefficient position, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient.
[0010] Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0011] Secondly, embodiments of this application provide a coefficient encoding method applied to an encoder, the method comprising:
[0012] Determine the video identification information and the position of the last non-zero coefficient;
[0013] When the video identification information indicates that the video meets the preset conditions, the last non-zero coefficient position is flipped.
[0014] Based on the position of the last non-zero coefficient and the flipping information of the last non-zero coefficient position, determine the coordinate information of the last non-zero coefficient;
[0015] All coefficients before the last non-zero coefficient are encoded according to the preset scanning order, and the encoded bit information, video identification information, and coordinate information of the last non-zero coefficient are written into the bitstream.
[0016] Thirdly, embodiments of this application provide an encoder, which includes a first determining unit and an encoding unit; wherein,
[0017] The first determining unit is configured to determine video identification information and the position of the last non-zero coefficient; and when the video identification information indicates that the video meets preset conditions, determine the position of the last non-zero coefficient and flip the identification information.
[0018] The first determining unit is further configured to determine the coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the flipping identifier information of the position of the last non-zero coefficient;
[0019] 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, video identification information and coordinate information of the last non-zero coefficient into the bit stream.
[0020] Fourthly, embodiments of this application provide an encoder, which includes a first memory and a first processor; wherein,
[0021] A first memory for storing computer programs that can run on a first processor;
[0022] A first processor is configured to execute the method described in the second aspect when running a computer program.
[0023] Fifthly, embodiments of this application provide a decoder, which includes a parsing unit and a second determining unit; wherein,
[0024] The parsing unit is configured to parse the bitstream and obtain video identification information; and when the video identification information indicates that the video meets preset conditions, it parses the bitstream and obtains the flip flag information of the last non-zero coefficient position and the coordinate information of the last non-zero coefficient.
[0025] The second determining unit is configured to calculate the coordinate information of the last non-zero coefficient and determine the position of the last non-zero coefficient when the last non-zero coefficient position flipping identifier information indicates that the current block is flipped using the last non-zero coefficient position.
[0026] 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.
[0027] Sixthly, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein,
[0028] The second memory is used to store computer programs that can run on the second processor;
[0029] The second processor is configured to execute the method described in the first aspect when running a computer program.
[0030] In a seventh aspect, 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.
[0031] This application provides a coefficient encoding / decoding method, an encoder, a decoder, and a computer storage medium. In the encoder, video identification information and the position of the last non-zero coefficient are determined. When the video identification information indicates that the video meets a preset condition, the position flipping information of the last non-zero coefficient is determined. Based on the position of the last non-zero coefficient and the position flipping information, the coordinate information of the last non-zero coefficient 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, video identification information, and coordinate information of the last non-zero coefficient are written into the bitstream. In the decoder, the bitstream is parsed to obtain the video identification information. When the video identification information indicates that the video meets a preset condition, the bitstream is parsed to obtain the position flipping information of the last non-zero coefficient and the coordinate information of the last non-zero coefficient. When the position flipping information of the last non-zero coefficient indicates that the current block uses the position flipping information of the last non-zero coefficient, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient. 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 high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, since the coefficient distribution pattern differs from that of conventional video scenarios, the number of syntax elements in context mode encoding can be reduced or even eliminated in coefficient encoding. These elements include syntax elements related to the position of the last non-zero coefficient and sub-block encoding identifiers. Furthermore, coordinate transformation can be performed when the coordinate information of the last non-zero coefficient is too large. This reduces the overhead of encoding in the bitstream, thereby improving the throughput and encoding / decoding speed of coefficient encoding. In addition, since the reduced or eliminated syntax elements have a smaller impact on high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved. Attached Figure Description
[0032] Figure 1 An application diagram illustrating a coding framework provided for related technologies;
[0033] Figure 2 A schematic diagram illustrating the positional relationship between the current coefficient and adjacent coefficients, provided for related technologies;
[0034] Figure 3 A flowchart illustrating the arithmetic decoding process of bin for related technologies;
[0035] Figure 4 A flowchart illustrating the arithmetic decoding process of binary symbols, provided for related technologies;
[0036] Figure 5 A flowchart illustrating the renormalization process of an arithmetic decoding engine for related technologies;
[0037] Figure 6 A flowchart illustrating a bypass decoding process for related technologies;
[0038] 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;
[0039] Figure 8A This application provides a schematic diagram of the system composition of an encoder according to an embodiment of the present application.
[0040] Figure 8B This application provides a schematic diagram of the system composition of a decoder according to an embodiment of the present application;
[0041] Figure 9 A flowchart illustrating a coefficient decoding method provided in an embodiment of this application;
[0042] 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.
[0043] 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.
[0044] Figure 11 A flowchart illustrating a coefficient encoding method provided in an embodiment of this application;
[0045] Figure 12 A schematic diagram of the composition structure of an encoder provided in an embodiment of this application;
[0046] Figure 13 This is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application;
[0047] Figure 14 A schematic diagram of the composition structure of a decoder provided in an embodiment of this application;
[0048] Figure 15 This is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application. Detailed Implementation
[0049] 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.
[0050] 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.
[0051] 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.
[0052] In video images, a coding block (CB) is generally represented by a first image component, a second image component, and a third image component. These three image components are a luminance component, a blue chrominance component, and a red chrominance component, respectively. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.
[0053] 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:
[0054] Moving Picture Experts Group (MPEG)
[0055] International Organization for Standardization (ISO)
[0056] International Electrotechnical Commission (IEC)
[0057] Joint Video Experts Team (JVET)
[0058] Alliance for Open Media (AOM)
[0059] The next-generation video coding standard H.266 / Versatile Video Coding (VVC)
[0060] VVC Reference Software Testing Platform (VVC Test Model, VTM)
[0061] Audio Video Standard (AVS)
[0062] AVS High-Performance Model (HPM)
[0063] Context-based Adaptive Binary Arithmetic Coding (CABAC)
[0064] Regular Residual Coding (RRC)
[0065] Transform Skip Residual Coding (TSRC)
[0066] 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 1As 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 strong similarity between adjacent frames in a video image, inter-prediction can eliminate temporal redundancy between adjacent frames, thereby improving encoding and decoding efficiency.
[0067] 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.
[0068] The current block can be the current coding unit (CU), the current prediction unit (PU), or the current transform block (TU), etc.
[0069] In this method, block partitioning information, various modes and parameter information for prediction, transformation, and quantization, and coefficients are written into the bitstream through entropy coding. Assuming that different elements have different probabilities, shorter codewords are assigned to elements with higher probabilities, and longer codewords are assigned to elements with lower probabilities, achieving 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 use a context model to improve compression efficiency, 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 the embodiments of this application, the mode in CABAC that requires the use and updating of the context model can be called the context mode.
[0070] 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; for example... Figure 2 As shown, 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.
[0071] 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.
[0072] The following example uses CABAC in VVC for illustration:
[0073] 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.
[0074] Here, ctxTable is the table used when selecting the context mode, and ctxIdx is the context model index.
[0075] 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, ctxIdx, and bypassFlag are passed as input to the arithmetic decoding process DecodeBin(ctxTable, ctxIdx, bypassFlag), as follows:
[0076] If the value of bypassFlag is 1, then the bypass decoding process DecodeBypass() is called;
[0077] Otherwise, if the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, then DecodeTerminate() is called;
[0078] 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.
[0079] 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.
[0080] Figure 4 A flowchart illustrating an arithmetic decoding process for binary symbols provided by related technologies is shown. For example... Figure 4 As shown, pStateIdx0 and pStateIdx1 are the two states of the current context model.
[0081] (1) The value of the variable ivlLpsRange is derived as follows:
[0082] Given the current value of ivlCurrRange, the variable qRangeIdx is derived as follows:
[0083] qRangeIdx=ivlCurrRange>>5
[0084] Given qRangeIdx, ctxTable, and the corresponding pStateIdx0 and pStateIdx1 of ctxIdx, valMps and ivlLpsRange are derived as follows:
[0085] pState=pStateIdx1+16×pStateIdx0;
[0086] valMps = pState >> 14;
[0087] ivlLpsRange=(qRangeIdx×((valMps?32767–pState:pState)>>9)>>1)+4.
[0088] (2) Set the value of variable ivlCurrRange to ivlCurrRange – ivlLpsRange, and perform the following operations:
[0089] If ivlOffset is greater than or equal to ivlCurrRange, then the value of the variable binVal is 1 – valMps, the value of ivlOffset is ivlOffset minus ivlCurrRange, and the value of ivlCurrRange is ivlLpsRange.
[0090] Otherwise (ivlOffset is less than ivlCurrRange), the value of the variable binVal is valMps.
[0091] Given the value of binVal, perform the defined state transition. Based on the current value of ivlCurrRange, perform the defined renormalization.
[0092] 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:
[0093] shift0 = (shiftIdx >> 2) + 2;
[0094] shift1=(shiftIdx&3)+3+shift0.
[0095] Based on the solved value binVal, the updates to the two variables pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx are as follows:
[0096] pStateIdx0=pStateIdx0-(pStateIdx0>>shift0)+(1023×binVal>>shift0);
[0097] pStateIdx1=pStateIdx1-(pStateIdx1>>shift1)+(16383×binVal>>shift1).
[0098] 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.
[0099] Figure 5 This diagram illustrates a normalization process for an arithmetic decoding engine provided by related technologies, such as... Figure 5 As shown, the current value of ivlCurrRange is first compared with 256, and the subsequent steps are as follows:
[0100] If ivlCurrRange is greater than or equal to 256, then no renormalization is needed, and the RenormD process ends.
[0101] Otherwise (ivlCurrRange is less than 256), enter the renormalization loop. In this loop, the value of ivlCurrRange is multiplied by 2, which is equivalent to shifting it left by one bit. The value of ivlOffset is multiplied by 2, which is also equivalent to shifting it left by one bit. The bit obtained by read_bits(1) is shifted into ivlOffset.
[0102] Throughout the process, the data in the bitstream should not cause ivlOffset to be greater than or equal to ivlCurrRange.
[0103] 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.
[0104] 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, the value of ivlOffset is multiplied by 2, which is equivalent to shifting it left by one bit. The bit obtained using read_bits(1) is then shifted into ivlOffset. Next, the value of ivlOffset is compared with the value of ivlCurrRange, and the subsequent steps are as follows:
[0105] If ivlOffset is greater than or equal to ivlCurrRange, then the value of binVal is set to 1, and ivlOffset is equal to ivlOffset - CurrRange.
[0106] Otherwise (ivlOffset is less than ivlCurrRange), the value of binVal is set to 0.
[0107] Throughout the process, the data in the bitstream should not cause ivlOffset to be greater than or equal to ivlCurrRange.
[0108] 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 coefficients after transform skipping, and TSRC is used for coefficients after transform skipping.
[0109] 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 7As shown, the upper left corner may contain non-zero coefficients (i.e., the region that may contain non-zero coefficients), while the lower right corner will be entirely set to zero (i.e., the region that is forced to be 0). Thus, for the subsequent coefficient encoding, the coefficients in the region that is forced to be 0 by zero-out do not need to be encoded since they are definitely 0.
[0110] 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, 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. Once this position is determined, 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).
[0111] (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 in the range of 0 to (log2ZoTbWidth<<1)-1, inclusive of these two boundary values.
[0112] If last_sig_coeff_x_prefix does not exist, then the value of last_sig_coeff_x_prefix is 0.
[0113] (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 in the range of 0 to (log2ZoTbHeight<<1)-1, inclusive of these two boundary values.
[0114] If last_sig_coeff_y_prefix does not exist, then the value of last_sig_coeff_y_prefix is 0.
[0115] (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 in the range of 0 to (1 << ((last_sig_coeff_x_prefix>>1)-1))-1, inclusive of these two boundary values.
[0116] The value of the horizontal (or column) coordinate of the last non-zero coefficient in the current transform block, in scan order, LastSignificantCoeffX, is derived as follows:
[0117] If last_sig_coeff_x_suffix does not exist, then
[0118] LastSignificantCoeffX=last_sig_coeff_x_prefix;
[0119] Otherwise (if last_sig_coeff_x_suffix exists),
[0120] LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+
[0121] last_sig_coeff_x_suffix.
[0122] (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 in the range of 0 to (1 << ((last_sig_coeff_y_prefix >> 1) - 1)) - 1, inclusive of these two boundary values.
[0123] 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:
[0124] If last_sig_coeff_y_suffix does not exist, then
[0125] LastSignificantCoeffY=last_sig_coeff_y_prefix;
[0126] Otherwise (if last_sig_coeff_y_suffix exists),
[0127] LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+
[0128] last_sig_coeff_y_suffix.
[0129] Furthermore, all coefficients up to 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, the coefficients in the current sub-block are considered to be all 0. Here, the sub-block is usually an n×n sub-block, such as a 4×4 sub-block.
[0130] 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:
[0131] 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.
[0132] If sb_coded_flag[xS][yS] does not exist, then the value of sb_coded_flag[xS][yS] is 1.
[0133] Furthermore, when processing coefficient coding, the characteristics of coefficients can be utilized to improve compression efficiency. For example, in a typical video, among the coefficients to be coded, a certain proportion of the coefficients are 0. Thus, 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 coding of the current coefficient has ended; otherwise, the coding of the current coefficient needs to continue. Another example is that in a typical video, among the non-zero coefficients, a certain proportion of the coefficients have an absolute value of 1. Thus, 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 coding of the current coefficient has ended; otherwise, the coding of the current coefficient needs to continue. For example, the syntax elements involved in VVC are as follows,
[0134] sig_coeff_flag[xC][yC] is used to determine whether the corresponding transform coefficient at the transform coefficient position (xC, yC) of the current transform block is a non-zero coefficient:
[0135] If the value of sig_coeff_flag[xC][yC] is 0, then the value of the transform coefficient at the position (xC, yC) is set to 0;
[0136] Otherwise (the value of sig_coeff_flag[xC][yC] is 1), the transform coefficient at the position (xC, yC) is a non-zero coefficient.
[0137] If sig_coeff_flag[xC][yC] does not exist, then the following inferences are made:
[0138] If the value of transform_skip_flag[x0][y0][cIdx] is 0 or the value of sh_ts_residual_coding_disabled_flag is 1:
[0139] If (xC, yC) is the position (LastSignificantCoeffX, LastSignificantCoeffY) of the last non-zero coefficient in the scan order or all of the following conditions are true, then the value of sig_coeff_flag[xC][yC] is inferred to be 1:
[0140] (xC & ((1 << log2SbW) - 1), yC & ((1 << log2SbH) - 1)) is equal to (0, 0);
[0141] The value of inferSbDcSigCoeffFlag is equal to 1;
[0142] The value of sb_coded_flag[xS][yS] is 1;
[0143] Otherwise, the value of sig_coeff_flag[xC][yC] is inferred to be 0;
[0144] Otherwise (when transform_skip_flag[x0][y0][cIdx] is 1 and sh_ts_residual_coding_disabled_flag is 0):
[0145] If all of the following conditions are true, then the value of sig_coeff_flag[xC][yC] is inferred to be 1:
[0146] (xC & ((1 << log2SbW) - 1), yC & ((1 << log2SbH) - 1)) is equal to ((1 <<
[0147] log2SbW) - 1, (1 << log2SbH) - 1);
[0148] The value of inferSbSigCoeffFlag is 1;
[0149] The value of sb_coded_flag[xS][yS] is 1;
[0150] Otherwise, the value of sig_coeff_flag[xC][yC] is inferred to be 0.
[0151] abs_level_gtx_flag[n][j] is used to determine whether the absolute value of the (n-th in scan order) transform coefficient 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.
[0152] Thus, if after processing the above flags (or called syntax elements), the current coefficient has not been encoded completely, then the remaining value of the coefficient absolute value needs to be encoded. Such as abs_remainder in VVC.
[0153] abs_remainder[n] is used to determine the remaining absolute value of the (n-th in scan order) transform coefficient encoded with Golomb - Rice. If abs_remainder[n] does not exist, then the value of abs_remainder[n] is 0.
[0154] 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.
[0155] 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:
[0156] 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;
[0157] 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;
[0158] 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].
[0159] 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:
[0160] If the value of coeff_sign_flag[n] is 0, then the corresponding transformation coefficient is positive;
[0161] Otherwise (coeff_sign_flag[n] is 1), the corresponding transformation coefficient is negative.
[0162] 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].
[0163] If the value of CoeffSignLevel[xC][yC] is 0, then the corresponding transformation coefficient is 0;
[0164] 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 coefficient is negative.
[0165] It should also be noted that CoeffSignLevel[xC][yC] can be exported using other methods, which will not be elaborated here.
[0166] 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.
[0167] `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.
[0168] 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.
[0169] 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.
[0170] In a specific example, the specific syntax of RRC is shown in Table 1.
[0171] Table 1
[0172]
[0173]
[0174]
[0175]
[0176]
[0177] 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.
[0178] 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 abscissa in the range [0, (1<<log2ZoTbWidth)–1] and ordinate in the range [0, (1<<log2ZoTbHeight)–1] may be non-zero coefficients. Here, (1<<log2ZoTbWidth) represents the width of the transform block after zero-out, and (1<<log2ZoTbHeight) represents the height of the transform 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, that is, use the equation remBinsPass1 = ((1<<(log2TbWidth+log2TbHeight))×7)>>2 to determine. 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 remaining binary symbols 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, it is successively determined whether the current sub-block needs to be encoded. 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, needs to be processed. If remBinsPass1 is already 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.
[0179] In another specific example, the specific syntax of TSRC is shown in Table 2.
[0180] Table 2
[0181]
[0182]
[0183]
[0184] 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`.
[0185] 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 megabits 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 generally result in larger coefficients and more non-zero coefficients, 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.
[0186] 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 to be encoded and decoded 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 are 0 after prediction, transformation, and quantization, using the last non-zero coefficient position (LastSignificantCoeffX, LastSignificantCoeffY) to distinguish whether a region needs encoding is effective. Even before the last non-zero coefficient position, a large proportion of the coefficients remain 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.
[0187] 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.
[0188] 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 most non-zero coefficients are 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 even affect the speed and throughput of encoding and decoding.
[0189] This application provides a coefficient decoding method applied to a decoder. The method involves parsing the bitstream to obtain video identification information; when the video identification information indicates that the video meets preset conditions, parsing the bitstream to obtain the last non-zero coefficient position flipping identifier information and the coordinate information of the last non-zero coefficient; when the last non-zero coefficient position flipping identifier information indicates that the current block uses the last non-zero coefficient position for flipping, calculating the coordinate information of the last non-zero coefficient to determine its position; and decoding 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.
[0190] This application also provides a coefficient encoding method applied to an encoder. The method involves: determining video identification information and the position of the last non-zero coefficient; determining a position flip flag for the last non-zero coefficient when the video identification information indicates that the video meets a preset condition; determining the coordinate information of the last non-zero coefficient based on its position and the position flip flag; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order; and writing the encoded bit information, video identification information, and coordinate information of the last non-zero coefficient into the bitstream.
[0191] In high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, since the coefficient distribution pattern differs from that of conventional video scenarios, the number of syntax elements in context mode encoding can be reduced or even eliminated in coefficient encoding. These elements include syntax elements related to the position of the last non-zero coefficient and sub-block encoding identifiers. Furthermore, coordinate transformation can be performed when the coordinate information of the last non-zero coefficient is too large. This reduces the overhead of encoding in the bitstream, thereby improving the throughput and encoding / decoding speed of coefficient encoding. In addition, since the reduced or eliminated syntax elements have a smaller impact on high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.
[0192] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0193] 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.
[0194] 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 multiple 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.
[0195] 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.
[0196] 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.
[0197] The output of filtering unit 113 is a decoded image or sub-image, which is buffered in DPB unit 114. DPB unit 114 outputs the decoded image or sub-image according to timing and control information. Here, the image stored in DPB unit 114 can also be used as a reference for prediction unit 102 to perform inter-frame prediction or intra-frame prediction. Finally, entropy coding unit 115 converts the parameters (such as control parameters and supplementary information) necessary for decoding the image from 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 encoder 100.
[0198] 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.
[0199] 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.
[0200] 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.
[0201] 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.
[0202] 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-prediction unit 204. Specifically, when an inter-frame decoding 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-prediction unit 204 to obtain intra-frame prediction blocks.
[0203] 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.
[0204] 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.
[0205] 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.
[0206] 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.
[0207] Furthermore, the decoder 200 can be a second memory having a second processor and a computer program for recording. When the first processor reads and runs the computer program, the decoder 200 reads the input bitstream and generates the corresponding decoded video. Additionally, the decoder 200 can also be a computing device having one or more chips. These units, implemented as integrated circuits on the chip, have... Figure 8B Similar connection and data exchange functions to the corresponding units in the middle.
[0208] 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").
[0209] In one embodiment of this application, see [link to embodiment]. Figure 9 This illustrates a flowchart of a coefficient decoding method provided in an embodiment of this application. Figure 9 As shown, the method may include:
[0210] S901: Parse the bitstream and obtain video identification information.
[0211] It should be noted that the coefficient decoding method in this application embodiment is applied to the decoder. Specifically, based on Figure 8B The decoder 200 shown in the embodiment of this application has a coefficient decoding method that is mainly applied to the "parsing unit 201" part of the decoder 200. For the parsing 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.
[0212] It should also be noted that coefficient encoding, as commonly referred to in video standards, can include both encoding and decoding. Therefore, coefficient encoding includes coefficient encoding methods on the encoder side and coefficient decoding methods on the decoder side. This application describes the coefficient decoding method on the decoder side.
[0213] In general, for example, for regular videos, the coefficient decoding method 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 can modify the method for deriving the position of the last non-zero coefficient.
[0214] In this embodiment, it is first necessary to determine whether the current video meets preset conditions, which can be represented by video identification information. In some embodiments, parsing the bitstream and obtaining the video identification information may include:
[0215] If the video identifier information takes the first value, then the video identifier information indicates that the video meets the preset conditions; or,
[0216] If the video identifier information takes the second value, then the video identifier information indicates that the video does not meet the preset conditions.
[0217] Here, the first value is 1, and the second value is 0.
[0218] It should be noted that in another specific example, the first value can also be set to true, and the second value can also be set to false. Even in yet another specific example, the first value can be set to 0, and the second value can also be set to 1; or, the first value can be set to false, and the second value can also be set to true. No limitations are imposed here.
[0219] It should also be noted that the preset conditions include at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0220] 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.
[0221] Furthermore, video identification information can be sequence-level markers, or even higher-level markers, such as Video Usability Information (VUI) and Supplemental Enhancement Information (SEI). Determining whether a video meets preset conditions can be done by checking if it meets requirements such as high bit width, high bit rate, high quality, or lossless compression. These four conditions will be described below as examples.
[0222] In some embodiments, when the video identification information is high-bit width identification information, the method may further include:
[0223] If the high bit width identifier indicates that the video meets the high bit width requirement, then the video is determined to meet the preset conditions.
[0224] In some embodiments, when the video identification information is high bitrate identification information, the method may further include:
[0225] If the high bitrate identifier indicates that the video meets the high bitrate requirement, then the video is determined to meet the preset conditions.
[0226] In some embodiments, when the video identification information is high-quality identification information, the method may further include:
[0227] If the high-quality identification information indicates that the video meets the high-quality standard, then the video is determined to meet the preset conditions.
[0228] In some embodiments, when the video identification information is lossless compression identification information, the method may further include:
[0229] If the lossless compression identifier indicates that the video meets the lossless compression requirement, then the video is determined to meet the preset conditions.
[0230] For example, taking the sequence level as an example, the video identification information can be high bit width identification information (represented by sps_high_bit_depth_flag), used to indicate whether the current video 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 video 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. This application embodiment does not make specific limitations.
[0231] S902: When the video identification information indicates that the video meets the preset conditions, parse the bitstream and obtain the flipping identification information of the last non-zero coefficient position and the coordinate information of the last non-zero coefficient.
[0232] It should be noted that when the video identification information indicates that the video meets the preset conditions, the bitstream can be further parsed to obtain the flipping identification information of the last non-zero coefficient position and the coordinate information of the last non-zero coefficient.
[0233] 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. Therefore, in some embodiments, parsing the bitstream to obtain the coordinate information of the last non-zero coefficient may include:
[0234] 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.
[0235] 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.
[0236] 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.
[0237] The coordinate information of the last non-zero coefficient is determined based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0238] 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.
[0239] 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.
[0240] The flip flag for the last non-zero coefficient position can be represented by `reverse_last_sig_coeff_flag`. In this embodiment, the flip flag for 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 a higher level flag (such as VUI, SEI, etc.), without any limitation.
[0241] 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 of other levels. In addition, block-level flags may include maximum coding unit (LCU) level flags, coding unit (CU) level flags, or other block-level flags, and the embodiments of this application do not impose any limitations.
[0242] In some embodiments, the method may further include:
[0243] If the value of the last non-zero coefficient position flip flag is the first value, then the last non-zero coefficient position flip flag indicates that the current block should be flipped using the last non-zero coefficient position; or...
[0244] If the value of the last non-zero coefficient position flip flag is the second value, then the last non-zero coefficient position flip flag indicates that the current block does not use the last non-zero coefficient position flip.
[0245] In other words, taking a first value of 1 and a second value of 0 as an example, if the value of reverse_last_sig_coeff_flag is 1, then it can be determined that reverse_last_sig_coeff_flag indicates that the current block is flipped using the last non-zero coefficient position; or, if the value of reverse_last_sig_coeff_flag is 0, then it can be determined that reverse_last_sig_coeff_flag indicates that the current block is not flipped using the last non-zero coefficient position.
[0246] S903: When the last non-zero coefficient position flipping identifier indicates that the current block is flipped using the last non-zero coefficient position, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient.
[0247] S904: Decode all coefficients before the last non-zero coefficient according to the preset scanning order to determine the coefficients of the current block.
[0248] It should be noted that, in the embodiments of this application, when the last non-zero coefficient position flipping identifier information indicates that the current block is flipped using the last non-zero coefficient position, the coordinate information of the last non-zero coefficient 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.
[0249] In some embodiments, calculating the coordinates of the last non-zero coefficient to determine its position may include:
[0250] Determine the width and height of the current block;
[0251] Perform a subtraction calculation based on 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 position of the current block to obtain the horizontal coordinate of the last non-zero coefficient; and
[0252] Perform a subtraction calculation based on 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 position of the current block to obtain the vertical coordinate of the last non-zero coefficient;
[0253] Determine the position of the last non-zero coefficient based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0254] 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 values of the coordinate information of the last non-zero coefficient usually large. In this case, 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, 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 decode all the coefficients before the position of the last non-zero coefficient in the current block according to the preset scanning order.
[0255] It should also be noted that the current block here 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 reverse_last_sig_coeff_flag indicates that the current block uses the position flipping of the last non-zero coefficient (that is, the value of reverse_last_sig_coeff_flag is 1),
[0256] LastSignificantCoeffX=(1< <log2ZoTbWidth)-1-LastSignificantCoeffX;
[0257] LastSignificantCoeffY=(1< <log2ZoTbHeight)-1-LastSignificantCoeffY。
[0258] In this equation, (LastSignificantCoeffX, LastSignificantCoeffY) on the right side represents the coordinate information of the last non-zero coefficient obtained through decoding, while (LastSignificantCoeffX, LastSignificantCoeffY) on the left side 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).
[0259] In some embodiments of this application, when the value of reverse_last_sig_coeff_flag is 0, the method may further include:
[0260] When the last non-zero coefficient position flipping flag indicates that the current block does not use the last non-zero coefficient position flipping, 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 top-left corner of the current block.
[0261] The position of the last non-zero coefficient is determined by the horizontal and vertical distances between the position of the last non-zero coefficient and the top-left corner of the current block.
[0262] It should be noted that if `reverse_last_sig_coeff_flag` indicates that the current block does not use the position of the last non-zero coefficient for flipping, then 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 this embodiment, 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 position of the upper left corner of the current block.
[0263] Furthermore, in some embodiments, the method may further include:
[0264] When the last non-zero coefficient position flipping flag indicates that the current block does not use the last non-zero coefficient position flipping, the position of the last non-zero coefficient is directly determined based on the coordinate information of the last non-zero coefficient.
[0265] Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0266] It should be noted that the preset scanning order can be diagonal, zigzag, horizontal, vertical, 4×4 sub-block scanning, or any other scanning order. This application embodiment does not impose any limitations.
[0267] It should also be noted that after obtaining `reverse_last_sig_coeff_flag`, if its value is 1 (meaning the last non-zero coefficient needs to be flipped), then after decoding the coordinates of the last non-zero coefficient, its position needs to be calculated to determine its location. Then, all coefficients before the last non-zero coefficient's position are decoded according to the preset scanning order. If `reverse_last_sig_coeff_flag` is 0 (meaning the last non-zero coefficient doesn't need to be flipped), then after decoding the coordinates of the last non-zero coefficient, its position can be directly determined based on those coordinates. Then, all coefficients before the last non-zero coefficient's position are decoded according to the preset scanning order.
[0268] Thus, for certain situations, this application provides a method for modifying the position derivation of the last non-zero coefficient during coefficient encoding. That is, under normal circumstances, the coefficient encoding / decoding method is still the same as existing methods in related technologies. In certain situations, this could refer to high-bit-width, high-quality, or high-bitrate video encoding / decoding, or lossless compressed video encoding / 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 10AAs shown. In the case of high-bitwidth, high-quality, high-bitrate, or lossless compression video coding and decoding, the position of the last non-zero coefficient generally approaches the lower right corner of the area where all possible non-zero coefficients in the current block are located. In this case, 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 lower right corner of the area where all possible non-zero coefficients in the current block are located; 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 lower right corner of the area where all possible non-zero coefficients in the current block are located, as Figure 10B shown. For example, if the area where all possible non-zero coefficients in the current block is a 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 ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1) of the current block. 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 ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1) of the current block.
[0269] The modifications for semantics are as follows:
[0270] 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:
[0271] If last_sig_coeff_x_suffix does not exist, then,
[0272] LastSignificantCoeffX = last_sig_coeff_x_prefix;
[0273] Otherwise (last_sig_coeff_x_suffix exists),
[0274] LastSignificantCoeffX=(1<<((last_sig_coeff_x_prefix>>1)-1))*(2+(last_sig_coeff_x_prefix&1))+last_sig_coeff_x_suffix;
[0275] If the value of reverse_last_sig_coeff_flag is 1, then
[0276] LastSignificantCoeffX=(1< <log2ZoTbWidth)-1-LastSignificantCoeffX;
[0277] 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:
[0278] If last_sig_coeff_y_suffix does not exist, then
[0279] LastSignificantCoeffY=last_sig_coeff_y_prefix;
[0280] Otherwise (if last_sig_coeff_y_suffix exists):
[0281] LastSignificantCoeffY=(1<<((last_sig_coeff_y_prefix>>1)-1))*(2+(last_sig_coeff_y_prefix&1))+last_sig_coeff_y_suffix;
[0282] If the value of reverse_last_sig_coeff_flag is 1, then
[0283] LastSignificantCoeffY=(1< <log2ZoTbHeight)-1-LastSignificantCoeffY。
[0284] 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.
[0285] It should also be noted that reverse_last_sig_coeff_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 maximum coding unit (LCU) level flags, coding unit (CU) level flags, or other block-level flags.
[0286] Additionally, `reverse_last_sig_coeff_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 `reverse_last_sig_coeff_flag` flag needs to be decoded; otherwise, it does not.
[0287] 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_reverse_last_sig_coeff_flag` needs to be decoded. Here, `sps_reverse_last_sig_coeff_flag` is the flag indicating the last non-zero coefficient position of the current sequence is flipped. If `sps_reverse_last_sig_coeff_flag` is 1, it means 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 means 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 syntax table above has been changed to sps_reverse_last_sig_coeff_flag.
[0288] Its syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 3.
[0289] Table 3
[0290]
[0291]
[0292] 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_reverse_last_sig_coeff_flag` needs to be decoded. Here, `sh_reverse_last_sig_coeff_flag` is the flag indicating the last non-zero coefficient position of the current slice is flipped. If `sh_reverse_last_sig_coeff_flag` is 1, it means the 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 the blocks in the current slice do not use the last non-zero coefficient position for flipping. The reverse_last_sig_coeff_flag in the syntax table above has been changed to sh_reverse_last_sig_coeff_flag.
[0293] Its syntax elements are as follows (Slice header syntax), see Table 4.
[0294] Table 4
[0295]
[0296] It can also be understood that when the video identification information indicates that the video meets the preset conditions, it is also possible to default to encoding all coefficients that may need to be encoded. That is, the position of the last non-zero coefficient is no longer used, but all possible non-zero coefficients of the current block are scanned 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 position of the last coefficient is used in the current block.
[0297] In some embodiments, when video identification information indicates that a video meets preset conditions, the method may further include:
[0298] Parse the bitstream and obtain the enable flag information for the last coefficient;
[0299] 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.
[0300] It should be noted that the last coefficient enable flag can be represented by `default_last_coeff_enabled_flag`. In this embodiment, 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.
[0301] 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 unit (CU) level flags, or other block-level flags; this application embodiment does not impose any limitations.
[0302] In some embodiments, the method may further include:
[0303] 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,
[0304] 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.
[0305] Here, the first value is 1, and the second value is 0.
[0306] It should be noted that in another specific example, the first value can also be set to true, and the second value can also be set to false. Even in yet another specific example, the first value can be set to 0, and the second value can also be set to 1; or, the first value can be set to false, and the second value can also be set to true. No limitations are imposed here.
[0307] 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.
[0308] 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.
[0309] 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:
[0310] 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.
[0311] 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.
[0312] Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0313] 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`.
[0314] 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, 4×4 sub-block scan, or any other scan order, and this application embodiment does not impose any limitations.
[0315] 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.
[0316] 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.
[0317] In one particular example, the method may also include setting the position of the last non-zero coefficient at the last coefficient position.
[0318] 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.
[0319] 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:
[0320] Determine the width and height of the transformed block after the current block undergoes a preset operation;
[0321] The coordinates of the lower right corner of the transform block are calculated based on its width and height.
[0322] The position of the last coefficient is determined based on the coordinate information of the lower right corner of the transform block.
[0323] Here, the default operations include at least the forced zero-out operation.
[0324] It should be noted that (LastCoeffX, LastCoeffY) represents the coordinates of the bottom right corner of the transform block after zero-out; the method for deriving (LastCoeffX, LastCoeffY) is as follows:
[0325] LastCoeffX = (1< <log2ZoTbWidth)-1;LastCoeffY=(1<<log2ZoTbHeight)-1。
[0326] 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).
[0327] 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 coefficients that might be 0 in the current block according to a preset scan order. In some embodiments, the method may further include:
[0328] 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.
[0329] In other words, the position of the last non-zero coefficient can be represented by (LastSignificantCoeffX, LastSignificantCoeffY), which is derived as follows:
[0330] LastSignificantCoeffX=(1< <log2ZoTbWidth)-1;LastSignificantCoeffY=(1<<log2ZoTbHeight)-1。
[0331] 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).
[0332] 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 / 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 / decoding, or lossless compressed video encoding / 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.
[0333] 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.
[0334] 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.
[0335] The semantic modifications are shown in Table 5.
[0336] Table 5
[0337]
[0338] In this embodiment, a condition can be added before decoding the information required for the last non-zero coefficient. That is, if `default_last_coeff_enabled_flag` is not true (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`.
[0339] 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.
[0340] If the value of `default_last_coeff_enabled_flag` is 1, then the default 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:
[0341] LastCoeffX = (1< <log2ZoTbWidth)-1;LastCoeffY=(1<<log2ZoTbHeight)-1。
[0342] Where (LastCoeffX, LastCoeffY) are the coordinates of the lower right corner of the transform block after zero-out.
[0343] 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:
[0344] LastSignificantCoeffX=(1< <log2ZoTbWidth)-1;LastSignificantCoeffY=(1<<log2ZoTbHeight)-1。
[0345] Where (LastSignificantCoeffX, LastSignificantCoeffY) are the coordinates of the lower right corner of the transform block after zero-out.
[0346] 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 maximum coding unit (LCU) level flags, coding unit (CU) level flags, or other block-level flags.
[0347] 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.
[0348] 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`.
[0349] Its syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 6.
[0350] Table 6
[0351]
[0352] 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`.
[0353] Its syntax elements are as follows (Slice header syntax), see Table 7.
[0354] Table 7
[0355]
[0356] It can also be understood that when the video identifier information indicates that the video meets preset conditions, all scanned sub-blocks 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, thereby 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 one.
[0357] In some embodiments, when video identification information indicates that a video meets preset conditions, the method may further include:
[0358] Parse the bitstream to obtain the default encoding identifier information of sub-blocks;
[0359] When the sub-block default encoding identifier indicates the default encoding of the sub-block to be decoded in the current block, the value of the sub-block encoding identifier is determined to be the first value, and all coefficients in the sub-block to be decoded are decoded.
[0360] It should be noted that the default identifier information for sub-blocks can be represented by default_sb_coded_flag. In the embodiments of this application, the default encoding identifier information for sub-blocks is at least one of the following: sequence level, image level, slice level, and block level; it can even be higher-level identifier information (such as VUI, SEI, etc.), without any limitation here.
[0361] 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 unit (CU) level flags, or other block-level flags, and the embodiments of this application do not impose any limitations.
[0362] In some embodiments, the method may further include:
[0363] If the sub-block default encoding identifier information takes the first value, then the sub-block default encoding identifier information indicates the default encoding of the sub-block to be decoded; or,
[0364] If the default encoding identifier of the sub-block is the second value, then the default encoding identifier of the sub-block indicates that the sub-block to be decoded is not encoded by default.
[0365] Here, the first value is 1, and the second value is 0.
[0366] It should be noted that in another specific example, the first value can also be set to true, and the second value can also be set to false. Even in yet another specific example, the first value can be set to 0, and the second value can also be set to 1; or, the first value can be set to false, and the second value can also be set to true. No limitations are imposed here.
[0367] 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.
[0368] 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.
[0369] 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:
[0370] Parse the bitstream to obtain sub-block encoding identifier information;
[0371] When the sub-block encoding identifier information takes the first value, all coefficients in the sub-block to be decoded are decoded.
[0372] 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.
[0373] Furthermore, regarding sub-block encoding identification information, the method may also include:
[0374] If the sub-block encoding identifier information takes the first value, then it is determined that all coefficients within the sub-block to be decoded will be decoded; or,
[0375] If the sub-block encoding identifier information takes the second value, then all coefficients in the sub-block to be decoded are determined to be zero.
[0376] 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.
[0377] 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 method remains the same as existing methods in related technologies. This situation might refer to high-bit-width, high-quality, or high-bit-rate 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 results in a slight improvement in compression performance.
[0378] The semantic modifications are shown in Table 8.
[0379] Table 8
[0380]
[0381] Here, default_sb_coded_flag is a flag indicating which sub-blocks need to be encoded by default. 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.
[0382] 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 maximum coding unit (LCU) level flags, coding unit (CU) level flags, or other block-level flags.
[0383] 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.
[0384] 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`.
[0385] Its syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 9.
[0386] Table 9
[0387]
[0388] 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`.
[0389] Its syntax elements are as follows (Slice header syntax), see Table 10.
[0390] Table 10
[0391]
[0392] Understandably, the embodiments of this application involve three optimization methods, as follows:
[0393] Method 1, for certain situations, defaults to encoding all coefficients that might need to be encoded during coefficient encoding. In other words, under normal circumstances, the coefficient encoding method is the same as existing methods in related technologies. This "certain situation" might refer to high-bit-width, high-quality, or high-bitrate video encoding / decoding, or lossless compression video encoding / decoding. The default is to encode all coefficients that might need to be encoded. 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. Here, the position of the last coefficient to be encoded is used instead of the position of the last non-zero coefficient. This is 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.
[0394] In addition, a specific example is to still use the position of the last non-zero coefficient and place the position of the last non-zero coefficient at the last position among all the coefficients that may be non-zero in the current block in the preset scanning order.
[0395] Method 2: For a certain situation, when encoding coefficients, modify the method for deriving the position of the last non-zero coefficient. That is, generally, the method of coefficient encoding is still the same as the existing method in the related technology. A certain situation can refer to videos with high bitwidth or high quality or high bitrate or lossless compression video encoding and decoding. Generally, last_sig_coeff_x_prefix and last_sig_coeff_x_suffix encode the abscissa of the position of the last non-zero coefficient, that is, the horizontal distance relative to the upper left corner of the current block; last_sig_coeff_y_prefix and last_sig_coeff_y_suffix encode the ordinate of the position of the last non-zero coefficient, that is, the vertical distance relative to the upper left corner of the current block. In the case of videos with high bitwidth or high quality or high bitrate or lossless compression video encoding and decoding, the position of the last non-zero coefficient generally approaches the lower right corner of the area where all possible non-zero coefficients in the current block are located. In this case, 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 lower right corner of the area where all possible non-zero coefficients in the current block are located; 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 lower right corner of the area where all possible non-zero coefficients in the current block are located. For example, if the area where all possible non-zero coefficients in the current block is a 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).
[0396] Method 3: 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 method remains the same as existing methods in related technologies. This can occur in situations such as high-bit-width, high-quality, or high-bit-rate video encoding / decoding, or lossless compressed video encoding / decoding. In these cases, 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. In this case, it is unnecessary to transmit the `sb_coded_flag` in the bitstream, and the encoder / decoder does not need to process this flag.
[0397] Regarding the three methods mentioned above, in high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, since the coefficient distribution pattern differs from that in ordinary video scenarios, reducing or even eliminating the number of syntax elements in context mode encoding, such as syntax elements related to the last non-zero coefficient position and sub-block encoding identifiers, can improve the throughput and encoding / decoding speed of coefficient encoding. At the same time, since these flags have little effect in high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding, not using these flags will not reduce compression efficiency but may even improve it to some extent.
[0398] In addition, in the embodiments of this application, taking the sequence level as an example, the sequence level flag sps_high_bit_depth_flag, which indicates whether the current video sequence is a high bit width sequence, can also be replaced with sps_high_bit_rate_flag, which indicates whether the current video sequence is a high bit rate sequence; it can even be replaced with other flags that indicate high bit width, high bit rate, high quality, or lossless encoding.
[0399] It should also be noted that the coefficient decoding methods in this application embodiment are all based on the example of using this technology uniformly for all components in the video. All components refer to R, G, B in RGB format video, or Y, U, V (Y, Cb, Cr) in YUV format, etc. The coefficient decoding methods in this application embodiment can also be used only for a certain component, such as only for the Y component in YUV format. The coefficient decoding methods in this application embodiment embodiment can also be used for each component separately, that is, each component can be controlled individually.
[0400] This embodiment provides a coefficient decoding method applied to a decoder. By parsing the bitstream, video identification information is obtained. When the video identification information indicates that the video meets preset conditions, the bitstream is parsed to obtain the last non-zero coefficient position flipping identifier and the coordinate information of the last non-zero coefficient. When the last non-zero coefficient position flipping identifier indicates that the current block uses the last non-zero coefficient position for flipping, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient. 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 high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, since the coefficient distribution pattern differs from that of conventional video scenarios, the number of syntax elements in context mode encoding can be reduced or even eliminated in coefficient encoding. These elements include syntax elements related to the position of the last non-zero coefficient and sub-block encoding identifiers. Furthermore, coordinate transformation can be performed when the coordinate information of the last non-zero coefficient is too large. This reduces the overhead of encoding in the bitstream, thereby improving the throughput and encoding / decoding speed of coefficient encoding. In addition, since the reduced or eliminated syntax elements have a smaller impact on high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.
[0401] In another embodiment of this application, see Figure 11 This illustrates a flowchart of a coefficient encoding method provided in an embodiment of this application. Figure 11 As shown, the method may include:
[0402] S1101: Determine the video identification information and the position of the last non-zero coefficient.
[0403] S1102: When the video identification information indicates that the video meets the preset conditions, determine the flip identification information of the last non-zero coefficient position.
[0404] S1103: Determine the coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the flipping information of the last non-zero coefficient position.
[0405] S1104: Encode all coefficients before the position of the last non-zero coefficient according to the preset scanning order, and write the encoded bit information, video identification information and coordinate information of the last non-zero coefficient into the bit stream.
[0406] It should be noted that the coefficient encoding method in this application embodiment is applied to the encoder. Specifically, based on Figure 8AThe encoder 100 shown has a structural composition. The coefficient encoding method in this embodiment is mainly applied to the "entropy encoding unit 115" part of the encoder 100. For the entropy encoding unit 115, an adaptive binary arithmetic encoding mode or a bypass mode based on the context model can be used to entropy encode the relevant identification information (or syntax elements) and then write it into the bitstream.
[0407] It should also be noted that coefficient encoding, as commonly referred to in video standards, can include both encoding and decoding. Therefore, coefficient encoding includes coefficient encoding methods on the encoder side and coefficient decoding methods on the decoder side. This application describes the coefficient encoding method on the encoder side.
[0408] In general, for example, for regular videos, the coefficient encoding method 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, the embodiments of this application can modify the method for deriving the position of the last non-zero coefficient. In this case, the embodiments of this application need to introduce video identification information and the last non-zero coefficient position flipping identification information to determine the position of the last non-zero coefficient, and then encode all coefficients before the position of the last non-zero coefficient in the current block according to the preset scanning order.
[0409] In this embodiment, it is first necessary to determine whether the current video meets preset conditions, which can be represented by video identification information. In some embodiments, determining the video identification information may include:
[0410] If the video meets the preset conditions, then the video identifier information is set to the first value; or,
[0411] If the video does not meet the preset conditions, the value of the video identifier information will be determined to be the second value.
[0412] Here, the first value is 1, and the second value is 0.
[0413] It should be noted that in another specific example, the first value can also be set to true, and the second value can also be set to false. Even in yet another specific example, the first value can be set to 0, and the second value can also be set to 1; or, the first value can be set to false, and the second value can also be set to true. No limitations are imposed here.
[0414] It should also be noted that the preset conditions include at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0415] Furthermore, video identification information can be sequence-level identifiers, or even higher-level identifiers (such as VUI, SEI, etc.). Determining whether a video meets preset conditions can also be done by judging whether the video meets requirements such as high bit width, high bit rate, high quality, or lossless compression. These four cases will be described below as examples.
[0416] In some embodiments, when the video identification information is high-bit width identification information, the method may further include:
[0417] If the video meets the high bit width requirement, then the high bit width identifier information indicates that the video meets the preset conditions.
[0418] In some embodiments, when the video identification information is high bitrate identification information, the method may further include:
[0419] If the video meets the high bitrate requirement, the high bitrate identifier information indicates that the video meets the preset conditions.
[0420] In some embodiments, when the video identification information is high-quality identification information, the method may further include:
[0421] If the video meets the high-quality standard, then the high-quality identification information indicates that the video meets the preset conditions.
[0422] In some embodiments, when the video identification information is lossless compression identification information, the method may further include:
[0423] If the video meets the lossless compression requirement, then the lossless compression identifier indicates that the video meets the preset conditions.
[0424] For example, taking the sequence level as an example, the video identification information can be high bit width identification information (represented by sps_high_bit_depth_flag), used to indicate whether the current video 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 video 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. This application embodiment does not make specific limitations.
[0425] Furthermore, regarding the last non-zero coefficient position flip identifier information, determining the last non-zero coefficient position flip identifier information may include:
[0426] If the current block is flipped using the last non-zero coefficient position, then the value of the last non-zero coefficient position flip flag is determined to be the first value; or,
[0427] If the current block does not use the last non-zero coefficient position to flip, then the value of the last non-zero coefficient position flip flag information is determined to be the second value.
[0428] In this embodiment, the last non-zero coefficient position flip flag can be represented by reverse_last_sig_coeff_flag. Here, the last non-zero coefficient position flip flag can be at least one of the following flags: sequence level, picture level, slice level, and block level; it can even be a higher level flag (such as VUI, SEI, etc.), without any limitation.
[0429] 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 of other levels. In addition, block-level flags may include maximum coding unit (LCU) level flags, coding unit (CU) level flags, or other block-level flags, and the embodiments of this application do not impose any limitations.
[0430] Thus, taking a first value of 1 and a second value of 0 as an example, if it is determined that the current block is flipped using the last non-zero coefficient position, then the value of reverse_last_sig_coeff_flag is 1; or, if it is determined that the current block is not flipped using the last non-zero coefficient position, then the value of reverse_last_sig_coeff_flag is 0.
[0431] Further, 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 top-left corner of the current block, determining the coordinate information of the last non-zero coefficient based on its position and the flipping flag information may include:
[0432] If the value of the flip flag information for the last non-zero coefficient is 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,
[0433] If the value of the flip flag information of the last non-zero coefficient is 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.
[0434] In other words, in some embodiments, the method may further include:
[0435] If the value of the flip flag information for the last non-zero coefficient is 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 bottom right corner of the current block; or,
[0436] If the value of the flip flag information of the last non-zero coefficient is the second value, then the 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 position of the top left corner of the current block.
[0437] In other words, the coordinate information of the last non-zero coefficient is usually the horizontal and vertical distance between the position of the last non-zero coefficient and the top-left corner of the current block. For regular videos, most non-zero coefficients are concentrated in the top-left corner, while a large area in the bottom-right corner is 0. However, for high-bit-width, high-quality, and high-bitrate video encoding and decoding, a large number of non-zero coefficients will also appear in the bottom-right corner, making the coordinate information of the last non-zero coefficient usually larger. In this case, to save overhead, coordinate transformation is required during coefficient encoding (specifically, coordinate flipping calculation, i.e., after coordinate flipping, the 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 bottom-right corner of the current block). Then, in the decoder, coordinate flipping calculation is also required during coefficient decoding. After flipping again, the coordinate information of the last non-zero coefficient can be restored as the horizontal and vertical distance between the position of the last non-zero coefficient and the top-left corner of the current block, thus determining the position of the last non-zero coefficient.
[0438] Furthermore, in some embodiments, the step of calculating and determining the coordinate information of the last non-zero coefficient based on the initial horizontal and initial vertical coordinates of the last non-zero coefficient may include:
[0439] Determine the width and height of the current block;
[0440] The horizontal coordinate of the last non-zero coefficient is obtained by subtracting the width of the current block from the initial horizontal coordinate of the last non-zero coefficient; and the vertical coordinate of the last non-zero coefficient is obtained by subtracting the height of the current block from the initial vertical coordinate of the last non-zero coefficient.
[0441] The coordinate information of the last non-zero coefficient is determined based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0442] It should be noted that the current block here 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 reverse_last_sig_coeff_flag indicates using the last non-zero coefficient position for flipping (that is, the value of reverse_last_sig_coeff_flag is 1),
[0443] LastSignificantCoeffX = (1<<log2ZoTbWidth)-1-LastSignificantCoeffX;
[0444] LastSignificantCoeffY = (1<<log2ZoTbHeight)-1-LastSignificantCoeffY.
[0445] Among them, (LastSignificantCoeffX, LastSignificantCoeffY) on the right side of the equation represents the coordinate information of the directly determined last non-zero coefficient (that is, the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient), and (LastSignificantCoeffX, LastSignificantCoeffY) on the left side of the equation represents the coordinate information of the last non-zero coefficient obtained after coordinate flipping (that is, in the case where the last non-zero coefficient position flipping is used in the current block, the coordinate information of the last non-zero coefficient written into the code stream).
[0446] In some embodiments, writing the coordinate information of the last non-zero coefficient into the code stream may include:
[0447] Determining the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient according to the coordinate information of the last non-zero coefficient;
[0448] Writing 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 code stream.
[0449] 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.
[0450] Thus, this application provides a method for modifying the position of the last non-zero coefficient. That is, under normal circumstances, the coefficient encoding / decoding method is the same as existing methods in related technologies. In some cases, this may refer to high-bit-width, high-quality, or high-bit-rate video encoding / decoding or lossless compressed video. 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. 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.
[0451] Furthermore, when the video identification information indicates that the video meets the preset conditions, it is also possible to default to encoding all coefficients that may need to be encoded. That is, the position of the last non-zero coefficient is no longer used, but all possible non-zero coefficients of the current block are scanned 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 position of the last coefficient is used in the current block.
[0452] In some embodiments, when video identification information indicates that a video meets preset conditions, the method may further include:
[0453] Determine the enable flag information for the last coefficient;
[0454] 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.
[0455] It should be noted that the last coefficient enable flag can be represented by `default_last_coeff_enabled_flag`. In this embodiment, 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.
[0456] It should also be noted that, regarding the last coefficient enable identifier information, in some embodiments, determining the last coefficient enable identifier information may include:
[0457] If the current block uses the last coefficient position, then the value of the last coefficient enable flag is determined to be a first value; or, if the current block does not use the last coefficient position, then the value of the last coefficient enable flag is determined to be a second value.
[0458] 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.
[0459] 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.
[0460] 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.
[0461] In one particular example, the method may further include setting the position of the last non-zero coefficient at the last coefficient position.
[0462] 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.
[0463] 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:
[0464] The width and height of the transformed block are determined after the current block undergoes a preset operation;
[0465] The coordinates of the lower right corner of the transformation block are calculated based on its width and height.
[0466] The position of the last coefficient is determined based on the coordinate information of the lower right corner of the transformation block.
[0467] Here, the default operations include at least the forced zero-out operation.
[0468] It should be noted that (LastCoeffX, LastCoeffY) represents the coordinates of the bottom right corner of the transform block after zero-out; the method for deriving (LastCoeffX, LastCoeffY) is as follows:
[0469] LastCoeffX = (1< <log2ZoTbWidth)-1;LastCoeffY=(1<<log2ZoTbHeight)-1。
[0470] 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).
[0471] 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 coefficients that might be 0 in the current block according to a preset scan order. In some embodiments, the method may further include:
[0472] 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.
[0473] In other words, the position of the last non-zero coefficient can be represented by (LastSignificantCoeffX, LastSignificantCoeffY), which is derived as follows:
[0474] LastSignificantCoeffX=(1< <log2ZoTbWidth)-1;LastSignificantCoeffY=(1<<log2ZoTbHeight)-1。
[0475] 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).
[0476] 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:
[0477] 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.
[0478] 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.
[0479] 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.
[0480] 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; and then write last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix into the bitstream.
[0481] 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.
[0482] Furthermore, when the video identifier information indicates that the video meets preset conditions, all scanned sub-blocks can be assumed to require encoding 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, thereby 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 default encoded.
[0483] In some embodiments, when video identification information indicates that a video meets preset conditions, the method may further include:
[0484] Determine the default encoding identifier information of the sub-blocks to be encoded within the current block;
[0485] 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.
[0486] It should be noted that the default identifier information for sub-blocks can be represented by default_sb_coded_flag. In the embodiments of this application, the default encoding identifier information for sub-blocks is at least one of the following: sequence level, image level, slice level, and block level; it can even be higher-level identifier information (such as VUI, SEI, etc.), without any limitation here.
[0487] It should also be noted that, regarding the sub-block default identifier information, in some embodiments, determining the sub-block default encoding identifier information of the sub-block to be encoded may include:
[0488] If the sub-block to be encoded uses the default encoding, then the default encoding identifier information for the sub-block is determined to be the first value; or,
[0489] If the sub-block to be encoded does not have a default encoding, then the default encoding identifier information of the sub-block is determined to be the second value.
[0490] 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 decoded 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 decoded does not need to be encoded by default, then the value of default_sb_coded_flag is 0.
[0491] When the sub-block to be decoded 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 decoded 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.
[0492] Furthermore, in some embodiments, determining the sub-block encoding identifier information of the sub-block to be encoded may include:
[0493] If encoding is required within a sub-block, then the sub-block encoding identifier information is set to the first value; or,
[0494] If all coefficients within a sub-block are zero, then the sub-block encoding identifier information is determined to be the second value.
[0495] 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.
[0496] 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.
[0497] This embodiment also provides a coefficient encoding method applied to an encoder. It involves determining video identification information and the position of the last non-zero coefficient; when the video identification information indicates that the video meets preset conditions, determining the flipping flag information of the last non-zero coefficient position; determining the coordinate information of the last non-zero coefficient based on its position and the flipping flag information; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order; and writing the encoded bit information, video identification information, and coordinate information of the last non-zero coefficient into the bitstream. In this way, in high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding scenarios, since the coefficient distribution pattern differs from that of conventional video scenarios, coefficient encoding can reduce or even eliminate the number of syntax elements in context mode encoding, such as syntax elements related to the position of the last non-zero coefficient and sub-block encoding flags. It can even perform coordinate transformation when the coordinate information of the last non-zero coefficient is too large, thereby reducing the overhead of encoding in the bitstream and improving the throughput and encoding speed of coefficient encoding. Furthermore, since the reduced or eliminated syntax elements have a relatively small impact on high-bit-width, high-bit-rate, high-quality, or lossless video encoding, compression efficiency can also be improved.
[0498] 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,
[0499] The first determining unit 1201 is configured to determine video identification information and the position of the last non-zero coefficient; and when the video identification information indicates that the video meets preset conditions, determine the position of the last non-zero coefficient and flip the identification information.
[0500] The first determining unit 1201 is further configured to determine the coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the flipping identifier information of the position of the last non-zero coefficient.
[0501] 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, video identification information and coordinate information of the last non-zero coefficient into the bit stream.
[0502] In some embodiments, the first determining unit 1201 is further configured to determine the value of the video identification information as a first value if the video meets the preset conditions; or, if the video does not meet the preset conditions, determine the value of the video identification information as a second value.
[0503] In some embodiments, the preset conditions include at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0504] In some embodiments, the first determining unit 1201 is further configured to determine the value of the last non-zero coefficient position flipping identifier information as a first value if the current block uses the last non-zero coefficient position flipping; or, if the current block does not use the last non-zero coefficient position flipping, determine the value of the last non-zero coefficient position flipping identifier information as a second value.
[0505] 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.
[0506] Accordingly, the first determining unit 1201 is further configured to, if the value of the last non-zero coefficient position flipping identifier information is a first value, calculate and determine the coordinate information of the last non-zero coefficient based on the initial horizontal coordinate and initial vertical coordinate of the last non-zero coefficient; or, if the value of the last non-zero coefficient position flipping identifier information is a second value, directly determine the coordinate information of the last non-zero coefficient based on the initial horizontal coordinate and initial vertical coordinate of the last non-zero coefficient.
[0507] In some embodiments, the first determining unit 1201 is further configured to: 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; 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.
[0508] 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 value of the last non-zero coefficient position flip identifier information is a first value; or, if the value of the last non-zero coefficient position flip identifier information is a second value, the coordinate information of the last non-zero coefficient is the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner of the current block.
[0509] In some embodiments, the encoding unit 1202 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 suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient; and to 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.
[0510] In some embodiments, the last non-zero coefficient position flip identifier information is at least one of the following identifier information: sequence level, image level, slice level, and block level.
[0511] In some embodiments, the first determining unit 1201 is further configured to determine the last coefficient enabling identifier information when the video identifier information indicates that the video meets the preset conditions;
[0512] The encoding unit 1202 is also configured to encode all coefficients before the last coefficient position according to a preset scanning order when the last coefficient enable flag indicates that the current block uses the last coefficient position, and write the encoded bit information, video flag information and last coefficient enable flag information into the bit stream.
[0513] 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.
[0514] 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.
[0515] 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.
[0516] In some embodiments, the first determining unit 1201 is further configured to determine the width and height of the transformed block obtained by the current block after a preset operation; perform coordinate calculation based on the width and height of the transformed block to obtain the lower right corner coordinate information of the transformed block; and determine the position of the last coefficient based on the lower right corner coordinate information of the transformed block.
[0517] In some embodiments, the preset operation includes at least a forced zero-out operation.
[0518] 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.
[0519] In some embodiments, the first determining unit 1201 is further configured to determine, when the current block does not use the position of the last 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; 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.
[0520] 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.
[0521] In some embodiments, the last coefficient enable identifier is at least one of the following identifiers: sequence level, image level, slice level, and block level.
[0522] 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 in the current block when the video identifier information indicates that the video meets the preset conditions;
[0523] The encoding unit 1202 is further 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 encoded bit information and the sub-block default encoding identifier information into the bit stream.
[0524] 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 and write the sub-block encoding identifier information into the bitstream when the sub-block default encoding identifier information indicates that the sub-block to be encoded is not encoded by default.
[0525] 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.
[0526] 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.
[0527] In some embodiments, the sub-block default encoding identification information is at least one of the following: sequence level, image level, slice level, and block level identification information.
[0528] In some embodiments, the first value is 1 and the second value is 0.
[0529] In some embodiments, the first determining unit 1201 is further configured to determine that the high bit width identifier information indicates that the video meets the preset conditions if the video meets the high bit width requirement when the video identifier information is high bit width identifier information.
[0530] In some embodiments, the first determining unit 1201 is further configured to determine that the high bitrate identification information indicates that the video meets preset conditions if the video meets the high bitrate requirement when the video identification information is high bitrate identification information.
[0531] In some embodiments, the first determining unit 1201 is further configured to determine that the high-quality identification information indicates that the video meets preset conditions if the video meets the high-quality requirement when the video identification information is high-quality identification information.
[0532] In some embodiments, the first determining unit 1201 is further configured to determine that the lossless compression identifier indicates that the video meets preset conditions if the video meets lossless compression when the video identifier information is lossless compression identifier information.
[0533] 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.
[0534] 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.
[0535] 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.
[0536] 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,
[0537] 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;
[0538] The first memory 1302 is used to store computer programs that can run on the first processor 1303;
[0539] The first processor 1303 is configured to, when running the computer program, execute:
[0540] Determine the video identification information and the position of the last non-zero coefficient;
[0541] When the video identification information indicates that the video meets the preset conditions, the last non-zero coefficient position is flipped.
[0542] Based on the position of the last non-zero coefficient and the flipping information of the last non-zero coefficient position, determine the coordinate information of the last non-zero coefficient;
[0543] All coefficients before the last non-zero coefficient are encoded according to the preset scanning order, and the encoded bit information, video identification information, and coordinate information of the last non-zero coefficient are written into the bitstream.
[0544] It is understood that the first memory 1302 in this embodiment 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.
[0545] 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.
[0546] 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.
[0547] Alternatively, as another embodiment, the first processor 1303 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0548] 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, since the coefficient distribution pattern differs from that in conventional video scenarios, reducing or even eliminating the number of syntax elements in context mode encoding in coefficient encoding can reduce the overhead of encoding in the bitstream, thereby improving the throughput and encoding / decoding speed of coefficient encoding. Furthermore, since the reduced or eliminated syntax elements have a relatively small impact on high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.
[0549] 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,
[0550] The parsing unit 1401 is configured to parse the bitstream and obtain video identification information; and when the video identification information indicates that the video meets preset conditions, it parses the bitstream and obtains the flipping identification information of the last non-zero coefficient position and the coordinate information of the last non-zero coefficient.
[0551] The second determining unit 1402 is configured to calculate the coordinate information of the last non-zero coefficient and determine the position of the last non-zero coefficient when the last non-zero coefficient position flipping identifier information indicates that the current block is flipped using the last non-zero coefficient position.
[0552] 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.
[0553] In some embodiments, the second determining unit 1402 is further configured to directly determine the position of the last non-zero coefficient based on the coordinate information of the last non-zero coefficient when the last non-zero coefficient position flipping identifier information indicates that the current block does not use the last non-zero coefficient position flipping.
[0554] 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.
[0555] In some embodiments, the second determining unit 1402 is further configured to determine that if the video identification information is a first value, the video identification information indicates that the video meets the preset conditions; or, if the video identification information is a second value, the video identification information indicates that the video does not meet the preset conditions.
[0556] In some embodiments, the preset conditions include at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
[0557] In some embodiments, the second determining unit 1402 is further configured to determine that if the value of the last non-zero coefficient position flipping identifier information is a first value, the last non-zero coefficient position flipping identifier information indicates that the current block uses the last non-zero coefficient position flipping; or, if the value of the last non-zero coefficient position flipping identifier information is a second value, the last non-zero coefficient position flipping identifier information indicates that the current block does not use the last non-zero coefficient position flipping.
[0558] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream 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.
[0559] 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 based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0560] In some embodiments, the second determining unit 1402 is further configured to determine the coordinate information of the last non-zero coefficient as the horizontal and vertical distance between the position of the last non-zero coefficient and the lower right corner of the current block when the last non-zero coefficient position flipping identifier information indicates that the current block is flipped using the last non-zero coefficient position.
[0561] Furthermore, the second determining unit 1402 is also configured to determine the width and height of the current block; calculate the horizontal coordinate of the last non-zero coefficient by subtracting 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; calculate the vertical coordinate of the last non-zero coefficient by subtracting 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; and determine the position of the last non-zero coefficient based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient.
[0562] In some embodiments, the second determining unit 1402 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 upper left corner of the current block when the last non-zero coefficient position flipping identifier information indicates that the current block does not use the last non-zero coefficient position flipping; and to determine the position of the last non-zero coefficient based on the horizontal and vertical distances between the position of the last non-zero coefficient and the upper left corner of the current block.
[0563] In some embodiments, the last non-zero coefficient position flipping identifier information is at least one of the following identifier information: sequence level, picture level, slice level, and block level.
[0564] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream to obtain the last coefficient enable identifier information; and when the last coefficient enable identifier information indicates that the current block uses the last coefficient position, to decode all coefficients before the last coefficient position according to a preset scanning order to determine the coefficients of the current block.
[0565] 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.
[0566] 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.
[0567] 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; and 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.
[0568] 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.
[0569] 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.
[0570] 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.
[0571] In some embodiments, the preset operation includes at least a forced zero-out operation.
[0572] 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.
[0573] In some embodiments, the last coefficient enable identifier is at least one of the following identifiers: sequence level, image level, slice level, and block level.
[0574] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and obtain the sub-block default encoding identifier information when the video identifier information indicates that the video meets the preset conditions; and to determine the value of the sub-block encoding identifier information as the first value when the sub-block default encoding identifier information indicates the default encoding of the sub-block to be decoded in the current block, and to decode all coefficients in the sub-block to be decoded.
[0575] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream and obtain the sub-block encoding identifier information when the sub-block default encoding identifier information indicates that the sub-block to be decoded 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.
[0576] 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 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 is not encoded by default.
[0577] 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.
[0578] In some embodiments, the sub-block default encoding identification information is at least one of the following: sequence level, image level, slice level, and block level identification information.
[0579] In some embodiments, the first value is 1 and the second value is 0.
[0580] In some embodiments, the second determining unit 1402 is further configured to determine that the video meets the preset conditions if the high bit width identifier information indicates that the video meets the high bit width when the video identifier information is high bit width identifier information.
[0581] In some embodiments, the second determining unit 1402 is further configured to determine that the video meets the preset conditions if the high bitrate identification information indicates that the video meets the high bitrate when the video identification information is high bitrate identification information.
[0582] In some embodiments, the second determining unit 1402 is further configured to determine that the video meets preset conditions if the high-quality identification information indicates that the video meets high quality when the video identification information is high-quality identification information.
[0583] In some embodiments, the second determining unit 1402 is further configured to determine that the video meets the preset conditions if the lossless compression identification information indicates that the video meets lossless compression when the video identification information is lossless compression identification information.
[0584] 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.
[0585] 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.
[0586] Therefore, this application provides a computer storage medium applied to a decoder 140, 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.
[0587] 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,
[0588] 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;
[0589] The second memory 1502 is used to store computer programs that can run on the second processor 1503;
[0590] The second processor 1503 is configured to, when running the computer program, perform:
[0591] Parse the bitstream to obtain video identifier information;
[0592] When the video identifier information indicates that the video meets the preset conditions, the bitstream is parsed to obtain the flip identifier information of the last non-zero coefficient position and the coordinate information of the last non-zero coefficient.
[0593] When the last non-zero coefficient position flipping flag indicates that the current block is flipped using the last non-zero coefficient position, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient.
[0594] Decode all coefficients before the last non-zero coefficient in the preset scanning order to determine the coefficients of the current block.
[0595] 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.
[0596] 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.
[0597] 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 scenarios, because the coefficient distribution differs from conventional video encoding and decoding scenarios, reducing or even eliminating the number of syntax elements in context mode encoding in coefficient coding can reduce the overhead of encoding in the bitstream, thereby improving the throughput and encoding / decoding speed of coefficient coding. Furthermore, since the reduced or eliminated syntax elements have a relatively small impact on high-bit-width, high-bit-rate, high-quality, or lossless video encoding and decoding, compression efficiency can also be improved.
[0598] 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.
[0599] 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.
[0600] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0601] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0602] 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.
[0603] 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.
[0604] Industrial applicability
[0605] In this embodiment, whether it is the encoder or the decoder, in high-bit-width, high-bit-rate, high-quality or lossless video encoding and decoding scenarios, the coefficient distribution pattern is different from that of conventional video scenarios. In coefficient encoding, the number of syntax elements in context mode encoding can be reduced or even eliminated, such as syntax elements about the position of the last non-zero coefficient, sub-block encoding identifiers, etc. Even when the coordinate information of the last non-zero coefficient is too large, coordinate transformation can be performed, thereby reducing the overhead of encoding in the bitstream and improving the throughput and encoding / decoding speed of coefficient encoding. In addition, since the reduced or eliminated syntax elements have little impact on high-bit-width, high-bit-rate, high-quality or lossless video encoding and decoding, compression efficiency can also be improved.
Claims
1. A coefficient decoding method, applied to a decoder, the method comprising: Parse the bitstream to obtain sequence-level identifier information; When the sequence-level identifier information indicates that the video meets the preset conditions, the bitstream is parsed to obtain the flip identifier information of the last non-zero coefficient position. 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. 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 of the vertical coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient. The coordinate information of the last non-zero coefficient is determined based on the horizontal coordinate and the vertical coordinate of the last non-zero coefficient. When the last non-zero coefficient position flipping identifier information indicates that the current block is flipped using the last non-zero coefficient position, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient; Decode all coefficients before the last non-zero coefficient according to a preset scanning order to determine the coefficients of the current block. The value of the horizontal coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX= last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX= (1<<((last_sig_coeff_x_prefix>>1)-1)) * (2+(last_sig_coeff_x_prefix&1)) + last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX = (1< <log2ZoTbWidth)-1-LastSignificantCoeffX; The value of the vertical coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY= last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY= (1<<((last_sig_coeff_y_prefix>>1)-1)) * (2+(last_sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY, Wherein, LastSignificantCoeffX represents the horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scan order, LastSignificantCoeffY represents the vertical coordinate value of the last non-zero coefficient in the current block according to the preset scan order, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_prefix represents the prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position flipping flag information of the last non-zero coefficient.
2. The method according to claim 1, wherein, The method further includes: When the last non-zero coefficient position flipping identifier indicates that the current block does not use the last non-zero coefficient position flipping, the position of the last non-zero coefficient is directly determined according to the coordinate information of the last non-zero coefficient; The coefficients of the current block are determined by decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order.
3. The method according to claim 1, wherein, The method further includes: If the sequence-level identifier information takes the first value, then it is determined that the sequence-level identifier information indicates that the video meets the preset conditions; or, If the sequence-level identifier information takes the second value, then it is determined that the sequence-level identifier information indicates that the video does not meet the preset conditions.
4. The method according to claim 3, wherein, The preset conditions include at least one of the following: high bit width, high quality, high bit rate, high frame rate, and lossless compression.
5. The method according to claim 1, wherein, The method further includes: If the value of the last non-zero coefficient position flip identifier is the first value, then it is determined that the last non-zero coefficient position flip identifier indicates that the current block uses the last non-zero coefficient position for flipping; or, If the value of the last non-zero coefficient position flip identifier is the second value, then it is determined that the last non-zero coefficient position flip identifier indicates that the current block does not use the last non-zero coefficient position flip.
6. A coefficient encoding method applied to an encoder, the method comprising: Determine the sequence-level identifier information and the position of the last non-zero coefficient; When the sequence-level identification information indicates that the video meets the preset conditions, the flip identification information of the last non-zero coefficient position is determined; Based on the position of the last non-zero coefficient and the flipping identifier information of the last non-zero coefficient position, determine the coordinate information of the last non-zero coefficient; 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. All coefficients preceding the position of the last non-zero coefficient are encoded according to a preset scanning order. The encoded bit information, the sequence-level identifier information, 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. The value of the horizontal coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX= last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX= (1<<((last_sig_coeff_x_prefix>>1)-1)) * (2+(last_sig_coeff_x_prefix&1)) + last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX = (1< <log2ZoTbWidth)-1-LastSignificantCoeffX; The value of the vertical coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY= last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY= (1<<((last_sig_coeff_y_prefix>>1)-1)) * (2+(last_sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY, Wherein, LastSignificantCoeffX represents the horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scan order, LastSignificantCoeffY represents the vertical coordinate value of the last non-zero coefficient in the current block according to the preset scan order, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_prefix represents the prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position flipping flag information of the last non-zero coefficient.
7. The method according to claim 6, wherein, The determination of sequence-level identifier information includes: If the video meets the preset conditions, then the value of the sequence-level identifier information is determined to be a first value; or, If the video does not meet the preset conditions, then the value of the sequence-level identifier information is determined to be the second value.
8. An encoder, the encoder comprising a first determining unit and an encoding unit; wherein, The first determining unit is configured to determine sequence-level identification information and the position of the last non-zero coefficient; and when the sequence-level identification information indicates that the video meets a preset condition, to determine the flipping identification information of the last non-zero coefficient position. The first determining unit is further configured to determine the coordinate information of the last non-zero coefficient based on the position of the last non-zero coefficient and the flipping identifier information of the position of the last non-zero coefficient; The first determining unit 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. 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, the sequence-level identifier information, 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. The value of the horizontal coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX= last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX= (1<<((last_sig_coeff_x_prefix>>1)-1)) * (2+(last_sig_coeff_x_prefix&1)) + last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX = (1< <log2ZoTbWidth)-1-LastSignificantCoeffX; The value of the vertical coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY= last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY= (1<<((last_sig_coeff_y_prefix>>1)-1)) * (2+(last_sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY, Wherein, LastSignificantCoeffX represents the horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scan order, LastSignificantCoeffY represents the vertical coordinate value of the last non-zero coefficient in the current block according to the preset scan order, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_prefix represents the prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position flipping flag information of the last non-zero coefficient.
9. A decoder, the decoder comprising a parsing unit and a determining unit; wherein, The parsing unit is configured as follows: Parse the bitstream to obtain sequence-level identifier information; When the sequence-level identifier information indicates that the video meets the preset conditions, the bitstream is parsed to obtain the flip identifier information of the last non-zero coefficient position. 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. The second determining unit is configured to calculate the coordinate information of the last non-zero coefficient and determine the position of the last non-zero coefficient when the last non-zero coefficient position flipping identifier information indicates that the current block is flipped using the last non-zero coefficient position; The parsing unit is further configured to decode all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine the coefficients of the current block. The value of the horizontal coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX= last_sig_coeff_x_prefix; If last_sig_coeff_x_suffix exists, then LastSignificantCoeffX= (1<<((last_sig_coeff_x_prefix>>1)-1)) * (2+(last_sig_coeff_x_prefix&1)) + last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX = (1< <log2ZoTbWidth)-1-LastSignificantCoeffX; The value of the vertical coordinate of the last non-zero coefficient in the current block according to the preset scan order is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY= last_sig_coeff_y_prefix; If last_sig_coeff_y_suffix exists, then LastSignificantCoeffY= (1<<((last_sig_coeff_y_prefix>>1)-1)) * (2+(last_sig_coeff_y_prefix&1)) + last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1< <log2ZoTbHeight)-1-LastSignificantCoeffY, Wherein, LastSignificantCoeffX represents the horizontal coordinate value of the last non-zero coefficient in the current block according to the preset scan order, LastSignificantCoeffY represents the vertical coordinate value of the last non-zero coefficient in the current block according to the preset scan order, last_sig_coeff_x_prefix represents the prefix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_prefix represents the prefix information of the vertical coordinate of the last non-zero coefficient, last_sig_coeff_x_suffix represents the suffix information of the horizontal coordinate of the last non-zero coefficient, last_sig_coeff_y_suffix represents the suffix information of the vertical coordinate of the last non-zero coefficient, and reverse_last_sig_coeff_flag represents the position flipping flag information of the last non-zero coefficient.
10. A computer storage medium storing a computer program and a bit stream thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the coefficient encoding method of claim 6 or 7 to generate the bit stream.