WO2022188186A1 - 系数编解码方法、编解码设备及存储介质 - Google Patents

系数编解码方法、编解码设备及存储介质 Download PDF

Info

Publication number
WO2022188186A1
WO2022188186A1 PCT/CN2021/080635 CN2021080635W WO2022188186A1 WO 2022188186 A1 WO2022188186 A1 WO 2022188186A1 CN 2021080635 W CN2021080635 W CN 2021080635W WO 2022188186 A1 WO2022188186 A1 WO 2022188186A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
flag
coefficient
modulo
decoded
Prior art date
Application number
PCT/CN2021/080635
Other languages
English (en)
French (fr)
Inventor
黄航
袁锜超
王凡
谢志煌
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2021/080635 priority Critical patent/WO2022188186A1/zh
Priority to CN202180095282.6A priority patent/CN116982316A/zh
Priority to EP21929659.7A priority patent/EP4307666A1/en
Publication of WO2022188186A1 publication Critical patent/WO2022188186A1/zh
Priority to US18/367,101 priority patent/US20230421816A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/61Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding in combination with predictive coding

Definitions

  • the embodiments of the present disclosure relate to, but are not limited to, video encoding and decoding technologies, and in particular provide a coefficient encoding and decoding method, encoding and decoding device, and storage medium.
  • Digital video compression technology mainly compresses huge digital video and video data to facilitate transmission and storage.
  • Digital video compression standards can save a lot of video data, it is still necessary to pursue better digital video compression technology to reduce digital video data. Bandwidth and traffic pressure for video transmission.
  • An embodiment of the present disclosure provides a coefficient decoding method, including:
  • the syntax elements include: a non-zero flag, M absolute values greater than X i flags, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, The sum of the M code values whose absolute value is greater than the X i mark and the corresponding values preset by the code value of the modulo result mark, plus the product of the code value of the remaining value mark and N, the obtained sum value ;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and a sign indicating positive and negative;
  • the encoded value of the modulo result sign is determined according to the coefficient to N modulo operation, i ⁇ M, i, M are positive integers, N is a positive integer greater than 1, X i is a positive integer and when i takes different values, X i takes different values and increases with the value of i.
  • An embodiment of the present disclosure provides a coefficient encoding method, including:
  • the syntax elements include: a non-zero flag, M absolute values greater than X i flags, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, The sum of the M code values whose absolute value is greater than the X i mark and the corresponding values preset by the code value of the modulo result mark, plus the product of the code value of the remaining value mark and N, the obtained sum value ;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and a sign indicating positive and negative;
  • the encoded value of the modulo result sign is determined according to the coefficient to N modulo operation, i ⁇ M, i, M are positive integers, N is a positive integer greater than 1, X i is a positive integer and when i takes different values, X i takes different values and increases with the value of i.
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, the absolute value is greater than The coded value of the 1 mark and the pre-set corresponding numerical value of the coded value of the modulo result mark, plus the product of the coded value of the remaining value mark and N, the obtained sum value;
  • the coefficient to be decoded The value of the value is determined according to the absolute value of the coefficient to be decoded and the sign indicating positive and negative; , 4 or 5.
  • An embodiment of the present disclosure provides a coefficient encoding method, including:
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, the absolute value is greater than The coded value of the 1 mark and the pre-set corresponding numerical value of the coded value of the modulo result mark, plus the product of the coded value of the remaining value mark and N, the obtained sum value;
  • the coefficient to be decoded The value of the value is determined according to the absolute value of the coefficient to be decoded and the sign indicating positive and negative; 4 or 5.
  • An embodiment of the present disclosure provides a coefficient decoding method, including:
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, an absolute value greater than 2 flag, a modulo result flag, a residual value flag and a symbol flag;
  • the absolute value of the coefficient to be decoded is a non-zero flag
  • the product of N is the obtained sum value;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and the sign sign indicating positive and negative;
  • An embodiment of the present disclosure provides a coefficient encoding method, including:
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, an absolute value greater than 2 flag, a modulo result flag, a residual value flag and a symbol flag;
  • the absolute value of the coefficient to be decoded is a non-zero flag
  • the product of N is the obtained sum value;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and the sign sign indicating positive and negative;
  • An embodiment of the present disclosure provides a decoding device, including: a processor and a memory storing a computer program
  • An embodiment of the present disclosure provides an encoding device, including: a processor and a memory storing a computer program that can be executed on the processor, wherein the processor implements any of the above when executing the computer program.
  • the coefficient coding method described above is a method for coding any of the above when executing the computer program.
  • An embodiment of the present disclosure provides a non-transitory computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, wherein, when the computer program is executed by a processor, any one of the coefficients described above is implemented decoding method, or implement the coefficient encoding method described in any one of the above.
  • Fig. 1 is a kind of frame schematic diagram of video compression coding
  • Fig. 2 is the schematic diagram of a kind of diagonal scanning in VVC
  • Fig. 3 is the schematic diagram of a kind of coefficient absolute value coding mode in VVC
  • Fig. 4 is the schematic diagram of a kind of anti-zig-zag scanning in AVS
  • Fig. 5 is the schematic diagram of a kind of coefficient absolute value coding mode in AVS
  • FIG. 6 is a schematic flowchart of a coefficient decoding method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic flowchart of a coefficient encoding method according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic flowchart of a coefficient decoding method according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic flowchart of a coefficient encoding method according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic diagram of an absolute value encoding method of a coefficient whose modulus is 3 in an exemplary embodiment of the present disclosure
  • FIG. 11 is a schematic flowchart of a coefficient encoding method in an exemplary embodiment of the disclosure.
  • FIG. 13 is a schematic diagram of encoding a scanned coefficient string according to an exemplary embodiment of the present disclosure
  • FIG. 14 is a schematic flowchart of a coefficient decoding method in an exemplary embodiment of the disclosure.
  • FIG. 15 is a schematic diagram of an absolute value encoding method of a coefficient whose modulus is 3 in an exemplary embodiment of the present disclosure
  • 16 is a schematic flowchart of a coefficient encoding method in an exemplary embodiment of the disclosure.
  • 17 is a schematic flowchart of a coefficient decoding method in an exemplary embodiment of the disclosure.
  • FIG. 18 is a schematic diagram of an absolute value encoding method of a coefficient whose modulus is 5 in an exemplary embodiment of the present disclosure
  • FIG. 19 is a schematic flowchart of a coefficient encoding method in an exemplary embodiment of the disclosure.
  • FIG. 21 is a schematic diagram of an absolute value encoding method of a coefficient whose modulus is 4 in an exemplary embodiment of the present disclosure
  • FIG. 22 is a schematic flowchart of a coefficient encoding method in an exemplary embodiment of the disclosure.
  • FIG. 23 is a schematic flowchart of a coefficient decoding method in an exemplary embodiment of the disclosure.
  • 24 is a schematic flowchart of a coefficient decoding method according to an embodiment of the present disclosure.
  • 25 is a schematic flowchart of a coefficient encoding method according to an embodiment of the disclosure.
  • 26 is a schematic flowchart of a coefficient decoding method according to an embodiment of the present disclosure.
  • FIG. 27 is a schematic flowchart of a coefficient encoding method according to an embodiment of the present disclosure.
  • FIG. 28 is a schematic structural diagram of an encoding device according to an embodiment of the present disclosure.
  • 29 is a structural block diagram of a video encoder in an exemplary embodiment of the disclosure.
  • FIG. 30 is a schematic structural diagram of a decoding device according to an embodiment of the present disclosure.
  • FIG. 31 is a structural block diagram of a video decoder in an exemplary embodiment of the disclosure.
  • Video codec standards include H.264/Advanced Video Coding (Advanced Video Coding, AVC), H.265/High Efficiency Video Coding (High Efficiency Video Coding, HEVC), H.266/Versatile Video Coding (Multifunctional Video Coding, VVC) ) and extensions of these standards, MPEG (Moving Picture Experts Group, Moving Picture Experts Group), AOM (Alliance for Open Media) or any other custom standards, which reduce data transmission and The amount of data stored to achieve more efficient video codec and transmission storage.
  • AVC Advanced Video Coding
  • H.265/High Efficiency Video Coding High Efficiency Video Coding
  • H.266/Versatile Video Coding Multifunctional Video Coding
  • MPEG Moving Picture Experts Group, Moving Picture Experts Group
  • AOM Alliance for Open Media
  • Video compression includes intra-frame prediction (spatial domain) and/or inter-frame prediction (temporal domain) for reducing or removing redundancy within the video, transforming, quantizing, and inverse quantizing and inverse transforming residual information, and improving the quality of subjective and objective reconstruction.
  • Multiple modules such as path filtering and entropy coding.
  • Figure 1 is a schematic diagram of a video compression coding framework, as shown in Figure 1, including: intra-frame prediction, motion estimation/compensation, transform/quantization, inverse transform/inverse quantization, loop filtering, entropy coding and other modules.
  • Video compression standards are block-based compression techniques. For example, a video slice, a frame of pictures or a series of pictures can be divided into coding tree units CTU (Coding Tree Unit), and then the coding tree unit CTU can be divided into image blocks with CU (Coding Unit) as the basic unit.
  • Intra-frame prediction refers to predicting by using the surrounding pixels of the block as a reference
  • inter-frame prediction refers to referencing adjacent block information in space and reference information in other frames for prediction.
  • the prediction block The residual information represents the pixel difference between the original CU to be encoded and the predicted CU, also known as the residual block.
  • the residual block can be transformed, quantized and entropy encoded into a code stream to carry out
  • the residual information can be transformed from the pixel domain to the transform domain, resulting in residual coefficients, which can then quantize the two-dimensional array into a one-dimensional vector in coefficient scan order,
  • the transformed and quantized coefficients can be applied to entropy coding to achieve more compression.
  • the coding unit CU (Coding Unit) is a basic unit for performing various types of coding operations or decoding operations in the video coding and decoding process, such as CU-based prediction, transformation, entropy coding and other operations.
  • CU refers to a two-dimensional sampling point array, which can be a square array or a rectangular array.
  • a 4x8 CU can be regarded as a 4x8 square sampling point array consisting of a total of 32 sampling points.
  • a CU may also be referred to as a tile.
  • the current coding unit CU refers to the coding unit currently being processed, and may also be referred to as the current block.
  • the current CU refers to the CU currently being encoded; in decoding, the current CU refers to the CU currently being decoded.
  • Reference CU refers to a CU that provides a reference signal for the current CU, and may also be referred to as a reference block. Wherein, the pixels of the reference CU refer to the pixels included in the reference CU.
  • Prediction CU refers to the CU that provides prediction for the current CU, and may also be called a prediction block (PU, prediction unit). Each CU may contain one or more PUs.
  • a PU may include pixel data in a spatial domain (which may be referred to as a pixel domain).
  • Residual block refers to the residual image block formed by subtracting the prediction block from the current block to be encoded after the prediction block of the current block is generated by inter-frame prediction and/or intra-frame prediction, which may also be called residual poor data.
  • the transform unit TU refers to a block that presents residual (Residual) or coefficients (Transform Coefficients) obtained by transforming residual data, and may also be called a transform block.
  • Each CU may contain one or more TUs.
  • transforms such as discrete cosine transforms, integer transforms, wavelet transforms, or similar transforms may be used to transform residual data into coefficients, ie, transform the residual data from the pixel domain to the transform domain.
  • the coefficient block includes transforming the residual block to obtain a transform block containing transform coefficients, or not transforming the residual block, including the residual block containing residual data (residual signal).
  • the coefficients include coefficients of a transform block obtained by transforming the residual block, or the coefficients of the residual block, and entropy encoding the coefficients includes entropy encoding after quantizing the coefficients of the transform block, or, if not Applying a transform to the residual data includes quantizing and entropy encoding the coefficients of the residual block.
  • the untransformed residual signal and the transformed residual signal may also be collectively referred to as coefficients.
  • the general coefficients need to be quantized.
  • the quantized coefficients can also become levels.
  • Quantization is often used to reduce the dynamic range of the coefficients, thereby expressing the video with fewer codewords.
  • the quantized value is often referred to as a level.
  • the quantization operation usually divides the coefficient by the quantization step size, which is determined by the quantization factor passed in the code stream. Inverse quantization is done by multiplying the level by the quantization step size. For a block of NxM size, the quantization of all coefficients can be done independently. This technique is widely used in many international video compression standards, such as H.264, HEVC. In the VVC international video compression standard, the quantization operation can use the correlation between the coefficients and use the characteristics of the quantized coefficients to select a better quantization method, so as to achieve the purpose of optimizing the quantization.
  • Entropy encoding the coefficients consists of two parts:
  • One is to scan the coefficients, which includes transforming a two-dimensional coefficient block into a one-dimensional coefficient stream;
  • the scan order can be diagonal scan, zigzag scan, Zigzag scan, horizontal scan, vertical scan, 4x4 sub-block scan, or any other sequence of scans.
  • the second is to entropy encode the value of the coefficient, and then write it into the code stream.
  • coefficient block is scanned and quantized to form a one-dimensional coefficient stream (or coefficient string), CAVLC (context-based adaptive variable-length code), context-adaptive binary arithmetic coding (context- based adaptive binary arithmetic coding), syntax-based adaptive binary arithmetic coding (syntax-based adaptive binary arithmetic coding), probability interval partitioning entropy (PIPE), bypass coding or other entropy coding Entropy encoding of coefficients.
  • CAVLC context-based adaptive variable-length code
  • context-adaptive binary arithmetic coding context- based adaptive binary arithmetic coding
  • syntax-based adaptive binary arithmetic coding syntax-based adaptive binary arithmetic coding
  • PIPE probability interval partitioning entropy
  • bypass coding or other entropy coding Entropy encoding of coefficients.
  • VVC Versatile Video Coding
  • the coefficients in one transform block are usually divided into multiple non-overlapping coefficient groups.
  • the size of the coefficient group depends on the size of the transform block, for example, may include 1x16, 2x8, 8x2, 2x4, 4x2, or 16x1, etc.
  • an 8x8 transform block is first divided into four 4x4 sub-blocks, and then the coefficients are quantized from a two-dimensional vector to a one-dimensional vector by diagonal scanning.
  • the syntax elements of the coefficients at each position include the non-zero flag bit sig_coeff_flag, the coefficient absolute value greater than 1 flag abs_level_gtx_flag[0], the parity check flag par_level_flag, the coefficient absolute value greater than 3 flag abs_level_gtx_flag[1], The remaining value flags abs_remainder and dec_abs_level, and six parts of the sign flag bit coeff_sign_flag.
  • the non-zero flag bit is used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is non-zero.
  • the absolute value of the coefficient is greater than 1 flag, which is used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is greater than 1. Parity flag, used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is odd or even.
  • the absolute value of the coefficient is greater than 3 flag, which is used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is greater than 3.
  • the residual value flag represents the residual value of the coefficient, which can be determined by the following formula:
  • sig+gt1+par+2 ⁇ gt3+2 ⁇ rem, qk is the value of the coefficient, sig is the encoded value of the non-zero flag bit, gt1 is the coded value of the coefficient absolute value greater than 1 flag, par represents the coded value of the parity check flag, gt3 represents the coded value of the coefficient absolute value greater than 3 flag, and rem represents the coded value of the residual value of the coefficient. When present, its value is treated as 0. Sign flags are used to indicate the positive and negative nature of the coefficients.
  • the process of entropy coding the coefficients includes:
  • abs_level_gtx_flag[0] When abs_level_gtx_flag[0] is 0, skip the encoding of parity check flag par_level_flag, coefficient absolute value greater than 3 flag abs_level_gtx_flag[1], remaining value flag abs_remainder and dec_abs_level; when abs_level_gtx_flag[0] is 1, encode par_level_flag, when When the absolute value of the coefficient is even, encode par_level_flag as 0; when the absolute value of the coefficient is odd, encode par_level_flag as 1;
  • abs_level_gtx_flag[1] When abs_level_gtx_flag[1] is 0, skip the encoding of the remaining value flags abs_remainder and dec_abs_level; when abs_level_gtx_flag[1] is 1, encode abs_remainder and dec_abs_level;
  • the remaining value flag can be determined according to the following formula:
  • sig+gt1+par+2 ⁇ gt3+2 ⁇ rem;
  • the coeff_sign_flag is coded according to the positive or negative of the coefficient, when the coefficient is positive, the coeff_sign_flag is coded as 0; when the coefficient is negative, the coeff_sign_flag is coded as 1.
  • the residual value flag and the symbol flag are coded using the bypass coding mode, and the other flags can be coded using the context-based adaptive coding mode.
  • the coefficients that need to be coded are usually limited within a range by the SRCC technology.
  • the coefficient scanning method is to quantize the coefficients from a two-dimensional vector to a one-dimensional vector by scanning in an inverse zig-zag order starting from the lower right corner in the range of SR X -SR Y.
  • the syntax elements of the coefficients at each position include the non-zero flag bit sig_flag, the coefficient absolute value greater than 1 mark coeff_abs_level_greater1_flag, the coefficient absolute value greater than 2 mark coeff_abs_level_greater2_flag, the residual value mark coeff_abs_level_remaining and the sign mark coeff_sign five parts.
  • the non-zero flag bit is used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is non-zero.
  • the absolute value of the coefficient is greater than 1 flag, which is used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is greater than 1.
  • the absolute value of the coefficient is greater than 2 flag, which is used to indicate whether the absolute value of the coefficient ⁇ qk ⁇ is greater than 2.
  • the residual value flag represents the residual value of the coefficient, which can be determined by the following formula:
  • sig+gt1+gt2+rem.
  • qk is the value of the coefficient
  • sig is the coded value of the non-zero flag bit
  • gt1 is the coded value of the coefficient absolute value greater than 1 flag
  • gt2 represents the coded value of the coefficient absolute value greater than 2 flag
  • rem represents the coded value of the remaining value of the coefficient, where , in this formula, when a certain flag does not exist, its value is treated as 0.
  • Sign flags are used to indicate the positive and negative nature of the coefficients. .
  • the process of entropy coding the coefficients includes:
  • coeff_abs_level_remaining can be determined according to the following formula:
  • sig+gt1+gt2+rem.
  • the coeff_sign is coded according to the positive or negative of the coefficient.
  • the coefficient is positive, the coeff_sign is coded as 0; when the coefficient is negative, the coeff_sign is coded as 1.
  • the residual value flag and the symbol flag are coded using the bypass coding mode, and the other flags can be coded using the context-based adaptive coding mode.
  • An embodiment of the present disclosure provides a coefficient decoding method, as shown in FIG. 6 , including:
  • Step 601 parse the obtained code stream, and decode the syntax element of the coefficient to be decoded
  • Step 602 determining the value of the coefficient to be decoded according to the syntax element obtained by decoding
  • the syntax elements include: a non-zero flag, M absolute values greater than X i flags, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, The sum of the M code values whose absolute value is greater than the X i mark and the corresponding values preset by the code value of the modulo result mark, plus the product of the code value of the remaining value mark and N, the obtained sum value ;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and a sign indicating positive and negative;
  • the encoded value of the modulo result sign is determined according to the coefficient to N modulo operation, i ⁇ M, i, M are positive integers, N is a positive integer greater than 1, X i is a positive integer and when i takes different values, X i takes different values and increases with the value of i.
  • the method further includes: pre-setting a specific encoding value for the modulo result flag of the specified absolute value;
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the M coefficients whose absolute value is greater than the i flag, the modulo result flag, the residual value flag and the symbol flag;
  • the method further includes:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the M coefficients whose absolute value is greater than the i flag, the modulo result flag, the residual value flag and the symbol flag;
  • the method further includes:
  • the absolute value of the coefficient the decoded value of the non-zero flag+M absolute values greater than the decoded value corresponding to the Xi flag respectively+the corresponding numerical value preset by the decoded value of the modulo result flag+the remaining value flag ⁇ N;
  • the non-existing syntax element when the decoded value of the non-zero flag, the M absolute values greater than the corresponding decoded value of the Xi flag, the decoded value of the modulo result flag, and the remaining value flag do not exist, the non-existing syntax element shall be used.
  • the decoded value of the syntax element or the preset corresponding value takes the value 0.
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • An embodiment of the present disclosure provides a coefficient encoding method, as shown in FIG. 7 , including:
  • Step 701 generating a coefficient block based on the residual block, scanning the coefficients in the coefficient block, and encoding the syntax element of the coefficient to be encoded;
  • Step 702 write the codeword generated by encoding into the code stream
  • the syntax elements include: a non-zero flag, M absolute values greater than X i flags, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, The sum of the M code values whose absolute value is greater than the X i mark and the corresponding values preset by the code value of the modulo result mark, plus the product of the code value of the remaining value mark and N, the obtained sum value ;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and a sign indicating positive and negative;
  • the encoded value of the modulo result sign is determined according to the coefficient to N modulo operation, i ⁇ M, i, M are positive integers, N is a positive integer greater than 1, X i is a positive integer and when i takes different values, X i takes different values and increases with the value of i.
  • the coding of the modulo result flag is binary coding, occupying K flag bits, then the binary coding of the modulo result flag has 2 K kinds;
  • the method further includes: setting a specific coding value for the modulo result flag of the specified absolute value of the coefficient in advance; coding the non-zero flag, when the absolute value of the coefficient is 0, coding the non-zero flag as 0, Skip the encoding of M coefficients whose absolute value is greater than the i flag, the modulo result flag, the residual value flag and the symbol flag; when the absolute value of the coefficient is not 0, the non-zero flag is encoded as 1;
  • the modulo result flag is coded, when the absolute value of the coefficient is the specified absolute value of the coefficient, the modulo result flag is encoded as the specific encoded value, wherein the specific encoded value is globally unique; when the absolute value of the coefficient is When it is not the absolute value of the specified coefficient, the ( 2K -N) binary codes are encoded as the modulo result flags of the coefficients whose absolute values are M+1 to M+ 2K -N, and the above binary codes are encoded.
  • the encoded encoded values are defined as 0 to 2K -N-1 respectively; the remaining N kinds of binary codes are encoded as the modulo result flags of the coefficients whose absolute value is greater than M+ 2K -N, and the N kinds of binary codes are encoded respectively.
  • the coding values of , respectively, are defined as 1 ⁇ N;
  • the quotient value is the absolute value of the coefficient minus a non-zero flag
  • the corresponding coded value, the absolute value of the M coefficients are greater than the coded value corresponding to the i flag and the preset corresponding numerical value of the coded value of the modulo result flag, and then divided by N to obtain the quotient value, wherein the modulo The preset corresponding numerical value of the encoded value of the result flag satisfies that the calculated quotient is an integer;
  • the sign flag is encoded, when the coefficient is positive, the sign flag is encoded as 0, and when the coefficient is negative, the sign flag is encoded as 1.
  • the coding of the modulo result flag is binary coding, occupying K flag bits, then the binary coding of the modulo result flag has 2 K kinds;
  • the method also includes:
  • the residual value flag is encoded, and the residual value flag is encoded as a quotient value, where the quotient value is the absolute value of the coefficient minus the encoded value corresponding to the non-zero flag , the absolute value of M coefficients is greater than the corresponding numerical value of the encoding value corresponding to the i mark respectively and the encoding value of the said modulo result sign, and then divides the quotient value obtained by N, wherein, the encoding of the said modulo result sign The corresponding value preset by the value satisfies that the calculated quotient is an integer;
  • the sign flag is encoded, when the coefficient is positive, the sign flag is encoded as 0, and when the coefficient is negative, the sign flag is encoded as 1.
  • the coefficient modulo result flag of 2 is coded as 10B;
  • the specific coding value set by the result flag is 00B; the coefficient modulo result flag with the remainder of 0 from the absolute value modulo 3 is coded as 11B, and the coefficient modulo result flag with the remainder of 1 from the absolute value modulo 3 is coded as 01B, Encode the coefficient modulo result flag with a remainder of 2 of the coefficient absolute value modulo 3 as 10B;
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • An embodiment of the present disclosure provides a coefficient decoding method, as shown in FIG. 8 , including:
  • Step 801 obtain a code stream, and analyze the position of the current coding unit to determine the coefficient
  • Step 802 performing entropy decoding on the coefficient according to the position to obtain the syntax element of the coefficient
  • Step 803 determining the value of the coefficient according to the syntax element of the coefficient
  • performing entropy decoding on the coefficient includes: decoding the five syntax elements of the non-zero flag of the coefficient, the M absolute values greater than Xi flag, the modulo result flag, the residual value flag and the symbol flag.
  • the coding of the modulo result flag and the remaining value flag is determined according to the coefficient operation on N modulo, i ⁇ M, i and M are positive integers, and N is a positive integer greater than 1.
  • the entropy decoding of the coefficient is implemented in the following manner:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the M coefficients whose absolute value is greater than the i flag, the modulo result flag, the residual value flag and the symbol flag;
  • entropy decoding of the coefficients is accomplished by:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the M coefficients whose absolute value is greater than the i flag, the modulo result flag, the residual value flag and the symbol flag;
  • determining the value of the coefficient from its syntax element is accomplished by:
  • the decoded value of the non-zero flag the M number of absolute values greater than the corresponding decoded value of the Xi flag, the preset corresponding numerical value of the decoded value of the modulo result flag, and the residual value flag by N, and the obtained sum value is used as: the absolute value of the coefficient; when the sign flag is 0, the value of the coefficient is positive, and when the sign flag is 1, the value of the coefficient is negative; the modulo operation is an operation of taking modulo N;
  • the non-existing syntax element when the decoded value of the non-zero flag, the M absolute values greater than the corresponding decoded value of the Xi flag, the decoded value of the modulo result flag, and the remaining value flag do not exist, the non-existing syntax element shall be used.
  • the decoded value of the syntax element takes the value 0.
  • the value of the coefficient is determined according to the syntax element of the coefficient in any one of the following ways:
  • the X i values corresponding to the M absolute values greater than 0 in the Xi flags are used as the absolute values of the coefficients; when the symbol flags are When the value of the coefficient is 0, the value of the coefficient is positive, and when the sign flag is 1, the value of the coefficient is negative;
  • the non-zero flags When the non-zero flags are decoded as 1, and the M absolute values are greater than the Xi flags and both are 1, add the decoded values of the non-zero flags to the decoded values corresponding to the M absolute values greater than the Xi flags, and the encoded value of the modulo result flag.
  • the preset corresponding numerical value and the residual value flag are multiplied by N, and the obtained sum value is used as the absolute value of the coefficient; when the symbol flag is 0, the value of the coefficient is positive, and when the symbol flag is 1, all The value of the coefficient is negative; the modulo operation is an operation of taking the modulo of N.
  • An embodiment of the present disclosure provides a coefficient encoding method, as shown in FIG. 9 , including:
  • Step 901 generating a coefficient block based on the residual block, scanning the coefficients in the coefficient block, and entropy coding the value of the coefficient;
  • Step 902 write the code word generated by entropy coding into the code stream; wherein, entropy coding is performed on the value of the coefficient, including the non-zero flag of the coefficient, the M absolute values greater than Xi flag, the modulo result flag, The coding of the remaining value flag and the symbol flag of the five syntax elements, the coded values of the modulo result flag and the remaining value flag are determined according to the modulo operation on N, i ⁇ M, i and M are positive integers, and N is A positive integer greater than 1.
  • the encoding of the modulo result flag is implemented in any one of the following ways:
  • a specific coded value is set for the modulo result flag of the specified coefficient absolute value in advance, and when the absolute value of the coefficient is the specified coefficient absolute value, the modulo result flag is coded as the specific coded value, wherein , the corresponding encoded value has global uniqueness;
  • the modulo result flag is encoded as the absolute value of the coefficient minus the non-zero flag and the absolute value of M coefficients greater than the i flag, and the difference obtained is then the pre-set coded value of the remainder obtained by taking the modulo of N;
  • the preset coded value is a binary coded value, and each type of remainder corresponds to a binary coded value.
  • the encoding of the residual value flag is implemented in any one of the following ways:
  • the residual value flag is encoded as a quotient value, where the quotient value is the absolute value of the coefficient minus the encoded value corresponding to the non-zero flag, M absolute values
  • the value is greater than the corresponding value of the encoded value corresponding to the Xi flag and the preset corresponding value of the encoded value of the modulo result flag, and then divided by N to obtain the quotient value, wherein the encoded value of the modulo result flag is preset.
  • the corresponding value satisfies that the calculated quotient is an integer.
  • the encoding in which the absolute values of the M coefficients are greater than the i flag is implemented by any one of the following methods:
  • the non-zero flag is coded as 0, and M coefficients whose absolute value is greater than the i flag, Encoding of modulo result flag, residual value flag and symbol flag;
  • the coding of the non-zero flag, the absolute value of the M coefficients greater than i flag, the modulo result flag, the residual value flag and the symbol flag is performed in sequence, wherein, when the non-zero flag is coded as 1, and when the absolute value of the M coefficients is greater than i and the flags are not all 1, the coding of the modulo result flag and the remaining value flag is skipped.
  • the preset encoded value of the modulo result flag adopts two binary digits.
  • the coding of the modulo result flag is binary coding, occupying K flag bits, then the binary coding of the modulo result flag has 2 K kinds;
  • the ( 2K -N) binary codes are coded as the modulo result flags of the coefficients whose absolute values are M+1 to M+ 2K -N, and the The encoded values of the binary encoding are respectively defined as 0 to 2 K -N-1; the remaining N binary encodings are respectively encoded as the modulo result flags of the coefficients whose absolute value is greater than M+2 K -N, and the N binary encodings are The code values of the code are defined as 1 to N, respectively.
  • the value is determined by the following calculation method:
  • sig+gt1+f(rem_flag)+3 ⁇ rem, where qk is the coefficient, ⁇ qk ⁇ is the absolute value of the coefficient, sig is the encoded value of the non-zero flag, gt1 is the coding value whose absolute value of the coefficient is greater than 1 flag, rem_flag is the coding value of the modulo result flag, f(rem_flag) is the corresponding value preset by rem_flag, when the coding value rem_flag of the modulo result flag
  • Coding is 11B, the coefficient absolute value modulo 3 is coded as 01B, and the coefficient absolute value modulo 3 is coded as 10B, and the coding of the residual value mark rem
  • the value is determined by the following calculation method:
  • sig+gt1+gt2+f(rem_flag)+3 ⁇ rem, where qk is the coefficient, ⁇ qk ⁇ is the absolute value of the coefficient, and sig is the encoded value of the non-zero flag , gt1 is the encoded value of the coefficient absolute value greater than 1 flag, gt2 is the encoded value of the coefficient absolute value greater than 2 flag, rem_flag is the encoded value of the modulo result flag, f(rem_flag) is the corresponding value preset by rem_flag.
  • the coding of the modulo result flag is binary coding, and there are N kinds of binary coding of the modulo result flag;
  • the absolute value of the coefficient is subtracted from the coding value of the non-zero mark and the coding value of the M coefficients whose absolute value is greater than the 1 mark, and the difference obtained is obtained after modulo N.
  • the remainder is pre-set binary coded coded as the coded value of the modulo result flag of the coefficient
  • the modulo result flag is coded as 11B, the modulus result flag with a remainder of 2 from the absolute value modulo 4 is coded as 00B, and the coefficient absolute value modulo 4 with a remainder of 3 is coded as 01B, and the remaining value is 01B.
  • the coded value of the flag rem is determined by the following calculation method:
  • sig+gt1+g(rem_flag)+4 ⁇ rem, where qk is the coefficient, ⁇ qk ⁇ is the absolute value of the coefficient, and sig is the non-zero flag Coding value, gt1 is the coding value whose absolute value of the coefficient is greater than 1 flag, rem_flag is the coding value of the modulo result flag, g(rem_flag) is the corresponding value preset by rem_flag, when the coding value rem_flag of the modulo result flag is 00B , the corresponding g(rem_flag) is 0, when the coded value rem_flag of the modulo result flag is 01B, the corresponding g(rem_flag) is 1, and when the coded value rem_flag of the modulo result flag is 10B, the corresponding g(rem_flag) ) is 2, and
  • the syntax elements of the coefficients include a non-zero flag sig, a coefficient absolute value greater than i flag gti, a modulo result flag rem_flag, a residual value flag rem, and a sign flag coeff_sign.
  • the non-zero flag sig is used to indicate whether the coefficient is non-zero.
  • the coefficient absolute value greater than i flag gti indicates whether the coefficient absolute value is greater than i, for example, the coefficient absolute value greater than i flag gti at least includes the coefficient absolute value greater than 1 flag gt1.
  • the absolute value of the coefficient greater than the i flag may also be referred to as the absolute value greater than the Xi flag.
  • the value required to be encoded by the modulo result flag rem_flag is determined by the value of the modulo and the obtained remainder.
  • the modulo result flag can be encoded as an encoded value corresponding to the remainder, wherein the remainder is the remainder obtained by taking the modulus of the absolute value of the coefficient to N; or, the remainder is subtracting the absolute value of the coefficient from the remainder.
  • the absolute value of the non-zero flag and the M coefficients is greater than the i flag, and the difference obtained is the remainder obtained by modulo N.
  • a specific coding value may be set for the modulo result flag of the specified absolute value of the coefficient in advance, and when the absolute value of the coefficient is the specified absolute value of the coefficient, the modulo result flag is coded as The specific code value, wherein the specific code is globally unique.
  • a specific coding value may be set for the modulo result flag of the specified absolute value of the coefficient in advance, and when the absolute value of the coefficient is not the specified absolute value of the coefficient, the modulo result flag is coded is the coded value corresponding to the remainder, wherein the remainder is the remainder obtained by taking the absolute value of the coefficient modulo N; i sign, the difference obtained is then the remainder obtained by modulo N;
  • the numerical value required to be coded by the residual value flag rem is preset by subtracting the coding value corresponding to the non-zero flag from the absolute value of the coefficient, the coding value corresponding to the absolute value of the M coefficients greater than the i flag respectively, and the coding value of the modulo result flag.
  • the corresponding value of and then divided by N to determine the quotient value, wherein the preset corresponding value of the encoded value of the modulo result flag satisfies that the calculated quotient value is an integer.
  • the sign flag coeff_sign is used to indicate the positive and negative of the level.
  • the syntax elements of the coefficient include a non-zero flag sig, a coefficient absolute value greater than 1 flag gt1, a modulo result flag rem_flag, a residual value flag rem, and a sign flag coeff_sign.
  • the modulo result flag rem_flag is represented by a two-bit binary.
  • the coefficient coding method is as shown in FIG. 10 , where the values of each flag satisfy Formula 1:
  • sig+gt1+f(rem_flag) +3 ⁇ rem.
  • the coefficient absolute value greater than 1 flag gt1 the modulo result flag rem_flag, and the residual value flag rem does not exist, the corresponding value in this formula is treated as 0.
  • rem_flag is a binary coded value
  • f(rem_flag) is a numerical value corresponding to rem_flag, expressed in decimal
  • Table 1 the corresponding relationship between rem_flag and f(rem_flag) is shown in Table 1:
  • the encoded value of the modulo result flag rem_flag corresponding to the absolute value of the coefficient 2 is set to 11B in advance.
  • this exemplary embodiment provides a coefficient entropy encoding method, as shown in FIG. 11 , the method includes:
  • Step 1101 generating a coefficient block based on the residual block, and scanning the coefficients in the coefficient block;
  • the current block is subjected to a prediction part, that is, by inter-frame prediction, or by means of intra-frame prediction, etc., the current block is predicted to obtain a prediction block, and an image corresponding to the coordinates of the original image and the prediction block is taken. block, make a difference with the prediction block to obtain the residual block of the current block, and then transform or not transform the residual block to obtain a transformed block containing transformed coefficients or a non-transformed coefficient block, which are collectively referred to as coefficient blocks here. .
  • the coefficient block is then quantized, and the quantized coefficients are entropy encoded according to the coefficient scanning order.
  • the scan may take a diagonal scan, a zigzag scan, a Zigzag scan, a horizontal scan, a vertical scan, a 4x4 sub-block scan, or any other sequence of scans.
  • Step 1102 entropy encoding is performed on the value of the coefficient based on the encoding method shown in FIG. 10 and the corresponding relationship shown in Table 1;
  • entropy coding is performed on the values of the coefficients based on the coding manner shown in The value is entropy encoded:
  • the non-zero flag sig When the non-zero flag sig is 0, skip the coding of the coefficient absolute value greater than 1 flag, the modulo result flag, the residual value flag and the symbol flag; when the non-zero flag sig is 1, the absolute value of the coding coefficient is greater than 1 Flag gt1, when the absolute value of the coefficient is not greater than 1, the absolute value of the coefficient is greater than 1, the flag gt1 is encoded as 0, and when the absolute value of the coefficient is greater than 1, the absolute value of the coefficient is greater than 1.
  • the flag gt1 is encoded as 1;
  • the flag gt1 When the absolute value of the coefficient is greater than 1, the flag gt1 is 0, skip the encoding of the modulo result flag and the remaining value flag of the coefficient.
  • the flag gt1 When the absolute value of the coefficient is greater than 1, the flag gt1 is 1, and the modulo result flag rem_flag is encoded.
  • the modulo result flag rem_flag When the absolute value of the coefficient is 2, the modulo result flag rem_flag is encoded as 11B; when the coefficient absolute value modulo 3 result is 0, the modulo result flag rem_flag is encoded as 00B; when the coefficient absolute value modulo 3 result is 1, The modulo result flag rem_flag is encoded as 01B; when the coefficient absolute value modulo 3 result is 2, the modulo result flag rem_flag is encoded as 10B;
  • the remaining value flag rem can be calculated according to the above formula 1 and Table 1.
  • the sign flag coeff_sign of the coefficient is encoded; when the coefficient is positive, the sign flag coeff_sign is encoded as 0; when the coefficient is negative, the sign flag coeff_sign is encoded as 1.
  • the transform coefficient string obtained after quantization according to the diagonal scan is ⁇ 0, 2, 4, 5, 0, 6, 3, 7, 0, 2, 1, 0, 9, 3, 0, 8 ⁇
  • Step 1103 write the codeword generated by entropy coding into the code stream.
  • this exemplary embodiment provides a coefficient entropy decoding method, as shown in FIG. 14 , the method includes:
  • Step 1401 Acquire the code stream, parse the current coding unit, and determine the position of the coefficient according to the scanning mode used during coding;
  • the scanning manner may be diagonal scanning, zigzag scanning, Zigzag scanning, horizontal scanning, vertical scanning, 4 ⁇ 4 sub-block scanning, or any other sequence of scanning.
  • diagonal scanning is used for encoding, and diagonal scanning is also used for decoding.
  • Step 1402 performing entropy decoding on the coefficient according to the position to obtain the syntax element of the coefficient
  • entropy decoding may be performed on the first coefficient among all the coefficients in sequence according to the position to obtain the syntax element of the coefficient, and then the value of the coefficient may be determined according to the syntax element of the coefficient, and then the following steps may be performed. Entropy decoding of a coefficient.
  • the syntax elements of the coefficients are obtained by entropy decoding the coefficients by position in the following manner:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the coefficient absolute value greater than 1 flag, the modulo result flag, the residual value flag and the symbol flag;
  • Step 1403 Determine the value of the coefficient according to the syntax element of the coefficient.
  • determining the value of the coefficient from the syntax element of the coefficient is achieved by:
  • the syntax element that does not exist shall be used as the syntax element.
  • the decoded value or the preset corresponding value is 0.
  • the absolute value of the coefficient is calculated by Equation 1 above.
  • determining the value of the coefficient from a syntax element of the coefficient is accomplished in any of the following ways:
  • the absolute value of the coefficient is determined to be 1; when the sign flag is 0, the value of the coefficient is positive, and when the sign flag is 1 , the value of the coefficient is negative;
  • the absolute value of the coefficient greater than 1 is decoded as 1
  • the modulo result flag is decoded as 11B
  • the absolute value of the coefficient is determined to be 2
  • the sign flag is 0, the value of the coefficient is determined to be 2 Positive, when the sign flag is 1, the value of the coefficient is negative;
  • the absolute value of the coefficient is calculated according to the above formula 1; when the symbol flag is 0, the coefficient The value of is positive, and when the sign flag is 1, the value of the coefficient is negative.
  • the coefficient is -3.
  • the encoding mode and the corresponding relationship shown in the above-mentioned Figure 10 and Table 1 are an exemplary description, and other encoding modes and corresponding relationships can also be used, for example, two binary codes include four kinds of binary codes, and any one of the binary codes is used as.
  • the syntax elements of the coefficients include a non-zero flag sig, a coefficient absolute value greater than 1 flag gt1, a coefficient absolute value greater than 2 flag gt2, a modulo result flag rem_flag, a residual value flag rem, and a sign flag coeff_sign.
  • the modulo result flag rem_flag is represented by a two-bit binary.
  • the coefficient coding method is as shown in FIG. 15 , wherein the values of each flag satisfy Formula 2:
  • sig+gt1+gt2+f( rem_flag)+3 ⁇ rem.
  • the coefficient absolute value greater than 1 flag gt1 the coefficient absolute value greater than 2 flag gt2
  • the modulo result flag rem_flag the residual value flag rem does not exist, it is not present in this formula
  • the corresponding value in is treated as 0.
  • rem_flag is a binary coded value
  • f(rem_flag) is a numerical value corresponding to rem_flag, expressed in decimal
  • Table 2 the corresponding relationship between rem_flag and f(rem_flag) is shown in Table 2:
  • the encoded value of the modulo result flag rem_flag corresponding to the absolute value of the coefficient of 3 is set to 00B in advance.
  • this exemplary embodiment provides a coefficient entropy encoding method, as shown in FIG. 16 , the method includes:
  • Step 1601 generating a coefficient block based on the residual block, and scanning the coefficients in the coefficient block;
  • the current block is subjected to a prediction part, that is, by inter-frame prediction, or by means of intra-frame prediction, etc., the current block is predicted to obtain a prediction block, and an image corresponding to the coordinates of the original image and the prediction block is taken. block, make a difference with the prediction block to obtain the residual block of the current block, and then transform or not transform the residual block to obtain a transformed block containing transformed coefficients or a non-transformed coefficient block, which are collectively referred to as coefficient blocks here. .
  • the coefficient block is then quantized, and the quantized coefficients are entropy encoded according to the coefficient scanning order.
  • the scan may take a diagonal scan, a zigzag scan, a Zigzag scan, a horizontal scan, a vertical scan, a 4x4 sub-block scan, or any other sequence of scans.
  • Step 1602 entropy encoding is performed on the value of the coefficient based on the encoding method shown in FIG. 15 and the corresponding relationship shown in Table 2;
  • entropy coding is performed on the value of the coefficient based on the coding manner shown in The value is entropy encoded:
  • the non-zero flag sig When the non-zero flag sig is 0, skip the coding of the coefficient absolute value greater than 1 flag, the coefficient absolute value greater than 2 flag, the modulo result flag, the residual value flag and the symbol flag; when the non-zero flag sig is 1 , the absolute value of the coding coefficient is greater than 1 flag gt1, when the absolute value of the coefficient is not greater than 1, the absolute value of the coefficient is greater than 1 flag gt1 is encoded as 0, when the absolute value of the coefficient is greater than 1, the absolute value of the coefficient is greater than 1 The flag gt1 is encoded is 1;
  • the flag gt1 When the absolute value of the coefficient is greater than 1, the flag gt1 is 0, skip the coding of the absolute value of the coefficient of the coefficient is greater than 2, the modulo result flag and the remaining value flag.
  • the flag gt1 When the absolute value of the coefficient is greater than 1, the flag gt1 is 1, the coding coefficient If the absolute value of the coefficient is greater than 2, when the absolute value of the coefficient is not greater than 2, the absolute value of the coefficient is greater than 2 and the flag gt1 is encoded as 0.
  • the absolute value of the coefficient is greater than 2
  • the flag gt1 is encoded as 1;
  • the flag gt2 When the absolute value of the coefficient is greater than 2, the flag gt2 is 0, skip the encoding of the modulo result flag and the remaining value flag of the coefficient; when the absolute value of the coefficient is greater than 2, the flag gt2 is 1, and the modulo result flag rem_flag is encoded.
  • the modulo result flag rem_flag When the absolute value of the coefficient is 3, the modulo result flag rem_flag is encoded as 00B; when the absolute value of the coefficient modulo 3 is 0, the modulo result flag rem_flag is encoded as 11B; when the coefficient absolute value modulo 3 is 1, the The modulo result flag rem_flag is coded as 01B; when the coefficient absolute value modulo 3 result is 2, the modulo result flag rem_flag is coded as 10B;
  • the remaining value flag rem can be calculated according to the above formula 2 and table 2.
  • the sign flag coeff_sign is encoded; when the coefficient is positive, the sign flag coeff_sign is encoded as 0; when the coefficient is negative, the sign flag coeff_sign is encoded as 1.
  • Step 1603 write the codeword generated by entropy coding into the code stream.
  • this exemplary embodiment provides a coefficient entropy decoding method, as shown in FIG. 17 , the method includes:
  • Step 1701 Acquire a code stream, parse the current coding unit, and determine the position of the coefficient according to the scanning mode used during coding;
  • the scanning manner may be diagonal scanning, zigzag scanning, Zigzag scanning, horizontal scanning, vertical scanning, 4 ⁇ 4 sub-block scanning, or any other sequence of scanning.
  • zigzag scanning is used during encoding, and zigzag scanning is also used during decoding.
  • Step 1702 performing entropy decoding on the coefficient according to the position to obtain the syntax element of the coefficient
  • entropy decoding may be performed on the first coefficient among all the coefficients in sequence according to the position to obtain the syntax element of the coefficient, and then the value of the coefficient may be determined according to the syntax element of the coefficient, and then the following steps may be performed. Entropy decoding of a coefficient.
  • the syntax elements of the coefficients are obtained by entropy decoding the coefficients by position in the following manner:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the flag of coefficient absolute value greater than 1, coefficient absolute value greater than 2 flag, modulo result flag, residual value flag and symbol flag;
  • the absolute value of the decoding coefficient is greater than 1, and when the absolute value of the coefficient is greater than 1, the decoding is 0, and the decoding of the absolute value of the coefficient is greater than 2, the modulo result flag, and the remaining value flag are skipped;
  • Step 1703 determining the value of the coefficient according to the syntax element of the coefficient
  • determining the value of the coefficient from the syntax element of the coefficient is achieved by:
  • the obtained sum value is used as the absolute value of the coefficient; when the sign is 0, the value of the coefficient is positive, and when the sign is 1, the value of the coefficient is negative;
  • the decoded value of the non-zero flag when the decoded value of the non-zero flag, the decoded value of the coefficient absolute value greater than 1 flag, the decoded value of the coefficient absolute value greater than 2 flag, the decoded value of the modulo result flag, and the residual value flag, any syntax element does not exist , the decoded value of the non-existing syntax element or the preset corresponding value takes the value 0.
  • the absolute value of the coefficient is calculated by Equation 2 above.
  • determining the value of the coefficient from a syntax element of the coefficient is accomplished in any of the following ways:
  • the absolute value of the coefficient is determined to be 1; when the sign flag is 0, the value of the coefficient is positive, and when the sign flag is 1 , the value of the coefficient is negative;
  • the coefficient absolute value greater than 1 is decoded as 1
  • the coefficient absolute value greater than 2 is decoded as 0, the absolute value of the coefficient is determined to be 2; when the sign flag is 0, the coefficient's absolute value is 0. The value is positive, and when the sign flag is 1, the value of the coefficient is negative;
  • the coefficient absolute value greater than 1 is decoded as 1
  • the coefficient absolute value greater than 2 is decoded as 1
  • the modulo result flag is decoded as 00B, the absolute value of the coefficient is determined to be 3;
  • the value of the coefficient is positive, and when the sign flag is 1, the value of the coefficient is negative;
  • the coefficient is -3.
  • the encoding mode and the corresponding relationship shown in the above-mentioned Figure 15 and Table 2 are an exemplary illustration, and other encoding modes and corresponding relationships can also be adopted, for example, two binary codes include four kinds of binary codes, and any one of the binary codes is used as the binary code.
  • the coded value of the modulo result flag rem_flag whose coefficient absolute value is 3, and the other three are respectively used as the coding value of the three modulo result flags rem_flag, rem_flag and f( The corresponding relationship of rem_flag) satisfies that the absolute value of the coefficient calculated according to formula 2 is an integer.
  • the syntax elements of the coefficient include a non-zero flag sig, a coefficient absolute value greater than 1 flag gt1, a modulo result flag rem_flag, a residual value flag rem, and a sign flag coeff_sign.
  • the modulo result flag rem_flag is represented by a three-bit binary.
  • the coefficient coding method is as shown in FIG. 18 , where the values of each flag satisfy Formula 3:
  • sig+gt1+f(rem_flag) +5 ⁇ rem, in this formula 3, when any one of the non-zero flag sig, the coefficient absolute value greater than 1 flag gt1, the modulo result flag rem_flag, and the residual value flag rem does not exist, its corresponding value in this formula Values are treated as 0.
  • rem_flag is a binary coded value
  • f(rem_flag) is a numerical value corresponding to rem_flag, expressed in decimal
  • Table 3 the corresponding relationship between rem_flag and f(rem_flag) is shown in Table 3:
  • the coded value of the modulo result flag rem_flag corresponding to the absolute coefficient value of 2 is set to 101B in advance
  • the coded value of the modulo result flag rem_flag corresponding to the absolute coefficient value of 3 is set to 110B
  • the absolute value of the coefficient is set to 110B.
  • the encoded value of the modulo result flag rem_flag corresponding to a value of 4 is set to 11B.
  • the present exemplary embodiment provides a coefficient entropy encoding method, as shown in FIG. 19 , the method includes:
  • Step 1901 generating a coefficient block based on the residual block, and scanning the coefficients in the coefficient block;
  • the current block is subjected to a prediction part, that is, by inter-frame prediction, or by means of intra-frame prediction, etc., the current block is predicted to obtain a prediction block, and an image corresponding to the coordinates of the original image and the prediction block is taken. block, make a difference with the prediction block to obtain the residual block of the current block, and then transform or not transform the residual block to obtain a transformed block containing transformed coefficients or a non-transformed coefficient block, which are collectively referred to as coefficient blocks here. .
  • the coefficient block is then quantized, and the quantized coefficients are entropy encoded according to the coefficient scanning order.
  • the scan may take a diagonal scan, a zigzag scan, a Zigzag scan, a horizontal scan, a vertical scan, a 4x4 sub-block scan, or any other sequence of scans.
  • Step 1902 entropy encoding is performed on the value of the coefficient based on the encoding method shown in FIG. 18 and the corresponding relationship shown in Table 3;
  • entropy coding is performed on the values of the coefficients based on the coding manner shown in The value is entropy encoded:
  • the non-zero flag sig When the non-zero flag sig is 0, skip the coding of the coefficient absolute value greater than 1 flag, the modulo result flag, the residual value flag and the symbol flag; when the non-zero flag sig is 1, the absolute value of the coding coefficient is greater than 1 Flag gt1, when the absolute value of the coefficient is not greater than 1, the absolute value of the coefficient greater than 1 flag gt1 is encoded as 0, when the absolute value of the coefficient is greater than 1, the absolute value of the coefficient is greater than 1 The flag gt1 is encoded as 1;
  • the flag gt1 When the absolute value of the coefficient is greater than 1, the flag gt1 is 0, skip the encoding of the modulo result flag and the remaining value flag of the coefficient, and when the absolute value of the coefficient is greater than 1, the flag gt1 is 1, encode the modulo result flag of the coefficient;
  • the modulo result flag rem_flag When the absolute value modulo of the coefficient is 2, the modulo result flag rem_flag is coded as 101B; when the absolute value modulo of the coefficient is 3, the modulo result flag rem_flag is coded as 110B; when the coefficient absolute value modulo is 4,
  • the modulo result flag rem_flag is encoded as 111B, when the absolute value modulo 5 result of the coefficient is 0, the modulo result flag rem_flag is encoded as 000B; when the coefficient absolute value modulo 5 result is 1, the modulo result flag rem_flag Coded as 001B, when the coefficient absolute value modulo 5 result is 2, encode the modulo result flag
  • the remaining value flag rem can be calculated according to the above formula 3 and table 3.
  • the sign flag coeff_sign is encoded; when the coefficient is positive, the sign flag coeff_sign is encoded as 0; when the coefficient is negative, the sign flag coeff_sign is encoded as 1.
  • Step 1903 write the codeword generated by entropy coding into the code stream.
  • this exemplary embodiment provides a coefficient entropy decoding method, as shown in FIG. 20 , the method includes:
  • Step 2001 obtain a code stream, parse the current coding unit, and determine the position of the coefficient according to the scanning mode adopted during coding;
  • the scanning manner may be diagonal scanning, zigzag scanning, Zigzag scanning, horizontal scanning, vertical scanning, 4 ⁇ 4 sub-block scanning, or any other sequence of scanning.
  • horizontal scanning is used during encoding, and horizontal scanning is also used during decoding.
  • Step 2002 performing entropy decoding on the coefficient according to the position to obtain the syntax element of the coefficient
  • entropy decoding may be performed on the first coefficient among all the coefficients in sequence according to the position to obtain the syntax element of the coefficient, and then the value of the coefficient may be determined according to the syntax element of the coefficient, and then the following steps may be performed. Entropy decoding of a coefficient.
  • the syntax elements of the coefficients are obtained by entropy decoding the coefficients by position in the following manner:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the coefficient absolute value greater than 1 flag, the modulo result flag, the residual value flag and the symbol flag;
  • Step 2003 determining the value of the coefficient according to the syntax element of the coefficient
  • determining the value of the coefficient from the syntax element of the coefficient is achieved by:
  • the non-existing syntax element when any syntax element in the decoded value of the non-zero flag, the decoded value corresponding to the absolute value of the coefficient greater than 1 flag, the decoded value of the modulo result flag, and the remaining value flag does not exist, the non-existing syntax element is used.
  • the decoded value of the element or the preset corresponding value takes the value 0.
  • the absolute value of the coefficient is calculated by Equation 3 above.
  • determining the value of the coefficient from a syntax element of the coefficient is accomplished in any of the following ways:
  • the absolute value of the coefficient is determined to be 1; when the sign flag is 0, the value of the coefficient is positive, and when the sign flag is 1 , the value of the coefficient is negative;
  • the absolute value of the coefficient greater than 1 is decoded as 1
  • the modulo result flag is decoded as 110B
  • the absolute value of the coefficient is determined to be 3 and when the sign flag is 0, the value of the coefficient is Positive, when the sign flag is 1, the value of the coefficient is negative;
  • the absolute value of the coefficient is determined to be 4, and when the symbol flag is 0, the value of the coefficient is determined Positive, when the sign flag is 1, the value of the coefficient is negative;
  • the absolute value of the coefficient is calculated according to the above formula 3 and Table 3; when the symbol When the flag is 0, the value of the coefficient is positive, and when the sign flag is 1, the value of the coefficient is negative.
  • the encoding mode and the corresponding relationship shown in the above-mentioned Figure 18 and Table 3 are an exemplary illustration, and other encoding modes and corresponding relationships can also be used, for example, three binary codes include eight binary codes, and any three binary codes are respectively.
  • the coding value of the modulo result flag rem_flag with absolute coefficient values of 2, 3, and 4 the other five binary codes are used as the absolute value modulo 5 plus 0, excess 1, excess 2, excess 3, and excess 4.
  • the coded value of the modulo result flag rem_flag, the corresponding relationship between rem_flag and f(rem_flag) satisfies that the absolute value of the coefficient calculated according to formula 3 is an integer.
  • the syntax elements of the coefficient include a non-zero flag sig, a coefficient absolute value greater than 1 flag gt1, a modulo result flag rem_flag, a residual value flag rem, and a sign flag coeff_sign.
  • the modulo result flag rem_flag is represented by a two-bit binary.
  • the coefficient coding method is as shown in FIG. 21 , where the values of each flag satisfy Formula 4:
  • sig+gt1+g(rem_flag) +4 ⁇ rem.
  • the coefficient absolute value greater than 1 flag gt1 the modulo result flag rem_flag, and the residual value flag rem does not exist, its corresponding value in this formula is treated as 0.
  • rem_flag is a corresponding binary code value
  • g(rem_flag) is a numerical value corresponding to rem_flag, and the numerical value is expressed in decimal
  • Table 4 the corresponding relationship between rem_flag and g(rem_flag) is shown in Table 4:
  • the present exemplary embodiment provides a coefficient entropy encoding method, as shown in FIG. 22 , the method includes:
  • Step 2201 generating a coefficient block based on the residual block, and scanning the coefficients in the coefficient block;
  • the current block is subjected to a prediction part, that is, by inter-frame prediction, or by means of intra-frame prediction, etc., the current block is predicted to obtain a prediction block, and an image corresponding to the coordinates of the original image and the prediction block is taken. block, make a difference with the prediction block to obtain the residual block of the current block, and then transform or not transform the residual block to obtain a transformed block containing transformed coefficients or a non-transformed coefficient block, which are collectively referred to as coefficient blocks here. .
  • the coefficient block is then quantized, and the quantized coefficients are entropy encoded according to the coefficient scanning order.
  • the scan may take a diagonal scan, a zigzag scan, a Zigzag scan, a horizontal scan, a vertical scan, a 4x4 sub-block scan, or any other sequence of scans.
  • Step 2202 entropy encoding is performed on the value of the coefficient based on the encoding method shown in FIG. 21 and the corresponding relationship shown in Table 4;
  • entropy coding is performed on the values of the coefficients based on the coding manner shown in FIG. 21 and the corresponding relationship shown in Table 4, including: performing entropy coding on each coefficient in the coefficient block according to the scanning position.
  • the value is entropy encoded:
  • the flag gt1 When the absolute value of the coefficient is greater than 1, the flag gt1 is 0, skip the encoding of the modulo result flag and the remaining value flag of the coefficient, and when the absolute value of the coefficient is greater than 1, the flag gt1 is 1, encode the modulo result flag of the coefficient;
  • the coefficient absolute value modulo 4 result When the coefficient absolute value modulo 4 result is 0, encode the modulo result flag rem_flag as 00B; when the coefficient absolute value modulo 4 result is 1, encode the modulo result flag rem_flag as 01B, when the coefficient absolute value modulo 4 4
  • the modulo result flag rem_flag When the result is 2, the modulo result flag rem_flag is coded as 10B, and when the coefficient absolute value modulo 4 result is 3, the modulo result flag rem_flag is coded as 11B;
  • the remaining value flag rem can be calculated according to the above formula 4 and Table 4.
  • the sign flag coeff_sign is encoded; when the coefficient is positive, the sign flag coeff_sign is encoded as 0; when the coefficient is negative, the sign flag coeff_sign is encoded as 1.
  • Step 2203 Write the codeword generated by entropy coding into the code stream.
  • the present exemplary embodiment provides a coefficient entropy decoding method, as shown in FIG. 23 , the method includes:
  • Step 2301 obtain the code stream, parse the current coding unit, and determine the position of the coefficient according to the scanning mode adopted during coding;
  • the scanning manner may be diagonal scanning, zigzag scanning, Zigzag scanning, horizontal scanning, vertical scanning, 4 ⁇ 4 sub-block scanning, or any other sequence of scanning.
  • vertical scanning is used during encoding, and vertical scanning is also used during decoding.
  • Step 2302 performing entropy decoding on the coefficient according to the position to obtain the syntax element of the coefficient
  • entropy decoding may be performed on the first coefficient among all the coefficients in sequence according to the position to obtain the syntax element of the coefficient, and then the value of the coefficient may be determined according to the syntax element of the coefficient, and then the following steps may be performed. Entropy decoding of a coefficient.
  • the syntax elements of the coefficients are obtained by entropy decoding the coefficients by position in the following manner:
  • Decode the non-zero flag when the non-zero flag is decoded as 0, skip the decoding of the coefficient absolute value greater than 1 flag, the modulo result flag, the residual value flag and the symbol flag;
  • Step 2303 Determine the value of the coefficient according to the syntax element of the coefficient.
  • determining the value of the coefficient from the syntax element of the coefficient is achieved by:
  • the non-existing syntax element when any syntax element in the decoded value of the non-zero flag, the decoded value corresponding to the absolute value of the coefficient greater than 1 flag, the decoded value of the modulo result flag, and the remaining value flag does not exist, the non-existing syntax element is used.
  • the decoded value of the element or the preset corresponding value takes the value 0.
  • the absolute value of the coefficient is calculated by Equation 4 above.
  • determining the value of the coefficient from a syntax element of the coefficient is accomplished in any of the following ways:
  • the absolute value of the coefficient is determined to be 1; when the sign flag is 0, the value of the coefficient is positive, and when the sign flag is 1 , the value of the coefficient is negative;
  • the coefficient is -8.
  • the encoding mode and the corresponding relationship shown in the above-mentioned Figure 21 and Table 4 are an exemplary illustration, and other encoding modes and corresponding relationships can also be adopted, for example, two binary codes include four kinds of binary codes, and these four kinds are respectively used as coefficient absolutes.
  • An embodiment of the present disclosure provides a coefficient decoding method, as shown in FIG. 24 , including:
  • Step 2401 parse the obtained code stream, and decode the syntax element of the coefficient to be decoded
  • Step 2402 determining the value of the coefficient to be decoded according to the syntax element obtained by decoding
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, the absolute value is greater than The coded value of the 1 mark and the pre-set corresponding numerical value of the coded value of the modulo result mark, plus the product of the coded value of the remaining value mark and N, the obtained sum value;
  • the coefficient to be decoded The value of the value is determined according to the absolute value of the coefficient to be decoded and the sign indicating positive and negative; , 4 or 5.
  • N 3;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • N 4;
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • An embodiment of the present disclosure provides a coefficient encoding method, as shown in FIG. 25 , including:
  • Step 2501 generating a coefficient block based on the residual block, scanning the coefficients in the coefficient block, and encoding the syntax elements of the coefficients to be encoded;
  • Step 2502 write the code word generated by encoding into the code stream
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, a modulo result flag, a residual value flag, and a symbol flag;
  • the absolute value of the coefficient to be decoded is the encoded value of the non-zero flag, the absolute value is greater than The coded value of the 1 mark and the pre-set corresponding numerical value of the coded value of the modulo result mark, plus the product of the coded value of the remaining value mark and N, the obtained sum value;
  • the coefficient to be decoded The value of the value is determined according to the absolute value of the coefficient to be decoded and the sign indicating positive and negative; 4 or 5.
  • N 3;
  • the modulo result flag is encoded as 11B,
  • N 3;
  • the modulo result flag is encoded as 00B
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • An embodiment of the present disclosure provides a coefficient decoding method, as shown in FIG. 26 , including:
  • Step 2601 parse the obtained code stream, and decode the syntax element of the coefficient to be decoded
  • Step 2602 determining the value of the coefficient to be decoded according to the syntax element obtained by decoding
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, an absolute value greater than 2 flag, a modulo result flag, a residual value flag and a symbol flag;
  • the absolute value of the coefficient to be decoded is a non-zero flag
  • the product of N is the obtained sum value;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and the sign sign indicating positive and negative;
  • N 4;
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • An embodiment of the present disclosure provides a coefficient encoding method, as shown in FIG. 27 , including:
  • Step 2701 generating a coefficient block based on the residual block, scanning the coefficients in the coefficient block, and encoding the syntax elements of the coefficients to be encoded;
  • Step 2702 write the code word generated by encoding into the code stream
  • the syntax elements include: a non-zero flag, an absolute value greater than 1 flag, an absolute value greater than 2 flag, a modulo result flag, a residual value flag and a symbol flag;
  • the absolute value of the coefficient to be decoded is a non-zero flag
  • the product of N is the obtained sum value;
  • the value of the coefficient to be decoded is a value determined according to the absolute value of the coefficient to be decoded and the sign sign indicating positive and negative;
  • N 4;
  • the preset corresponding value is 1;
  • the preset corresponding value is 2;
  • the preset corresponding value is 3.
  • any one or more of the following methods are used for encoding: context-based adaptive variable-length coding CAVLC (context-based adaptive variable-length code ), context-based adaptive binary arithmetic coding (context-based adaptive binary arithmetic coding), syntax-based adaptive binary arithmetic coding (syntax-based adaptive binary arithmetic coding), probability interval partitioning entropy (PIPE) ), bypass coding or other entropy coding.
  • CAVLC context-based adaptive variable-length code
  • context-based adaptive binary arithmetic coding context-based adaptive binary arithmetic coding
  • syntax-based adaptive binary arithmetic coding syntax-based adaptive binary arithmetic coding
  • PIPE probability interval partitioning entropy
  • the encoding of the residual value flag rem and the symbol flag coeff_sign may be encoded using the bypass encoding method, and the non-zero flag sig and the coefficient absolute value greater than 1 flag may be used for encoding. gt1.
  • the coding of the modulo result flag rem_flag is performed using a context-based adaptive coding method.
  • the encoding of the residual value flag rem and the symbol flag coeff_sign may be encoded using the bypass encoding method, and the non-zero flag sig and the coefficient absolute value greater than 1 flag may be used for encoding.
  • gt1 the coefficient absolute value greater than 1 flag gt1
  • the modulo result flag rem_flag are coded using a context-based adaptive coding method.
  • An embodiment of the present disclosure further provides an encoding device, as shown in FIG. 28 , comprising: a processor and a memory storing a computer program executable on the processor, wherein the processor executes the computer program When implementing the coefficient entropy coding method described in any one of the above.
  • the encoding device may be a video encoder or a video codec of any structure.
  • FIG. 29 is a structural block diagram of a video encoder.
  • the video encoder 20 includes a video data memory 33, a division unit 35, a prediction processing unit 41, a summer 50, Transform processing unit 52 , quantification unit 54 , entropy encoding unit 56 .
  • Prediction processing unit 41 includes a motion estimation unit (MEU) 42 , a motion compensation unit (MCU) 44 , an intra-prediction processing unit 46 , and an intra-block copy (IBC) unit 48 .
  • MEU 42, MCU 44, intra-prediction processing unit 46, and IBC unit 48 may actually be highly integrated.
  • video encoder 20 also includes inverse quantization unit 58 , inverse transform processing unit 60 , summer 62 , filter unit 64 , and decoded picture buffer (DPB) 66 .
  • DPB decoded picture buffer
  • the coefficient decoding method described in any of the above embodiments may be performed by a video decoder.
  • An embodiment of the present disclosure further provides a decoding device, as shown in FIG. 30 , comprising: a processor and a memory storing a computer program executable on the processor, wherein the processor executes the computer program When implementing the coefficient entropy decoding method described in any of the above.
  • the encoding device may be a video decoder or video codec of any structure.
  • FIG. 31 is a structural block diagram of a video decoder.
  • the video decoder 30 includes a video data memory 78 , an entropy decoding unit 80 , a prediction processing unit 81 , and an inverse quantization unit 86 . , an inverse transform processing unit 88 , a summer 90 , a wave filter unit 92 and a DPB 94 .
  • the prediction processing unit 81 includes an MCU 82 intra-frame prediction processing unit 84 and an IBC unit 85 .
  • video decoder 30 may perform a decoding process that is substantially reciprocal to the encoding process described with respect to video encoder 20 from FIG. 30 .
  • Embodiments of the present disclosure further provide a non-transitory computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, wherein, when the computer program is executed by a processor, any one of the above-mentioned methods is implemented.
  • the decoding described in the embodiments of the present disclosure may be interpreted as including a decoding operation, or as including an encoding operation and a decoding operation.
  • the encoding described in the embodiments of the present disclosure may be interpreted as including an encoding operation, or as including an encoding operation and a decoding operation.
  • decoded values described in the embodiments of the present disclosure may also be referred to as encoded values, and the encoded values may also be referred to as decoded values, which are the same.
  • the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium and executed by a hardware-based processing unit.
  • Computer-readable media may include computer-readable storage media corresponding to tangible media, such as data storage media, or communication media including any medium that facilitates transfer of a computer program from one place to another, eg, according to a communication protocol.
  • a computer-readable medium may generally correspond to a non-transitory, tangible computer-readable storage medium or a communication medium such as a signal or carrier wave.
  • Data storage media can be any available media that can be accessed by one or more computers or one or more processors to retrieve instructions, code and/or data structures for implementing the techniques described in this disclosure.
  • the computer program product may comprise a computer-readable medium.
  • such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage devices, magnetic disk storage devices or other magnetic storage devices, flash memory, or may be used to store instructions or data Any other medium in the form of a structure that stores the desired program code and that can be accessed by a computer.
  • any connection is also termed a computer-readable medium if, for example, a connection is made from a website, server, or other remote sources transmit instructions, coaxial cable, fiber optic cable, twine, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium.
  • computer-readable storage media and data storage media do not include connections, carrier waves, signals, or other transitory (transitory) media, but are instead directed to non-transitory, tangible storage media.
  • magnetic disks and optical disks include compact disks (CDs), laser disks, optical disks, digital versatile disks (DVDs), floppy disks, or Blu-ray disks, etc., where disks typically reproduce data magnetically, while optical disks use lasers to Optically reproduce data. Combinations of the above should also be included within the scope of computer-readable media.
  • processors such as one or more digital signal processors (DSPs), general purpose microprocessors, application specific integrated circuits (ASICs) field programmable logic arrays (FPGAs) or other equivalent integrated or discrete logic circuits.
  • DSPs digital signal processors
  • ASICs application specific integrated circuits
  • FPGAs field programmable logic arrays
  • processors may refer to any of the foregoing structure or any other structure suitable for implementation of the techniques described herein.
  • the functionality described herein may be provided within dedicated hardware and/or software modules configured for encoding and decoding, or incorporated in a combined codec. Also, the techniques may be fully implemented in one or more circuits or logic elements.
  • the technical solutions of the embodiments of the present disclosure may be implemented in a wide variety of devices or apparatuses, including a wireless handset, an integrated circuit (IC), or a set of ICs (eg, a chip set).
  • IC integrated circuit
  • Various components, modules, or units are described in the disclosed embodiments to emphasize functional aspects of devices configured to perform the described techniques, but do not necessarily require realization by different hardware units. Rather, as described above, the various units may be combined in codec hardware units or provided by a collection of interoperating hardware units (including one or more processors as described above) in conjunction with suitable software and/or firmware.
  • Computer storage media includes both volatile and nonvolatile implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules or other data flexible, removable and non-removable media.
  • Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may Any other medium used to store desired information and which can be accessed by a computer.
  • communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and can include any information delivery media, as is well known to those of ordinary skill in the art .

Abstract

系数编解码方法、编解码设备及存储介质,其中系数解码方法,包括:解析获取的码流,并对待解码系数的语法元素进行解码;根据解码得到的语法元素确定所述待解码系数的值;其中,所述语法元素包括:非零标志、M个绝对值大于Xi标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于Xi标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,Xi为正整数且当i取值不同时,Xi取值不同且随i的取值递增。

Description

系数编解码方法、编解码设备及存储介质 技术领域
本公开实施例涉及但不限于视频编解码技术,尤其设置一种系数编解码方法、编解码设备及存储介质。
背景技术
数字视频压缩技术主要是将庞大的数字影像视频数据进行压缩,以便于传输以及存储等。随着互联网视频的激增以及人们对视频清晰度的要求越来越高,尽管已有的数字视频压缩标准能够节省不少视频数据,但目前仍然需要追求更好的数字视频压缩技术,以减少数字视频传输的带宽和流量压力。
发明概述
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本公开实施例提供了一种系数解码方法,包括:
解析获取的码流,并对待解码系数的语法元素进行解码;
根据解码得到的语法元素确定所述待解码系数的值;
其中,所述语法元素包括:非零标志、M个绝对值大于X i标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于X i标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,X i为正整数且当i取值不同时,X i取值不同且随i的取值递增。
本公开实施例提供了一种系数编码方法,包括:
基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
将编码产生的码字写入码流;
其中,所述语法元素包括:非零标志、M个绝对值大于X i标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于X i标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,X i为正整数且当i取值不同时,X i取值不同且随i的取值递增。本公开实施例提供了一种系数解码方法,包括:
解析获取的码流,并对待解码系数的语法元素进行解码;根据解码得到的语法元素确定所述待解码系数的值;
其中,所述语法元素包括:非零标志、绝对值大于1标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,,N=2,3,4或5。本公开实施例提供了一种系数编码方法,包括:
基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
将编码产生的码字写入码流;
其中,所述语法元素包括:非零标志、绝对值大于1标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。本公开实施例提供了一种系数解码方法,包括:
解析获取的码流,并对待解码系数的语法元素进行解码;根据解码得到的语法元素确定所述待解码系数的值;
其中,所述语法元素包括:非零标志、绝对值大于1标志、绝对值大于2标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的编码值、绝对值大于2标志的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。本公开实施例提供了一种系数编码方法,包括:
基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
将编码产生的码字写入码流;
其中,所述语法元素包括:非零标志、绝对值大于1标志、绝对值大于2标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的编码值、绝对值大于2标志的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。本公开实施例提供了一种解码设备,包括:处理器以及存储有可在所述处理器上运行的计算机程序的存储器,其中,所述处理器执行所述计算机程序时实现上述任一项所述的系数解码方法。
本公开实施例提供了一种编码设备,包括:处理器以及存储有可在所述处理器上运行的计算机程序的存储器,其中,所述处理器执行所述计算机程序时实现上述任一项所述的系数编码方法。
本公开实施例提供了一种非瞬态计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序时被处理器执行时实现上述任一项所述的系数解码方法,或者实现上述任一项所述的系数编码方法。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
附图用来提供对本公开实施例的理解,并且构成说明书的一部分,与本公开实施例一起用于解释本公开的技术方案,并不构成对本公开技术方案的限制。
图1为一种视频压缩编码的框架示意图;
图2为VVC中一种对角线扫描的示意图;
图3为VVC中一种系数绝对值编码方式的示意图;
图4为AVS中一种反zig-zag扫描的示意图;
图5为AVS中一种系数绝对值编码方式的示意图;
图6为本公开一实施例系数解码方法的流程示意图;
图7为本公开一实施例系数编码方法的流程示意图;
图8为本公开一实施例系数解码方法的流程示意图;
图9为本公开一实施例系数编码方法的流程示意图;
图10为本公开一示例性实施例中取模为3的系数绝对值编码方式的示意图;
图11为本公开一示例性实施例中系数编码方法的流程示意图;
图12为本公开一示例性实施例中对角线扫描的示例图;
图13为本公开一示例性实施例中扫描后的系数串的编码示意图;
图14为本公开一示例性实施例中系数解码方法的流程示意图;
图15为本公开一示例性实施例中取模为3的系数绝对值编码方式的示意图;
图16为本公开一示例性实施例中系数编码方法的流程示意图;
图17为本公开一示例性实施例中系数解码方法的流程示意图;
图18为本公开一示例性实施例中取模为5的系数绝对值编码方式的示意图;
图19为本公开一示例性实施例中系数编码方法的流程示意图;
图20为本公开一示例性实施例中系数解码方法的流程示意图;
图21为本公开一示例性实施例中取模为4的系数绝对值编码方式的示意图;
图22为本公开一示例性实施例中系数编码方法的流程示意图;
图23为本公开一示例性实施例中系数解码方法的流程示意图;
图24为本公开一实施例系数解码方法的流程示意图;
图25为本公开一实施例系数编码方法的流程示意图;
图26为本公开一实施例系数解码方法的流程示意图;
图27为本公开一实施例系数编码方法的流程示意图;
图28为本公开实施例编码设备的结构示意图;
图29为本公开一示例性实施例中视频编码器的结构框图;
图30为本公开实施例解码设备的结构示意图;
图31为本公开一示例性实施例中视频解码器的结构框图。
详述
本公开描述了多个实施例,但是该描述是示例性的,而不是限制性的,并且对于本领域的普通技术人员来说显而易见的是,在本公开所描述的实施例包含的范围内可以有更多的实施例和实现方案。
本公开中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本公开中被描述为“示例性的”或者“例如”的任何实施例不应被解释为比其他实施例更优选或更具优势。
在描述具有代表性的示例性实施例时,说明书可能已经将方法和/或过程呈现为特定的步骤序列。然而,在该方法或过程不依赖于本文所述步骤的特定顺序的程度上,该方法或过程不应限于所述的特定顺序的步骤。如本领域普通技术人员将理解的,其它的步骤顺序也是可能的。因此,说明书中阐述的步骤的特定顺序不应被解释为对权利要求的限制。此外,针对该方法和/或过程的权利要求不应限于按照所写顺序执行它们的步骤,本领域技术人员可以容易地理解,这些顺序可以变化,并且仍然保持在本公开实施例的精神和范围内。
视频编解码标准包括H.264/Advanced Video Coding(高级视频编码,AVC),H.265/High Efficiency Video Coding(高效视频编码,HEVC),H.266/Versatile Video Coding(多功能视频编码,VVC)以及这些标准的拓展,MPEG(Moving Picture Experts Group,动态图像专家组),AOM(开放媒体联盟,Alliance for Open Media)或任何自定义的其他标准等,这些标准通过视频压缩技术减少数据传输和存储的数据量,以达到更高效的视频编解码和传输储存。
视频压缩包括用于减少或取出视频内冗余的帧内预测(空域)和/或帧间预测(时域),残差信息的变换、量化和反量化反变换,提高主客观重建质量的环路滤波和熵编码等多个模块。图1为一种视频压缩编码的框架示意图,如图1所示,包括:帧内预测、运动估计/补偿、变换/量化、反变换/反量化、环路滤波、熵编码等模块。
一些视频压缩标准是以块为基础的压缩技术。例如,可以将一个视频片,一帧图片或一系列图片划分成编码树单元CTU(CodingTreeUnit),再将编码树单元CTU划分成以CU(编码单元CU(Coding Unit)为基本单位的图像块。帧内预测是指通过块周边像素作为参考进行预测,帧间预测是指参考空间上的邻近块信息和其他帧里的参考信息进行预测,通过帧内预测或帧间预测可以得到待编码单元CU的预测块。残差信息表示待编码的原始CU与预测CU之间的像素差,也称为残差块。与预测信号相对,可以将残差块进行变换、量化和熵编码成码流进行传输或存储,例如,为了更好的压缩,可将残差信息从像素域变换到变换域,从而得到残差系数,所述系数随后可按照系数扫描顺序将二维阵列量化为一维向量,经过变换和量化后的系数可应用于熵编码以实现更多的压缩。这些视频压缩技术被描述在标准里并实施在的各种与视频压缩相关的领域。
下面先对本公开实施例中涉及到的一些概念进行介绍。
编码单元CU(Coding Unit),是视频编解码过程中进行各种类型的编码操作或解码操作的基本单元,例如基于CU的预测、变换、熵编码等等操作。CU是指一个二维采样点阵列,可以是正方形阵列,或者可以是矩形阵列。例如,一个4x8大小的CU可看做4x8共32个采样点构成的方形采样点阵列。CU也可称为图像块。
当前编码单元CU,是指当前正在处理的编码单元,也可称为当前块。例如,在编码中,当前CU指当前正在编码的CU;在解码中,当前CU指当前正在解码的CU。
参考CU:是指为当前CU提供参考信号的CU,也可称为参考块。其中,参考CU的像素点是指该参考CU内包含的像素点。
预测CU:是指为当前CU提供预测的CU,也可称为预测块(PU,prediction unit)。每一个CU可包含一个或者多个PU。PU可包括空间域(可称为像素域)中的像素数据。
残差块,是指在经帧间预测和/或帧内预测产生当前块的预测块后,将从待编码的当前块减去所述预测块形成的残差图像块,也可称为残差数据。
变换单元TU(TU,transform unit),是指对残差数据进行变换得到的呈现残差(Residual)或是系数(TransformCoefficients)的区块,也可称为变换块。每一个CU可包含一个或者多个TU。例如,可使用离散余弦变换、整数变换、小波变换或类似的变换等变换将残差数据变换成系数,即将残差数据从 像素域转换到变换域。
系数块,包括对残差块进行变换得到含有变换系数的变换块,或者对残差块不进行变换,包括含有残差数据(残差信号)的残差块。
本公开实施例中,系数包括对残差块进行变换得到的变换块的系数,或者残差块的系数,对系数进行熵编码包括对变换块的系数经量化后进行熵编码,或者,如果未将变换应用于残差数据,包括对残差块的系数经量化后进行熵编码。
也可以将未经变换的残差信号和经变换的残差信号统称为系数。为进行有效的压缩,一般系数需进行量化处理。经量化后的系数也可以成为级别。
量化通常被用于降低系数的动态范围,从而达到用更少的码字表达视频的目的。量化后的数值通常称为级别(level)。量化的操作通常是用系数除以量化步长,量化步长由在码流传递的量化因子决定。反量化则是通过级别乘以量化步长来完成。对于一个NxM大小的块,所有系数的量化可以独立的完成,这一技术被广泛地应用在很多国际视频压缩标准,例如H.264,HEVC。在VVC国际视频压缩标准中,量化操作可以利用系数间的相关性,利用已量化系数的特性来选择更优的量化方式,从而达到优化量化的目的。
对系数进行熵编码包含两个部分:
一是对系数进行扫描,作用包括将二维系数块变换成一维系数流;
扫描顺序可以是对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。
二是对系数的值进行熵编码,然后写入码流。
在对系数块经扫描量化形成一维系数流(或者系数串)之后,可根据上下文自适应可变长度编码CAVLC(context-based adaptive variable-length code)、上下文自适应性二进制算术编码(context-based adaptive binary arithmetic coding)、基于语法的上下文自适应性二进制算术编码(syntax-based adaptive binary arithmetic coding)、概率区间分割熵(probability interval partitioning entropy,PIPE)、旁路编码方式或其他熵编码方式来对系数进行熵编码。
在多功能视频编码VVC(Versatile Video Coding,H.266的别称)中,通常将一个变换块中的系数分成多组不重叠的系数组。系数组的大小取决于变换块的大小,例如,可包括1x16、2x8、8x2、2x4、4x2、或者16x1等。例如图2所示,首先将一个8x8的变换块划分为4个4x4的子块,然后采用对角线扫描的方式将系数从二维向量量化为一维向量。
VVC中,经过扫描后,每一个位置的系数的语法元素包括非零标志位sig_coeff_flag、系数绝对值大于1标志abs_level_gtx_flag[0]、奇偶校验标志par_level_flag、系数绝对值大于3标志abs_level_gtx_flag[1]、剩余值标志abs_remainder和dec_abs_level,以及符号标志位coeff_sign_flag六个部分。其中,非零标志位,用于表示系数绝对值│qk│是否为非零。系数绝对值大于1标志,用于表示系数绝对值│qk│是否大于1。奇偶校验标志,用于表示系数绝对值│qk│是奇数还是偶数。系数绝对值大于3标志,用于表示系数绝对值│qk│是否大于3。剩余值标志表示系数剩余值,可以利用下述公式确定:|q k|=sig+gt1+par+2×gt3+2×rem,qk为系数的值,sig为非零标志位的编码值,gt1为系数绝对值大于1标志的编码值、par表示奇偶校验标志的编码值、gt3表示系数绝对值大于3标志的编码值、rem表示系数剩余值的编码值,其中当某一标志位不存在时,其值按0处理。符号标志用于表示系数的正负性。
在VVC中,系数的语法元素包括的各标志位与系数绝对值的对应关系如图3所示,
基于图3所示的系数绝对值编码方式,对系数进行熵编码的过程包括:
编码非零标志位sig_coeff_flag,当系数为0时,将sig_coeff_flag编码为0;当系数不为0时,将sig_coeff_flag编码为1;
当sig_coeff_flag编码为0时,跳过对系数绝对值大于1标志abs_level_gtx_flag[0]、奇偶校验标志par_level_flag、系数绝对值大于3标志abs_level_gtx_flag[1]、剩余值标志abs_remainder和dec_abs_level,以及符号标志位coeff_sign_flag的编码;当sig_coeff_flag编码为1时,编码abs_level_gtx_flag[0],当系数绝对值为1时,将abs_level_gtx_flag[0]编码为0;当系数绝对值大于1时,将abs_level_gtx_flag[0]编码为1;
当abs_level_gtx_flag[0]为0时,跳过奇偶校验标志par_level_flag、系数绝对值大于3标志abs_level_gtx_flag[1]、剩余值标志abs_remainder和dec_abs_level的编码;当abs_level_gtx_flag[0]为1时,编码par_level_flag,当系数绝对值为偶数时,将par_level_flag编码为0;当系数绝对值为奇数时, 将par_level_flag编码为1;
编码abs_level_gtx_flag[1],当系数绝对值不大于3时,将abs_level_gtx_flag[1]编码为0;当系数绝对值大于3时,将abs_level_gtx_flag[1]编码为1;
当abs_level_gtx_flag[1]为0时,跳过剩余值标志abs_remainder和dec_abs_level的编码;当abs_level_gtx_flag[1]为1时,编码abs_remainder和dec_abs_level;
其中,可根据如下公式确定剩余值标志:|q k|=sig+gt1+par+2×gt3+2×rem;
当sig_coeff_flag编码为1时,根据系数正负性编码coeff_sign_flag,当系数为正时,将coeff_sign_flag编码为0;当系数为负时,将coeff_sign_flag编码为1。
其中,剩余值标志以及符号标志使用旁路编码方式进行编码,除此之外的标志可均使用基于上下文的自适应编码方式进行编码。
在AVS(Audio and Video coding Standard,数字音视频编解码技术标准)中,通常通过SRCC技术将需要编码的系数限定在一个范围内。例如,图4所示,系数扫描方式为以SR X—SR Y范围内的右下角为起点,按照反zig-zag的顺序扫描将系数从二维向量量化为一维向量。
AVS中,扫描后,每一个位置的系数的语法元素包括非零标志位sig_flag、系数绝对值大于1标coeff_abs_level_greater1_flag、系数绝对值大于2标志coeff_abs_level_greater2_flag、剩余值标志coeff_abs_level_remaining和符号标志coeff_sign五个部分。其中,非零标志位,用于表示系数绝对值│qk│是否为非零。系数绝对值大于1标志,用于表示系数绝对值│qk│是否大于1。系数绝对值大于2标志,用于表示系数绝对值│qk│是否大于2。剩余值标志表示系数剩余值,可以利用下述公式确定:|q k|=sig+gt1+gt2+rem。qk为系数的值,sig为非零标志位的编码值,gt1为系数绝对值大于1标志的编码值、gt2表示系数绝对值大于2标志的编码值、rem表示系数剩余值的编码值,其中,在该公式中,当某一标志位不存在时,其值按0处理。符号标志用于表示系数的正负性。。
在AVS中,系数qk的语法元素包括的各标志位与系数绝对值的对应关系如图5所示。
基于图5所示的系数绝对值编码方式,对系数进行熵编码的过程包括:
编码非零标志位sig_flag,当系数为0时,将sig_flag编码为0;当系数不为0时,将sig_flag编码为1;
当sig_flag编码为0时,跳过对系数绝对值大于1标coeff_abs_level_greater1_flag、系数绝对值大于2标志coeff_abs_level_greater2_flag、剩余值标志coeff_abs_level_remaining和符号标志coeff_sign的编码;当sig_flag编码为1时,编码coeff_abs_level_greater1_flag,当系数绝对值不大于1时,将coeff_abs_level_greater1_flag编码为0;当系数绝对值大于1时,将coeff_abs_level_greater1_flag编码为1;
当coeff_abs_level_greater1_flag为0时,跳过系数绝对值大于2标志coeff_abs_level_greater2_flag、剩余值标志coeff_abs_level_remaining的编码;当coeff_abs_level_greater1_flag为1时,编码coeff_abs_level_greater2_flag,当系数绝对值不大于2时,将coeff_abs_level_greater2_flag编码为0;当系数绝对值大于2时,将coeff_abs_level_greater2_flag编码为1;
当coeff_abs_level_greater2_flag为0时,跳过剩余值标志coeff_abs_level_remaining的编码;当coeff_abs_level_greater2_flag为1时,编码剩余值标志coeff_abs_level_remaining;
其中,可根据如下公式确定coeff_abs_level_remaining:|q k|=sig+gt1+gt2+rem。
当sig_flag编码为1时,根据系数正负性编码coeff_sign,当系数为正时,将coeff_sign编码为0;当系数为负时,将coeff_sign编码为1。
其中,剩余值标志以及符号标志使用旁路编码方式进行编码,除此之外的标志可均使用基于上下文的自适应编码方式进行编码。
扫描后各个位置的系数之间存在很多统计特性,但是上述编码方式比较单一,基于上下文的自适应二进制算术编码没有充分利用这些统计特性,因此目前的系数熵编码方法还有很多可改进的余地。
本公开实施例提供了一种系数解码方法,如图6所示,包括:
步骤601,解析获取的码流,并对待解码系数的语法元素进行解码;
步骤602,根据解码得到的语法元素确定所述待解码系数的值;
其中,所述语法元素包括:非零标志、M个绝对值大于X i标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于X i标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述 取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,X i为正整数且当i取值不同时,X i取值不同且随i的取值递增。
在一示例性实施例中,所述方法还包括:预先为指定的绝对值的取模结果标志设置特定编码值;
解码非零标志,当非零标志解码为0时,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,解码M个绝对值大于Xi标志,当第g个绝对值大于Xi标志解码为0时,跳过后续M-g个绝对值大于Xi标志、取模结果标志和剩余值标志的解码;1≤g≤M;
当M个系数绝对值大于i标志均为1时,解码取模结果标志;
当取模结果标志的编码值解码为所述特定编码值时,跳过剩余值标志的解码;
当取模结果标志解码不为所述特定编码值时,解码剩余值标志;
当非零标志解码为1时,解码符号标志。
在一示例性实施例中,所述方法还包括:
解码非零标志,当非零标志解码为0时,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,解码M个绝对值大于Xi标志,当第g个绝对值大于Xi标志解码为0时,跳过后续M-g个绝对值大于Xi标志、取模结果标志和剩余值标志的解码;1≤g≤M,当i取值不同时,X i取值不同且随i的取值递增;
当M个绝对值大于Xi标志均为1时,依次解码取模结果标志和剩余值标志;
当非零标志解码为1时,解码符号标志。
在一示例性实施例中,所述方法还包括:
系数的绝对值=非零标志的解码值+M个绝对值大于Xi标志分别对应的解码值+取模结果标志的解码值预先设定的对应数值+剩余值标志×N;
其中,当非零标志的解码值、M个绝对值大于Xi标志分别对应的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值或预先设定的对应数值取值为0。
在一示例性实施例中,M=1,2,或3,N=2,3,4或5。
在一示例性实施例中,M=1,X 1=1,N=3,所述指定的绝对值为2,预先为指定的系数绝对值的取模结果标志设置的特定编码值为11B;
或者,M=2,X 1=1,X 2=2,N=3,所述指定的绝对值为3,预先为指定的系数绝对值的取模结果标志设置的特定编码值为00B;。
在一示例性实施例中,M=1,X 1=1,N=3;
当取模结果标志解码为11B时,预先设定的对应数值为0;
当取模结果标志解码为00B时,预先设定的对应数值为1;
当取模结果标志解码为01B时,预先设定的对应数值为2;
当取模结果标志解码为10B时,预先设定的对应数值为3。
在一示例性实施例中,M=2,X 1=1,X 2=2,N=3;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
在一示例性实施例中,M=1,X 1=1,N=4;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
本公开实施例提供了一种系数编码方法,如图7所示,包括:
步骤701,基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
步骤702,将编码产生的码字写入码流;
其中,所述语法元素包括:非零标志、M个绝对值大于X i标志、取模结果标志、剩余值标志和符 号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于X i标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,X i为正整数且当i取值不同时,X i取值不同且随i的取值递增。
在一示例性实施例中,所述取模结果标志的编码为二进制编码,占用K个标志位,则所述取模结果标志的二进制编码有2 K种;
所述方法还包括:预先为指定的系数绝对值的取模结果标志设置特定编码值;编码所述非零标志,当所述系数绝对值为0时,将所述非零标志编码为0,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的编码;当所述系数绝对值不为0时,将所述非零标志编码为1;
当所述非零标志编码为1时,依次编码M个绝对值大于Xi标志,当所述系数的绝对值为Q,将X i大于Q的绝对值大于Xi标志编码为为0,跳过后续绝对值大于Xi标志的编码;将X i小于等于Q的绝对值大于Xi标志编码为1;
当M个绝对值大于Xi标志中任一个编码为0时,跳过取模结果标志和剩余值标志的编码;当M个绝对值大于Xi标志均编码为1时,编码取模结果标志,当所述系数的绝对值为所述指定的系数绝对值时,将所述取模结果标志编码为所述特定编码值,其中,所述特定编码值具有全局唯一性;当所述系数的绝对值不为所述指定的系数绝对值时,将其中的(2 K-N)种二进制编码编码为绝对值为M+1到M+2 K-N的系数的取模结果标志,且将上述二进制编码的编码值分别定义为0到2 K-N-1;将其余的N种二进制编码分别编码为绝对值大于M+2 K-N的系数的取模结果标志,且将该N种二进制编码的编码值分别定义为1~N;
当所述系数的绝对值不为所述指定的系数绝对值时,编码剩余值标志,将所述剩余值标志编码为商值,所述商值是所述系数的绝对值减去非零标志对应的编码值、M个系数绝对值大于i标志分别对应的编码值以及所述取模结果标志的编码值预先设定的对应数值,再除以N得到的商值,其中,所述取模结果标志的编码值预先设定的对应数值满足计算得到的商值为整数;
当非零标志编码为1时,编码符号标志,当所述系数为正时,将符号标志编码为0,当所述系数为负时,将符号标志编码为1。
在一示例性实施例中,所述取模结果标志的编码为二进制编码,占用K个标志位,则所述取模结果标志的二进制编码有2 K种;
所述方法还包括:
编码所述非零标志,当所述系数绝对值为0时,将所述非零标志编码为0,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的编码;当所述系数绝对值不为0时,将所述非零标志编码为1;
当所述非零标志编码为1时,依次编码M个绝对值大于Xi标志,当所述系数的绝对值为Q,将X i大于Q的绝对值大于Xi标志编码为为0,跳过后续绝对值大于Xi标志的编码;将X i小于等于Q的绝对值大于Xi标志编码为1;当M个绝对值大于Xi标志中任一个编码为0时,跳过取模结果标志和剩余值标志的编码;当M个绝对值大于Xi标志均编码为1时,编码取模结果标志,将其中的(2 K-N)种二进制编码编码为绝对值为M+1到M+2 K-N的系数的取模结果标志,且将上述二进制编码的编码值分别定义为0到2 K-N-1;将其余的N种二进制编码分别编码为绝对值大于M+2 K-N的系数的取模结果标志,且将该N种二进制编码的编码值分别定义为1~N;
当M个绝对值大于Xi标志均编码为1时,编码剩余值标志,将所述剩余值标志编码为商值,所述商值是所述系数的绝对值减去非零标志对应的编码值、M个系数绝对值大于i标志分别对应的编码值以及所述取模结果标志的编码值预先设定的对应数值,再除以N得到的商值,其中,所述取模结果标志的编码值预先设定的对应数值满足计算得到的商值为整数;
当非零标志编码为1时,编码符号标志,当所述系数为正时,将符号标志编码为0,当所述系数为负时,将符号标志编码为1。
在一示例性实施例中,M=1,2,或3,N=2,3,4或5。
在一示例性实施例中,M=1,X 1=1N=3,K=2,所述指定的系数绝对值为2,预先为指定的绝对值的取模结果标志设置的特定编码值为11B;将系数绝对值模3得余数为0的系数取模结果标志编码为00B,将系数绝对值模3得余数为1的系数取模结果标志编码为01B,将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
当取模结果标志编码为11B时,预先设定的对应数值为0;
当取模结果标志编码为00B时,预先设定的对应数值为1;
当取模结果标志编码为01B时,预先设定的对应数值为2;
当取模结果标志编码为10B时,预先设定的对应数值为3。
在一示例性实施例中,M=2,X 1=1,X 2=2,N=3,K=2,所述指定的系数绝对值为3,预先为指定的系数绝对值的取模结果标志设置的特定编码值为00B;将系数绝对值模3得余数为0的系数取模结果标志编码为11B,将系数绝对值模3得余数为1的系数取模结果标志编码为01B,将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
在一示例性实施例中,M=1,X 1=1,N=4,K=2,将系数绝对值模4得余数为0的系数取模结果标志编码为10B,将系数绝对值模4得余数为1的系数取模结果标志编码为11B,将系数绝对值模4得余数为2的系数取模结果标志编码为00B,将系数绝对值模4得余数为3的系数取模结果标志编码为01B
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
本公开实施例提供了一种系数解码方法,如图8所示,包括:
步骤801,获取码流,解析当前编码单元确定系数的位置;
步骤802,按照位置对所述系数进行熵解码得到所述系数的语法元素;
步骤803,根据所述系数的语法元素确定所述系数的值;
其中,对所述系数进行熵解码,包括:对所述系数的非零标志、M个绝对值大于Xi标志、取模结果标志、剩余值标志和符号标志五个语法元素的解码,所述取模结果标志和剩余值标志的编码根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数。
在一示例性实施例中,当预先为指定的系数绝对值的取模结果标志设置特定编码值时,通过以下方式实现对所述系数进行熵解码:
解码非零标志,当非零标志解码为0时,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,依次解码M个绝对值大于Xi标志,当第g个绝对值大于Xi标志解码为0时,跳过后续M-g个绝对值大于Xi标志、取模结果标志和剩余值标志的解码;1≤g≤M,当i取值不同时,X i取值不同且随i的取值递增;
当M个系数绝对值大于i标志均为1时,解码取模结果标志;
当取模结果标志解码为所述特定编码值时,跳过剩余值标志的解码;
当取模结果标志解码不为所述特定编码值时,解码剩余值标志;
当非零标志解码为1时,解码符号标志。
在一示例性实施例中,通过以下方式实现对所述系数进行熵解码:
解码非零标志,当非零标志解码为0时,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,依次解码M个绝对值大于Xi标志,当第g个绝对值大于Xi标志解码为0时,跳过后续M-g个绝对值大于Xi标志、取模结果标志和剩余值标志的解码;1≤g≤M,当i取值不同时,X i取值不同且随i的取值递增;当M个系数绝对值大于i标志均为1时,依次解码取模结果标志和剩余值标志;
当非零标志解码为1时,解码符号标志。
在一示例性实施例中,通过以下方式实现根据所述系数的语法元素确定所述系数的值:
将非零标志的解码值,加上M个绝对值大于Xi标志分别对应的解码值、取模结果标志的解码值预先设定的对应数值、以及剩余值标志乘以N,得到的和值作为所述系数的绝对值;当符号标志为0 时,所述系数的值为正,当符号标志为1时,所述系数的值为负;所述取模运算为对N取模的运算;
其中,当非零标志的解码值、M个绝对值大于Xi标志分别对应的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值取值为0。
在一示例性实施例中,当预先为指定的系数绝对值的取模结果标志设置特定编码值时,通过以下任意一种方式实现根据所述系数的语法元素确定所述系数的值:
当非零标志解码为0时,确定所述系数的值为0;
当非零标志解码为1,M个绝对值大于Xi标志不全为1时,将M个绝对值大于Xi标志中为0的标志对应的X i值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,M个绝对值大于Xi标志均为1,取模结果标志为特定编码值时,将指定的系数绝对值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,M个绝对值大于Xi标志均为1时,将非零标志的解码值,加上M个绝对值大于Xi标志分别对应的解码值、取模结果标志的编码值预先设定的对应数值、以及剩余值标志乘以N,得到的和值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;所述取模运算为对N取模的运算。
在一示例性实施例中,M=1,2,或3,N=2,3,4或5。
本公开实施例提供了一种系数编码方法,如图9所示,包括:
步骤901,基于残差块产生系数块,对所述系数块中的系数进行扫描,并对所述系数的值进行熵编码;
步骤902,将熵编码产生的码字写入码流;其中,对所述系数的值进行熵编码,包括对所述系数的非零标志、M个绝对值大于Xi标志、取模结果标志、剩余值标志和符号标志五个语法元素的编码,所述取模结果标志和剩余值标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数。
在一示例性实施例中,在对所述系数的值进行熵编码的过程中,通过以下任意一种方式实现所述取模结果标志的编码:
预先为指定的系数绝对值的取模结果标志设置特定编码值,当所述系数的绝对值为所述指定的系数绝对值时,将所述取模结果标志编码为所述特定编码值,其中,所述对应的编码值具有全局唯一性;
预先为指定的系数绝对值的取模结果标志设置特定编码值,当所述系数的绝对值不为所述指定的系数绝对值时,将所述取模结果标志编码为余数预先设定的编码值,其中,所述余数为所述系数的绝对值对N取模得到的余数;或者,所述余数为将所述系数的绝对值减去非零标志和M个系数绝对值大于i标志,得到的差再对N取模得到的余数;
将所述取模结果标志编码为所述系数的绝对值对N取模得到的余数预先设定的编码值;
将所述取模结果标志编码为所述系数的绝对值减去非零标志和M个系数绝对值大于i标志,得到的差再对N取模得到的余数预先设定的编码值;
其中,所述预先设定的编码值为二进制编码值,每一种余数对应一种二进制编码值,。
在一示例性实施例中,在对所述系数的值进行熵编码的过程中,通过以下任意一种方式实现所述剩余值标志的编码:
当所述系数的绝对值为所述指定的系数绝对值时,跳过对所述剩余值标志的编码;
当将所述取模结果标志编码为所述余数时,将所述剩余值标志编码为商值,所述商值是所述系数的绝对值减去非零标志对应的编码值、M个绝对值大于Xi标志分别对应的编码值以及所述取模结果标志的编码值预先设定的对应数值,再除以N得到的商值,其中,所述取模结果标志的编码值预先设定的对应数值满足计算得到的商值为整数。
在一示例性实施例中,在对所述系数的值进行熵编码的过程中,通过以下任意一种方式实现所述M个系数绝对值大于i标志的编码:
当所述非零标志编码为1时,依次编码M个绝对值大于Xi标志,当所述系数的绝对值为Q,将X i大于Q的绝对值大于Xi标志编码为为0,跳过后续绝对值大于Xi标志的编码;将X i小于等于Q的绝对值大于Xi标志编码为1。
在一示例性实施例中,在对所述系数进行熵编码的过程中,当所述系数的绝对值为0时,将非零标志编码为0,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的编码;
当所述系数的绝对值不为0时,依次进行非零标志、M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的编码,其中,当将非零标志编码为1,且当M个系数绝对值大于i标志不全为1时,跳过取模结果标志和剩余值标志的编码。
在一示例性实施例中,所述N不大于4时,所述取模结果标志预先设定的编码值采用两位二进制。
在一示例性实施例中,所述取模结果标志的编码为二进制编码,占用K个标志位,则所述取模结果标志的二进制编码有2 K种;
在对所述系数的值进行熵编码时,将其中的(2 K-N)种二进制编码编码为绝对值为M+1到M+2 K-N的系数的取模结果标志,且将上诉二进制编码的编码值分别定义为0到2 K-N-1;将其余的N种二进制编码分别编码为绝对值大于M+2 K-N的系数的取模结果标志,且将该N种二进制编码的编码值分别定义为1~N。
在一示例性实施例中,N=3,K=2,M=1,将系数绝对值为2的取模结果标志编码为11B,将系数绝对值模3得余数为0的取模结果标志编码为00B,将系数绝对值模3得余数为1的取模结果标志编码为01B,将系数绝对值模3得余数为2的取模结果标志编码为10B,所述剩余值标志rem的编码数值采用如下计算方式确定:|q k|=sig+gt1+f(rem_flag)+3×rem,其中,qk为系数,│qk│为系数的绝对值,sig为非零标志的编码值,gt1为系数绝对值大于1标志的编码值,rem_flag为取模结果标志的编码值,f(rem_flag)为rem_flag预先设定的对应数值,当取模结果标志的编码值rem_flag为11B时,对应的f(rem_flag)为0,当取模结果标志的编码值rem_flag为00B时,对应的f(rem_flag)为1,当取模结果标志的编码值rem_flag为01B时,对应的f(rem_flag)为2,当取模结果标志的编码值rem_flag为10B时,对应的f(rem_flag)为3。
在一示例性实施例中,N=3,K=2,M=2,将系数绝对值为3的取模结果标志编码为00B,将系数绝对值模3得余数为0的取模结果标志编码为11B,将系数绝对值模3得余数为1的取模结果标志编码为01B,将系数绝对值模3得余数为2的取模结果标志编码为10B,所述剩余值标志rem的编码数值采用如下计算方式确定:|q k|=sig+gt1+gt2+f(rem_flag)+3×rem,其中,qk为系数,│qk│为系数的绝对值,sig为非零标志的编码值,gt1为系数绝对值大于1标志的编码值,gt2为系数绝对值大于2标志的编码值,rem_flag为取模结果标志的编码值,f(rem_flag)为rem_flag预先设定的对应数值,当取模结果标志的编码值rem_flag为00B时,对应的f(rem_flag)为0,当取模结果标志的编码值rem_flag为01B时,对应的f(rem_flag)为1,当取模结果标志的编码值rem_flag为10B时,对应的f(rem_flag)为2,当取模结果标志的编码值rem_flag为11B时,对应的f(rem_flag)为3。
在一示例性实施例中,所述取模结果标志的编码为二进制编码,所述取模结果标志的二进制编码有N种;
对所述系数的值进行熵编码时,将所述系数的绝对值减去非零标志的编码值和M个系数绝对值大于1标志的编码值,得到的差再对N取模后得到的余数预先设定的二进制编码编码为所述系数的取模结果标志的编码值
在一示例性实施例中,N=4,K=2,M=1,将系数绝对值模4得余数为0的取模结果标志编码为10B,将系数绝对值模4得余数为1的取模结果标志编码为11B,将系数绝对值模4得余数为2的取模结果标志编码为00B,将系数绝对值模4得余数为3的取模结果标志编码为01B,所述剩余值标志rem的编码数值采用如下计算方式确定:|q k|=sig+gt1+g(rem_flag)+4×rem,其中,qk为系数,│qk│为系数的绝对值,sig为非零标志的编码值,gt1为系数绝对值大于1标志的编码值,rem_flag为取模结果标志的编码值,g(rem_flag)为rem_flag预先设定的对应数值,当取模结果标志的编码值rem_flag为00B时,对应的g(rem_flag)为0,当取模结果标志的编码值rem_flag为01B时,对应的g(rem_flag)为1,当取模结果标志的编码值rem_flag为10B时,对应的g(rem_flag)为2,当取模结果标志的编码值rem_flag为11B时,对应的g(rem_flag)为3。
在本公开实施例中,系数的的语法元素包括非零标志sig、系数绝对值大于i标志gti、取模结果标志rem_flag、剩余值标志rem、符号标志coeff_sign五个部分。
其中,非零标志sig,用于表示系数是否为非零。
其中,系数绝对值大于i标志gti表示系数绝对值是否大于i,例如系数绝对值大于i标志gti至少包括系数绝对值大于1标志gt1。系数绝对值大于i标志也可以称为绝对值大于Xi标志。
其中,取模结果标志rem_flag所需编码的值由取模的数值以及得到的余数确定。在一示例中,可以将取模结果标志编码为余数对应的编码值,其中,所述余数为系数的绝对值对N取模得到的余数; 或者,所述余数为将系数的绝对值减去非零标志和M个系数绝对值大于i标志,得到的差再对N取模得到的余数。在另一示例中,可以预先为指定的系数绝对值的取模结果标志设置特定编码值,当所述系数的绝对值为所述指定的系数绝对值时,将所述取模结果标志编码为所述特定编码值,其中,所述特定编码具有全局唯一性。在另一示例中,可以预先为指定的系数绝对值的取模结果标志设置特定编码值,当所述系数的绝对值不为所述指定的系数绝对值时,将所述取模结果标志编码为余数对应的编码值,其中,所述余数为所述系数的绝对值对N取模得到的余数;或者,所述余数为将系数的绝对值减去非零标志和M个系数绝对值大于i标志,得到的差再对N取模得到的余数;
其中,剩余值标志rem所需编码的数值由系数的绝对值减去非零标志对应的编码值、M个系数绝对值大于i标志分别对应的编码值以及取模结果标志的编码值预先设定的对应数值,再除以N得到的商值确定,其中,取模结果标志的编码值预先设定的对应数值满足计算得到的商值为整数。
其中,符号标志coeff_sign,用于表示级别的正负性。
在一示例性实施例中,以取模为3为例详细说明本公开实施例的技术方案。
在本示例性实施例中,系数的的语法元素包括非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag、剩余值标志rem、符号标志coeff_sign。其中,取模结果标志rem_flag采用两位二进制表示。
在本示例性实施例中,在取模为3的情况下,系数编码方式如图10所示,其中,各个标志的取值满足公式1:|q k|=sig+gt1+f(rem_flag)+3×rem。在该公式1中,当非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag、剩余值标志rem中任意一个标志不存在时,其在该公式中对应的值按0处理。
在本示例性实施例中,rem_flag为二进制编码值,f(rem_flag)为rem_flag对应的数值,用十进制表示,rem_flag与f(rem_flag)的对应关系如表1所示:
表1:
rem_flag 1 1 0 0 0 1 1 0
f(rem_flag) 0 1 2 3
在本示例性实施例中,预先将系数绝对值为2对应的取模结果标志rem_flag的编码值设置为11B。基于图10所示的编码方式以及表1所示的对应关系,本示例性实施例提供了一种系数熵编码方法,如图11所示,该方法包括:
步骤1101,基于残差块产生系数块,对所述系数块中的系数进行扫描;
在一示例性实施例中,当前块经过预测部分,即通过帧间预测,或通过帧内预测等方式,对当前块进行预测得到预测块,取原始图像与预测块坐标等相对应位置的图像块,与预测块做差得到当前块的残差块,然后对残差块进行变换或不进行变换,可以得到含有变换后系数的变换块或非变换的系数块,这里将其统称为系数块。然后对该系数块进行量化,量化后的系数按照系数扫描顺序进行熵编码。
在一示例性实施例中,所述扫描可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。
步骤1102,对所述系数的值基于图10所示的编码方式以及表1所示的对应关系进行熵编码;
在一示例性实施例中,对所述系数的值基于图10所示的编码方式以及表1所示的对应关系进行熵编码,包括:按照扫描位置对所述系数块中的每一个系数的值进行熵编码:
编码该系数的非零标志sig,当该系数绝对值为0时,将非零标志sig编码为0,当该系数绝对值不为0时,将非零标志sig编码为1;
当非零标志sig为0时,跳过该系数的系数绝对值大于1标志、取模结果标志、剩余值标志和符号标志的编码;当非零标志sig为1时,编码系数绝对值大于1标志gt1,当系数绝对值不大于1时,将系数绝对值大于1标志gt1编码为0,当系数绝对值大于1时,将系数绝对值大于1标志gt1编码为1;
当系数绝对值大于1标志gt1为0时,跳过对该系数的取模结果标志和剩余值标志的编码,当该系数绝对值大于1标志gt1为1时,编码取模结果标志rem_flag,当该系数绝对值为2时,将取模结果标志rem_flag编码为11B,当系数绝对值模3结果为0时,将取模结果标志rem_flag编码为00B;当系数绝对值模3结果为1时,将取模结果标志rem_flag编码为01B;当系数绝对值模3结果为2时,将取模结果标志rem_flag编码为10B;
当取模结果标志rem_flag为11B时,跳过对该系数的剩余值标志的编码;当取模结果标志rem_flag 不为11B时,编码该系数的剩余值标志rem;
其中,剩余值标志rem可以根据上述公式1和表1计算得到。
当非零标志sig为1时,编码该系数的符号标志coeff_sign,当系数为正时,将符号标志coeff_sign编码为0;当系数为负时,将符号标志coeff_sign编码为1。
在一示例中,当系数为-3时,对该系数的编码结果为:sig=1,gt1=1,rem_flag=00B,rem=0,coeff_sign=1。
在一示例中,假设对残差变换后的4x4的变换块,图12所示,按照对角线扫描量化后得到的变换系数串为{0,2,4,5,0,6,3,7,0,2,1,0,9,3,0,8},按照顺序对该系数串中的每一个系数按照图9所示的编码方式和表1所示的对应关系分别执行熵编码,则编码值如图13所示。
步骤1103,将熵编码产生的码字写入码流。
基于图10所示的编码方式以及表1所示的对应关系,本示例性实施例提供了一种系数熵解码方法,如图14所示,该方法包括:
步骤1401,获取码流,解析当前编码单元,按照编码时采用的扫描方式确定系数的位置;
在一示例性实施例中,所述扫描方式可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。例如,在本示例性实施例中,编码时采用的是对角线扫描,解码时也采用对角线扫描。
步骤1402,按照位置对所述系数进行熵解码得到所述系数的语法元素;
在一示例性实施例中,可以按照位置依次对全部系数中的第一个系数进行熵解码,得到该系数的语法元素,然后根据该系数的语法元素确定该系数的值,然后可以再进行下一个系数的熵解码。
在一示例性实施例中,通过以下方式实现按照位置对所述系数进行熵解码得到所述系数的语法元素:
解码非零标志,当非零标志解码为0时,跳过系数绝对值大于1标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,解码系数绝对值大于1标志,当系数绝对值大于1标志解码为0时,跳过取模结果标志、剩余值标志的解码;
当系数绝对值大于1标志解码为1时,解码取模结果标志;当取模结果标志解码为11B时,跳过剩余值标志的解码;
当取模结果标志解码不为11B时,解码剩余值标志;
当非零标志解码为1时,解码符号标志。
步骤1403,根据所述系数的语法元素确定所述系数的值。
在本示例性实施例中,通过以下方式实现根据所述系数的语法元素确定所述系数的值:
将非零标志的解码值,加上系数绝对值大于1标志的解码值、取模结果标志的解码值预先设定的对应数值、以及剩余值标志乘以3,得到的和值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
其中,当非零标志的解码值、系数绝对值大于1标志的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值或者预先设定的对应数值取值为0。
在本示例性实施例中,通过上述公式1计算所述系数的绝对值。
在另一示例性实施例中,通过以下任意一种方式实现根据所述系数的语法元素确定所述系数的值:
当非零标志解码为0时,确定所述系数的值为0;
当非零标志解码为1,系数绝对值大于1标志解码为0时,确定所述系数的绝对值为1;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,取模结果标志解码为11B时,确定所述系数的绝对值为2;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,取模结果标志解码不为11B时,根据上述公式1计算所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负。
在一示例中,对系数的解码结果为:sig=1,gt1=1,rem_flag=00B,rem=0,coeff_sign=1时,该系数为-3。
上述图10和表1所示的编码方式和对应关系是一种示例性说明,也可以采用其他的编码方 式和对应关系,例如两位二进制包括四种二进制编码,将其中任一种二进制编码作为系数绝对值为2的取模结果标志rem_flag的编码值,将其他三种分别作为系数绝对值模3余0、余1、余2的三种取模结果标志rem_flag的编码值,rem_flag和f(rem_flag)的对应关系满足根据公式1计算得到的系数绝对值为整数。
在一示例性实施例中,以取模为3为例详细说明本公开实施例的技术方案。
在本示例性实施例中,系数的的语法元素包括非零标志sig、系数绝对值大于1标志gt1、系数绝对值大于2标志gt2、取模结果标志rem_flag、剩余值标志rem、符号标志coeff_sign。其中,取模结果标志rem_flag采用两位二进制表示。
在本示例性实施例中,在取模为3的情况下,系数编码方式如图15所示,其中,各个标志的取值满足公式2:|q k|=sig+gt1+gt2+f(rem_flag)+3×rem。在该公式2中,当非零标志sig、系数绝对值大于1标志gt1、系数绝对值大于2标志gt2、取模结果标志rem_flag、剩余值标志rem中任意一个标志不存在时,其在该公式中对应的值按0处理。
在本示例性实施例中,rem_flag为二进制编码值,f(rem_flag)为rem_flag对应的数值,用十进制表示,rem_flag与f(rem_flag)的对应关系如表2所示:
表2:
rem_flag 00 0 1 10 11
f(rem_flag) 0 1 2 3
在本示例性实施例中,预先将系数绝对值为3对应的取模结果标志rem_flag的编码值设置为00B。
基于图15所示的编码方式以及表2所示的对应关系,本示例性实施例提供了一种系数熵编码方法,如图16所示,该方法包括:
步骤1601,基于残差块产生系数块,对所述系数块中的系数进行扫描;
在一示例性实施例中,当前块经过预测部分,即通过帧间预测,或通过帧内预测等方式,对当前块进行预测得到预测块,取原始图像与预测块坐标等相对应位置的图像块,与预测块做差得到当前块的残差块,然后对残差块进行变换或不进行变换,可以得到含有变换后系数的变换块或非变换的系数块,这里将其统称为系数块。然后对该系数块进行量化,量化后的系数按照系数扫描顺序进行熵编码。
在一示例性实施例中,所述扫描可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。
步骤1602,对所述系数的值基于图15所示的编码方式以及表2所示的对应关系进行熵编码;
在一示例性实施例中,对所述系数的值基于图15所示的编码方式以及表2所示的对应关系进行熵编码,包括:按照扫描位置对所述系数块中的每一个系数的值进行熵编码:
编码该系数的非零标志sig,当该系数绝对值为0时,将非零标志sig编码为0,当该系数绝对值不为0时,将非零标志sig编码为1;
当非零标志sig为0时,跳过该系数的系数绝对值大于1标志、系数绝对值大于2标志、取模结果标志、剩余值标志和符号标志的编码;当非零标志sig为1时,编码系数绝对值大于1标志gt1,当该系数绝对值不大于1时,将系数绝对值大于1标志gt1编码为0,当该系数绝对值大于1时,将系数绝对值大于1标志gt1编码为1;
当系数绝对值大于1标志gt1为0时,跳过对该系数的系数绝对值大于2标志、取模结果标志和剩余值标志的编码,当系数绝对值大于1标志gt1为1时,编码系数绝对值大于2标志,当该系数绝对值不大于2时,将系数绝对值大于2标志gt1编码为0,当该系数绝对值大于2时,将系数绝对值大于2标志gt1编码为1;
当系数绝对值大于2标志gt2为0时,跳过对该系数的取模结果标志和剩余值标志的编码;当系数绝对值大于2标志gt2为1时,编码取模结果标志rem_flag,当该系数绝对值为3时,将取模结果标志rem_flag编码为00B,当系数绝对值模3结果为0时,将取模结果标志rem_flag编码为11B;当系数绝对值模3结果为1时,将取模结果标志rem_flag编码为01B;当系数绝对值模3结果为2时,将取模结果标志rem_flag编码为10B;
当取模结果标志rem_flag为00B时,跳过对剩余值标志的编码;当取模结果标志rem_flag不为00B时,编码剩余值标志rem;
其中,剩余值标志rem可以根据上述公式2和表2计算得到。
当非零标志sig为1时,编码符号标志coeff_sign,当系数为正时,将符号标志coeff_sign编码为0;当系数为负时,将符号标志coeff_sign编码为1。
在一示例中,当系数为-3时,编码结果为:sig=1,gt1=1,gt2=1,rem_flag=00B,coeff_sign=1。
步骤1603,将熵编码产生的码字写入码流。
基于图15所示的编码方式以及表2所示的对应关系,本示例性实施例提供了一种系数熵解码方法,如图17所示,该方法包括:
步骤1701,获取码流,解析当前编码单元,按照编码时采用的扫描方式确定系数的位置;
在一示例性实施例中,所述扫描方式可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。例如,在本示例性实施例中,编码时采用的是z字形扫描,解码时也采用z字形扫描。
步骤1702,按照位置对所述系数进行熵解码得到所述系数的语法元素;
在一示例性实施例中,可以按照位置依次对全部系数中的第一个系数进行熵解码,得到该系数的语法元素,然后根据该系数的语法元素确定该系数的值,然后可以再进行下一个系数的熵解码。
在一示例性实施例中,通过以下方式实现按照位置对所述系数进行熵解码得到所述系数的语法元素:
解码非零标志,当非零标志解码为0时,跳过系数绝对值大于1标志、系数绝对值大于2标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,解码系数绝对值大于1标志,当系数绝对值大于1标志解码为0时,跳过系数绝对值大于2标志、取模结果标志、剩余值标志的解码;
当系数绝对值大于1标志解码为1时,解码系数绝对值大于2标志;当系数绝对值大于2标志解码为0时,跳过取模结果标志和剩余值标志的解码;
当系数绝对值大于2标志解码为1时,解码取模结果标志,当取模结果标志编码为00B时,跳过剩余值标志的解码;
当取模结果标志编码不为00B时,继续剩余值标志的解码;
当非零标志解码为1,解码符号标志。
步骤1703,根据所述系数的语法元素确定所述系数的值;
在本示例性实施例中,通过以下方式实现根据所述系数的语法元素确定所述系数的值:
将非零标志的解码值,加上系数绝对值大于1标志的解码值、系数绝对值大于2标志的解码值、取模结果标志的解码值预先设定的对应数值、以及剩余值标志乘以3,得到的和值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
其中,当非零标志的解码值、系数绝对值大于1标志的解码值、系数绝对值大于2标志的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值或者预先设定的对应数值取值为0。
在本示例性实施例中,通过上述公式2计算所述系数的绝对值。
在另一示例性实施例中,通过以下任意一种方式实现根据所述系数的语法元素确定所述系数的值:
当非零标志解码为0时,确定所述系数的值为0;
当非零标志解码为1,系数绝对值大于1标志解码为0时,确定所述系数的绝对值为1;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,系数绝对值大于2标志解码为0时,确定所述系数的绝对值为2;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,系数绝对值大于2标志解码为1,取模结果标志解码为00B时,确定所述系数的绝对值为3;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,系数绝对值大于2标志解码为1,取模结果标志解码不为00B时,根据上述公式2计算所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负。
在一示例中,对系数的解码结果为:sig=1,gt1=1,rem_flag=00B,coeff_sign=1时,该系数为-3。
上述图15和表2所示的编码方式和对应关系是一种示例性说明,也可以采用其他的编码方式和对应关系,例如两位二进制包括四种二进制编码,将其中任一种二进制编码作为系数绝对值为3的取 模结果标志rem_flag的编码值,将其他三种分别作为系数绝对值模3余0、余1、余2的三种取模结果标志rem_flag的编码值,rem_flag和f(rem_flag)的对应关系满足根据公式2计算得到的系数绝对值为整数。
在一示例性实施例中,以取模为5为例详细说明本公开实施例的技术方案。
在本示例性实施例中,系数的的语法元素包括非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag、剩余值标志rem、符号标志coeff_sign。其中,取模结果标志rem_flag采用三位二进制表示。
在本示例性实施例中,在取模为5的情况下,系数编码方式如图18所示,其中,各个标志的取值满足公式3:|q k|=sig+gt1+f(rem_flag)+5×rem,在该公式3中,当非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag、剩余值标志rem中任意一个标志不存在时,其在该公式中对应的值按0处理。
在本示例性实施例中,rem_flag为二进制编码值,f(rem_flag)为rem_flag对应的数值,用十进制表示,rem_flag与f(rem_flag)的对应关系如表3所示:
表3:
Figure PCTCN2021080635-appb-000001
在本示例性实施例中,预先将系数绝对值为2对应的取模结果标志rem_flag的编码值设置为101B,系数绝对值为3对应的取模结果标志rem_flag的编码值设置为110B,系数绝对值为4对应的取模结果标志rem_flag的编码值设置为11B。
基于图18所示的编码方式以及表3所示的对应关系,本示例性实施例提供了一种系数熵编码方法,如图19所示,该方法包括:
步骤1901,基于残差块产生系数块,对所述系数块中的系数进行扫描;
在一示例性实施例中,当前块经过预测部分,即通过帧间预测,或通过帧内预测等方式,对当前块进行预测得到预测块,取原始图像与预测块坐标等相对应位置的图像块,与预测块做差得到当前块的残差块,然后对残差块进行变换或不进行变换,可以得到含有变换后系数的变换块或非变换的系数块,这里将其统称为系数块。然后对该系数块进行量化,量化后的系数按照系数扫描顺序进行熵编码。
在一示例性实施例中,所述扫描可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。
步骤1902,对所述系数的值基于图18所示的编码方式以及表3所示的对应关系进行熵编码;
在一示例性实施例中,对所述系数的值基于图18所示的编码方式以及表3所示的对应关系进行熵编码,包括:按照扫描位置对所述系数块中的每一个系数的值进行熵编码:
编码该系数的非零标志sig,当该系数绝对值为0时,将非零标志sig编码为0,当该系数绝对值不为0时,将非零标志sig编码为1;
当非零标志sig为0时,跳过该系数的系数绝对值大于1标志、取模结果标志、剩余值标志和符号标志的编码;当非零标志sig为1时,编码系数绝对值大于1标志gt1,当该系数绝对值不大于1时,将系数绝对值大于1标志gt1编码为0,当该系数绝对值大于1时,将系数绝对值大于1标志gt1编码为1;
当系数绝对值大于1标志gt1为0时,跳过对该系数的取模结果标志和剩余值标志的编码,当系数绝对值大于1标志gt1为1时,编码该系数的取模结果标志;当该系数绝对值模为2时,将取模结果标志rem_flag编码为101B,当该系数绝对值模为3时,将取模结果标志rem_flag编码为110B,当该系数绝对值模为4时,将取模结果标志rem_flag编码为111B,当该系数绝对值模5结果为0时,将取模结果标志rem_flag编码为000B;当该系数绝对值模5结果为1时,将取模结果标志rem_flag编码为001B,当该系数绝对值模5结果为2时,将取模结果标志rem_flag编码为010B,当该系数绝对值模5结果为3时,将取模结果标志rem_flag编码为011B,当该系数绝对值模5结果为4时,将取模结果标志rem_flag编码为100B;
当取模结果标志rem_flag编码为101B、110B或111B时,跳过编码剩余值标志;
当取模结果标志rem_flag编码不为101B、110B或111B时,编码剩余值标志;
其中,剩余值标志rem可以根据上述公式3和表3计算得到。
当非零标志sig为1时,编码符号标志coeff_sign,当系数为正时,将符号标志coeff_sign编码为0;当系数为负时,将符号标志coeff_sign编码为1。
在一示例中,当系数为-3时,编码结果为:sig=1,gt1=1,rem_flag=110B,coeff_sign=1。
步骤1903,将熵编码产生的码字写入码流。
基于图18所示的编码方式以及表3所示的对应关系,本示例性实施例提供了一种系数熵解码方法,如图20所示,该方法包括:
步骤2001,获取码流,解析当前编码单元,按照编码时采用的扫描方式确定系数的位置;
在一示例性实施例中,所述扫描方式可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。例如,在本示例性实施例中,编码时采用的是水平扫描,解码时也采用水平扫描。
步骤2002,按照位置对所述系数进行熵解码得到所述系数的语法元素;
在一示例性实施例中,可以按照位置依次对全部系数中的第一个系数进行熵解码,得到该系数的语法元素,然后根据该系数的语法元素确定该系数的值,然后可以再进行下一个系数的熵解码。
在一示例性实施例中,通过以下方式实现按照位置对所述系数进行熵解码得到所述系数的语法元素:
解码非零标志,当非零标志解码为0时,跳过系数绝对值大于1标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,解码系数绝对值大于1标志,当系数绝对值大于1标志解码为0时,跳过取模结果标志、剩余值标志的解码;
当系数绝对值大于1标志解码为1时,解码取模结果标志,当取模结果标志解码为101B、110B或111B时,跳过对剩余值标志的解码;
当取模结果标志解码不为101B、110B或111B时,解码剩余值标志;
当非零标志解码为1,解码符号标志。
步骤2003,根据所述系数的语法元素确定所述系数的值;
在本示例性实施例中,通过以下方式实现根据所述系数的语法元素确定所述系数的值:
将非零标志的解码值,加上系数绝对值大于1标志的解码值、取模结果标志的解码值预先设定的对应数值、以及剩余值标志乘以5,得到的和值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
其中,当非零标志的解码值、系数绝对值大于1标志分别对应的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值或者预先设定的对应数值取值为0。
在本示例性实施例中,通过上述公式3计算所述系数的绝对值。
在另一示例性实施例中,通过以下任意一种方式实现根据所述系数的语法元素确定所述系数的值:
当非零标志解码为0时,确定所述系数的值为0;
当非零标志解码为1,系数绝对值大于1标志解码为0时,确定所述系数的绝对值为1;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,取模结果标志解码为101B时,确定所述系数的绝对值为2,当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,取模结果标志解码为110B时,确定所述系数的绝对值为3,当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1,取模结果标志解码为111B时,确定所述系数的绝对值为4,当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1时,取模结果标志解码不为101B、110B或111B时,根据上述公式3和表3计算所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负。
在一示例中,对系数的解码结果为:sig=1,gt1=1,rem_flag=000B,rem=0,coeff_sign=1时,该系数为-5。
上述图18和表3所示的编码方式和对应关系是一种示例性说明,也可以采用其他的编码方式和对应关系,例如三位二进制包括八种二进制编码,将其中任三种二进制编码分别作为系数绝对值为2、3、4的取模结果标志rem_flag的编码值,将其他五种二进制编码分别作为系数绝对值模5余0、余1、 余2、余3、余4的五种取模结果标志rem_flag的编码值,rem_flag和f(rem_flag)的对应关系满足根据公式3计算得到的系数绝对值为整数。
在一示例性实施例中,以取模为4为例详细说明本公开实施例的技术方案。
在本示例性实施例中,系数的的语法元素包括非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag、剩余值标志rem、符号标志coeff_sign。其中,取模结果标志rem_flag采用两位二进制表示。
在本示例性实施例中,在取模为4的情况下,系数编码方式如图21所示,其中,各个标志的取值满足公式4:|q k|=sig+gt1+g(rem_flag)+4×rem。当非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag、剩余值标志rem中任意一个标志不存在时,其在该公式中对应的值按0处理。
在本示例性实施例中,rem_flag为对应的二进制编码值,g(rem_flag)为rem_flag对应的数值,该数值采用十进制表示,rem_flag与g(rem_flag)的对应关系如表4所示:
表4:
rem_flag 00 01 10 11
f(rem_flag) 0 1 2 3
基于图21所示的编码方式以及表4所示的对应关系,本示例性实施例提供了一种系数熵编码方法,如图22所示,该方法包括:
步骤2201,基于残差块产生系数块,对所述系数块中的系数进行扫描;
在一示例性实施例中,当前块经过预测部分,即通过帧间预测,或通过帧内预测等方式,对当前块进行预测得到预测块,取原始图像与预测块坐标等相对应位置的图像块,与预测块做差得到当前块的残差块,然后对残差块进行变换或不进行变换,可以得到含有变换后系数的变换块或非变换的系数块,这里将其统称为系数块。然后对该系数块进行量化,量化后的系数按照系数扫描顺序进行熵编码。
在一示例性实施例中,所述扫描可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。
步骤2202,对所述系数的值基于图21所示的编码方式以及表4所示的对应关系进行熵编码;
在一示例性实施例中,对所述系数的值基于图21所示的编码方式以及表4所示的对应关系进行熵编码,包括:按照扫描位置对所述系数块中的每一个系数的值进行熵编码:
编码该系数的非零标志sig,当该系数绝对值为0时,将非零标志sig编码为0,当该系数绝对值不为0时,将非零标志sig编码为1;
当非零标志sig为0时,跳过该系数的系数绝对值大于1标志、取模结果标志、剩余值标志和符号标志的编码;当非零标志sig为1时,编码系数绝对值大于1标志gt1,当该系数绝对值不大于1时,将系数绝对值大于1标志gt1编码为0,当该系数绝对值大于1时,将系数绝对值大于1标志gt1编码为1;
当系数绝对值大于1标志gt1为0时,跳过对该系数的取模结果标志和剩余值标志的编码,当系数绝对值大于1标志gt1为1时,编码该系数的取模结果标志;当该系数绝对值模4结果为0时,将取模结果标志rem_flag编码为00B;当该系数绝对值模4结果为1时,将取模结果标志rem_flag编码为01B,当该系数绝对值模4结果为2时,将取模结果标志rem_flag编码为10B,当该系数绝对值模4结果为3时,将取模结果标志rem_flag编码为11B;
编码剩余值标志;
其中,剩余值标志rem可以根据上述公式4和表4计算得到。
当非零标志sig为1时,编码符号标志coeff_sign,当系数为正时,将符号标志coeff_sign编码为0;当系数为负时,将符号标志coeff_sign编码为1。
在一示例中,当系数为-3时,编码结果为:sig=1,gt1=1,rem_flag=01B,rem=0,coeff_sign=1。
步骤2203,将熵编码产生的码字写入码流。
基于图21所示的编码方式以及表4所示的对应关系,本示例性实施例提供了一种系数熵解码方法,如图23所示,该方法包括:
步骤2301,获取码流,解析当前编码单元,按照编码时采用的扫描方式确定系数的位置;
在一示例性实施例中,所述扫描方式可以采取对角线扫描、z字形扫描、Zigzag扫描、水平扫描、垂直扫描、4x4子块扫描或其他任意一种顺序的扫描。例如,在本示例性实施例中,编码时采用的是垂直扫描,解码时也采用垂直扫描。
步骤2302,按照位置对所述系数进行熵解码得到所述系数的语法元素;
在一示例性实施例中,可以按照位置依次对全部系数中的第一个系数进行熵解码,得到该系数的语法元素,然后根据该系数的语法元素确定该系数的值,然后可以再进行下一个系数的熵解码。
在一示例性实施例中,通过以下方式实现按照位置对所述系数进行熵解码得到所述系数的语法元素:
解码非零标志,当非零标志解码为0时,跳过系数绝对值大于1标志、取模结果标志、剩余值标志和符号标志的解码;
当非零标志解码为1时,解码系数绝对值大于1标志,当系数绝对值大于1标志解码为0时,跳过取模结果标志、剩余值标志的解码;
当系数绝对值大于1标志解码为1时,继续取模结果标志和剩余值标志的解码;
当非零标志解码为1,解码符号标志。
步骤2303,根据所述系数的语法元素确定所述系数的值。
在本示例性实施例中,通过以下方式实现根据所述系数的语法元素确定所述系数的值:
将非零标志的解码值,加上系数绝对值大于1标志的解码值、取模结果标志的解码值预先设定的对应数值、以及剩余值标志乘以4,得到的和值作为所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
其中,当非零标志的解码值、系数绝对值大于1标志分别对应的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值或者预先设定的对应数值取值为0。
在本示例性实施例中,通过上述公式4计算所述系数的绝对值。
在另一示例性实施例中,通过以下任意一种方式实现根据所述系数的语法元素确定所述系数的值:
当非零标志解码为0时,确定所述系数的值为0;
当非零标志解码为1,系数绝对值大于1标志解码为0时,确定所述系数的绝对值为1;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负;
当非零标志解码为1,系数绝对值大于1标志解码为1时,根据上述公式4和表4计算所述系数的绝对值;当符号标志为0时,所述系数的值为正,当符号标志为1时,所述系数的值为负。
在一示例中,对系数的解码结果为:sig=1,gt1=1,rem_flag=10B,rem=1,coeff_sign=1时,该系数为-8。
上述图21和表4所示的编码方式和对应关系是一种示例性说明,也可以采用其他的编码方式和对应关系,例如两位二进制包括四种二进制编码,将该四种分别作为系数绝对值模4余0、余1、余2、余3的四种取模结果标志rem_flag的编码值,rem_flag和f(rem_flag)的对应关系满足根据公式4计算得到的系数绝对值为整数。
在另一示例性实施例中,以取模为4为例详细说明本公开实施例的技术方案。本示例性实施例与上一示例性实施的区别为,各个标志的取值满足公式5:|q k|=sig+gt1+rem_flag+4×rem。
本公开实施例提供了一种系数解码方法,如图24所示,包括:
步骤2401,解析获取的码流,并对待解码系数的语法元素进行解码;
步骤2402,根据解码得到的语法元素确定所述待解码系数的值;
其中,所述语法元素包括:非零标志、绝对值大于1标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,,N=2,3,4或5。
在一示例性实施例中,N=3;
当取模结果标志解码为11B时,预先设定的对应数值为0;
当取模结果标志解码为00B时,预先设定的对应数值为1;
当取模结果标志解码为01B时,预先设定的对应数值为2;
当取模结果标志解码为10B时,预先设定的对应数值为3。
在一示例性实施例中,N=4;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。本公开实施例提供了一种系数编码方法,如图25所示,包括:
步骤2501,基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
步骤2502,将编码产生的码字写入码流;
其中,所述语法元素包括:非零标志、绝对值大于1标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。
在一示例性实施例中,N=3;
当系数绝对值为2时,将取模结果标志编码为11B,
将系数绝对值模3得余数为0的系数取模结果标志编码为00B;
将系数绝对值模3得余数为1的系数取模结果标志编码为01B;
将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
当取模结果标志编码为11B时,预先设定的对应数值为0;
当取模结果标志编码为00B时,预先设定的对应数值为1;
当取模结果标志编码为01B时,预先设定的对应数值为2;
当取模结果标志编码为10B时,预先设定的对应数值为3。
在一示例性实施例中,N=3;
当系数绝对值为3时,将取模结果标志编码为00B,
将系数绝对值模3得余数为0的系数取模结果标志编码为11B;
将系数绝对值模3得余数为1的系数取模结果标志编码为01B;
将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
本公开实施例提供了一种系数解码方法,如图26所示,包括:
步骤2601,解析获取的码流,并对待解码系数的语法元素进行解码;
步骤2602,根据解码得到的语法元素确定所述待解码系数的值;
其中,所述语法元素包括:非零标志、绝对值大于1标志、绝对值大于2标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的编码值、绝对值大于2标志的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。
在一示例性实施例中,N=4;
将系数绝对值模4得余数为0的系数取模结果标志编码为10B;
将系数绝对值模4得余数为1的系数取模结果标志编码为11B;
将系数绝对值模4得余数为2的系数取模结果标志编码为00B;
将系数绝对值模4得余数为3的系数取模结果标志编码为01B;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
本公开实施例提供了一种系数编码方法,如图27所示,包括:
步骤2701,基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
步骤2702,将编码产生的码字写入码流;
其中,所述语法元素包括:非零标志、绝对值大于1标志、绝对值大于2标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的编码值、绝对值大于2标志的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。
在一示例性实施例中,N=4;
将系数绝对值模4得余数为0的系数取模结果标志编码为10B,将系数绝对值模4得余数为1的系数取模结果标志编码为11B,将系数绝对值模4得余数为2的系数取模结果标志编码为00B,将系数绝对值模4得余数为3的系数取模结果标志编码为01B;
当取模结果标志解码为00B时,预先设定的对应数值为0;
当取模结果标志解码为01B时,预先设定的对应数值为1;
当取模结果标志解码为10B时,预先设定的对应数值为2;
当取模结果标志解码为11B时,预先设定的对应数值为3。
在一示例性实施例中,在对系数的的语法元素进行编码的过程中,采用以下任意一种或者多种方式进行编码:上下文自适应可变长度编码CAVLC(context-based adaptive variable-length code)、上下文自适应性二进制算术编码(context-based adaptive binary arithmetic coding)、基于语法的上下文自适应性二进制算术编码(syntax-based adaptive binary arithmetic coding)、概率区间分割熵(probability interval partitioning entropy,PIPE)、旁路编码方式或其他熵编码方式。
在一示例中,在对系数的的语法元素进行编码的过程中,可以对剩余值标志rem、符号标志coeff_sign的编码使用旁路编码方式进行编码,对非零标志sig、系数绝对值大于1标志gt1、取模结果标志rem_flag的编码使用基于上下文的自适应编码方式进行编码。
在一示例中,在对系数的的语法元素进行编码的过程中,可以对剩余值标志rem、符号标志coeff_sign的编码使用旁路编码方式进行编码,对非零标志sig、系数绝对值大于1标志gt1、系数绝对值大于1标志gt1、取模结果标志rem_flag的编码使用基于上下文的自适应编码方式进行编码。
本公开上述实施例提供的技术方案,改进了原有的系数熵编码方式,能够更好的利用自适应编码的特性,有效节省码率,提高编码性能。
本公开实施例还提供了一种编码设备,如图28所示,包括:处理器以及存储有可在所述处理器上运行的计算机程序的存储器,其中,所述处理器执行所述计算机程序时实现上述任一项所述的系数熵编码方法。所述编码设备可以为任一种结构的视频编码器或视频编解码器。
在一示例性实施例中,图29为一种视频编码器的结构框图,如图29所示,视频编码器20包含视频数据存储器33、分割单元35、预测处理单元41、求和器50、变换处理单元52、量单元54、熵编码单元56。预测处理单元41包含运动估单元(MEU)42、运动补偿单元(MCU)44帧内预测处理单元46及帧内块副本(IBC)单元48。尽管为了易于阐释而在图29中单独地展示,但应理解,MEU42、MCU44、帧内预测处理单元46及IBC单元48可实际上高度地集成。对于视频块重构,视频编码器20还包含反量化单元58、反变换处理单元60、求和器62、滤波器单元64及经解码图片缓冲器(DPB)66。
在本公开的一实施例中,可以由视频解码器执行上述任一实施例所述的系数解码方法。
本公开实施例还提供了一种解码设备,如图30所示,包括:处理器以及存储有可在所述处理器上运行的计算机程序的存储器,其中,所述处理器执行所述计算机程序时实现上述任一项所述的系数熵解码方法。所述编码设备可以为任一种结构的视频解码器或视频编解码器。
在一示例性实施例中,图31为一种视频解码器的结构框图,如图31所示,视频解码器30包含视频数据存储器78、熵解码单元80、预测处理单元81、反量化单元86、反变换处理单元88、求和器90、波器单元92及DPB94。预测处理单元81包含MCU82帧内预测处理单元84及IBC单元85。在一些实例中,视频解码器30可执行与关于来自图30的视频编码器20所描述的编码过程大体上互逆的解码过程。
本公开实施例还提供了一种非瞬态计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序时被处理器执行时实现上述任一项所述的系数熵编码方法,或者实现上 述任一项所述的系数熵解码方法。
在本公开实施例中记载的解码可以解释为包括解码操作,或者解释为包括编码操作和解码操作。在本公开实施例中记载的编码可以解释为包括编码操作,或者解释为包括编码操作和解码操作。
在本公开实施例中记载的解码值也可以称为编码值,编码值也可以称为解码值,两者相同。
在一或多个示例性实施例中,所描述的功能可以硬件、软件、固件或其任一组合来实施。如果以软件实施,那么功能可作为一个或多个指令或代码存储在计算机可读介质上或经由计算机可读介质传输,且由基于硬件的处理单元执行。计算机可读介质可包含对应于例如数据存储介质等有形介质的计算机可读存储介质,或包含促进计算机程序例如根据通信协议从一处传送到另一处的任何介质的通信介质。以此方式,计算机可读介质通常可对应于非暂时性的有形计算机可读存储介质或例如信号或载波等通信介质。数据存储介质可为可由一或多个计算机或者一或多个处理器存取以检索用于实施本发明中描述的技术的指令、代码和/或数据结构的任何可用介质。计算机程序产品可包含计算机可读介质。
举例来说且并非限制,此类计算机可读存储介质可包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储装置、磁盘存储装置或其它磁性存储装置、快闪存储器或可用来以指令或数据结构的形式存储所要程序代码且可由计算机存取的任何其它介质。而且,还可以将任何连接称作计算机可读介质举例来说,如果使用同轴电缆、光纤电缆、双绞线、数字订户线(DSL)或例如红外线、无线电及微波等无线技术从网站、服务器或其它远程源传输指令,则同轴电缆、光纤电缆、双纹线、DSL或例如红外线、无线电及微波等无线技术包含于介质的定义中。然而应了解,计算机可读存储介质和数据存储介质不包含连接、载波、信号或其它瞬时(瞬态)介质,而是针对非瞬时有形存储介质。如本文中所使用,磁盘及光盘包含压缩光盘(CD)、激光光盘、光学光盘、数字多功能光盘(DVD)、软磁盘或蓝光光盘等,其中磁盘通常以磁性方式再生数据,而光盘使用激光以光学方式再生数据。上文的组合也应包含在计算机可读介质的范围内。
可由例如一或多个数字信号理器(DSP)、通用微处理器、专用集成电路(ASIC)现场可编程逻辑阵列(FPGA)或其它等效集成或离散逻辑电路等一或多个处理器来执行指令。因此,如本文中所使用的术语“处理器”可指上述结构或适合于实施本文中所描述的技术的任一其它结构中的任一者。另外,在一些方面中,本文描述的功能性可提供于经配置以用于编码和解码的专用硬件和/或软件模块内,或并入在组合式编解码器中。并且,可将所述技术完全实施于一个或多个电路或逻辑元件中。
本公开实施例的技术方案可在广泛多种装置或设备中实施,包含无线手机、集成电路(IC)或一组IC(例如,芯片组)。本公开实施例中描各种组件、模块或单元以强调经配置以执行所描述的技术的装置的功能方面,但不一定需要通过不同硬件单元来实现。而是,如上所述,各种单元可在编解码器硬件单元中组合或由互操作硬件单元(包含如上所述的一个或多个处理器)的集合结合合适软件和/或固件来提供。
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。

Claims (29)

  1. 一种系数解码方法,包括:
    解析获取的码流,并对待解码系数的语法元素进行解码;根据解码得到的语法元素确定所述待解码系数的值;
    其中,所述语法元素包括:非零标志、M个绝对值大于X i标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于X i标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,X i为正整数且当i取值不同时,X i取值不同且随i的取值递增。
  2. 根据权利要求1所述的系数解码方法,所述方法还包括:预先为指定的绝对值的取模结果标志设置特定编码值;
    解码非零标志,当非零标志解码为0时,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的解码;
    当非零标志解码为1时,解码M个绝对值大于Xi标志,当第g个绝对值大于Xi标志解码为0时,跳过后续M-g个绝对值大于Xi标志、取模结果标志和剩余值标志的解码;1≤g≤M;
    当M个系数绝对值大于i标志均为1时,解码取模结果标志;
    当取模结果标志的编码值解码为所述特定编码值时,跳过剩余值标志的解码;
    当取模结果标志解码不为所述特定编码值时,解码剩余值标志;
    当非零标志解码为1时,解码符号标志。
  3. 根据权利要求1所述的系数解码方法,所述方法还包括:
    解码非零标志,当非零标志解码为0时,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的解码;
    当非零标志解码为1时,解码M个绝对值大于Xi标志,当第g个绝对值大于Xi标志解码为0时,跳过后续M-g个绝对值大于Xi标志、取模结果标志和剩余值标志的解码;1≤g≤M,当i取值不同时,X i取值不同且随i的取值递增;
    当M个绝对值大于Xi标志均为1时,依次解码取模结果标志和剩余值标志;
    当非零标志解码为1时,解码符号标志。
  4. 根据权利要求2或3所述的系数解码方法,所述方法还包括:
    系数的绝对值=非零标志的解码值+M个绝对值大于Xi标志分别对应的解码值+取模结果标志的解码值预先设定的对应数值+剩余值标志×N;
    其中,当非零标志的解码值、M个绝对值大于Xi标志分别对应的解码值、取模结果标志的解码值、以及剩余值标志中的任一个语法元素不存在时,将该不存在的语法元素的解码值或预先设定的对应数值取值为0。
  5. 根据权利要求1所述的系数解码方法,其中,M=1,2,或3,N=2,3,4或5。
  6. 根据权利要求2所述的系数解码方法,其中,M=1,X 1=1,N=3,所述指定的绝对值为2,预先为指定的系数绝对值的取模结果标志设置的特定编码值为11B;
    或者,M=2,X 1=1,X 2=2,N=3,所述指定的绝对值为3,预先为指定的系数绝对值的取模结果标志设置的特定编码值为00B。
  7. 根据权利要求2所述的系数解码方法,其中,M=1,X 1=1,N=3;
    当取模结果标志解码为11B时,预先设定的对应数值为0;
    当取模结果标志解码为00B时,预先设定的对应数值为1;
    当取模结果标志解码为01B时,预先设定的对应数值为2;
    当取模结果标志解码为10B时,预先设定的对应数值为3。
  8. 根据权利要求2所述的系数解码方法,其中,M=2,X 1=1,X 2=2,N=3;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  9. 根据权利要求3所述的系数解码方法,其中,M=1,X 1=1,N=4;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  10. 一种系数编码方法,包括:
    基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
    将编码产生的码字写入码流;
    其中,所述语法元素包括:非零标志、M个绝对值大于X i标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、M个绝对值大于X i标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,i≥M,i、M为正整数,N为大于1的正整数,X i为正整数且当i取值不同时,X i取值不同且随i的取值递增。
  11. 根据权利要求10所述的系数编码方法,其中,所述取模结果标志的编码为二进制编码,占用K个标志位,则所述取模结果标志的二进制编码有2 K种;
    所述方法还包括:预先为指定的系数绝对值的取模结果标志设置特定编码值;编码所述非零标志,当所述系数绝对值为0时,将所述非零标志编码为0,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的编码;当所述系数绝对值不为0时,将所述非零标志编码为1;
    当所述非零标志编码为1时,依次编码M个绝对值大于Xi标志,当所述系数的绝对值为Q,将X i大于Q的绝对值大于Xi标志编码为为0,跳过后续绝对值大于Xi标志的编码;将X i小于等于Q的绝对值大于Xi标志编码为1;
    当M个绝对值大于Xi标志中任一个编码为0时,跳过取模结果标志和剩余值标志的编码;当M个绝对值大于Xi标志均编码为1时,编码取模结果标志,当所述系数的绝对值为所述指定的系数绝对值时,将所述取模结果标志编码为所述特定编码值,其中,所述特定编码值具有全局唯一性;当所述系数的绝对值不为所述指定的系数绝对值时,将其中的(2 K-N)种二进制编码编码为绝对值为M+1到M+2 K-N的系数的取模结果标志,且将上述二进制编码的编码值分别定义为0到2 K-N-1;将其余的N种二进制编码分别编码为绝对值大于M+2 K-N的系数的取模结果标志,且将该N种二进制编码的编码值分别定义为1~N;
    当所述系数的绝对值不为所述指定的系数绝对值时,编码剩余值标志,将所述剩余值标志编码为商值,所述商值是所述系数的绝对值减去非零标志对应的编码值、M个系数绝对值大于i标志分别对应的编码值以及所述取模结果标志的编码值预先设定的对应数值,再除以N得到的商值,其中,所述取模结果标志的编码值预先设定的对应数值满足计算得到的商值为整数;
    当非零标志编码为1时,编码符号标志,当所述系数为正时,将符号标志编码为0,当所述系数为负时,将符号标志编码为1。
  12. 根据权利要求10所述的系数编码方法,其中,所述取模结果标志的编码为二进制编码,占用K个标志位,则所述取模结果标志的二进制编码有2 K种;
    所述方法还包括:
    编码所述非零标志,当所述系数绝对值为0时,将所述非零标志编码为0,跳过M个系数绝对值大于i标志、取模结果标志、剩余值标志和符号标志的编码;当所述系数绝对值不为0时,将所述非零标志编码为1;
    当所述非零标志编码为1时,依次编码M个绝对值大于Xi标志,当所述系数的绝对值为Q,将X i大于Q的绝对值大于Xi标志编码为为0,跳过后续绝对值大于Xi标志的编码;将X i小于等于Q的绝对值大于Xi标志编码为1;当M个绝对值大于Xi标志中任一个编码为0时,跳过取模结果标志和剩余值标志的编码;当M个绝对值大于Xi标志均编码为1时,编码取模结果标志,将其中的(2 K-N)种二进制编码编码为绝对值为M+1到M+2 K-N的系数的取模结果标志,且将上述二进制编码的编码值分别定义为0到2 K-N-1;将其余的N种二进制编码分别编码为绝对值大于M+2 K-N的系数的取模结果标志,且将该N种二进制编码的编码值分别定义为1~N;
    当M个绝对值大于Xi标志均编码为1时,编码剩余值标志,将所述剩余值标志编码为商值,所述商值是所述系数的绝对值减去非零标志对应的编码值、M个系数绝对值大于i标志分别对应的编码 值以及所述取模结果标志的编码值预先设定的对应数值,再除以N得到的商值,其中,所述取模结果标志的编码值预先设定的对应数值满足计算得到的商值为整数;
    当非零标志编码为1时,编码符号标志,当所述系数为正时,将符号标志编码为0,当所述系数为负时,将符号标志编码为1。
  13. 根据权利要求10所述的系数编码方法,其中,M=1,2,或3,N=2,3,4或5。
  14. 根据权利要求11所述的系数编码方法,其中,M=1,X 1=1 N=3,K=2,所述指定的系数绝对值为2,预先为指定的绝对值的取模结果标志设置的特定编码值为11B;将系数绝对值模3得余数为0的系数取模结果标志编码为00B,将系数绝对值模3得余数为1的系数取模结果标志编码为01B,将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
    当取模结果标志编码为11B时,预先设定的对应数值为0;
    当取模结果标志编码为00B时,预先设定的对应数值为1;
    当取模结果标志编码为01B时,预先设定的对应数值为2;
    当取模结果标志编码为10B时,预先设定的对应数值为3。
  15. 根据权利要求11所述的系数编码方法,其中,M=2,X 1=1,X 2=2,N=3,K=2,所述指定的系数绝对值为3,预先为指定的系数绝对值的取模结果标志设置的特定编码值为00B;将系数绝对值模3得余数为0的系数取模结果标志编码为11B,将系数绝对值模3得余数为1的系数取模结果标志编码为01B,将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  16. 根据权利要求12所述的系数编码方法,其中,M=1,X 1=1,N=4,K=2,将系数绝对值模4得余数为0的系数取模结果标志编码为10B,将系数绝对值模4得余数为1的系数取模结果标志编码为11B,将系数绝对值模4得余数为2的系数取模结果标志编码为00B,将系数绝对值模4得余数为3的系数取模结果标志编码为01B;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  17. 一种系数解码方法,包括:
    解析获取的码流,并对待解码系数的语法元素进行解码;根据解码得到的语法元素确定所述待解码系数的值;
    其中,所述语法元素包括:非零标志、绝对值大于1标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,,N=2,3,4或5。
  18. 根据权利要求17所述的系数解码方法,其中,N=3;
    当取模结果标志解码为11B时,预先设定的对应数值为0;
    当取模结果标志解码为00B时,预先设定的对应数值为1;
    当取模结果标志解码为01B时,预先设定的对应数值为2;
    当取模结果标志解码为10B时,预先设定的对应数值为3。
  19. 根据权利要求17所述的系数解码方法,其中,N=4;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  20. 一种系数编码方法,包括:
    基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
    将编码产生的码字写入码流;
    其中,所述语法元素包括:非零标志、绝对值大于1标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。
  21. 根据权利要求20所述的系数编码方法,其中,N=3;
    当系数绝对值为2时,将取模结果标志编码为11B,
    将系数绝对值模3得余数为0的系数取模结果标志编码为00B;
    将系数绝对值模3得余数为1的系数取模结果标志编码为01B;
    将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
    当取模结果标志编码为11B时,预先设定的对应数值为0;
    当取模结果标志编码为00B时,预先设定的对应数值为1;
    当取模结果标志编码为01B时,预先设定的对应数值为2;
    当取模结果标志编码为10B时,预先设定的对应数值为3。
  22. 根据权利要求20所述的系数编码方法,其中,N=3;
    当系数绝对值为3时,将取模结果标志编码为00B;
    将系数绝对值模3得余数为0的系数取模结果标志编码为11B;
    将系数绝对值模3得余数为1的系数取模结果标志编码为01B;
    将系数绝对值模3得余数为2的系数取模结果标志编码为10B;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  23. 一种系数解码方法,包括:
    解析获取的码流,并对待解码系数的语法元素进行解码;根据解码得到的语法元素确定所述待解码系数的值;
    其中,所述语法元素包括:非零标志、绝对值大于1标志、绝对值大于2标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的编码值、绝对值大于2标志的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。
  24. 根据权利要求23所述的系数解码方法,其中,N=4;
    将系数绝对值模4得余数为0的系数取模结果标志编码为10B;
    将系数绝对值模4得余数为1的系数取模结果标志编码为11B;
    将系数绝对值模4得余数为2的系数取模结果标志编码为00B;
    将系数绝对值模4得余数为3的系数取模结果标志编码为01B;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  25. 一种系数编码方法,包括:
    基于残差块产生系数块,对所述系数块中的系数进行扫描,并对待编码系数的语法元素进行编码;
    将编码产生的码字写入码流;
    其中,所述语法元素包括:非零标志、绝对值大于1标志、绝对值大于2标志、取模结果标志、剩余值标志和符号标志;所述待解码系数的绝对值为将非零标志的编码值、绝对值大于1标志的编码值、绝对值大于2标志的编码值以及取模结果标志的编码值预先设定的对应数值相加的和值,再加上剩余值标志的编码值与N的积,得到的和值;所述待解码系数的值为根据所述待解码系数的绝对值和表示正负性的符号标志确定的值;所述取模结果标志的编码值根据所述系数对N取模运算确定,N=2,3,4或5。
  26. 根据权利要求25所述的系数编码方法,其中,N=4;
    将系数绝对值模4得余数为0的系数取模结果标志编码为10B,将系数绝对值模4得余数为1的系数取模结果标志编码为11B,将系数绝对值模4得余数为2的系数取模结果标志编码为00B,将系数绝对值模4得余数为3的系数取模结果标志编码为01B;
    当取模结果标志解码为00B时,预先设定的对应数值为0;
    当取模结果标志解码为01B时,预先设定的对应数值为1;
    当取模结果标志解码为10B时,预先设定的对应数值为2;
    当取模结果标志解码为11B时,预先设定的对应数值为3。
  27. 一种解码设备,包括:处理器以及存储有可在所述处理器上运行的计算机程序的存储器,其中,所述处理器执行所述计算机程序时实现如权利要求1至9,或者权利要求17至19,或者权利要求23至24中任一项所述的系数解码方法。
  28. 一种编码设备,包括:处理器以及存储有可在所述处理器上运行的计算机程序的存储器,其中,所述处理器执行所述计算机程序时实现如权利要求12至18,或者权利要求20至22,或者权利要求25至26中任一项所述的系数编码方法。
  29. 一种非瞬态计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序时被处理器执行时实现如权利要求1至9,或者权利要求17至19,或者权利要求23至24中任一项所述的系数解码方法,或者实现如权利要求10至16,或者权利要求20至22,或者权利要求25至26中任一项所述的系数编码方法。
PCT/CN2021/080635 2021-03-12 2021-03-12 系数编解码方法、编解码设备及存储介质 WO2022188186A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
PCT/CN2021/080635 WO2022188186A1 (zh) 2021-03-12 2021-03-12 系数编解码方法、编解码设备及存储介质
CN202180095282.6A CN116982316A (zh) 2021-03-12 2021-03-12 系数编解码方法、编解码设备及存储介质
EP21929659.7A EP4307666A1 (en) 2021-03-12 2021-03-12 Coefficient encoding method, coefficient decoding method, encoding device, decoding device, and storage medium
US18/367,101 US20230421816A1 (en) 2021-03-12 2023-09-12 Coefficient encoding method, coefficient decoding method, encoding device, decoding device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/080635 WO2022188186A1 (zh) 2021-03-12 2021-03-12 系数编解码方法、编解码设备及存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/367,101 Continuation US20230421816A1 (en) 2021-03-12 2023-09-12 Coefficient encoding method, coefficient decoding method, encoding device, decoding device, and storage medium

Publications (1)

Publication Number Publication Date
WO2022188186A1 true WO2022188186A1 (zh) 2022-09-15

Family

ID=83226202

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/080635 WO2022188186A1 (zh) 2021-03-12 2021-03-12 系数编解码方法、编解码设备及存储介质

Country Status (4)

Country Link
US (1) US20230421816A1 (zh)
EP (1) EP4307666A1 (zh)
CN (1) CN116982316A (zh)
WO (1) WO2022188186A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108353167A (zh) * 2015-11-13 2018-07-31 高通股份有限公司 译码视频数据的正负号信息
WO2019027241A1 (ko) * 2017-07-31 2019-02-07 한국전자통신연구원 영상 부호화/복호화 방법, 장치 및 비트스트림을 저장한 기록 매체
CN109788285A (zh) * 2019-02-27 2019-05-21 北京大学深圳研究生院 一种量化系数结束标志位的上下文模型选取方法及装置
CN110708552A (zh) * 2019-08-27 2020-01-17 杭州海康威视数字技术股份有限公司 解码方法、编码方法及装置
CN111586419A (zh) * 2019-05-13 2020-08-25 北京达佳互联信息技术有限公司 视频解码方法、视频编码方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108353167A (zh) * 2015-11-13 2018-07-31 高通股份有限公司 译码视频数据的正负号信息
WO2019027241A1 (ko) * 2017-07-31 2019-02-07 한국전자통신연구원 영상 부호화/복호화 방법, 장치 및 비트스트림을 저장한 기록 매체
CN109788285A (zh) * 2019-02-27 2019-05-21 北京大学深圳研究生院 一种量化系数结束标志位的上下文模型选取方法及装置
CN111586419A (zh) * 2019-05-13 2020-08-25 北京达佳互联信息技术有限公司 视频解码方法、视频编码方法及装置
CN110708552A (zh) * 2019-08-27 2020-01-17 杭州海康威视数字技术股份有限公司 解码方法、编码方法及装置

Also Published As

Publication number Publication date
CN116982316A (zh) 2023-10-31
US20230421816A1 (en) 2023-12-28
EP4307666A1 (en) 2024-01-17

Similar Documents

Publication Publication Date Title
JP2023040013A (ja) 適応ツリー選択を使用してバイナリ・セットをビデオ符号化およびビデオ復号する方法および装置
US20200244995A1 (en) Methods and Apparatuses for Coding Transform Blocks
US20120140813A1 (en) Separately coding the position of a last significant coefficient of a video block in video coding
TWI830629B (zh) 轉換省略區塊之傳訊編碼技術
CN112533000B (zh) 视频解码方法、装置、计算机可读介质及电子设备
WO2022063033A1 (zh) 视频解码方法、视频编码方法、装置、计算机可读介质及电子设备
WO2022062880A1 (zh) 视频解码方法、装置、计算机可读介质及电子设备
WO2022116836A1 (zh) 视频解码方法、视频编码方法、装置及设备
WO2022174660A1 (zh) 视频编解码方法、装置、计算机可读介质及电子设备
CN113365057B (zh) 进行编码和解码的方法、解码端、编码端和系统
WO2022217610A1 (zh) 残差编码方法及设备、视频编码方法及设备、存储介质
CN114257810B (zh) 上下文模型的选择方法、装置、设备及存储介质
WO2022188186A1 (zh) 系数编解码方法、编解码设备及存储介质
WO2022193386A1 (zh) 系数编解码方法、编解码设备、终端及存储介质
CN114286095B (zh) 视频解码方法、装置及设备
CN114286096B (zh) 视频解码方法、装置及设备
WO2023051222A1 (zh) 滤波及编解码方法、装置、计算机可读介质及电子设备
US20230077935A1 (en) Video Encoding Method and Apparatus, Video Decoding Method and Apparatus, Computer-Readable Medium, and Electronic Device
CN117354545B (zh) 视频图像小波变换高频系数按限定尺寸分块编码方法
WO2023039856A1 (zh) 一种视频解码、编码方法及设备、存储介质
US20240114140A1 (en) Video decoding and encoding method, device and storage medium
WO2022116854A1 (zh) 视频解码方法、装置、可读介质、电子设备及程序产品
WO2022063040A1 (zh) 视频编解码方法、装置及设备
WO2022037478A1 (zh) 视频解码方法、视频编码方法、装置、介质及电子设备
WO2022188239A1 (zh) 系数的编解码方法、编码器、解码器及计算机存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21929659

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180095282.6

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2021929659

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2021929659

Country of ref document: EP

Effective date: 20231012