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

By optimizing the coefficient encoding and decoding process, determining the position and flipping identifier information of the last non-zero coefficient, and reducing context mode encoding syntax elements, 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.

CN121397243APending Publication Date: 2026-01-23GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511710839.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2021-04-12
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

Existing high-bit-width, high-bit-rate, and high-quality video encoding and decoding schemes have significant overhead in coefficient encoding, affecting encoding and decoding speed and throughput, and have low compression efficiency.

Method used

By determining the position and flipping information of the last non-zero coefficient when the video identification information meets the preset conditions, the coefficients are encoded and decoded according to the preset scanning order, reducing or eliminating the syntax elements of context mode encoding, and even performing coordinate transformation when the coordinate information of the last non-zero coefficient is too large, thus optimizing the coefficient encoding process.

Benefits of technology

It improves the throughput and encoding/decoding speed of coefficient encoding, while also enhancing compression efficiency and reducing overhead in the bitstream.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121397243A_ABST
    Figure CN121397243A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a coefficient encoding and decoding method, an encoder, a decoder and a computer storage medium, and the method comprises the steps: analyzing a code stream, and obtaining video identification information; when the video identification information indicates that the video meets a preset condition, analyzing the code stream, and obtaining position overturning identification information of the last non-zero coefficient and coordinate information of the last non-zero coefficient; when the last non-zero coefficient position overturning identification information indicates that the last non-zero coefficient position overturning is used, coordinate information of the last non-zero coefficient is calculated, and the position of the last non-zero coefficient is determined; and decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning-depicting sequence, and determining the coefficient of the current block. Therefore, in a high bit width, high bit rate, high quality or lossless video coding and decoding scene, the throughput and coding and decoding speed of coefficient coding are improved, and the compression efficiency is also improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of video coding, and particularly relate to a coefficient coding method, an encoder, a decoder and a computer storage medium. BACKGROUND

[0002] With the increasing demand for video display quality, the field of computer vision has received more and more attention. In recent years, image processing technology has been successfully applied in various industries. For the coding process of a video image, at the encoding end, after the image data to be encoded is transformed and quantized, it is compressed and encoded by an entropy coding unit, and the code stream generated after the entropy coding process is transmitted to the decoding end. Then the code stream is parsed, and after inverse quantization and inverse transformation processing, the original input image data can be recovered.

[0003] At present, high bit width, high quality, high code rate video coding (referred to as "three high video") usually requires more coefficients to be coded, and the coefficients are larger, compared with lower bit width, lower quality, lower code rate video coding (referred to as "regular video"). Thus, for three high video, the existing related solutions may bring greater overhead, waste, and even affect the coding speed and throughput. SUMMARY

[0004] Embodiments of the present application provide a coefficient coding method, an encoder, a decoder and a computer storage medium, which can improve the throughput and coding speed of coefficient coding in the field of high bit width, high code rate, high quality or lossless video coding, and also improve the compression efficiency.

[0005] The technical solution of the embodiments of the present application can be implemented as follows: In a first aspect, the embodiments of the present application provide a coefficient decoding method applied to a decoder, which comprises: parsing a code stream to obtain video identification information; when the video identification information indicates that the video meets a preset condition, parsing the code stream to obtain last non-zero coefficient position flipping identification information and coordinate information of the last non-zero coefficient; when the last non-zero coefficient position flipping identification information indicates that the current block uses last non-zero coefficient position flipping, calculating the coordinate information of the last non-zero coefficient to determine the position of the last non-zero coefficient; 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.

[0006] In a second aspect, the embodiments of the present application provide a coefficient coding method applied to an encoder, which comprises: determine the position of the last non-zero coefficient and video identification information; determine last non-zero coefficient position flip identification information when the video identification information indicates that the video satisfies a preset condition; determine coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information; encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write the bit information obtained after encoding, the video identification information, and the coordinate information of the last non-zero coefficient into a bitstream.

[0007] In a third aspect, an encoder is provided, which includes a first determining unit and an encoding unit; wherein, The first determining unit is configured to determine the position of the last non-zero coefficient and video identification information, and determine last non-zero coefficient position flip identification information when the video identification information indicates that the video satisfies a preset condition. The first determining unit is further configured to determine coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information. 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 bit information obtained after encoding, the video identification information, and the coordinate information of the last non-zero coefficient into a bitstream.

[0008] In a fourth aspect, an encoder is provided, which includes a first memory and a first processor; wherein, The first memory is configured to store a computer program capable of running on the first processor. The first processor is configured to execute the method in the second aspect when running the computer program.

[0009] In a fifth aspect, a decoder is provided, which includes a parsing unit and a second determining unit; wherein, The parsing unit is configured to parse a bitstream to obtain video identification information, and parse the bitstream to obtain last non-zero coefficient position flip identification information and coordinate information of the last non-zero coefficient when the video identification information indicates that the video satisfies a preset condition. The second determining unit is configured to calculate the coordinate information of the last non-zero coefficient to determine the position of the last non-zero coefficient when the last non-zero coefficient position flip identification information indicates that the current block uses last non-zero coefficient position flipping. The parsing unit is further configured to decode all coefficients before the position of the last non-zero coefficient in a preset scanning order to determine the coefficients of the current block.

[0010] In a sixth aspect, an embodiment of the present application provides a decoder, which comprises a second memory and a second processor; wherein, The second memory is configured to store a computer program capable of running on the second processor. The second processor is configured to execute the method in the first aspect when running the computer program.

[0011] In a seventh aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program, and the computer program is executed to implement the method in the first aspect or the method in the second aspect.

[0012] The embodiments of the present application provide a coefficient coding 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, last non-zero coefficient position flip identification information is determined; according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information, coordinate information of the last non-zero coefficient is determined; all coefficients before the position of the last non-zero coefficient are encoded in a preset scanning order, and the bit information obtained after encoding, the video identification information and the coordinate information of the last non-zero coefficient are written into a bitstream. In the decoder, the bitstream is parsed to obtain the video identification information; when the video identification information indicates that the video meets the preset condition, the bitstream is parsed to obtain the last non-zero coefficient position flip identification information and the coordinate information of the last non-zero coefficient; when the last non-zero coefficient position flip identification information indicates that the current block uses the last non-zero coefficient position flip, 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 in a preset scanning order to determine the coefficients of the current block. In this way, in the video coding scene of high bit width, high code rate, high quality or lossless, because the coefficient distribution law is different from that in the conventional video scene, the number of syntax elements, such as the syntax elements about the position of the last non-zero coefficient and the sub-block coding identification, is reduced or even eliminated in the coefficient coding, and even the coordinate transformation can be performed when the value of the coordinate information of the last non-zero coefficient is large, so that the overhead caused by coding in the bitstream can be reduced, and then the throughput and coding speed of the coefficient coding are improved; in addition, because the reduced or eliminated syntax elements have less impact in the video coding scene of high bit width, high code rate, high quality or lossless, the compression efficiency can also be improved. BRIEF DESCRIPTION OF DRAWINGS

[0013] Figure 1 An application diagram of an encoding framework provided by the related art; Figure 2 A position relationship diagram of a current coefficient and a neighboring coefficient provided by the related art; Figure 3 A flow diagram of a bin arithmetic decoding process provided by the related art; Figure 4 A flow diagram of a binary symbol arithmetic decoding process provided by the related art; Figure 5 A flow diagram of renormalization of an arithmetic decoding engine provided by the related art; Figure 6 A flow diagram of a bypass decoding process provided by the related art; Figure 7 A position relationship diagram of a possible non-zero coefficient region and a forced zero region provided by the related art; Figure 8A A system composition diagram of an encoder provided by an embodiment of the present application; Figure 8B A system composition diagram of a decoder provided by an embodiment of the present application; Figure 9 A flow diagram of a coefficient decoding method provided by an embodiment of the present application; Figure 10A A position diagram of a position of a last non-zero coefficient relative to a position of a top-left corner of a current block provided by an embodiment of the present application; Figure 10B A position diagram of a position of a last non-zero coefficient relative to a position of a bottom-right corner of a current block provided by an embodiment of the present application; Figure 11 A flow diagram of a coefficient encoding method provided by an embodiment of the present application; Figure 12 A composition structure diagram of an encoder provided by an embodiment of the present application; Figure 13 A specific hardware structure diagram of an encoder provided by an embodiment of the present application; Figure 14 A composition structure diagram of a decoder provided by an embodiment of the present application; Figure 15 A specific hardware structure diagram of a decoder provided by an embodiment of the present application. DETAILED DESCRIPTION

[0014] In order to enable a person skilled in the art to have a better understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application will be described in detail below with reference to the drawings, and the drawings are only used for reference and are not intended to limit the embodiments of the present application.

[0015] 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 in the description herein is for describing the embodiments of the present application only and is not intended to limit the present application.

[0016] In the following description, “some embodiments” are described, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict. It should also be noted that the terms “first\second\third” involved in the embodiments of the present application are only used to distinguish similar objects, and do not represent a specific order of the objects. It can be understood that “first\second\third” can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0017] In a video image, a first image component, a second image component and a third image component are generally used to represent a coding block (CB); wherein the three image components are a luminance component, a blue chroma component and a red chroma component respectively, specifically, the luminance component is usually represented by the symbol Y, the blue chroma component is usually represented by the symbol Cb or U, and the red chroma component is usually represented by the symbol Cr or V; in this way, the video image can be represented in YCbCr format or YUV format.

[0018] Before the embodiments of the present application are further described in detail, the terms and phrases involved in the embodiments of the present application are explained, and the terms and phrases involved in the embodiments of the present application are applicable to the following explanations: Moving Picture Experts Group (MPEG) International Standardization Organization (ISO) International Electrotechnical Commission (IEC) Joint Video Experts Team (JVET) Alliance for Open Media (AOM) New generation video coding standard H.266 / Versatile Video Coding (VVC) Reference software test platform of VVC (VVC Test Model, VTM) Audio Video Standard (AVS) High-Performance Model (HPM) of AVS Context-based Adaptive Binary Arithmetic Coding (CABAC) Regular Residual Coding (RRC) Transform Skip Residual Coding (TSRC) It can be understood that the current common video coding standard (such as VVC) all adopts a block-based hybrid coding framework. Each frame in a video image is divided into square maximum coding units (LCU) of the same size (such as 128x128, 64x64, etc.), and each maximum coding unit can also be divided into rectangular coding units (CU) according to rules; and the coding unit can also be divided into smaller prediction units (PU), transform units (TU), etc. Specifically, as shown in FIG. 1, a video image is divided into LCU, and each LCU is further divided into CU according to rules. Each CU can be further divided into PU, TU, etc. according to rules. Figure 1As shown, the hybrid coding framework can include modules such as Prediction, Transform, Quantization, Entropy Coding, In Loop Filter, etc. Among them, the prediction module can include Intra Prediction and Inter Prediction, and the Inter Prediction can include Motion Estimation and Motion Compensation. Due to the strong correlation between adjacent pixels in a frame of video image, the Intra Prediction is used in video coding technology to eliminate the spatial redundancy between adjacent pixels; but due to the strong similarity between adjacent frames in video image, the Inter Prediction is used in video coding technology to eliminate the temporal redundancy between adjacent frames, thereby improving the coding efficiency.

[0019] The basic process of the video codec is as follows: in the encoder, a frame of image is divided into blocks, Intra Prediction or Inter Prediction is used for the current block to generate a prediction block of the current block, the original block of the current block is subtracted from the prediction block to obtain a residual block, the residual block is transformed and quantized to obtain a quantized coefficient matrix, and the quantized coefficient matrix is entropy coded and output to the bitstream. In the decoder, Intra Prediction or Inter Prediction is used for the current block to generate a prediction block of the current block, and on the other hand, the quantized coefficient matrix is obtained by decoding the bitstream, the quantized coefficient matrix is dequantized and inverse transformed to obtain a residual block, and the prediction block and the residual block are added to obtain a reconstructed block. The reconstructed block constitutes a reconstructed image, and the reconstructed image is loop filtered based on the image or based on the block to obtain a decoded image. The encoder also needs similar operations as the decoder to obtain the decoded image. The decoded image can be used as a reference frame for Inter Prediction of subsequent frames. The block division information, prediction, transform, quantization, entropy coding, loop filtering mode information or parameter information determined by the encoder need to be output to the bitstream if necessary; then the decoder determines the same block division information, prediction, transform, quantization, entropy coding, loop filtering mode information or parameter information by analyzing the existing information, so as to ensure that the decoded image obtained by the encoder is the same as the decoded image obtained by the decoder. The decoded image obtained by the encoder is also called a reconstructed image. The current block can be divided into a prediction unit when predicting, and the current block can be divided into a transform unit when transforming, and the division of the prediction unit and the transform unit can be different. The above is the basic process of the video encoder and decoder under the block-based hybrid coding framework, and some modules or steps of the framework or process can be optimized with the development of technology. The embodiments of the present application are applicable to the basic process of the video codec under the block-based hybrid coding framework, but are not limited to the framework and process.

[0020] The current block can be a current coding unit (CU), a current prediction unit (PU), or a current transform unit (TU), etc.

[0021] Among them, the block partition information, the various modes and parameter information of prediction, transformation, quantization, and the coefficients are written into the code stream through entropy coding. Assuming that the probabilities of different elements are different, shorter code words are allocated to elements with higher probabilities, and longer code words are allocated to elements with lower probabilities, which can obtain higher coding efficiency than fixed-length coding. However, if the probabilities of different elements are similar or basically the same, the compression space of entropy coding is limited. CABAC is a commonly used entropy coding method, and HEVC and VVC 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 make the operation more complex. There is a bypass mode in CABAC, which does not need to use and update the context model, and can achieve higher throughput. In the embodiments of the present application, the mode in which the context model needs to be used and updated in CABAC can be called a context mode.

[0022] Generally, the context model needs to be determined according to the defined method, and the parameters of the context model can be used as input when calling the arithmetic decoding process of the defined binary symbol. The selection of the context model also has a dependency relationship between adjacent coefficients. For example, Figure 2 A schematic diagram of the position relationship between a current coefficient and adjacent coefficients provided by the related art is shown. In Figure 2 , the black filled block represents the current coefficient, and the grid line filled block represents the adjacent coefficient; as Figure 2 shown, the selection of the context model of sig_coeff_flag of the current coefficient needs to be determined according to the information of the 5 coefficients adjacent to the right and the bottom and the lower right of the current coefficient. According to 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.

[0023] For the arithmetic coding engine of CABAC, if the context mode needs to be used, the arithmetic decoding process of the defined binary symbol needs to be called, which includes the state transition process, that is, the updating of the context model. The renormalization process of the arithmetic decoding engine will be called in the arithmetic decoding process of the binary symbol. The bypass decoding process needs to be called when the bypass mode is used.

[0024] Next, taking the use of CABAC in VVC as an example for introduction: For the arithmetic coding engine of CABAC, the input of the arithmetic decoding process is ctxTable, ctxIdx, bypassFlag, and the state variables ivlCurrRange and ivlOffset of the arithmetic decoding engine, and the output of the arithmetic decoding process is the value of bin.

[0025] where ctxTable is the table used when selecting the context mode, and ctxIdx is the context model index.

[0026] Figure 3 A flowchart of a bin arithmetic decoding process provided by the related art is shown. As shown in Figure 3 To decode the value of bin, the context index table ctxTable, ctxIdx, bypassFlag are transmitted as input to the arithmetic decoding process DecodeBin(ctxTable, ctxIdx, bypassFlag), as follows: If the value of bypassFlag is 1, the bypass decoding process DecodeBypass() is called; Otherwise, if the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, DecodeTerminate() is called; Otherwise (the value of bypassFlag is 0 and the value of ctxTable is not 0), the arithmetic decoding process DecodeDecision(ctxTable, ctxIdx) of the defined binary symbol is called.

[0027] Further, for the arithmetic decoding process of the binary symbol, the input of the process is 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.

[0028] Figure 4 A flowchart of a binary symbol arithmetic decoding process provided by the related art is shown. As shown in Figure 4 where pStateIdx0 and pStateIdx1 are the two states of the current context model.

[0029] (1) The value of the variable ivlLpsRange is derived as follows: Given the current value of ivlCurrRange, the variable qRangeIdx is derived as follows: qRangeIdx = ivlCurrRange » 5 Given qRangeIdx, ctxTable and ctxIdx corresponding to pStateIdx0 and pStateIdx1, valMps and ivlLpsRange are derived as follows: pState = pStateIdx1 + 16 x pStateIdx0; valMps = pState » 14; ivlLpsRange = (qRangeIdx x ((valMps? 32767 - pState : pState) » 9) » 1) + 4.

[0030] (2) The value of variable ivlCurrRange is set to ivlCurrRange - ivlLpsRange, and the following operations are performed: If ivlOffset is greater than or equal to ivlCurrRange, the value of variable binVal is 1 - valMps, the value of ivlOffset is ivlOffset minus ivlCurrRange, and the value of ivlCurrRange is ivlLpsRange. Otherwise (ivlOffset is less than ivlCurrRange), the value of variable binVal is valMps.

[0031] Given the value of binVal, the defined state transition is performed. Based on the current value of ivlCurrRange, the defined renormalization can be performed.

[0032] Further, for the state transition process, the inputs of the process are the current pStateIdx0 and pStateIdx1, and the solved value binVal; the outputs are the updated context variables pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx. Among them, the variables shift0 and shift1 are derived from shiftIdx, and the correspondence between shiftIdx and ctxTable and ctxIdx is defined as follows: shift0 = (shiftIdx » 2) + 2; shift1 = (shiftIdx & 3) + 3 + shift0.

[0033] Based on the solved value binVal, the update of the two variables pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx is as follows: pStateIdx0 = pStateIdx0 (pStateIdxO » shiftO) + (1023 x binVal » shiftO); pStateIdx1 = pStateIdx1 (pStateIdx1 » shift1) + (16383 x binVal » shift1).

[0034] Further, the input of the renormalization process of the arithmetic decoding engine is bits in the slice data and variables ivlCurrRange and ivlOffset, and the output is updated variables ivlCurrRange and ivlOffset.

[0035] Figure 5 A flowchart of the renormalization of an arithmetic decoding engine provided by the related art is shown in FIG. 3. Figure 5 As shown in FIG. 3, the current value of ivlCurrRange is first compared with 256, and the subsequent steps are as follows: If ivlCurrRange is greater than or equal to 256, no renormalization is needed, and the RenormD process ends. Otherwise (ivlCurrRange is less than 256), the renormalization loop is entered. In this loop, the value of ivlCurrRange is multiplied by 2, i.e., left shifted by one bit. The value of ivlOffset is multiplied by 2, i.e., left shifted by one bit. One bit obtained by read_bits(1) is shifted into ivlOffset.

[0036] In the whole process, the data in the code stream should not cause ivlOffset to be greater than or equal to ivlCurrRange.

[0037] Further, the input of the bypass decoding process of the binary symbol is bits in the slice data and variables ivlCurrRange and ivlOffset, and the output is updated variable ivlOffset and the decoded value binVal.

[0038] The bypass decoding process is invoked when bypassFlag is 1, Figure 6 A flowchart of the bypass decoding process provided by the related art is shown in FIG. 4. Figure 6 As shown in FIG. 4, first, the value of ivlOffset is multiplied by 2, i.e., left shifted by one bit. One bit obtained by read_bits(1) is shifted into ivlOffset. Then, the value of ivlOffset is compared with the value of ivlCurrRange, and the subsequent steps are as follows: If ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1, and ivlOffset is equal to ivlOffsetivl minus CurrRange; Otherwise (ivlOffset is less than ivlCurrRange), the value of binVal is set to 0.

[0039] Throughout the process, the data in the bitstream should not cause ivlOffset to be greater than or equal to ivlCurrRange.

[0040] It should also be understood that in current video coding standards, one or more transforms and transform skip are usually supported for residual. The transform has Discrete Cosine Transform (DCT), etc. The residual block using transform usually has certain characteristics after transform (and quantization), such as the coefficients in the upper left corner are larger and the coefficients in the lower right corner are smaller or even many zeros after certain transform (and quantization) because the energy is mostly concentrated in the low frequency area. Transform skip, as the name implies, does not do transform, and the distribution of coefficients after transform skip is different from that after transform, so different coefficient coding methods can be used. For example, in VVC, RRC is used for coefficients after transform skip, and TSRC is used for coefficients after transform skip.

[0041] Generally, for a transform such as DCT transform, the block after transform represents the frequency from low to high from left to right and from low to high from top to bottom. The upper left corner represents low frequency, and the lower right corner represents high frequency. The human eye is more sensitive to low frequency information and less sensitive to high frequency information. Using this characteristic, some high frequency information is processed more or removed less visually. Some techniques, such as zero-out, can force some high frequency information to be zero. For example, for a 64x64 block, the coefficients at positions with horizontal coordinates greater than or equal to 32 or vertical coordinates greater than or equal to 32 are forced to be zero. The above is only a simple example, and the range of zero-out may have more complex derivation methods, which are not described here. For example, Figure 7 As shown, the upper left corner part may have non-zero coefficients (i.e., it is a possible non-zero coefficient area), and the lower right corner part will be all zeroed (i.e., it is a forced zero area). In this way, for the coefficient coding of the latter, the coefficients in the forced zero area of zero-out do not need to be coded because they are definitely zero.

[0042] Further, since the distribution of the coefficients after transform (and quantization) of the residual of a normal video shows the characteristics that the top-left corner coefficients are large while the bottom-right corner coefficients are mostly zeros, some methods are usually used to make the coefficients in a certain range of the top-left corner need to be coded while the coefficients in a certain range of the bottom-right corner do not need to be coded, that is, these coefficients are considered as zeros by default. One method is that when coding the coefficients of a block, the position of the last non-zero coefficient in the scanning order of this block is determined first. After the position of the last non-zero coefficient is determined, the coefficients after the position of the last non-zero coefficient in the scanning order are all considered as zeros, that is, they do not need to be coded; only the coefficients before the position of the last non-zero coefficient need to be coded. 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).

[0043] (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 the scanning order. The value of last_sig_coeff_x_prefix should be in the range of 0 to (log2TbWidth << 1) 1, inclusive.

[0044] If last_sig_coeff_x_prefix is not present, the value of last_sig_coeff_x_prefix is 0.

[0045] (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 the scanning order. The value of last_sig_coeff_y_prefix should be in the range of 0 to (log2TbHeight << 1) 1, inclusive.

[0046] If last_sig_coeff_y_prefix is not present, the value of last_sig_coeff_y_prefix is 0.

[0047] (c) last_sig_coeff_x_suffix determines a suffix of the horizontal (or column) coordinate of the last non-zero coefficient in the current block in the scan order. The value of last_sig_coeff_x_suffix shall be in the range of 0 to (1 « ((last_sig_coeff_x_prefix » 1) 1)) - 1, inclusive.

[0048] The value of the horizontal (or column) coordinate of the last non-zero coefficient in the current transform block in the scan order, LastSignificantCoeffX, is derived as follows: If last_sig_coeff_x_suffix is not present, then LastSignificantCoeffX = last_sig_coeff_x_prefix; Otherwise (last_sig_coeff_x_suffix is present), LastSignificantCoeffX = (1 « ((last_sig_coeff_x_prefix » 1) 1)) (2 + (last_sig_coeff_x_prefix & 1)) + last_sig_coeff_x_suffix.

[0049] (d) last_sig_coeff_y_suffix determines a suffix of the vertical (or row) coordinate of the last non-zero coefficient in the current block in the scan order. The value of last_sig_coeff_x_suffix shall be in the range of 0 to (1 « ((last_sig_coeff_y_prefix » 1) 1)) - 1, inclusive.

[0050] The value of the vertical (or row) coordinate of the last non-zero coefficient in the current transform block in the scan order, LastSignificantCoeffY, is derived as follows: If last_sig_coeff_y_suffix is not present, then LastSignificantCoeffY = last_sig_coeff_y_prefix; Otherwise (last_sig_coeff_y_suffix is present), LastSignificantCoeffY = (1 « ((last_sig_coeff_y_prefix » 1) 1)) (2 + (last_ sig_coeff_y_prefix & 1)) + last_sig_coeff_y_suffix.

[0051] Further, the last non-zero coefficient and the coefficients before it are all coded, but in normal video, even among these coefficients, there is still a certain proportion of coefficients that are 0, and in VVC, a flag sb_coded_flag is used to determine whether the coefficients in the current sub-block need to be coded. If not, it is considered that the coefficients in the current sub-block are all 0. Here, the sub-block is usually an n n sub-block, such as a 4 4 sub-block.

[0052] sb_coded_flag[xS][yS] determines the following information of the sub-block at position (xS, yS) in the current transform block, where the sub-block is an array of transform coefficient values: If the value of sb_coded_flag[xS][yS] is 0, then the value of all transform coefficients within the sub-block at position (xS, yS) in the current transform block is 0; If sb_coded_flag[xS][yS] does not exist, then the value of sb_coded_flag[xS][yS] is 1.

[0053] Further, in the process of coding coefficients, the compression efficiency can be improved by using the characteristics of the coefficients. For example, for a normal video, among the coefficients that need to be coded, there is a certain proportion of coefficients that are 0, so a syntax element can be used to represent whether the current coefficient is 0, and 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 still needs to continue. For another example, for a normal video, among the non-zero coefficients, there is a certain proportion of coefficients whose absolute values are 1, so a syntax element can be used to represent whether the absolute value of the current coefficient is greater than 1, and 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 still needs to continue. For example, in VVC, the syntax elements involved are as follows, sig_coeff_flag[xC][yC] is used to determine whether the corresponding transform coefficient of the current transform block at transform coefficient position (xC, yC) is a non-zero coefficient: If the value of sig_coeff_flag[ xC ][ yC ] is 0, the value of the transform coefficient at position ( xC, yC ) is set to 0; Otherwise (the value of sig_coeff_flag[ xC ][ yC ] is 1 ), the transform coefficient at position ( xC, yC ) is a non-zero coefficient.

[0054] If sig_coeff_flag[ xC ][ yC ] is not present, the following is inferred: If the value of transform_skip_flag[ x0 ][ y0 ][ cldx ] is 0 or the value of sh ts residual coding disabled flag is 1 : If ( xC, yC ) is the position of the last non-zero coefficient in scan order ( LastSignificantCoeffX, LastSignificantCoeffY ) or all of the following conditions are true: ( xC & ( ( 1 « log2SbW ) 1 ), yC & ( ( 1 « log2SbH ) 1 )) is equal to ( 0, 0 ); the value of inferSbDcSigCoeffFlag is equal to 1 ; the value of sb coded flag[ xS ][ yS ] is 1 ; Otherwise, the value of sig_coeff_flag[ xC ][ yC ] is inferred to be 0; Otherwise (the value of transform_skip_flag[ x0 ][ y0 ][ cldx ] is 1 and the value of sh ts residual coding disabled flag is 0 ) : If all of the following conditions are true: ( xC & ( ( 1 « log2SbW ) 1 ), yC & ( ( 1 « log2SbH ) 1 )) is equal to ( ( 1 « log2SbW ) 1, ( 1 « log2SbH ) 1 ); the value of inferSbSigCoeffFlag is 1 ; the value of sb coded flag[ xS ][ yS ] is 1 ; Otherwise, the value of sig_coeff_flag[ xC ][ yC ] is inferred to be 0.

[0055] 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 ] is not present, the value of abs_level_gtx_flag[ n ][ j ] is 0.

[0056] Thus, if the current coefficient is not finished coding after the above-mentioned flags (or syntax elements) are processed, the remaining value of the absolute value of the coefficient needs to be coded. For example, abs_remainder in VVC.

[0057] abs_remainder[ n ] is used to determine the remaining absolute value of the n-th transform coefficient in scan order, which is coded using Golomb-Rice. If abs_remainder[ n ] is not present, the value of abs_remainder[ n ] is 0.

[0058] Further, in VVC, syntax elements such as sig_coeff_flag and abs_level_gtx_flag are coded using context mode, while abs_remainder is coded using bypass mode. As mentioned above, context mode is more complex than bypass mode, and intuitively, it is slower to process. If there are many coefficients to be coded, using too many context modes will affect the decoding speed. Thus, the number of syntax elements coded using context mode can be limited, for example, if the number of binary symbols coded using context mode exceeds a threshold, the subsequent coefficient coding is forced to use bypass mode. For example, dec_abs_level in VVC.

[0059] dec_abs_level[ n ] is an intermediate value of the n-th in scan order, which is coded using Golomb-Rice. When dec_abs_level[ n ] is parsed, ZeroPos[ n ] can be derived, and the absolute value of the quantized coefficient at position ( xC, yC ), AbsLevel[ xC ][ yC ], is derived as follows: If dec_abs_level[ n ] is not present or the value of dec_abs_level[ n ] is equal to ZeroPos[ n ], the value of AbsLevel[ xC ][ yC ] is 0. Otherwise, if the value of dec_abs_level[ n ] is less than ZeroPos[ n ], the value of AbsLevel[ xC ][ yC ] is dec_abs_level[ n ] + 1. Otherwise (the value of dec_abs_level[n] is greater than ZeroPos[n]), the value of AbsLevel[xC][yC] is dec_abs_level[n].

[0060] The above all refer to the absolute value of the coefficient, the sign of the non-zero coefficient can be determined by the coefficient sign flag coeff_sign_flag or some sign derived method. The coeff_sign_flag[n] can determine the sign of the transform coefficient at the scanning position n as follows: If the value of coeff_sign_flag[n] is 0, then the corresponding transform coefficient is positive; Otherwise (the value of coeff_sign_flag[n] is 1), the corresponding transform coefficient is negative.

[0061] If coeff_sign_flag[n] does not exist, then the value of coeff_sign_flag[n] is 0; at this time, the sign of the transform coefficient at the coordinates (xC, yC) is determined according to CoeffSignLevel[xC][yC]: If the value of CoeffSignLevel[xC][yC] is 0, then the corresponding transform coefficient is 0; Otherwise, if the value of CoeffSignLevel[xC][yC] is 1, then the corresponding transform coefficient is positive; otherwise (the value of CoeffSignLevel[xC][yC] is 1), the corresponding transform coefficient is negative.

[0062] It should be further pointed out that CoeffSignLevel[xC][yC] can also be derived by using other methods, which will not be described here.

[0063] In addition, a coefficient value parity flag par_level_flag is also used in VVC. According to this flag, the parity of the current coefficient value can be known, which will be used in determining the current coefficient value and dependent quantization (DependentQuantization).

[0064] par_level_flag[n] determines the parity of the transform coefficient at the scanning order position n. If par_level_flag[n] does not exist, then the value of par_level_flag[n] is 0.

[0065] The par_level_flag can be used to determine the parity of the transform coefficient in addition to the size of the coefficient together with abs_level_gtx_flag, abs_remainder, etc.

[0066] Here, since the context mode coding needs to select, use and update the context mode, while the bypass mode coding does not need to select, use and update the context mode, the usual practice is to put the syntax elements of the context mode coding together within a certain range, and put the syntax elements of the bypass mode coding together, which is more friendly to hardware design. For example, all the syntax elements of the context mode coding in a block are processed first, and then the syntax elements of the bypass mode coding are processed. All the syntax elements of the context mode coding in the current block can also be divided into several groups, and all the syntax elements of the bypass mode coding in the block can also be divided into several groups.

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

[0068] Table 1

[0069] wherein the array AbsLevel[xC][yC] represents an array of absolute values of transform coefficients of the current transform block. The array AbsLevelPass1[xC][yC] represents an array of partially reconstructed absolute values of transform coefficients of the current transform block. The indices xC and yC of the array represent the (xC, yC) position in the current transform block.

[0070] After entering the residual_coding(x0, y0, log2TbWidth, log2TbHeight, cldx) function, some block size information needs to be determined, such as the logarithm of the zero-out block size log2ZoTbWidth, log2ZoTbHeight, and the coefficients in the horizontal coordinate [0, (1 « log2ZoTbWidth) - 1] and the vertical coordinate [0, (1 « log2ZoTbHeight) - 1] can be non-zero coefficients. Here, (1 « log2ZoTbWidth) represents the width of the zero-out transform block, and (1 « log2ZoTbHeight) represents the height of the zero-out transform block. Then, the position of the last non-zero coefficient is determined according to last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, and the like. The coefficients before the last non-zero coefficient in the scanning order can be non-zero coefficients. Then, the value of remBinsPass1 is determined, that is, it is determined using the equation remBinsPass1 = ((1 « (log2TbWidth + log2TbHeight)) x 7) » 2. remBinsPass1 determines the number of syntax elements in the current block that are encoded using the context mode. The embodiment of the present application can understand that remBinsPass1 means remaining binaries in pass 1, 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 in which these coefficients are located, it is determined in turn whether the current sub-block needs to be encoded. If it needs to be encoded, the syntax elements in the sub-block that are encoded using the context mode are placed in the first round, and the syntax elements that are encoded using the bypass mode are placed later. Each coefficient can need to process at most 4 syntax elements 1 sig_coeff_flag, 2 abs_level_gtx_flag, and 1 par_level_flag that are encoded using the context mode. In the first round, remBinsPass1 is reduced by 1 each time a syntax element that is encoded using the context mode is processed. If a coefficient is large enough, the remaining value, that is, abs_remainder, needs to be processed after the context mode encoding of several syntax elements is processed in the first round. If remBinsPass1 is small enough (does not satisfy remBinsPass1 >= 4), the first round ends, and the remaining coefficients are directly processed using the bypass mode, that is, dec_abs_level.

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

[0072] Table 2

[0073] After entering the residual_ts_coding (x0, y0, log2TbWidth, log2TbHeight, cldx) function, some block size information needs to be determined. Then the value of RemCcbs is determined, i.e. using the equation RemCcbs = ((1 « (log2TbWidth + log2TbHeight)) x 7) » 2. RemCcbs determines the number of syntax elements in the current block that are encoded using the context mode. The embodiments of the present application can understand that RemCcbs means the number of remaining context mode encoded binary symbols. For each sub-block, it is determined whether the current sub-block needs to be encoded. If it needs to be encoded, unlike the RRC described above, in the TSRC method, the context mode encoded syntax elements in a sub-block are placed in two rounds, and each coefficient is processed for a maximum of 4 context mode encoded syntax elements in the first round and the second round. The bypass mode encoded syntax elements are placed later. In the first round and the second round, after processing a context mode encoded syntax element remBinsPass1 will be reduced by 1 each time. If a coefficient is large enough, after processing several context mode encoded syntax elements in the first round and the second round, the remaining value, i.e. abs_remainder, also needs to be processed. If remBinsPass1 is small enough (not satisfying remBinsPass1 >= 4), the first two rounds will end, and the remaining coefficients will be directly processed using the bypass mode, which is still abs_remainder.

[0074] In summary, in the related art, the existing coefficient coding method has good compression efficiency for the currently commonly used video, such as consumer video. The bit width of each pixel of the consumer video is usually 8 bits or 10 bits, and the code rate of the consumer video is usually not too high, usually several megabytes per second (MB / s) or lower. However, some application videos require higher bit width of pixels, such as 12 bits, 14 bits, or 16 bits or more per pixel. Higher bit width usually brings larger coefficients, more non-zero coefficients, and thus higher code rate. Some application videos require higher quality, and higher quality also usually brings larger coefficients, more non-zero coefficients, and thus higher code rate. Higher code rate requires higher processing capacity such as throughput of the decoder.

[0075] High bit width, high quality, and high code rate video (three-high video) usually requires more and larger coefficients to be coded than low bit width, low quality, and low code rate video (regular video). For example, the coefficients to be coded in a block of the three-high video are much more than those in a block of the same size in the regular video. Because many coefficients in the block of the regular video after prediction, transformation, and quantization become 0, and many coefficients in the block of the three-high video after prediction, transformation, and quantization are still non-zero coefficients. A large proportion of the coefficients to be coded in the block of the regular video after prediction, transformation, and quantization are 0, and thus it is very effective to use the last significant coefficient position (LastSignificantCoeffX, LastSignificantCoeffY) to distinguish the coefficient area whether to be coded. Even the coefficients before the last significant coefficient position are also a large proportion of 0, and thus it is very effective to use the sub-block coding flag sb_coded_flag to further distinguish whether the current sub-block needs to be coded. However, when there are many non-zero coefficients in the current block, even most or all of the coefficients are non-zero coefficients, the last significant coefficient position and the sub-block coding flag will not filter out too many non-zero coefficients, and the coding of the last significant coefficient position and the sub-block coding flag in the bit stream will occupy a certain overhead and cause waste.

[0076] On the other hand, the last significant coefficient position and the sub-block coding flag are all coded by using the context mode, and the context mode coding is more complex than the bypass mode. Processing these information will also affect the speed and throughput of software and hardware coding and decoding.

[0077] In another aspect, the current method of encoding the position of the last significant coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is to encode the coordinates of the position of the last significant coefficient. In regular video, the values of LastSignificantCoeffX and LastSignificantCoeffY are usually small because the non-zero coefficients are mostly concentrated in the upper left corner and the large area in the lower right corner is zero. In three-high video, however, a large number of non-zero coefficients also appear in the lower right corner, which results in the values of LastSignificantCoeffX and LastSignificantCoeffY being usually large, and thus encoding the large values in the bitstream incurs a large overhead. In addition, there is a possibility that this method is used when lossless compression is used, because when lossless compression is used, quantization cannot be used, and in this case, there are usually more and larger coefficients. In this case, using the existing related scheme can incur a larger overhead, waste, and even affect the speed and throughput of encoding and decoding.

[0078] The embodiment of the present application provides a coefficient decoding method, which is applied to a decoder. A bitstream is parsed to obtain video identification information; when the video identification information indicates that a video meets a preset condition, the bitstream is parsed to obtain last non-zero coefficient position flip identification information and coordinate information of a last non-zero coefficient; when the last non-zero coefficient position flip identification information indicates that the current block uses last non-zero coefficient position flip, 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.

[0079] The embodiment of the present application also provides a coefficient encoding method, which is applied to an encoder. Video identification information and the position of a last non-zero coefficient are determined; when the video identification information indicates that a video meets a preset condition, last non-zero coefficient position flip identification information is determined; according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information, 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 bit information obtained after encoding, the video identification information and the coordinate information of the last non-zero coefficient are written into a bitstream.

[0080] In this way, in the high bit width, high code rate, high quality or lossless video coding scene, due to the different coefficient distribution rules from the conventional video scene, the syntax element number of the context mode coding in the coefficient coding is reduced or even eliminated, such as the syntax element about the last non-zero coefficient position, the sub-block coding identifier and the like, and even the coordinate transformation can be performed when the value of the last non-zero coefficient coordinate information is large, so that the overhead of the coding in the code stream is reduced, and the throughput and coding speed of the coefficient coding are improved; in addition, the compression efficiency can be improved due to the small influence of the reduced or eliminated syntax element in the high bit width, high code rate, high quality or lossless video coding.

[0081] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0082] Referring to Figure 8A , a system composition block diagram example of an encoder provided by the embodiments of the present application is shown. As Figure 8A shown, the encoder 100 can include a partition 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 filter 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 composed of a series of pictures or a still picture, and the output of the encoder 100 can be a bit stream (also referred to as “code stream”) for representing the compressed version of the input video.

[0083] Among them, the partition unit 101 partitions the pictures in the input video into one or more coding tree units (CTUs). The partition unit 101 divides the picture into one or more tiles (also referred to as tiles), and further divides one tile into one or more bricks (bricks), where one tile or one brick can include one or more complete and / or partial CTUs. In addition, the partition unit 101 can form one or more slices, where one slice can include one or more tiles arranged in raster order in the picture, or cover one or more tiles in a rectangular region of the picture. The partition unit 101 can also form one or more sub-pictures, where one sub-picture can include one or more slices, tiles or bricks.

[0084] In the encoding process of the encoder 100, the partition unit 101 delivers a CTU to the prediction unit 102. Generally, the prediction unit 102 can be composed of a block partition unit 103, a motion estimation (ME) unit 104, a motion compensation (MC) unit 105, and an intra-prediction unit 106. Specifically, the block partition unit 103 iteratively partitions an input CTU into smaller coding units (CUs) using quad-tree partitioning, binary-tree partitioning, and ternary-tree partitioning. The prediction unit 102 can obtain an inter-predicted block for a CU using the ME unit 104 and the MC unit 105. The intra-prediction unit 106 can obtain an intra-predicted block for a CU using various intra-prediction modes including the MIP mode. In an example, a rate-distortion optimized motion estimation approach can be invoked by the ME unit 104 and the MC unit 105 to obtain the inter-predicted block, and a rate-distortion optimized mode determination approach can be invoked by the intra-prediction unit 106 to obtain the intra-predicted block.

[0085] The prediction unit 102 outputs the predicted block of a CU, and the first adder 107 calculates the difference between the CU in the output of the partition unit 101 and the predicted block of the CU, i.e., a residual CU. The transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs quantized coefficients (i.e., levels). The inverse quantization unit 110 performs a scaling operation on the quantized coefficients to output reconstructed coefficients. The inverse transform unit 111 performs one or more inverse transforms corresponding to the transforms in the transform unit 108 and outputs a reconstructed residual. The second adder 112 calculates a reconstructed CU by adding the reconstructed residual and the predicted block of the CU from the prediction unit 102. The second adder 112 also sends its output to the prediction unit 102 to be used as an intra-prediction reference. After all CUs in a picture or sub-picture are reconstructed, the filter unit 113 performs in-loop filtering on the reconstructed picture or sub-picture. Here, the filter unit 113 contains one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), luma mapping with chroma scaling (LMCS) filter, and a neural network based filter, etc. Alternatively, when the filter unit 113 determines that a CU is not to be used as a reference for encoding of other CUs, the filter unit 113 performs in-loop filtering on one or more target pixels in the CU.

[0086] The output of the filtering unit 113 is decoded pictures or sub-pictures, which are buffered to the DPB unit 114. The DPB unit 114 outputs the decoded pictures or sub-pictures according to the timing and control information. Here, the pictures stored in the DPB unit 114 can also be used as reference for the inter prediction or intra prediction performed by the prediction unit 102. Finally, the entropy encoding unit 115 converts the parameters (such as control parameters and supplemental information, etc.) necessary for decoding the pictures from the encoder 100 into binary form, and writes such binary form into the bitstream according to the syntax structure of each data unit, i.e., the bitstream finally output by the encoder 100.

[0087] Further, the encoder 100 can be a computing device having a first processor and a first memory storing a computer program. When the first processor reads and runs the computer program, the encoder 100 reads the input video and generates the corresponding bitstream. In addition, the encoder 100 can also be a computing device having one or more chips. These units implemented as integrated circuits on the chip have similar connection and data exchange functions with the corresponding units in the encoder 100. Figure 8A

[0088] Referring to Figure 8B , a system composition block diagram example of a decoder provided by an embodiment of the present application is shown. As Figure 8B shown, the decoder 200 can include a parsing unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transformation unit 206, an adder 207, a filtering unit 208, and a decoded picture buffer unit 209. Here, the input of the decoder 200 is a bitstream used to represent a compressed version of a video or a still picture, and the output of the decoder 200 can be a decoded video composed of a series of pictures or a decoded still picture.

[0089] The input bitstream of 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 from the input bitstream. The parsing unit 201 converts the binary representation of the syntax elements into digital values and sends the digital values to the units in the decoder 200 to obtain one or more decoded pictures. The parsing unit 201 can also parse one or more syntax elements from the input bitstream to display the decoded pictures.

[0090] During the decoding process of the decoder 200, the parsing unit 201 sends the values of the syntax elements and one or more variables used to obtain one or more decoded pictures, which are set or determined according to the values of the syntax elements, to the units in the decoder 200.

[0091] ​The prediction unit 202 determines a prediction block for a current decoding block (e.g., a CU). Here, the prediction unit 202 can include a motion compensation unit 203 and an intra prediction unit 204. Specifically, when an inter decoding mode is indicated for decoding the current decoding block, the prediction unit 202 passes the related parameters from the parsing unit 201 to the motion compensation unit 203 to obtain an inter prediction block; when an intra prediction mode (including the MIP mode indicated based on the MIP mode index value) is indicated for decoding the current decoding block, the prediction unit 202 passes the related parameters from the parsing unit 201 to the intra prediction unit 204 to obtain an intra prediction block.

[0092] The inverse quantization unit 205 has the same function as the inverse quantization unit 110 in the encoder 100. The inverse quantization unit 205 performs a scaling operation on the quantized coefficients (i.e., levels) from the parsing unit 201 to obtain reconstructed coefficients.

[0093] The inverse transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The inverse transform unit 206 performs one or more transform operations (i.e., the inverse operations of the one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain reconstructed residuals.

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

[0095] After all CUs in a picture or sub-picture are reconstructed, the filter unit 208 performs loop filtering on the reconstructed picture or sub-picture. The filter unit 208 contains one or more filters, such as a deblocking filter, a sample adaptive offset filter, an adaptive loop filter, a luma mapping and chroma scaling filter, and a neural network based filter, etc. Alternatively, when the filter unit 208 determines that a reconstructed block is not used as a reference for decoding other blocks, the filter unit 208 performs loop filtering on one or more target pixels in the reconstructed block. Here, the output of the filter unit 208 is a decoded picture or sub-picture, which is buffered to the DPB unit 209. The DPB unit 209 outputs the decoded picture or sub-picture according to the timing and control information. The pictures stored in the DPB unit 209 can also be used as a reference for performing inter prediction or intra prediction by the prediction unit 202.

[0096] Further, the decoder 200 can be a second processor and a second memory recording a computer program. When the first processor reads and runs the computer program, the decoder 200 reads the input code stream and generates the corresponding decoded video. In addition, the decoder 200 can also be a computing device with one or more chips. These units implemented as integrated circuits on the chip have similar connection and data exchange functions with the corresponding units in the Figure 8B

[0097] It should be further noted that when the embodiments of the present application are applied to the encoder 100, the "current block" specifically refers to a current block to be encoded (which can also be referred to as "encoding block") in a video image; when the embodiments of the present application are applied to the decoder 200, the "current block" specifically refers to a current block to be decoded (which can also be referred to as "decoding block") in a video image.

[0098] In an embodiment of the present application, referring to Figure 9 , a flowchart of a coefficient decoding method provided by an embodiment of the present application is shown. As shown in Figure 9 , the method can include: S901: parsing a code stream to obtain video identification information.

[0099] It should be noted that the coefficient decoding method of the embodiments of the present application is applied to a decoder. Specifically, based on the composition structure of the decoder 200 as shown in Figure 8B , the coefficient decoding method of the embodiments of the present application is mainly applied to the "parsing unit 201" part in the decoder 200, and for the parsing unit 201, the adaptive binary arithmetic coding mode based on the context model or the bypass mode can be used for decoding to obtain the value of the related identification information (or syntax element), and then determine the coefficients of the current block.

[0100] It should be further noted that the coefficient coding commonly used in the video standard can include both encoding and decoding, therefore, the coefficient coding includes the coefficient coding method on the encoder side and the coefficient decoding method on the decoder side. The embodiments of the present application describe the coefficient decoding method on the decoder side.

[0101] Generally, for example, for a conventional video, the coefficient decoding method is the same as the existing method in the related art; but for some cases, such as high bit width or high quality or high code rate or lossless compression video coding scene, the embodiments of the present application can modify the position derivation method of the last non-zero coefficient.

[0102] In the embodiments of the present application, it is first necessary to determine whether the current video meets the preset condition, which can be represented by the video identification information. In some embodiments, the parsing of the code stream to obtain the video identification information can include: ​If the video identification information has a first value, it is determined that the video identification information indicates that the video satisfies the preset condition; or If the video identification information has a second value, it is determined that the video identification information indicates that the video does not satisfy the preset condition.

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

[0104] 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 also be set to 0, and the second value can also be set to 1; or the first value can also be set to false, and the second value can also be set to true. Here, no limitation is made.

[0105] It should also be noted that the preset condition at least includes one of the following: high bit width, high quality, high code rate, high frame rate, and lossless compression.

[0106] That is, compared with a conventional video, the video described in the embodiments of the present application has the characteristics of high bit width, high quality, high code rate, high frame rate, and lossless compression.

[0107] Further, the video identification information can be a sequence-level flag, or even a higher-level flag, such as Video Usability Information (VUI), Supplemental Enhancement Information (SEI), etc. Whether the video satisfies the preset condition can be determined by determining whether the video satisfies the high bit width, or whether it satisfies the high code rate, or whether it satisfies the high quality, or whether it satisfies the lossless compression, etc. The following will be described with respect to these four cases.

[0108] In some embodiments, when the video identification information is high bit width identification information, the method can further include: If the high bit width identification information indicates that the video satisfies the high bit width, it is determined that the video satisfies the preset condition.

[0109] In some embodiments, when the video identification information is high code rate identification information, the method can further include: If the high code rate identification information indicates that the video satisfies the high code rate, it is determined that the video satisfies the preset condition.

[0110] In some embodiments, when the video identification information is high quality identification information, the method can further include: If the high quality identification information indicates that the video satisfies the high quality, it is determined that the video satisfies the preset condition.

[0111] In some embodiments, when the video identification information is lossless compression identification information, the method can further include: If the lossless compression identification information indicates that the video satisfies lossless compression, determining that the video satisfies the preset condition.

[0112] For example, taking a sequence level as an example, the video identification information can be high-bit-width identification information (denoted as sps_high_bit_depth_flag) for indicating whether the current video sequence is a high-bit-width sequence, or can be replaced by high-bit-rate identification information (denoted as sps_high_bit_rate_flag) for indicating whether the current video sequence is a high-bit-rate sequence, or can be replaced by other identification information for indicating high-bit-width, high-bit-rate, high-quality or lossless compression, which is not limited in the embodiments of the present application.

[0113] S902: When the video identification information indicates that the video satisfies the preset condition, parsing the code stream to obtain the last non-zero coefficient position flipping identification information and the coordinate information of the last non-zero coefficient.

[0114] It should be noted that when the video identification information indicates that the video satisfies the preset condition, the code stream can be further parsed to obtain the last non-zero coefficient position flipping identification information and the coordinate information of the last non-zero coefficient.

[0115] For the coordinate information of the last non-zero coefficient, it 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, the parsing of the code stream to obtain the coordinate information of the last non-zero coefficient can include: parsing the code stream to obtain prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient and suffix information of the vertical coordinate of the last non-zero coefficient; determining the horizontal coordinate of the last non-zero coefficient according to the prefix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the horizontal coordinate of the last non-zero coefficient; determining the vertical coordinate of the last non-zero coefficient according to 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; determining the coordinate information of the last non-zero coefficient according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0116] 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, i.e. the prefix of the horizontal (or column) coordinate of the last non-zero coefficient of the current block according to the preset scanning order is determined; the prefix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_prefix, i.e. the prefix of the vertical (or row) coordinate of the last non-zero coefficient of the current block according to the preset scanning order is determined; the suffix information of the horizontal coordinate of the last non-zero coefficient is represented by last_sig_coeff_x_suffix, i.e. the suffix of the horizontal (or column) coordinate of the last non-zero coefficient of the current block according to the preset scanning order is determined; and the suffix information of the vertical coordinate of the last non-zero coefficient is represented by last_sig_coeff_y_suffix, i.e. the suffix of the vertical (or row) coordinate of the last non-zero coefficient of the current block according to the preset scanning order is determined.

[0117] It should also be noted that last_sig_coeff_x_prefix and last_sig_coeff_x_suffix determine the horizontal coordinate (i.e. the horizontal coordinate) of the last non-zero coefficient, and last_sig_coeff_y_prefix and last_sig_coeff_y_suffix determine the vertical coordinate (i.e. the vertical coordinate) of the last non-zero coefficient, so that the coordinate information of the last non-zero coefficient is obtained.

[0118] For the last non-zero coefficient position flip identification information, it can be represented by reverse_last_sig_coeff_flag. In the embodiments of the present application, the last non-zero coefficient position flip identification information can be at least one of the following identification information: sequence level, picture level, slice level and block level; or even higher level (such as VUI, SEI, etc.) identification information, which is not limited herein.

[0119] That is, reverse_last_sig_coeff_flag can be a sequence level or higher level flag, or can be a picture level flag or a slice level flag or a block level flag or a flag of other levels. In addition, the block level flag can include a maximum coding unit (LCU) level flag or a coding unit (CU) level flag or a flag of other block levels, and the embodiments of the present application do not make any limitation.

[0120] In some embodiments, the method can further include: If the value of the last non-zero coefficient position flipping flag is the first value, it is determined that the last non-zero coefficient position flipping flag indicates that the current block uses the last non-zero coefficient position flipping. If the value of the last non-zero coefficient position flipping flag is the second value, it is determined that the last non-zero coefficient position flipping flag indicates that the current block does not use the last non-zero coefficient position flipping.

[0121] That is, taking the first value as 1 and the second value as 0 as an example, if the value of the reverse_last_sig_coeff_flag is 1, it can be determined that the reverse_last_sig_coeff_flag indicates that the current block uses the last non-zero coefficient position flipping; or if the value of the reverse_last_sig_coeff_flag is 0, it can be determined that the reverse_last_sig_coeff_flag indicates that the current block does not use the last non-zero coefficient position flipping.

[0122] S903: When the last non-zero coefficient position flipping flag indicates that the current block uses the last non-zero coefficient position flipping, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient.

[0123] S904: 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.

[0124] It should be noted that in the embodiments of the present application, when the last non-zero coefficient position flipping flag indicates that the current block uses the last non-zero coefficient position flipping, it can be determined that 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.

[0125] At this time, in some embodiments, the calculation of the coordinate information of the last non-zero coefficient to determine the position of the last non-zero coefficient can include: determining the width and height of the current block; performing subtraction calculation according to the width of the current block and the horizontal distance between the position of the last non-zero coefficient and the lower right corner position of the current block to obtain the horizontal coordinate of the last non-zero coefficient; and performing subtraction calculation according to the height of the current block and the vertical distance between the position of the last non-zero coefficient and the lower right corner position of the current block to obtain the vertical coordinate of the last non-zero coefficient; determining the position of the last non-zero coefficient according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0126] 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 top-left corner of the current block. For a regular video, since the non-zero coefficients are mostly concentrated in the top-left corner, and a large area in the bottom-right corner is 0; but for high-bit width, high-quality, high-code rate video coding, a large number of non-zero coefficients also appear in the bottom-right corner, so that the value of the coordinate information of the last non-zero coefficient is usually large, at this time, in order to save overhead, coordinate transformation (specifically, coordinate flip calculation, that is, the coordinate information of the last non-zero coefficient after coordinate flip is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the bottom-right corner of the current block) needs to be performed when the coefficient is encoded, then coordinate flip calculation also needs to be performed when the coefficient is decoded, and the coordinate information of the last non-zero coefficient can be restored to the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the top-left corner of the current block after being flipped again, so as to determine the position of the last non-zero coefficient, so as to decode all the coefficients before the position of the last non-zero coefficient in the current block according to the preset scanning order.

[0127] 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 last non-zero coefficient position flip (that is, the value of reverse_last_sig_coeff_flag is 1), LastSignificantCoeffX= (1<<log2ZoTbWidth)-1-LastSignificantCoeffX; LastSignificantCoeffY= (1<<log2ZoTbHeight)-1-LastSignificantCoeffY.

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

[0129] In the embodiments of the present application, in the case where the value of reverse last sig coeff flag is 0, in some embodiments, the method can further include: When the last non-zero coefficient position flipping identification information indicates that the current block does not use the last non-zero coefficient position flipping, determining the coordinate information of the last non-zero coefficient as the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the top-left corner position of the current block; According to the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the top-left corner position of the current block, determining the position of the last non-zero coefficient.

[0130] It should be noted that if the reverse last sig coeff 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 obtained by decoding can be regarded as the target coordinate information of the last non-zero coefficient. In the embodiments of the present application, the target coordinate information of the last non-zero coefficient is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the top-left corner position of the current block.

[0131] Further, in some embodiments, the method can further include: When the last non-zero coefficient position flipping identification information indicates that the current block does not use the last non-zero coefficient position flipping, directly determining the position of the last non-zero coefficient according to the coordinate information of the last non-zero coefficient; According to the preset scanning order, decoding all the coefficients before the position of the last non-zero coefficient to determine the coefficients of the current block.

[0132] It should be noted that the preset scanning order can be diagonal, Zigzag, horizontal, vertical, 4 sub-block scanning or any other scanning order, and the embodiments of the present application do not make any limitation.

[0133] It should be further explained that, after obtaining the reverse last sig coeff flag, if the value of the reverse last sig coeff flag is 1, that is, the last non-zero coefficient position flipping is needed, after the coordinate information of the last non-zero coefficient is decoded, the coordinate information of the last non-zero coefficient is calculated to determine the position of the last non-zero coefficient; then all the coefficients before the position of the last non-zero coefficient are decoded according to the preset scanning order. If the value of the reverse last sig coeff flag is 0, that is, the last non-zero coefficient position flipping is not needed, after the coordinate information of the last non-zero coefficient is decoded, the position of the last non-zero coefficient can be directly determined according to the coordinate information of the last non-zero coefficient; then all the coefficients before the position of the last non-zero coefficient are decoded according to the preset scanning order.

[0134] In this way, for a certain case, during the coefficient coding, the embodiment of the application provides a method for modifying the derivation of the position of the last non-zero coefficient. That is, in general cases, the coefficient coding and decoding method is the same as the existing method of the related art. The certain case can be, for example, high-bit-width or high-quality or high-bit-rate video coding or lossless compression video coding. In general cases, the last_sig_coeff_x_prefix and the last_sig_coeff_x_suffix code the horizontal coordinate of the position of the last non-zero coefficient, that is, the horizontal distance relative to the top-left corner of the current block; the last_sig_coeff_y_prefix and the last_sig_coeff_y_suffix code the vertical coordinate of the position of the last non-zero coefficient, that is, the vertical distance relative to the top-left corner of the current block, as shown in FIG. 1. Figure 10A In the case of high-bit-width or high-quality or high-bit-rate or lossless compression video coding, the position of the last non-zero coefficient is generally close to the right-bottom corner of the region of the current block where all the possible non-zero coefficients are located. In this case, the last_sig_coeff_x_prefix and the last_sig_coeff_x_suffix code the horizontal distance of the position of the last non-zero coefficient relative to the right-bottom corner of the region of the current block where all the possible non-zero coefficients are located; the last_sig_coeff_y_prefix and the last_sig_coeff_y_suffix code the vertical distance of the position of the last non-zero coefficient relative to the right-bottom corner of the region of the current block where all the possible non-zero coefficients are located, as shown in FIG. 2. Figure 10BAs shown. For example, if all possible regions of non-zero coefficients in the current block are the rectangular region 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 last non-zero coefficient position 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 last non-zero coefficient position relative to the current block ((1 << log2ZoTbWidth)-1, (1 << log2ZoTbHeight)-1).

[0135] The modifications for semantics are as follows: The value of the horizontal (or column) coordinate of the last non-zero coefficient in the current block in the preset scanning order, LastSignificantCoeffX, is derived as follows: If last_sig_coeff_x_suffix does not exist, then LastSignificantCoeffX = last_sig_coeff_x_prefix; Otherwise (last_sig_coeff_x_suffix exists), LastSignificantCoeffX = (1 << ((last_sig_coeff_x_prefix >> 1)-1)) (2 + (last_sig_coeff_x_prefix & 1)) + last_sig_coeff_x_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffX = (1 << log2ZoTbWidth)-1 - LastSignificantCoeffX; The value of the vertical (or row) coordinate of the last non-zero coefficient in the current block in the scanning order, LastSignificantCoeffY, is derived as follows: If last_sig_coeff_y_suffix does not exist, then LastSignificantCoeffY = last_sig_coeff_y_prefix; Otherwise (last_sig_coeff_y_suffix is present): LastSignificantCoeffY = (1 « ((last_sig_coeff_y_prefix » 1) - 1)) (2 + (last_sig_coeff_y_prefix & 1)) + last_sig_coeff_y_suffix; If the value of reverse_last_sig_coeff_flag is 1, then LastSignificantCoeffY = (1 « log2TbHeight) - 1 - LastSignificantCoeffY.

[0136] Wherein, reverse_last_sig_coeff_flag is the last non-zero coefficient position flip flag, indicating whether the position of the last non-zero coefficient needs to be flipped. If the value of reverse_last_sig_coeff_flag is 1, it indicates that the position of the last non-zero coefficient needs to be flipped; otherwise, it indicates that the position of the last non-zero coefficient does not need to be flipped.

[0137] It should be further noted that reverse_last_sig_coeff_flag can be a sequence level or higher level flag, or a picture level flag or a slice level flag or a block level flag or other level flag. The block level flag includes a largest coding unit (LCU) level flag or a coding unit (CU) level flag or other block level flag.

[0138] In addition, reverse_last_sig_coeff_flag can depend on some other flags, such as high bit width identification information or high code rate identification information, etc. That is, when the value of high bit width identification information or high code rate identification information is 1, reverse_last_sig_coeff_flag flag needs to be decoded at this time; otherwise, reverse_last_sig_coeff_flag flag does not need to be decoded.

[0139] In one specific example, taking the sequence level as an example, it is assumed that there is a sequence level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high bit width sequence. If the value of sps_high_bit_depth_flag is 1, it means that the current video sequence is a high bit width sequence; otherwise, it means that the current video sequence is not a high bit width sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, sps_reverse_last_sig_coeff_flag needs to be decoded. Here, sps_reverse_last_sig_coeff_flag is the last non-zero coefficient position flipping flag of the current sequence. If the value of sps_reverse_last_sig_coeff_flag is 1, it means that the block in the current sequence uses the last non-zero coefficient position flipping; otherwise (i.e. the value of sps_reverse_last_sig_coeff_flag is 0), it means that the block in the current sequence does not use the last non-zero coefficient position flipping. The reverse_last_sig_coeff_flag in the above syntax table is changed to sps_reverse_last_sig_coeff_flag.

[0140] The syntax elements thereof are as follows (Sequence parameter set RBSP syntax), see Table 3.

[0141] Table 3

[0142] In another specific example, taking slice as an example, it is assumed that there is a sequence-level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high bit width sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit width sequence; otherwise, it indicates that the current video sequence is not a high bit width sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, sh_reverse_last_sig_coeff_flag needs to be decoded. Here, sh_reverse_last_sig_coeff_flag is the last non-zero coefficient position flipping flag of the current slice. If the value of sh_reverse_last_sig_coeff_flag is 1, it indicates that the block in the current slice uses the last non-zero coefficient position flipping; otherwise (i.e., the value of sh_reverse_last_sig_coeff_flag is 0), it indicates that the block in the current slice does not use the last non-zero coefficient position flipping. The reverse_last_sig_coeff_flag in the above syntax table is changed to sh_reverse_last_sig_coeff_flag.

[0143] The syntax elements thereof are as follows (Slice header syntax), see Table 4.

[0144] Table 4

[0145] It can also be understood that when the video identification information indicates that the video meets the preset condition, at this time, all possible coefficients that need to be encoded are also defaulted to be encoded, that is, the last non-zero coefficient position is no longer used, but all possible non-zero coefficients of the current block are scanned according to the preset scanning order; therefore, the last coefficient enable identification information can also be introduced in the embodiments of the present application, which is used to determine whether the last coefficient position is used for the current block.

[0146] In some embodiments, when the video identification information indicates that the video meets the preset condition, the method can further include: parsing the code stream to obtain the last coefficient enable identification information; when the last coefficient enable identification information indicates that the last coefficient position is used for the current block, decoding all coefficients before the last coefficient position according to the preset scanning order to determine the coefficients of the current block.

[0147] It should be noted that the last coefficient enabling identification information can be indicated by default last coefficient enabled flag. In the embodiments of the present application, the last coefficient enabling identification information can be at least one of the following identification information: sequence level, image level, slice level and block level; or even higher level (such as VUI, SEI, etc.), which is not limited herein.

[0148] That is, the default last coefficient enabled flag can be a sequence level or higher level flag, or an image level flag, or a slice level flag, or a block level flag, or a flag of other levels. In addition, the block level flag can include a maximum coding unit (LCU) level flag, or a coding unit (CU) level flag, or a flag of other block levels, which is not limited in the embodiments of the present application.

[0149] In some embodiments, the method can further include: If the value of the last coefficient enabling identification information is the first value, it is determined that the last coefficient enabling identification information indicates that the last coefficient position is used in the current block; or If the value of the last coefficient enabling identification information is the second value, it is determined that the last coefficient enabling identification information indicates that the last coefficient position is not used in the current block.

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

[0151] It should be noted that in another specific example, the first value can also be set as true, and the second value can also be set as false. Even in another specific example, the first value can also be set as 0, and the second value can also be set as 1; or the first value can also be set as false, and the second value can also be set as true. Here, it is not limited.

[0152] In this way, taking the first value as 1 and the second value as 0 as an example, if the value of the default last coefficient enabled flag is 1, it can be determined that the default last coefficient enabled flag indicates that the last coefficient position is used in the current block; or if the value of the default last coefficient enabled flag is 0, it can be determined that the default last coefficient enabled flag indicates that the last coefficient position is not used in the current block.

[0153] In the case that the current block uses the last coefficient position, all the coefficients before the last coefficient position can be decoded according to the preset scan order, and the coefficients of the current block are determined.

[0154] Further, in the case that the current block does not use the last coefficient position, i.e., the value of the last coefficient enable identification information is 0, in some embodiments, the method can further include: parsing the code stream to obtain prefix information of the horizontal coordinate of the last non-zero coefficient, prefix information of the vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient; determining the position of the last non-zero coefficient according to 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; decoding all the coefficients before the position of the last non-zero coefficient according to the preset scan order, and determining the coefficients of the current block.

[0155] It should be noted that if the current block does not use the last coefficient position, the position of the last non-zero coefficient needs to be decoded and obtained. Specifically, by parsing the code stream, last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix are obtained, and then the position of the last non-zero coefficient is determined according to last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix. Otherwise, if the current block uses the last coefficient position, the position of the last non-zero coefficient does not need to be determined, and last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix do not need to be decoded and obtained.

[0156] It should be noted that the last coefficient position in the embodiments of the present application does not represent the position of the last non-zero coefficient. Because the coefficient at the last coefficient position can be 0, while the coefficient at the position of the last non-zero coefficient must not be 0. 4subblock scan or any other scan order, and the embodiments of the present application are not limited in this respect.

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

[0158] It should be noted that the last coefficient position in the embodiments of the present application does not represent the position of the last non-zero coefficient. Because the coefficient at the last coefficient position can be 0, while the coefficient at the position of the last non-zero coefficient must not be 0.

[0159] In a specific example, the method can further include setting the position of the last non-zero coefficient at the last coefficient position.

[0160] That is, the embodiments of the present application can still use the position of the last non-zero coefficient, and at this time, the position of the last non-zero coefficient needs to be placed at the last position of all possible non-zero coefficients of the current block according to the preset scan order.

[0161] Further, the last coefficient position can be represented by (LastCoeffX, LastCoeffY), that is, the last position of all possible non-zero coefficients of the current block according to the preset scan order. In some embodiments, the method can further include: determining the width and height of the transform block obtained after the preset operation on the current block; performing coordinate calculation according to the width and height of the transform block to obtain the right lower corner coordinate information of the transform block; determining the last coefficient position according to the right lower corner coordinate information of the transform block.

[0162] Here, the preset operation at least includes a zero-out operation.

[0163] It should be noted that (LastCoeffX, LastCoeffY) represents the right lower corner coordinate information of the transform block after zero-out; and the derivation method of (LastCoeffX, LastCoeffY) is as follows: LastCoeffX = (1 « log2ZoTbWidth) - 1; LastCoeffY = (1 « log2ZoTbHeight) - 1.

[0164] Thus, if the value of default last coeff enabled flag is 1, the position of the last non-zero coefficient can be determined according to (LastCoeffX, LastCoeffY).

[0165] In a specific example, the position of the last non-zero coefficient is still used, and the position of the last non-zero coefficient can be placed at the last position of all possible zero coefficients of the current block in a preset scanning order. In some embodiments, the method can further include: When the position of the last non-zero coefficient is set at the last coefficient position, the position of the last non-zero coefficient is determined according to the bottom-right corner coordinate information of the transform block.

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

[0167] Wherein, (LastSignificantCoeffX, LastSignificantCoeffY) represents the bottom-right corner coordinate information of the zero-out transform block. If the value of default last coeff enabled flag is 1, the position of the last non-zero coefficient can be determined according to (LastSignificantCoeffX, LastSignificantCoeffY).

[0168] Thus, for a certain case, all the possible coefficients to be coded are coded by default when coding the coefficients. That is, in general, the coefficient coding method is the same as the existing method in the related art. The certain case can be, for example, a high bit width or high quality or high bit rate video or lossless compression video coding. All the possible coefficients to be coded are coded by default, that is, the position of the last non-zero coefficient is no longer used, and all the possible non-zero coefficients of the current block are scanned in the preset scan order; or the position of the last coefficient to be coded is placed at the last position of all the possible non-zero coefficients of the current block in the preset scan order. This position is usually the lower right corner position of the matrix composed of all the possible non-zero coefficients of the current block. The last coefficient to be coded is used instead of the last non-zero coefficient. Because the coefficient at the position of the last coefficient to be coded can be 0, and the coefficient at the position of the last non-zero coefficient must be non-zero.

[0169] A special case is that the position of the last non-zero coefficient is still used, and the position of the last non-zero coefficient is placed at the last position of all the possible non-zero coefficients of the current block in the preset scan order.

[0170] In addition, all the possible non-zero coefficients of the current block in the preset scan order are because there are some other technologies in addition to the last non-zero coefficient to make some coefficients in a block default to 0. For example, the zero-out mentioned above.

[0171] The modification of the semantics is shown in Table 5.

[0172] Table 5

[0173] In the embodiments of the present application, a condition can be added before decoding the information required for decoding the last non-zero coefficient, i.e. if the default_last_coeff_enabled_flag is not true (i.e. the value of the default_last_coeff_enabled_flag is equal to 0), then the syntax elements of last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, etc. need to be decoded. If the default_last_coeff_enabled_flag is true (i.e. the value of the default_last_coeff_enabled_flag is equal to 1), then the syntax elements of last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_suffix, etc. do not need to be decoded.

[0174] Here, the default_last_coeff_enabled_flag is a default last coefficient enabling flag, which is used to indicate whether to use a default last coefficient. If the value of the default_last_coeff_enabled_flag is 1, it indicates that the default last coefficient position is used, i.e. the position of the last coefficient to be encoded is placed at the last position of all possible non-zero coefficients of the current block in the preset scanning order. Otherwise, it indicates that the default last coefficient position is not used.

[0175] If the value of the default_last_coeff_enabled_flag is 1, then the default last coefficient position (LastCoeffX, LastCoeffY) is the last position of all possible non-zero coefficients of the current block in the preset scanning order. The coefficients before (LastCoeffX, LastCoeffY) in the preset scanning order need to be scanned. In the embodiments of the present application, the derivation method of (LastCoeffX, LastCoeffY) is as follows: LastCoeffX = (1 « log2ZoTbWidth) - 1; LastCoeffY = (1 « log2ZoTbHeight) - 1.

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

[0177] A special case is still using the position of the last non-zero coefficient, and the position of the last non-zero coefficient is placed at the last position of all possible non-zero coefficients of the current block in the preset scanning order. In the embodiments of the present application, the position of the last non-zero coefficient (LastSignificantCoeffX, LastSignificantCoeffY) is derived as follows: LastSignificantCoeffX = (1 << log2ZoTbWidth) - 1; LastSignificantCoeffY = (1 << log2ZoTbHeight) - 1.

[0178] Wherein, (LastSignificantCoeffX, LastSignificantCoeffY) is the coordinate information of the right lower corner position of the zero-out transform block.

[0179] It should be further noted that the default_last_coeff_enabled_flag can be a sequence level or higher level flag, or a picture level flag or a slice level flag or a block level flag or other level flag, and the block level flag includes a largest coding unit (LCU) level flag or a coding unit (CU) level flag or other block level flag.

[0180] In addition, the default_last_coeff_enabled_flag can depend on some other flags, such as high bit width identification information or high code rate identification information, etc. That is, when the high bit width identification information or the high code rate identification information has a value of 1, the default_last_coeff_enabled_flag flag needs to be decoded; otherwise, the default_last_coeff_enabled_flag flag does not need to be decoded.

[0181] In one specific example, take sequence level as an example, assume that there is a sequence level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high bit depth sequence. If the value of sps_high_bit_depth_flag is 1, it means that the current video sequence is a high bit depth sequence; otherwise, it means that the current video sequence is not a high bit depth sequence. At the sequence level, if the value of sps_high_bit_depth_flag is 1, sps_default_last_coeff_enabled_flag needs to be decoded. Here, sps_default_last_coeff_enabled_flag is the default last coefficient enabled flag of the current sequence. If the value of sps_default_last_coeff_enabled_flag is 1, it means that the block in the current sequence uses the default last coefficient; otherwise (i.e., the value of sps_default_last_coeff_enabled_flag is 0), it means that the block in the current sequence does not use the default last coefficient. The default_last_coeff_enabled_flag in the above syntax table is changed to sps_default_last_coeff_enabled_flag.

[0182] The syntax elements thereof are as follows (Sequence parameter set RBSP syntax), see Table 6.

[0183] Table 6

[0184] In another specific example, taking a slice as an example, it is assumed that there is a sequence-level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high bit-depth sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high bit-depth sequence; otherwise, it indicates that the current video sequence is not a high bit-depth sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, sh_default_last_coeff_enabled_flag needs to be decoded. Here, sh_default_last_coeff_enabled_flag is the default last coefficient enabled flag of the current slice. If the value of sh_default_last_coeff_enabled_flag is 1, it indicates that the block in the current slice uses the default last coefficient; otherwise (i.e., the value of sh_default_last_coeff_enabled_flag is 0), it indicates that the block in the current slice does not use the default last coefficient. The default_last_coeff_enabled_flag in the above syntax table is changed to sh_default_last_coeff_enabled_flag.

[0185] The syntax elements thereof are as follows (Slice header syntax), see Table 7.

[0186] Table 7

[0187] It can also be understood that when the video identification information indicates that the video meets the preset condition, all the subblocks that can be scanned also need to be encoded by default, and at this time, the sb_coded_flag does not need to be transmitted in the code stream, i.e., the encoder / decoder does not need to process this flag, so as to speed up the encoding and decoding speed. Therefore, the subblock default encoding identification information can also be introduced in the embodiments of the present application, which is used to determine whether the to-be-decoded subblock in the current block is encoded by default.

[0188] In some embodiments, when the video identification information indicates that the video meets the preset condition, the method can further include: parsing the code stream to obtain the subblock default encoding identification information; when the subblock default encoding identification information indicates that the to-be-decoded subblock in the current block is encoded by default, determining that the value of the subblock encoding identification information is the first value, and decoding all the coefficients in the to-be-decoded subblock.

[0189] It should be noted that, for the sub-block default identification information, the default_sb_coded_flag can be used. In the embodiments of the present application, the sub-block default coding identification information is at least one of the following identification information: sequence level, image level, slice level and block level; or even higher level (such as VUI, SEI, etc.) identification information, which is not limited herein.

[0190] That is, the default_sb_coded_flag can be a sequence level or higher level flag, or an image level flag or a slice level flag or a block level flag or a flag of other levels. In addition, the block level flag can include a maximum coding unit (LCU) level flag or a coding unit (CU) level flag or a flag of other block levels, which are not limited in the embodiments of the present application.

[0191] In some embodiments, the method can further include: If the value of the sub-block default coding identification information is the first value, it is determined that the sub-block default coding identification information indicates that the to-be-decoded sub-block is default coded; or, If the value of the sub-block default coding identification information is the second value, it is determined that the sub-block default coding identification information indicates that the to-be-decoded sub-block is not default coded.

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

[0193] 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 another specific example, the first value can also be set to 0, and the second value can also be set to 1; or, the first value can also be set to false, and the second value can also be set to true. Here, no limitation is made.

[0194] In this way, taking the first value as 1 and the second value as 0 as an example, if the value of the default_sb_coded_flag is 1, it can be determined that the default_sb_coded_flag indicates that the to-be-decoded sub-block is default coded; or, if the value of the default_sb_coded_flag is 0, it can be determined that the default_sb_coded_flag indicates that the to-be-decoded sub-block is not default coded.

[0195] In the case that the to-be-decoded sub-block is default coded, the value of the default_sb_coded_flag is 1 at this time, which means that the value of the sb_coded_flag is 1, i.e. the sb_coded_flag no longer needs to be decoded, and at this time, all the coefficients in the to-be-decoded sub-block are default decoded.

[0196] Further, in the case that the to-be-decoded sub-block does not default to require coding, i.e., the value of default sb coded flag is 0, in some embodiments, the method can further include: parsing the bitstream to obtain sub-block coding identification information; when the value of the sub-block coding identification information is the first value, decoding all coefficients in the to-be-decoded sub-block.

[0197] It should be noted that if the to-be-decoded sub-block does not default to require coding, then at this time the sub-block coding identification information also needs to be decoded; and then whether to decode all coefficients in the to-be-decoded sub-block is determined according to the sub-block coding identification information.

[0198] Further, for the sub-block coding identification information, the method can further include: if the value of the sub-block coding identification information is the first value, it is determined that all coefficients in the to-be-decoded sub-block are decoded; or if the value of the sub-block coding identification information is the second value, it is determined that all coefficients in the to-be-decoded sub-block are zero.

[0199] In the embodiments of the present application, the sub-block coding identification information can be represented by sb coded flag. Taking 1 as the first value and 0 as the second value as an example, if the value of sb coded flag is 1, it can be determined that all coefficients in the to-be-decoded sub-block need to be decoded; or if the value of sb coded flag is 0, it can be determined that all coefficients in the to-be-decoded sub-block do not need to be decoded, at which time all coefficients in the to-be-decoded sub-block are zero.

[0200] In this way, for a certain case, when the coefficients are coded, the scanned sub-blocks all default to require coding, or in other words, the scanned sub-blocks all default to contain non-zero coefficients. That is, in general cases, the method of coefficient coding is still the same as the existing method in related technologies. The certain case can be, for example, high-bit-width or high-quality or high-bit-rate video or lossless compression video coding. In this case, there are many non-zero coefficients, and almost all scanned sub-blocks need to be coded; or in other words, almost all scanned sub-blocks contain non-zero coefficients. In this way, there is no need to transmit sb coded flag in the bitstream, and the encoder / decoder does not need to process this flag, thereby being able to speed up the coding speed. Since one almost non-existent flag is removed, at this time there is also a little improvement in compression performance.

[0201] The modification of semantics is shown in Table 8.

[0202] Table 8

[0203] wherein the default sb coded flag is a flag indicating whether the default subblock needs to be coded. If the value of the default sb coded flag is 1, it is determined that the value of sb coded flag [xS][yS] is 1, and there is no need to decode sb coded flag [xS][yS] from the bitstream; otherwise (the value of the default sb coded flag is 0), sb coded flag [xS][yS] still needs to be decoded from the bitstream.

[0204] It should be further noted that the default sb coded flag can be a sequence level flag or a higher level flag, or a picture level flag or a slice level flag or a block level flag or other level flag. The block level flag includes a largest coding unit (LCU) level flag or a coding unit (CU) level flag or other block level flag.

[0205] In addition, the default sb coded flag can depend on some other flags, such as high bit depth identification information or high bit rate identification information. That is, when the value of the high bit depth identification information or the high bit rate identification information is 1, the default sb coded flag needs to be decoded; otherwise, the default sb coded flag does not need to be decoded.

[0206] In a specific example, taking the sequence level as an example, it is assumed that there is a sequence level flag sps high bit depth flag indicating whether the current video sequence is a high bit depth sequence. If the value of the sps high bit depth flag is 1, it indicates that the current video sequence is a high bit depth sequence; otherwise, it indicates that the current video sequence is not a high bit depth sequence. At the sequence level, if the value of the sps high bit depth flag is 1, the sps default sb coded flag needs to be decoded. Here, the sps default sb coded flag is a flag indicating whether the default subblock needs to be coded in the current sequence. If the value of the sps default sb coded flag is 1, it indicates that the default subblock needs to be coded in the block in the current sequence; otherwise (i.e., the value of the sps default sb coded flag is 0), it indicates that the default subblock does not need to be coded in the block in the current sequence. The default sb coded flag in the above syntax table is changed to the sps default sb coded flag.

[0207] The syntax elements are as follows (Sequence parameter set RBSP syntax), see Table 9.

[0208] Table 9

[0209] In another specific example, taking a slice as an example, it is assumed that there is a sequence-level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high-bit-width sequence. If the value of sps_high_bit_depth_flag is 1, it indicates that the current video sequence is a high-bit-width sequence; otherwise, it indicates that the current video sequence is not a high-bit-width sequence. At the slice level, if the value of sps_high_bit_depth_flag is 1, sh_default_sb_coded_flag needs to be decoded. Here, sh_default_sb_coded_flag is a flag indicating whether the default sub-block of the current slice needs to be coded. If the value of sh_default_sb_coded_flag is 1, it indicates that the default sub-block of the block in the current slice needs to be coded; otherwise (i.e., the value of sh_default_sb_coded_flag is 0), it indicates that the default sub-block of the block in the current slice does not need to be coded. In the above syntax table, default_sb_coded_flag is changed to sh_default_sb_coded_flag.

[0210] The syntax elements are as follows (Slice header syntax), see Table 10.

[0211] Table 10

[0212] It can be understood that the embodiments of the present application involve three optimization methods, which are as follows: Method one, for a certain case, all possible coefficients need to be encoded by default when encoding the coefficients. That is, in general, the method of coefficient encoding is still the same as the existing method in the related art. The certain case can be, for example, high bit width or high quality or high bit rate video or lossless compression video codec. All possible coefficients need to be encoded by default, 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 in the preset scan order; or the position of the last coefficient to be encoded is placed at the last position of all possible non-zero coefficients of the current block in the preset scan order. Here, the position of the last coefficient to be encoded is used instead of the position of the last non-zero coefficient. Because the coefficient at the position of the last coefficient to be encoded can be 0, but the coefficient at the position of the last non-zero coefficient must not be 0.

[0213] In addition, a specific example is still using the position of the last non-zero coefficient, and the position of the last non-zero coefficient is placed at the last position of all possible non-zero coefficients of the current block in the preset scan order.

[0214] Method two: for a certain case, the derivation method of the last non-zero coefficient position is modified during the coefficient coding. That is, the method of coefficient coding is still the same as the existing method in the related art under normal circumstances. The certain case can be, for example, high bit width or high quality or high bit rate video or lossless compressed video coding. Under normal circumstances, last_sig_coeff_x_prefix and last_sig_coeff_x_suffix code the horizontal distance of the last non-zero coefficient position relative to the top left corner of the current block; last_sig_coeff_y_prefix and last_sig_coeff_y_suffix code the vertical distance of the last non-zero coefficient position relative to the top left corner of the current block. In the case of high bit width or high quality or high bit rate video or lossless compressed video coding, the position of the last non-zero coefficient is generally close to the bottom right corner of the region of the current block that can have non-zero coefficients. In this case, last_sig_coeff_x_prefix and last_sig_coeff_x_suffix code the horizontal distance of the position of the last non-zero coefficient relative to the bottom right corner of the region of the current block that can have non-zero coefficients; last_sig_coeff_y_prefix and last_sig_coeff_y_suffix code the vertical distance of the position of the last non-zero coefficient relative to the bottom right corner of the region of the current block that can have non-zero coefficients. For example, if the region of the current block that can have non-zero coefficients is a rectangular region of (0, 0) to ((1<<log2ZoTbWidth)-1, (1<<log2ZoTbHeight)-1), then last_sig_coeff_x_prefix and last_sig_coeff_x_suffix code 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 code the vertical distance of the position of the last non-zero coefficient relative to ((1<<log2ZoTbWidth)-1, (1<<log2ZoTbHeight)-1) of the current block.

[0215] Method three: for a certain case, all the scanned sub-blocks are required to be coded by default when the coefficients are coded; or in other words, all the scanned sub-blocks contain non-zero coefficients by default. That is, in general cases, the method of coefficient coding is the same as the existing method in the related art. The certain case can be, for example, a high-bit-width or high-quality or high-bit-rate video or lossless compression video codec. In this case, there are many non-zero coefficients, and almost all the scanned sub-blocks need to be coded, or in other words, almost all the scanned sub-blocks contain non-zero coefficients. At this time, there is no need to transmit sb_coded_flag in the bitstream, and the encoder / decoder does not need to process this flag.

[0216] For the above three methods, in the high-bit-width, high-bit-rate, high-quality or lossless video codec scene, due to the difference in coefficient distribution law between the ordinary video scene and the high-bit-width, high-bit-rate, high-quality or lossless video codec scene, the number of syntax elements of the context mode coding in the coefficient coding can be reduced or even eliminated, such as the syntax elements about the position of the last non-zero coefficient and the sub-block coding identifier, so as to improve the throughput and coding speed of the coefficient coding; at the same time, since the above-mentioned flags have little effect in the high-bit-width, high-bit-rate, high-quality or lossless video codec scene, the use of these flags will not reduce the compression efficiency but can improve the compression efficiency to a certain extent.

[0217] In addition, in the embodiments of the present application, taking the sequence level as an example, the sequence level flag sps_high_bit_depth_flag indicating whether the current video sequence is a high-bit-width sequence can be replaced by sps_high_bit_rate_flag indicating whether the current video sequence is a high-bit-rate sequence; or even other flags indicating high-bit-width, high-bit-rate, high-quality or lossless coding, etc.

[0218] It should be noted that the coefficient decoding method of the embodiments of the present application is an example of using the technology for all components in the video. The components refer to, for example, R, G and B of the RGB format video, or Y, U and V (Y, Cb and Cr) of the YUV format, etc. The coefficient decoding method of the embodiments of the present application can also be used for only one component, such as only the Y component of the YUV format. The coefficient decoding method of the embodiments of the present application can also be used for each component respectively, that is, each component can be controlled independently.

[0219] The embodiment provides a coefficient decoding method, which is applied to a decoder. Video identification information is acquired by parsing a code stream; when the video identification information indicates that a video meets a preset condition, the code stream is parsed to acquire last non-zero coefficient position flip identification information and coordinate information of a last non-zero coefficient; when the last non-zero coefficient position flip identification information indicates that a last non-zero coefficient position flip is used in a current block, 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, and coefficients of the current block are determined. In this way, in a high-bit-width, high-bit-rate, high-quality or lossless video coding scene, because the coefficient distribution law is different from that in a conventional video scene, the number of syntax elements, such as syntax elements about the position of the last non-zero coefficient, sub-block coding identification and the like, is reduced or even eliminated in coefficient coding, and even when the value of the coordinate information of the last non-zero coefficient is large, coordinate transformation can be performed, so that the overhead caused by coding in the code stream can be reduced, and the throughput and coding speed of coefficient coding are improved; in addition, because the number of syntax elements is reduced or eliminated, the influence of the syntax elements in the high-bit-width, high-bit-rate, high-quality or lossless video coding is small, and the compression efficiency is improved.

[0220] In another embodiment of the present application, referring to Figure 11 , a flowchart of a coefficient coding method provided by the embodiment of the present application is shown. As shown in Figure 11 , the method can include the following steps. S1101: determining video identification information and the position of a last non-zero coefficient.

[0221] S1102: when the video identification information indicates that a video meets a preset condition, determining last non-zero coefficient position flip identification information.

[0222] S1103: determining coordinate information of a last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information.

[0223] S1104: encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing the obtained bit information after encoding, the video identification information and the coordinate information of the last non-zero coefficient into a code stream.

[0224] It should be noted that the coefficient coding method of the embodiment of the present application is applied to an encoder. Specifically, based on Figure 8AThe coefficient coding method of the embodiment of the present application is mainly applied to the "entropy coding unit 115" part of the encoder 100. For the entropy coding unit 115, the adaptive binary arithmetic coding mode based on the context model or the bypass mode can be used to entropy code the relevant identification information (or syntax element) and then write it into the code stream.

[0225] It should be further noted that the coefficient coding commonly used in the video standard can include both coding and decoding, and therefore, the coefficient coding includes the coefficient coding method on the encoder side and the coefficient decoding method on the decoder side. The embodiment of the present application describes the coefficient coding method on the encoder side.

[0226] In general, for example, for a conventional video, the coefficient coding method is the same as the existing method in the related art. However, for a certain case, for example, high bit width or high quality or high code rate or lossless compression video coding and decoding, the embodiment of the present application can modify the position derivation method of the last non-zero coefficient. At this time, the embodiment of the present application needs to introduce the video identification information and the last non-zero coefficient position flip identification information to determine the position of the last non-zero coefficient, and then encode all the coefficients before the position of the last non-zero coefficient in the current block according to the preset scanning order.

[0227] In the embodiment, the embodiment of the present application first needs to determine whether the current video satisfies the preset condition, which can be represented by the video identification information. In some embodiments, the determination of the video identification information can include: If the video satisfies the preset condition, the value of the video identification information is determined as a first value; or, If the video does not satisfy the preset condition, the value of the video identification information is determined as a second value.

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

[0229] It should be noted that in another specific example, the first value can also be set as true, and the second value can also be set as false. Even in another specific example, the first value can also be set as 0, and the second value can also be set as 1; or, the first value can also be set as false, and the second value can also be set as true. Here, there is no limitation.

[0230] It should be further noted that the preset condition at least includes one of the following: high bit width, high quality, high code rate, high frame rate, and lossless compression.

[0231] Further, the video identification information can be a flag at a sequence level, or even a flag at a higher level (such as VUI, SEI, etc.). The determination of whether the video satisfies the preset condition can also be made by determining whether the video satisfies a high bit width, or satisfies a high bit rate, or satisfies a high quality, or satisfies lossless compression, etc. The following will be described with respect to these four cases.

[0232] In some embodiments, when the video identification information is high bit width identification information, the method can further include: If the video satisfies the high bit width, it is determined that the high bit width identification information indicates that the video satisfies the preset condition.

[0233] In some embodiments, when the video identification information is high bit rate identification information, the method can further include: If the video satisfies the high bit rate, it is determined that the high bit rate identification information indicates that the video satisfies the preset condition.

[0234] In some embodiments, when the video identification information is high quality identification information, the method can further include: If the video satisfies the high quality, it is determined that the high quality identification information indicates that the video satisfies the preset condition.

[0235] In some embodiments, when the video identification information is lossless compression identification information, the method can further include: If the video satisfies the lossless compression, it is determined that the lossless compression identification information indicates that the video satisfies the preset condition.

[0236] Exemplarily, taking a sequence level as an example, the video identification information can be high bit width identification information (denoted as sps_high_bit_depth_flag) for indicating whether the current video sequence is a high bit width sequence, or can be replaced by high bit rate identification information (denoted as sps_high_bit_rate_flag) for indicating whether the current video sequence is a high bit rate sequence, or can be replaced by other identification information for indicating high bit width, high bit rate, high quality, or lossless compression, which is not limited in the embodiments of the present application.

[0237] Further, for the last non-zero coefficient position flipping identification information, the determination of the last non-zero coefficient position flipping identification information can include: If the current block uses the last non-zero coefficient position flipping, it is determined that the last non-zero coefficient position flipping identification information has a first value; or If the current block does not use the last non-zero coefficient position flipping, it is determined that the last non-zero coefficient position flipping identification information has a second value.

[0238] In the embodiments of the present application, the last non-zero coefficient position flipping identification information can be represented by reverse last sig coeff flag. Here, the last non-zero coefficient position flipping identification information can be identification information of at least one of the following: sequence level, picture level, slice level, and block level; or even identification information of a higher level (such as VUI, SEI, etc.), which is not limited herein.

[0239] That is, reverse last sig coeff flag can be a sequence level or higher level flag, or can be a picture level flag or a slice level flag or a block level flag or a flag of another level. In addition, the block level flag can include a maximum coding unit (LCU) level flag or a coding unit (CU) level flag or a flag of another block level, which is not limited in the embodiments of the present application.

[0240] In this way, taking the first value 1 and the second value 0 as an example, if it is determined that the last non-zero coefficient position flipping is used for the current block, the value of reverse last sig coeff flag is 1; or if it is determined that the last non-zero coefficient position flipping is not used for the current block, the value of reverse last sig coeff flag is 0.

[0241] Further, the position of the last non-zero coefficient can include an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient. When the initial horizontal coordinate and the initial vertical coordinate are horizontal and vertical distances between the position of the last non-zero coefficient and the position of the top left corner of the current block, the determining of the coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flipping identification information can include: If the value of the last non-zero coefficient position flipping identification information is the first value, the coordinate information of the last non-zero coefficient is determined by calculation according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient; or If the value of the last non-zero coefficient position flipping identification information is the second value, the coordinate information of the last non-zero coefficient is directly determined according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient.

[0242] In other words, in some embodiments, the method can further include: If the value of the last non-zero coefficient position flipping flag information is the first value, the coordinate information of the last non-zero coefficient is determined as the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the lower right corner of the current block; or If the value of the last non-zero coefficient position flipping flag information is the second value, the coordinate information of the last non-zero coefficient is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner of the current block.

[0243] That is, 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 of the current block. For a regular video, since the non-zero coefficients are mostly concentrated in the upper left corner, and a large area of the lower right corner is 0; but for high-bit, high-quality, high-rate video coding, a large number of non-zero coefficients also appear in the lower right corner, so that the value of the coordinate information of the last non-zero coefficient is usually large, at this time, in order to save overhead, coordinate transformation (specifically, coordinate flipping calculation, that is, the coordinate information of the last non-zero coefficient after coordinate flipping is the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the lower right corner of the current block) needs to be performed when the coefficient is encoded, then in the decoder, coordinate flipping calculation also needs to be performed when the coefficient is decoded, and after flipping again, the coordinate information of the last non-zero coefficient can be restored as the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the upper left corner of the current block, so as to determine the position of the last non-zero coefficient.

[0244] Further, in some embodiments, the determining the coordinate information of the last non-zero coefficient according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient can include: determining the width and the height of the current block; performing subtraction calculation on the width of the current block and the initial horizontal coordinate of the last non-zero coefficient to obtain the horizontal coordinate of the last non-zero coefficient, and performing subtraction calculation 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; determining the coordinate information of the last non-zero coefficient according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0245] 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, 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 last non-zero coefficient position is flipped (i.e., the value of reverse_last_sig_coeff_flag is 1), LastSignificantCoeffX = (1<<log2ZoTbWidth)-1-LastSignificantCoeffX; LastSignificantCoeffY = (1<<log2ZoTbHeight)-1-LastSignificantCoeffY.

[0246] Where (LastSignificantCoeffX, LastSignificantCoeffY) on the right side of the equation represents the coordinate information of the last non-zero coefficient directly determined (i.e., the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient), and (LastSignificantCoeffX, LastSignificantCoeffY) on the left side of the equation represents the coordinate information of the last non-zero coefficient obtained after coordinate flipping (i.e., the coordinate information of the last non-zero coefficient written into the code stream in the case where the current block uses the last non-zero coefficient position flipping).

[0247] In some embodiments, writing the coordinate information of the last non-zero coefficient into the code stream can include: determining, according to the coordinate information of the last non-zero coefficient, prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient; 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.

[0248] It should be noted that the prefix information of the horizontal coordinate of the last non-zero coefficient is indicated by last_sig_coeff_x_prefix, the prefix information of the vertical coordinate of the last non-zero coefficient is indicated by last_sig_coeff_y_prefix, the suffix information of the horizontal coordinate of the last non-zero coefficient is indicated by last_sig_coeff_x_suffix, and the suffix information of the vertical coordinate of the last non-zero coefficient is indicated 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.

[0249] Thus, the embodiment of the present application provides a method for deriving the position of the last non-zero coefficient. That is, in general cases, the coefficient coding method is the same as the existing method in the related art. In some cases, such as high-bit-width or high-quality or high-bit-rate video or lossless compressed video coding, the last_sig_coeff_x_prefix and last_sig_coeff_x_suffix encode the horizontal coordinate of the position of the last non-zero coefficient, that is, the horizontal distance relative to the top-left corner of the current block; the last_sig_coeff_y_prefix and last_sig_coeff_y_suffix encode the vertical coordinate of the position of the last non-zero coefficient, that is, the vertical distance relative to the top-left corner of the current block, as shown in FIG. 1. Figure 10A In the case of high-bit-width or high-quality or high-bit-rate video or lossless compressed video coding, the position of the last non-zero coefficient is generally close to the bottom-right corner of the region of the current block where all the possible non-zero coefficients are located. In this case, the 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 bottom-right corner of the region of the current block where all the possible non-zero coefficients are located; the 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 bottom-right corner of the region of the current block where all the possible non-zero coefficients are located, as shown in FIG. 2. Figure 10B Therefore, the embodiment of the present application can introduce reverse_last_sig_coeff_flag, thereby solving the problem that encoding a larger value in the bitstream will cause a larger overhead.

[0250] Further, when the video identification information indicates that the video satisfies the preset condition, it can be further determined that all possible coefficients need to be encoded, that is, the position of the last non-zero coefficient is not used, and all possible non-zero coefficients of the current block are scanned according to the preset scanning order; therefore, the last coefficient enabling identification information can be introduced in the embodiments of the present application to determine whether the last coefficient position is used for the current block.

[0251] In some embodiments, when the video identification information indicates that the video satisfies the preset condition, the method can further include: determining last coefficient enabling identification information; when the last coefficient enabling identification information indicates that the last coefficient position is used for the current block, encoding all coefficients before the last coefficient position according to the preset scanning order, and writing the obtained bit information after encoding, the video identification information and the last coefficient enabling identification information into the bitstream.

[0252] It should be noted that the last coefficient enabling identification information can be represented by default_last_coeff_enabled_flag. In the embodiments of the present application, the last coefficient enabling identification information can be at least one of the following identification information: sequence level, image level, slice level and block level; or even higher level (such as VUI, SEI, etc.), which is not limited here.

[0253] It should be further noted that for the last coefficient enabling identification information, in some embodiments, the determination of the last coefficient enabling identification information can include: if the current block uses the last coefficient position, the value of the last coefficient enabling identification information is determined as a first value; or if the current block does not use the last coefficient position, the value of the last coefficient enabling identification information is determined as a second value.

[0254] That is, taking 1 as the first value and 0 as the second value as an example, if it is determined that the current block uses the last coefficient position, 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, the value of default_last_coeff_enabled_flag is 0.

[0255] Further, for the last coefficient position, in some embodiments, the last coefficient position is a bottom-right position of a matrix composed of all possible non-zero coefficients in the current block; or, the last coefficient position is a last position of scanning all possible non-zero coefficients in the current block according to the preset scanning order.

[0256] It should be noted that the last coefficient position in the embodiments of the present application does not represent the position of the last non-zero coefficient. Because the coefficient at the last coefficient position can be 0, while the coefficient at the position of the last non-zero coefficient must not be 0.

[0257] In a specific example, the method can further include setting the position of the last non-zero coefficient at the last coefficient position.

[0258] That is, the embodiments of the present application can still use the position of the last non-zero coefficient, at which time 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.

[0259] Further, the last coefficient position can be represented by (LastCoeffX, LastCoeffY), i.e., the last position of all possible non-zero coefficients in the current block according to the preset scanning order. In some embodiments, the method can further include: determining the width and height of the transformed block after the preset operation on the current block; performing coordinate calculation according to the width and height of the transformed block to obtain the bottom-right corner coordinate information of the transformed block; determining the last coefficient position according to the bottom-right corner coordinate information of the transformed block.

[0260] Here, the preset operation at least includes a zero-out operation.

[0261] It should be noted that (LastCoeffX, LastCoeffY) represents the bottom-right corner coordinate information of the transformed block after the zero-out operation; and the derivation method of (LastCoeffX, LastCoeffY) is as follows: LastCoeffX= (1<<log2ZoTbWidth)-1; LastCoeffY= (1<<log2ZoTbHeight)-1.

[0262] In this way, if the value of default_last_coeff_enabled_flag is 1, the last coefficient position can be determined according to (LastCoeffX, LastCoeffY).

[0263] In a particular example, the position of the last non-zero coefficient is still used, which can be placed at the last position of all possible zero coefficients in the current block according to a preset scanning order. In some embodiments, the method can further include: When the position of the last non-zero coefficient is set at 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 transform block.

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

[0265] Wherein, (LastSignificantCoeffX, LastSignificantCoeffY) represents the coordinate information of the lower right corner of the zero-out transform block. If the value of default_last_coeff_enabled_flag is 1, the position of the last non-zero coefficient can be determined according to (LastSignificantCoeffX, LastSignificantCoeffY).

[0266] Further, in the case that the current block does not use the last coefficient position, i.e. the value of the last coefficient enabling identification information is 0, in some embodiments, the method can further include: 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; determining the position of the last non-zero coefficient according to 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 preset scanning order, all coefficients before the position of the last non-zero coefficient are encoded, and prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient are written into the bitstream.

[0267] It should be noted that if the current block does not use the last coefficient position, the position of the last non-zero coefficient needs to be determined at this time. Specifically, last_sig_coeff_x_prefix, last_sig_coeff_x_suffix, last_sig_coeff_y_prefix, and last_sig_coeff_y_suffix need to be determined; and 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.

[0268] Thus, when the coefficients are encoded, all possible coefficients that need to be encoded are required to be encoded by default. That is, in general, the coefficient coding method is the same as the existing method in the related art. In some cases, such as high-bit-width or high-quality or high-bit-rate video or lossless compressed video coding, all possible coefficients that need to be encoded are required to be encoded by default, that is, the position of the last non-zero coefficient is no longer used, and all possible non-zero coefficients of the current block are scanned according to the preset scanning order; or the position of the last coefficient that needs to be encoded is placed at the last position of all possible non-zero coefficients of the current block according to the preset scanning order. This position usually refers to the lower right corner position of the matrix composed of all possible non-zero coefficients of the current block. Therefore, the embodiments of the present application can introduce default_last_coeff_enabled_flag, which can reduce or even eliminate the related syntax elements about the position of the last non-zero coefficient, save overhead, and avoid waste.

[0269] Further, when the video identification information indicates that the video meets the preset condition, all scanned subblocks are required to be encoded by default, and at this time, sb_coded_flag does not need to be transmitted in the bitstream, that is, the encoder / decoder does not need to process this flag to speed up the coding speed. Therefore, the embodiments of the present application can also introduce subblock default coding identification information for determining whether a to-be-decoded subblock in the current block is a default coding.

[0270] In some embodiments, when the video identification information indicates that the video meets the preset condition, the method can further include: determining sub-block default coding identification information of a to-be-coded sub-block in the current block; when the sub-block default coding identification information indicates that the to-be-coded sub-block is to be coded by default, coding all coefficients in the to-be-coded sub-block, and writing bit information obtained after coding and the sub-block default coding identification information into a bitstream.

[0271] It should be noted that, for the sub-block default identification information, default sb coded flag can be used. In the embodiments of the present application, the sub-block default coding identification information is at least identification information of one of the following: sequence level, image level, slice level and block level; or even higher level (such as VUI, SEI, etc.), which is not limited here.

[0272] It should be further noted that, for the sub-block default identification information, in some embodiments, the determining of the sub-block default coding identification information of the to-be-coded sub-block can include: if the to-be-coded sub-block is to be coded by default, determining that the sub-block default coding identification information takes a first value; or if the to-be-coded sub-block is not to be coded by default, determining that the sub-block default coding identification information takes a second value.

[0273] In this way, taking 1 as the first value and 0 as the second value as an example, if it is determined that the to-be-coded sub-block needs to be coded by default, the value of default sb coded flag is 1; or if it is determined that the to-be-coded sub-block does not need to be coded by default, the value of default sb coded flag is 0.

[0274] In the case that the to-be-coded sub-block needs to be coded by default, the value of default sb coded flag is 1 at this time, which means that the value of sb coded flag is 1, i.e., sb coded flag does not need to be coded. However, in the case that the to-be-coded sub-block does not need to be coded by default, i.e., when the sub-block default coding identification information indicates that the to-be-coded sub-block is not to be coded by default, in some embodiments, the method can further include: determining sub-block coding identification information of the to-be-coded sub-block, and writing the sub-block coding identification information into the bitstream.

[0275] Further, in some embodiments, the determining of the sub-block coding identification information of the to-be-coded sub-block can include: if coding is needed in the sub-block, determining that the sub-block coding identification information takes a first value; or if all coefficients in the sub-block are zero, determining that the sub-block coding identification information takes a second value.

[0276] In the embodiments of the present application, the sub-block coding identification information can be represented by sb_coded_flag. Taking the first value as 1 and the second value as 0 as an example, if it is determined that the to-be-coded sub-block needs to be coded, which means that the to-be-coded sub-block contains non-zero coefficients, the value of sb_coded_flag is 1; or if it is determined that the to-be-coded sub-block does not need to be coded, which means that all the coefficients in the to-be-coded sub-block are zero, the value of sb_coded_flag is 0.

[0277] In this way, during the coefficient coding, the scanned sub-blocks are all defaulted to need coding, or in other words, the scanned sub-blocks all contain non-zero coefficients. That is, in general cases, the method of coefficient coding is the same as the existing method in the related art. In some cases, such as high-bit-width or high-quality or high-bit-rate video or lossless compression video coding, there are many non-zero coefficients, and almost all the scanned sub-blocks need to be coded; or in other words, almost all the scanned sub-blocks contain non-zero coefficients. In this way, it is not necessary to transmit sb_coded_flag in the bitstream, and the encoder does not need to process this flag, thereby being able to speed up the coding and decoding. Since one almost unnecessary flag is removed, a little compression performance is also improved at this time.

[0278] The embodiments of the present application also provide a coefficient coding method applied to an encoder. The position of a last non-zero coefficient is determined according to video identification information; when the video identification information indicates that the video satisfies a preset condition, last non-zero coefficient position flip identification information is determined; the coordinate information of the last non-zero coefficient is determined according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information; and all the coefficients before the position of the last non-zero coefficient are coded in a preset scanning order, and the bit information obtained after coding, the video identification information and the coordinate information of the last non-zero coefficient are written into a bitstream. In this way, in the high-bit-width, high-bit-rate, high-quality or lossless video coding scenario, since the coefficient distribution law is different from that in the conventional video scenario, the number of syntax elements, such as the syntax elements about the position of the last non-zero coefficient and the sub-block coding identification, in the context mode coding is reduced or even eliminated in the coefficient coding, and even the coordinate transformation can be performed when the value of the coordinate information of the last non-zero coefficient is large, thereby the overhead caused by coding in the bitstream can be reduced, and the throughput and coding speed of the coefficient coding are improved; in addition, since the reduced or eliminated syntax elements have little influence in the high-bit-width, high-bit-rate, high-quality or lossless video coding, the compression efficiency is also improved.

[0279] In another embodiment of the present application, based on the same inventive concept as the foregoing embodiments, referring to Figure 12 which shows a constituent structure schematic diagram of an encoder 120 provided by the embodiments of the present application. As shown in FIG. 1, the encoder 120 comprises a video identification information determination unit 121, a last non-zero coefficient position determination unit 122, a last non-zero coefficient coordinate information determination unit 123, a coefficient coding unit 124 and a bitstream writing unit 125.Figure 12 The encoder 120 can include a first determining unit 1201 and an encoding unit 1202, as shown in the figure. The first determining unit 1201 is configured to determine video identification information and a position of a last non-zero coefficient, and determine last non-zero coefficient position flip identification information when the video identification information indicates that the video satisfies a preset condition. The first determining unit 1201 is further configured to determine coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information. The encoding unit 1202 is configured to encode all coefficients before the position of the last non-zero coefficient in a preset scanning order, and write bit information obtained after encoding, the video identification information, and the coordinate information of the last non-zero coefficient into a bitstream.

[0280] In some embodiments, the first determining unit 1201 is further configured to determine a first value for the video identification information if the video satisfies the preset condition, or determine a second value for the video identification information if the video does not satisfy the preset condition.

[0281] In some embodiments, the preset condition includes at least one of the following: high bit width, high quality, high code rate, high frame rate, and lossless compression.

[0282] In some embodiments, the first determining unit 1201 is further configured to determine a first value for the last non-zero coefficient position flip identification information if the current block uses last non-zero coefficient position flip, or determine a second value for the last non-zero coefficient position flip identification information if the current block does not use last non-zero coefficient position flip.

[0283] In some embodiments, the position of the last non-zero coefficient includes an initial horizontal coordinate and an initial vertical coordinate of the last non-zero coefficient, and the initial horizontal coordinate and the initial vertical coordinate are horizontal and vertical distances between the position of the last non-zero coefficient and a top-left corner position of the current block. Correspondingly, the first determining unit 1201 is further configured to determine the coordinate information of the last non-zero coefficient according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient if the last non-zero coefficient position flip identification information has the first value, or directly determine the coordinate information of the last non-zero coefficient according to the initial horizontal coordinate and the initial vertical coordinate of the last non-zero coefficient if the last non-zero coefficient position flip identification information has the second value.

[0284] In some embodiments, the first determining unit 1201 is further configured to determine a width and a height of the current block; perform subtraction calculation 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 subtraction calculation 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 according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0285] In some embodiments, the first determining unit 1201 is further configured to, if the value of the last non-zero coefficient position flipping identification information is the first value, determine the coordinate information of the last non-zero coefficient as the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the right bottom corner position of the current block; or, if the value of the last non-zero coefficient position flipping identification information is the second value, determine the coordinate information of the last non-zero coefficient as the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the left top corner position of the current block.

[0286] In some embodiments, the encoding unit 1202 is further configured to determine the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient according to the coordinate information of the last non-zero coefficient; and write the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient into the bitstream.

[0287] In some embodiments, the last non-zero coefficient position flipping identification information is at least one of the following identification information: sequence level, image level, slice level, and block level.

[0288] In some embodiments, the first determining unit 1201 is further configured to determine the last coefficient enabling identification information when the video identification information indicates that the video satisfies a preset condition. The encoding unit 1202 is further configured to, when the last coefficient enabling identification information indicates that the last coefficient position is used in the current block, encode all the coefficients before the last coefficient position according to a preset scanning order, and write the bit information obtained after the encoding, the video identification information, and the last coefficient enabling identification information into the bitstream.

[0289] In some embodiments, the first determining unit 1201 is further configured to determine that the last coefficient enables identification information to be the first value if the last coefficient position is used by the current block; or determine that the last coefficient enables identification information to be the second value if the last coefficient position is not used by the current block.

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

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

[0292] In some embodiments, the first determining unit 1201 is further configured to determine a width and a height of a transformed block obtained after a preset operation on the current block; perform coordinate calculation according to the width and the height of the transformed block to obtain right lower corner coordinate information of the transformed block; and determine the last coefficient position according to the right lower corner coordinate information of the transformed block.

[0293] In some embodiments, the preset operation at least includes a zero-out operation.

[0294] In some embodiments, the first determining unit 1201 is further configured to determine the position of the last non-zero coefficient according to the right lower corner coordinate information of the transformed block when the position of the last non-zero coefficient is set at the last coefficient position.

[0295] In some embodiments, the first determining unit 1201 is further configured to determine prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient when the last coefficient position is not used by the current block; and determine the position of the last non-zero coefficient according to the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient, and the suffix information of the vertical coordinate of the last non-zero coefficient. The encoding unit 1202 is further configured to encode all coefficients before the position of the last non-zero coefficient in 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 a bitstream.

[0296] In some embodiments, the last coefficient enable identification information is identification information of at least one of the following: sequence level, image level, slice level and block level.

[0297] In some embodiments, the first determination unit 1201 is further configured to, when the video identification information indicates that the video satisfies a preset condition, determine sub-block default coding identification information of a to-be-coded sub-block in the current block. The encoding unit 1202 is further configured to, when the sub-block default coding identification information indicates that the to-be-coded sub-block is to be coded by default, code all coefficients in the to-be-coded sub-block, and write bit information obtained after coding and the sub-block default coding identification information into a bitstream.

[0298] In some embodiments, the first determination unit 1201 is further configured to, when the sub-block default coding identification information indicates that the to-be-coded sub-block is not to be coded by default, determine sub-block coding identification information of the to-be-coded sub-block, and write the sub-block coding identification information into the bitstream.

[0299] In some embodiments, the first determination unit 1201 is further configured to, if the to-be-coded sub-block is to be coded by default, determine a first value for the sub-block default coding identification information; or, if the to-be-coded sub-block is not to be coded by default, determine a second value for the sub-block default coding identification information.

[0300] In some embodiments, the first determination unit 1201 is further configured to, if coding is required in the sub-block, determine a first value for the sub-block coding identification information; or, if all coefficients in the sub-block are zero, determine a second value for the sub-block coding identification information.

[0301] In some embodiments, the sub-block default coding identification information is identification information of at least one of the following: sequence level, image level, slice level and block level.

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

[0303] In some embodiments, the first determination unit 1201 is further configured to, when the video identification information is high-bit-width identification information, if the video satisfies a high-bit-width, determine that the high-bit-width identification information indicates that the video satisfies the preset condition.

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

[0305] In some embodiments, the first determination unit 1201 is further configured to, when the video identification information is high-quality identification information, if the video satisfies a high-quality, determine that the high-quality identification information indicates that the video satisfies the preset condition.

[0306] In some embodiments, the first determining unit 1201 is further configured to determine that the lossless compression identification information indicates that the video meets the preset condition when the video meets the lossless compression if the video identification information is the lossless compression identification information.

[0307] It can be understood that, in the embodiments of the present application, the "unit" can be part of a circuit, part of a processor, part of a program or software, etc., and of course can also be a module, and can also be non-modular. Moreover, the various components in the embodiments can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function module.

[0308] The integrated unit, if realized in the form of a software function module and not sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments can essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in the embodiments. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0309] Therefore, the embodiments of the present application provide a computer storage medium applied to the encoder 120, and the computer storage medium stores a computer program. The computer program is executed by the first processor to implement the method described in any one of the foregoing embodiments.

[0310] Based on the components of the encoder 120 and the computer storage medium, refer to Figure 13 which shows a specific hardware structure schematic diagram of the encoder 120 provided by the embodiments of the present application. As Figure 13 indicated, it can include a first communication interface 1301, a first memory 1302 and a first processor 1303; each component is coupled together through a first bus system 1304. It can be understood that the first bus system 1304 is used to realize the connection communication between the components. The first bus system 1304 includes a data bus, a power supply bus, a control bus and a state signal bus. However, for the purpose of clear illustration, only the data bus is shown in Figure 13The various buses are all marked as a first bus system 1304. Among them, A first communication interface 1301 is configured to receive and send signals in the process of transmitting and receiving information with other external network elements; A first memory 1302 is configured to store a computer program capable of running on the first processor 1303; The first processor 1303 is configured to execute the following when running the computer program: determine video identification information and the position of the last non-zero coefficient; When the video identification information indicates that the video meets the preset condition, determine the last non-zero coefficient position flip identification information; According to the position of the last non-zero coefficient and the last non-zero coefficient position flip identification information, determine the coordinate information of the last non-zero coefficient; Encode all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and write the bit information obtained after encoding, the video identification information, and the coordinate information of the last non-zero coefficient into a bitstream.

[0311] It is to be appreciated that the first memory 1302 in the embodiments of this application can be volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. In one embodiment, a nonvolatile memory can be a read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), or flash memory. A volatile memory can be a random access memory (RAM), which acts as external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous dynamic RAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The first memory 1302 of the system and method described herein are intended to include, without being limited to, these and any other suitable types of memory.

[0312] The first processor 1303 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware or the instruction in the form of software in the first processor 1303. The first processor 1303 described above can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a ready programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment of the present application can be directly embodied as a hardware code processor to execute, or be executed by a combination of hardware and software modules in the code processor. The software module can be located in a random memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the first memory 1302, and the first processor 1303 reads the information in the first memory 1302 and combines the hardware to complete the steps of the above method.

[0313] It can be understood that the embodiments described in the present application can be realized by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be realized in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (DSP Device, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for executing functions described in the present application or a combination thereof. For software implementation, the technology described in the present application can be realized by modules (such as processes, functions, etc.) for executing functions described in the present application. The software code can be stored in the memory and executed by the processor. The memory can be implemented in the processor or outside the processor.

[0314] Optionally, as another embodiment, the first processor 1303 is further configured to execute the method in any one of the preceding embodiments when running the computer program.

[0315] The embodiment provides an encoder, which can comprise a first determining unit and an encoding unit. Thus, in the video coding scene of high bit width, high code rate, high quality or lossless, due to the difference of coefficient distribution law from the conventional video scene, the number of syntax elements of context mode coding is reduced or even eliminated in coefficient coding, so that the overhead caused by coding in the code stream can be reduced, and the throughput and coding speed of coefficient coding are improved; in addition, the reduced or eliminated syntax elements have less impact in the video coding scene of high bit width, high code rate, high quality or lossless, and the compression efficiency is also improved.

[0316] In another embodiment of the present application, based on the same inventive concept as the preceding embodiments, referring to Figure 14 which shows a constituent structure schematic diagram of a decoder 140 provided by an embodiment of the present application. As shown in Figure 14 , the decoder 140 can comprise a parsing unit 1401 and a second determining unit 1402; wherein, The parsing unit 1401 is configured to parse the code stream to obtain video identification information, and when the video identification information indicates that the video meets a preset condition, parse the code stream to obtain last non-zero coefficient position flipping identification information and coordinate information of the last non-zero coefficient; The second determining unit 1402 is configured to, when the last non-zero coefficient position flipping identification information indicates that the last non-zero coefficient position flipping is used in the current block, calculate the coordinate information of the last non-zero coefficient to determine the position of the last non-zero coefficient. The parsing unit 1401 is further configured to decode all the coefficients before the position of the last non-zero coefficient in a preset scanning order to determine the coefficients of the current block.

[0317] In some embodiments, the second determining unit 1402 is further configured to, when the last non-zero coefficient position flipping identification information indicates that the last non-zero coefficient position flipping is not used in the current block, directly determine the position of the last non-zero coefficient according to the coordinate information of the last non-zero coefficient. The parsing unit 1401 is further configured to decode all the coefficients before the position of the last non-zero coefficient in a preset scanning order to determine the coefficients of the current block.

[0318] In some embodiments, the second determining unit 1402 is further configured to, if the value of the video identification information is a first value, determine that the video identification information indicates that the video meets the preset condition; or, if the value of the video identification information is a second value, determine that the video identification information indicates that the video does not meet the preset condition.

[0319] In some embodiments, the preset condition comprises at least one of the following: high bit width, high quality, high code rate, high frame rate, and lossless compression.

[0320] In some embodiments, the second determining unit 1402 is further configured to determine that the last non-zero coefficient position flipping identification information indicates that the last non-zero coefficient position flipping is used for the current block if the value of the last non-zero coefficient position flipping identification information is the first value; or determine that the last non-zero coefficient position flipping identification information indicates that the last non-zero coefficient position flipping is not used for the current block if the value of the last non-zero coefficient position flipping identification information is the second value.

[0321] In some embodiments, the parsing unit 1401 is further configured to parse the code stream to obtain prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient, and suffix information of the vertical coordinate of the last non-zero coefficient. The second determining unit 1402 is further configured to determine the horizontal coordinate of the last non-zero coefficient according to the prefix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the horizontal coordinate of the last non-zero coefficient, and determine the vertical coordinate of the last non-zero coefficient according to the prefix information of the vertical coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient, and determine the coordinate information of the last non-zero coefficient according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0322] In some embodiments, the second determining unit 1402 is further configured to, when the last non-zero coefficient position flipping identification information indicates that the last non-zero coefficient position flipping is used for the current block, determine the coordinate information of the last non-zero coefficient as horizontal and vertical distances between the position of the last non-zero coefficient and the lower right corner position of the current block. Further, the second determining unit 1402 is further configured to determine the width and height of the current block, perform subtraction calculation on the width of the current block and the horizontal distance between the position of the last non-zero coefficient and the lower right corner position of the current block to obtain the horizontal coordinate of the last non-zero coefficient, and perform subtraction calculation on the height of the current block and the vertical distance between the position of the last non-zero coefficient and the lower right corner position of the current block to obtain the vertical coordinate of the last non-zero coefficient, and determine the position of the last non-zero coefficient according to the horizontal coordinate of the last non-zero coefficient and the vertical coordinate of the last non-zero coefficient.

[0323] In some embodiments, the second determining unit 1402 is further configured to, when the last non-zero coefficient position flipping identification information indicates that the current block does not use last non-zero coefficient position flipping, determine the coordinate information of the last non-zero coefficient as a horizontal distance and a vertical distance between the position of the last non-zero coefficient and the top-left corner position of the current block; and determine the position of the last non-zero coefficient according to the horizontal distance and the vertical distance between the position of the last non-zero coefficient and the top-left corner position of the current block.

[0324] In some embodiments, the last non-zero coefficient position flipping identification information is identification information at least one of the following: sequence level, picture level, slice level and block level.

[0325] In some embodiments, the parsing unit 1401 is further configured to parse the bitstream to obtain last coefficient enable identification information; and when the last coefficient enable identification information indicates that the current block uses the last coefficient position, decode all coefficients before the last coefficient position according to the preset scanning order to determine the coefficients of the current block.

[0326] In some embodiments, the second determining unit 1402 is further configured to, if the value of the last coefficient enable identification information is the first value, determine that the last coefficient enable identification information indicates that the current block uses the last coefficient position; or, if the value of the last coefficient enable identification information is the second value, determine that the last coefficient enable identification information indicates that the current block does not use the last coefficient position.

[0327] In some embodiments, the parsing unit 1401 is further configured to, when the value of the last coefficient enable identification information is the second value, parse the bitstream to obtain prefix information of a horizontal coordinate of the last non-zero coefficient, prefix information of a vertical coordinate of the last non-zero coefficient, suffix information of the horizontal coordinate of the last non-zero coefficient and suffix information of the vertical coordinate of the last non-zero coefficient. The second determining unit 1402 is further configured to determine the position of the last non-zero coefficient according to the prefix information of the horizontal coordinate of the last non-zero coefficient, the prefix information of the vertical coordinate of the last non-zero coefficient, the suffix information of the horizontal coordinate of the last non-zero coefficient and the suffix information of the vertical coordinate of the last non-zero coefficient; and decode all coefficients before the position of the last non-zero coefficient according to the preset scanning order to determine the coefficients of the current block.

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

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

[0330] In some embodiments, the second determining unit 1402 is further configured to determine a width and a height of the transformed block after a preset operation on the current block; and perform coordinate calculation according to the width and the height of the transformed block to obtain right lower corner coordinate information of the transformed block; and determine the last coefficient position according to the right lower corner coordinate information of the transformed block.

[0331] In some embodiments, the preset operation at least includes a zero-out operation.

[0332] In some embodiments, the second determining unit 1402 is further configured to, when setting the position of the last non-zero coefficient at the last coefficient position, determine the position of the last non-zero coefficient according to the right lower corner coordinate information of the transformed block.

[0333] In some embodiments, the last coefficient enabling identification information is at least one of identification information of a sequence level, an image level, a slice level and a block level.

[0334] In some embodiments, the parsing unit 1401 is further configured to, when the video identification information indicates that the video satisfies a preset condition, parse the bitstream to obtain sub-block default coding identification information; and when the sub-block default coding identification information indicates that a to-be-decoded sub-block in the current block is default coded, determine that the value of the sub-block coding identification information is the first value, and decode all coefficients in the to-be-decoded sub-block.

[0335] In some embodiments, the parsing unit 1401 is further configured to, when the sub-block default coding identification information indicates that the to-be-decoded sub-block is not default coded, parse the bitstream to obtain the sub-block coding identification information; and when the value of the sub-block coding identification information is the first value, decode all coefficients in the to-be-decoded sub-block.

[0336] In some embodiments, the second determining unit 1402 is further configured to, if the value of the sub-block default coding identification information is the first value, determine that the sub-block default coding identification information indicates that the to-be-decoded sub-block is default coded; or, if the value of the sub-block default coding identification information is the second value, determine that the sub-block default coding identification information indicates that the to-be-decoded sub-block is not default coded.

[0337] In some embodiments, the second determining unit 1402 is further configured to determine to decode all coefficients in the to-be-decoded sub-block if the value of the sub-block coding identification information is the first value, or determine that all coefficients in the to-be-decoded sub-block are zero if the value of the sub-block coding identification information is the second value.

[0338] In some embodiments, the sub-block default coding identification information is at least one of the following identification information: sequence level, image level, slice level and block level.

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

[0340] In some embodiments, the second determining unit 1402 is further configured to, when the video identification information is high-bit-width identification information, determine that the video satisfies the preset condition if the high-bit-width identification information indicates that the video satisfies high-bit-width.

[0341] In some embodiments, the second determining unit 1402 is further configured to, when the video identification information is high-bit-rate identification information, determine that the video satisfies the preset condition if the high-bit-rate identification information indicates that the video satisfies high-bit-rate.

[0342] In some embodiments, the second determining unit 1402 is further configured to, when the video identification information is high-quality identification information, determine that the video satisfies the preset condition if the high-quality identification information indicates that the video satisfies high-quality.

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

[0344] It can be understood that, in the embodiments of the present application, the "unit" can be part of a circuit, part of a processor, part of a program or software, etc., and of course can be a module, and can also be non-modular. Moreover, the components in the embodiments can be integrated in a processing unit, or can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function module.

[0345] The integrated unit, if implemented in the form of a software function module and not sold or used as an independent product, can be stored in a computer readable storage medium based on such understanding. The technical solutions of the embodiments essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in the embodiments. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0346] Therefore, the embodiments of the present application provide a computer storage medium applied to the decoder 140, and the computer storage medium stores a computer program. The computer program is executed by the first processor to implement the method in any one of the preceding embodiments.

[0347] Based on the composition of the decoder 140 and the computer storage medium, refer to Figure 15 , which shows a specific hardware structure schematic diagram of the decoder 140 provided by the embodiments of the present application. As Figure 15 indicated, it can include a second communication interface 1501, a second memory 1502 and a second processor 1503; each component is coupled together through a second bus system 1504. It can be understood that the second bus system 1504 is used to realize the connection communication between the components. The second bus system 1504 includes a data bus, a power bus, a control bus and a state signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the second bus system 1504 in Figure 15 . Among them, The second communication interface 1501 is used for receiving and sending signals in the information receiving and sending process between other external network elements; The second memory 1502 is used for storing computer programs capable of running on the second processor 1503; The second processor 1503 is used for executing the following when running the computer program: parsing the code stream to obtain video identification information; When the video identification information indicates that the video meets the preset condition, the code stream is parsed to obtain the last non-zero coefficient position flipping identification information and the coordinate information of the last non-zero coefficient; When the last non-zero coefficient position flipping flag information indicates that the current block uses last non-zero coefficient position flipping, 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.

[0348] Optionally, as another embodiment, the second processor 1503 is further configured to execute the method in any one of the preceding embodiments when the computer program is run.

[0349] It can be understood that the second memory 1502 has similar hardware functions as the first memory 1302, and the second processor 1503 has similar hardware functions as the first processor 1303; and details are not described herein.

[0350] The embodiment provides a decoder, which can include a parsing unit and a second determination unit. In this way, in a high-bit-width, high-code-rate, high-quality or lossless video scene, because the coefficient distribution law is different from that in a conventional video coding scene, the number of syntax elements in context mode coding is reduced or even eliminated in coefficient coding, so that the overhead caused by coding in a code stream can be reduced, and the throughput and coding speed of coefficient coding are improved; in addition, because the reduced or eliminated syntax elements have less impact in high-bit-width, high-code-rate, high-quality or lossless video coding, the compression efficiency can also be improved.

[0351] It should be noted that in the present application, the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent in such a process, method, article or apparatus. Without more limitations, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article or apparatus including the element.

[0352] The serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0353] The methods disclosed in the several method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.

[0354] The features disclosed in the several product embodiments provided by the present application can be combined arbitrarily without conflict to obtain new product embodiments.

[0355] The features disclosed in several method or device embodiments provided by the present application can be combined arbitrarily without conflict, to obtain new method embodiments or device embodiments.

[0356] The above merely provides a specific implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

[0357] Industrial applicability In the embodiments of the present application, whether it is an encoder or a decoder, in the high bit width, high code rate, high quality or lossless video coding scene, due to the different coefficient distribution rules from the conventional video scene, the number of syntax elements in the coefficient coding is reduced or even eliminated, such as the syntax elements about the position of the last non-zero coefficient, the sub-block coding identifier and the like, and even the coordinate transformation can be performed when the value of the coordinate information of the last non-zero coefficient is large, so as to reduce the overhead caused by coding in the code stream, and further improve the throughput and coding speed of the coefficient coding; in addition, due to the small influence of the reduced or eliminated syntax elements in the high bit width, high code rate, high quality or lossless video coding, the compression efficiency can also be improved.

Claims

1. A method of reading a bitstream, the method comprising: reading a bitstream; and decoding the bitstream to generate a video or an image using a decoding method, wherein the decoding method comprises: parsing the bitstream to obtain sequence level identification information; when the sequence level identification information indicates that a video satisfies a preset condition, parsing the bitstream to obtain last non-zero coefficient position flipping identification information and coordinate information of a last non-zero coefficient; when the last non-zero coefficient position flipping identification information indicates that a current block uses last non-zero coefficient position flipping, calculating the coordinate information of the last non-zero coefficient to determine a position of the last non-zero coefficient, wherein the coordinate information of the last non-zero coefficient is a horizontal distance and a vertical distance between the position of the last non-zero coefficient and a lower right corner position of the current block; decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine coefficients of the current block. the decoding method further comprises:

2. The method of claim 1, wherein, when the last non-zero coefficient position flipping identification information indicates that the current block does not use last non-zero coefficient position flipping, directly determining the position of the last non-zero coefficient according to the coordinate information of the last non-zero coefficient; decoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order to determine coefficients of the current block. the decoding method further comprises:

3. The method of claim 1, wherein, if a value of the sequence level identification information is a first value, it is determined that the sequence level identification information indicates that the video satisfies the preset condition; or if the value of the sequence level identification information is a second value, it is determined that the sequence level identification information indicates that the video does not satisfy the preset condition. the preset condition at least includes one of the following: high bit width, high quality, high code rate, high frame rate and lossless compression.

4. The method of any one of claims 1 to 3, wherein, the decoding method further comprises:

5. The method of claim 1, wherein, if a value of the last non-zero coefficient position flipping identification information is a first value, it is determined that the last non-zero coefficient position flipping identification information indicates that the current block uses last non-zero coefficient position flipping; or if the value of the last non-zero coefficient position flipping identification information is a second value, it is determined that the last non-zero coefficient position flipping identification information indicates that the current block does not use last non-zero coefficient position flipping.

6. A method of storing a bitstream, the method comprising: generating a bitstream using an encoding method; and storing the bitstream, wherein the encoding method comprises: determining sequence level identification information and a position of a last non-zero coefficient; when the sequence level identification information indicates that a video satisfies a preset condition, determining last non-zero coefficient position flipping identification information; ​ ​ determining coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flipping identification information, wherein when the last non-zero coefficient position flipping identification information indicates that the current block uses last non-zero coefficient position flipping, the coordinate information of the last non-zero coefficient is horizontal distance and vertical distance between the position of the last non-zero coefficient and a lower right corner position of the current block; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing bit information obtained after encoding, the sequence level identification information and the coordinate information of the last non-zero coefficient into the bitstream.

7. The method of claim 6, wherein, The determining sequence level identification information comprises: if the sequence level satisfies a preset condition, determining that the value of the sequence level identification information is a first value; or if the sequence level does not satisfy the preset condition, determining that the value of the sequence level identification information is a second value.

8. A method for transmitting a bitstream, comprising: performing an encoding method to generate a bitstream; and transmitting the bitstream, wherein the encoding method comprises: determining sequence level identification information and a position of a last non-zero coefficient; when the sequence level identification information indicates that a video satisfies a preset condition, determining last non-zero coefficient position flipping identification information; determining coordinate information of the last non-zero coefficient according to the position of the last non-zero coefficient and the last non-zero coefficient position flipping identification information, wherein when the last non-zero coefficient position flipping identification information indicates that the current block uses last non-zero coefficient position flipping, the coordinate information of the last non-zero coefficient is horizontal distance and vertical distance between the position of the last non-zero coefficient and a lower right corner position of the current block; encoding all coefficients before the position of the last non-zero coefficient according to a preset scanning order, and writing bit information obtained after encoding, the sequence level identification information and the coordinate information of the last non-zero coefficient into the bitstream. The preset condition at least comprises one of the following: high bit width, high quality, high code rate, high frame rate and lossless compression.

9. The method of claim 8, wherein, The determining last non-zero coefficient position flipping identification information comprises:

10. The method of claim 8 or 9, wherein, if the current block uses last non-zero coefficient position flipping, determining that the value of the last non-zero coefficient position flipping identification information is a first value; or if the current block does not use last non-zero coefficient position flipping, determining that the value of the last non-zero coefficient position flipping identification information is a second value. ​