WO2012159295A1 - Entropy decoding method and device - Google Patents

Entropy decoding method and device Download PDF

Info

Publication number
WO2012159295A1
WO2012159295A1 PCT/CN2011/076357 CN2011076357W WO2012159295A1 WO 2012159295 A1 WO2012159295 A1 WO 2012159295A1 CN 2011076357 W CN2011076357 W CN 2011076357W WO 2012159295 A1 WO2012159295 A1 WO 2012159295A1
Authority
WO
WIPO (PCT)
Prior art keywords
decoding
suffix
codeword
prefixnum
variable
Prior art date
Application number
PCT/CN2011/076357
Other languages
French (fr)
Chinese (zh)
Inventor
徐苏珊
Original Assignee
深圳市融创天下科技股份有限公司
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 深圳市融创天下科技股份有限公司 filed Critical 深圳市融创天下科技股份有限公司
Publication of WO2012159295A1 publication Critical patent/WO2012159295A1/en

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code

Definitions

  • the present invention relates to the field of video coding and decoding, and in particular, to an entropy decoding method and apparatus.
  • video coding technology effectively solves the problem of encoding and compressing massive digital video data. It is the premise of digital information transmission, storage and playback.
  • the mainstream international standards for video compression mainly include MPEG-x and H.26x.
  • These video coding algorithms are block-based hybrid coding methods, which eliminate video time redundancy by motion estimation and motion compensation, and discretize the difference image.
  • the cosine transform transform eliminates spatial redundancy and performs variable length coding on the quantized coefficients to eliminate statistical redundancy.
  • H.264/AVC the latest standard jointly introduced by the advantages of H.263+ and MPEG-4
  • H.263+ and MPEG-4 ASP standards 50% of the code stream is saved under the same reconstructed image quality.
  • the high compression performance of H.264 comes at the cost of high codec complexity.
  • H.264 uses two broad categories of entropy coding methods: arithmetic coding and variable length coding. Variable length coding is further divided into exponential Columbus coded Exp-Golomb and context-based adaptive variable length coding CAVLC. Index Columbus coding uses a fixed coding rule to encode various syntax elements, such as image sequence parameters, image layer parameters, slice parameters, macroblock types, coding block types, etc.; and prediction residual coefficients are encoded according to entropy coding mode.
  • CABAC Context-based Adaptive Binary Arithmetic Coding
  • CAVLC For applications such as real-time video communication such as mobile video, the entropy codec technology generally uses CAVLC codec and index Columbus codec. CAVLC still adopts the Huffman coding idea to construct a binary tree with the smallest length of the weighted path according to the probability of occurrence of characters, so that the average codeword length is the shortest, and the prefixes of each symbol code are different, that is, the coding of any symbol. Neither will be a prefix for another symbolic code. Based on the traditional variable length coding method, CAVLC defines multiple sets of code tables by introducing an adaptive model of context, and dynamically switches the code table according to the characteristics of coded code words. Therefore, CAVLC is in the currently published video standard. The most efficient coding adaptive variable length coding technique.
  • the main steps of the traditional entropy decoding operation are as follows: Read the received binary code stream and then traverse the lookup table matching codeword bit by bit. This requires repeatedly querying the variable length code table to determine the exact matching codeword, thereby determining the codeword. Decoding according to the corresponding relationship between the codeword and the corresponding syntax element, and obtaining the value of the corresponding syntax element. However, this also causes the CAVLC decoding process to be too computationally intensive. On the one hand, CAVLC decoding must distinguish codewords of different lengths from successive bitstreams. For example, the full search algorithm needs to traverse the entire binary tree, which requires multiple readings and judgments. Therefore, the table lookup process takes a lot of time; Since the codeword tree is sparse, the storage space of the code table increases with the length of the codeword. The index has grown, but most of it is vacant and has not been used effectively.
  • the lookup table operation here mainly involves two technical problems: 1) How to determine the complete codeword of variable length; 2) Indirectly obtain the corresponding syntax element from the codeword by looking up the table.
  • it is first necessary to store a complex variable length code table in the memory.
  • bit by bit traversing the lookup table to match the code words, and repeatedly reading and writing memory operations will also lead to a sharp increase in power consumption.
  • the operation of entropy decoding can generally be implemented by a Look Up Table (LUT) structure.
  • LUT Look Up Table
  • the lookup table mode can obtain better speed by occupying memory space, but these methods are suitable for embedded terminals such as mobile phones and PDAs. Resources are often very limited, and the lookup table traverses the lookup table to match the codewords in the decoding process. Repeated read and write memory operations also lead to a sharp increase in power consumption. Therefore, it is necessary to propose an entropy suitable for low resource requirements of embedded platforms. Decoding implementation method.
  • An object of the embodiments of the present invention is to provide an entropy decoding method and apparatus.
  • the entropy decoding method is specifically:
  • an embodiment of the present invention further provides an entropy decoding apparatus, where the apparatus includes: an acquiring unit, a decoding mode determining unit, a variable length code decoding unit, and a fixed length code decoding unit; and an acquiring unit, configured to acquire a binary a bitstream, obtaining a prefix portion of the codeword according to the binary bitstream; acquiring the first variable according to the binary bitstream;
  • a decoding mode determining unit configured to determine after acquiring the first variable; if the first variable is within the variable length codeword parameter range, determining that the decoding mode is one of the first to fourth decoding modes; Within the range of the word parameters, determining that the current codeword is a fixed length codeword; a variable length code decoding unit, configured to determine, according to the prefix, whether the current codeword is based on the prefix in one of the determined first to fourth decoding modes It is a special short code; if it is decoded according to a preset special short code decoding formula, the first parameter and the second parameter are obtained; if otherwise, the corresponding decoding formula is selected according to the prefix part of the code word for decoding, and an index is obtained.
  • the fixed length code decoding unit is configured to: when determining that the current codeword is a fixed length codeword, set an index value equal to the fixed length codeword; obtain according to the index value The first parameter and the second parameter.
  • An object of the embodiments of the present invention is to provide an entropy decoding method and apparatus.
  • the codeword rules and the order of the code table are newly designed.
  • the order index of the codewords in the code table is calculated according to the codeword rules, and the syntax elements in the code table are indexed and sorted.
  • Fast decoding operation is directly calculated into a simple arithmetic expression to calculate the corresponding syntax element value.
  • the embodiment of the present invention eliminates the operation of traversing the binary tree and the operation of matching the codeword, thereby greatly reducing the requirement of the entropy coding algorithm for hardware such as memory.
  • FIG. 1 is a flow chart of a preferred embodiment of the entropy decoding method of the present invention
  • FIG. 2 is a diagram showing a relationship between a current macroblock and a left and upper macroblock of a preferred embodiment of the entropy decoding method of the present invention
  • 3 is a schematic structural diagram of a preferred embodiment of an entropy decoding apparatus of the present invention
  • FIG. 4 is a decoding mode determining unit in a preferred embodiment of the entropy decoding apparatus of the present invention.
  • FIG. 5 is a special short code decoding unit in a preferred embodiment of the entropy decoding apparatus of the present invention.
  • FIG. 6 is an entropy decoding apparatus of the present invention.
  • Non-special short code decoding unit in a preferred embodiment
  • a macroblock is the basic unit of video coding.
  • the macroblock size is 16x16.
  • Each macroblock consists of four 4x4 blocks, each block consisting of one 4x4 luma block and two chroma blocks.
  • the predicted and quantized residual coefficients require the corresponding syntax elements of the image block residual coefficients to be obtained by scanning.
  • the syntax elements that need to be encoded are: Level (the magnitude of non-zero coefficients), Run (a continuous zero-coefficient run before a non-zero coefficient), and data terminators.
  • the entropy coding performs pre-processing on the Zigzag scan of the system after the prediction transform is quantized, and the non-zero coefficient encountered in the scan is recorded as Level, and the continuous zero-coefficient run before the non-zero coefficient is recorded as Run.
  • the entropy coding of video coding is encoded in addition to the syntax elements of the residual coefficients, and other syntax elements of the auxiliary information need to be encoded, such as motion vectors, image sequence parameters, picture layer parameters, slice parameters, macroblock types. , coding block type, etc.
  • CAVLC of H.264/AVC video coding standard defines multiple sets of code tables based on the adaptive model of context, and dynamically according to the characteristics of coded code words.
  • the code table is switched, and the Level and Run are separately coded, and the best coding efficiency effect in the currently released video standard is obtained.
  • the basic principle of CAVLC coding still follows the Huffman coding principle, that is, the symbol with high probability is assigned a short codeword, and the symbol with a small probability is assigned a long codeword, so as to achieve the shortest average code length.
  • the embodiment of the present invention will follow the basic idea of the CAVLC coding method of the H.264/AVC video coding standard and the statistical probability distribution of the corresponding syntax elements, but the code table is completely new. Therefore, the residual coefficient syntax elements that need to be processed mainly include: (a) coeff_token (the number of non-zero coefficients TotalCoeff and the number of trailing coefficients TrailingOnes); (b) the sign of the trailing coefficient trailing- ones-sign- Flag; (c) non-zero coefficient ⁇ value (Level); (d) total-zeros; (e) run- before.
  • coeff_token the number of non-zero coefficients TotalCoeff and the number of trailing coefficients TrailingOnes
  • the sign of the trailing coefficient trailing- ones-sign- Flag (c) non-zero coefficient ⁇ value (Level); (d) total-zeros; (e) run- before.
  • the decoding operation of these parameter coefficient syntax elements mainly requires two technical conditions: the requirement of memory resources and the power consumption of the bit-by-bit traversal lookup table, which poses a challenge to the video decoding design of the embedded terminal.
  • the codewords are sorted by introducing a code table sequential index by analyzing the probability distribution of the codeword rules and the syntax elements, and the special short expressions of the high-frequency special short codewords are directly calculated into corresponding corresponding expressions.
  • the value of the syntax element eliminates the operation of traversing the binary tree and the operation of matching the codeword, thereby greatly reducing the requirement of the entropy coding algorithm for hardware such as memory, and is very suitable for the method and system for entropy decoding application of the embedded terminal.
  • each syntax element of the residual coefficient is designed with multiple code tables, which are adaptively selected through context.
  • the Huffman coding principle that is, a symbol with a high probability of assigning a short codeword and a symbol with a small probability of a long codeword, thereby achieving the shortest average code length.
  • the codeword in the code table constructs the binary tree with the smallest length of the weighted path according to the probability of occurrence of the syntax element, so that the average codeword length is the shortest, and the prefixes of each symbol code are different, that is, the coding of any syntax symbol is It does not become a prefix for another syntax symbol encoding.
  • Embodiment 1 According to the above idea, an embodiment of the present invention provides an entropy decoding method, where the method may be: acquiring a first variable according to a binary bit stream;
  • the method further includes the step of: obtaining a prefix portion of the codeword in the binary bitstream before the "decoding according to the type of the current codeword using the corresponding decoding method";
  • Decoding according to the type of the current codeword by using a corresponding decoding method may be: when determining that the current codeword is a variable length codeword, determining that the decoding mode is a variable length codeword decoding mode; according to the prefix portion of the codeword Determining whether the current codeword is a special short code, if yes, decoding according to a preset special short code decoding formula to obtain a first parameter and a second parameter; if otherwise, selecting according to the prefix in the variable length codeword decoding mode The preset decoding formula is decoded to obtain an index value, and the first parameter and the second parameter are obtained according to the index value.
  • decoding according to the type of the current codeword using the corresponding decoding method may be: determining that the decoding mode is a fixed length codeword decoding mode; setting the index value value equal to the fixed length codeword The value is used to find a preset fixed length code table according to the index value, and obtain a first parameter and a second parameter corresponding to the index value.
  • Step 101 Obtain a first variable (NC); if the first variable (NC) is within a variable length codeword parameter range, for example, may be -1 ⁇ NC ⁇ 8; then determine that the decoding mode is the first to fourth decoding modes. If the first variable (NC) is within the range of the fixed length codeword parameter, for example, NC ⁇ 8, then the current codeword is determined to be a fixed length codeword, and step 106 is performed; The first variable obtained in this step (the method of Ncy can be:
  • Step 102 Acquiring a binary bitstream, and obtaining a prefix portion of the codeword according to the binary bitstream;
  • the prefix portion may be obtained by using a first "1" detector;
  • Step 103 In the first to fourth decoding modes determined in step 101, determining whether the current codeword is a special short code according to the prefix; if yes, performing the step 104; If otherwise, step 105 is performed; the step may be: assigning the number of "0"s of the prefix part to the intermediate variable PrefixNum, and then determining whether the codeword is special according to the relationship between the intermediate variable PrefixNum and the threshold.
  • Short code can be determined according to the first variable NC, for example:
  • the threshold S can be set to 3, and when PrefixNum ⁇ 3, it is determined that the current codeword is a special short code
  • the threshold S can be set to 2, and when PrefixNum ⁇ 2, it is determined that the current codeword is a special short code
  • the threshold S can be set to 1, and when PrefixNum ⁇ 1, it is determined that the current codeword is a special short code
  • Step 104 The first to the determined in step 101 In one of the fourth decoding modes, decoding is performed according to a preset special short code decoding formula, and the first parameter TrailingOnes and the second parameter are obtained. TotalCoeff;
  • TrailingOnes 3 (Suffix/4)+(Suffix%4) (l-Suffix/4)
  • TrailingOnes are actually the same, the former one is simple calculation, and the latter one is based on bit operation;
  • TrailingOnes is the first parameter
  • TotalCoeff is the second parameter
  • PrefixNum is the intermediate variable
  • Prefix is the prefix
  • Suffix is the suffix
  • Suffix[2:0] represents the 2nd to 0th bit of the 3-bit binary number
  • Suffix[l: 0] represents a 2-bit binary number from the 1st to the 0th bit
  • Suffix[2:2] represents a 1-bit binary number of the 2nd bit.
  • PrefixNum [1 : 0] represents the 2-bit binary number from bit 1 to bit
  • PrefixNum[l : l] represents the 1-bit binary number of the first
  • PrefixNum [0:0] represents The 1-bit binary number of the 0th bit.
  • Step 105 Decoding according to the prefix selection corresponding preset decoding formula in the first to fourth decoding modes determined in step 101, obtaining an index value, and the index value characterizing the syntax element (the first parameter TrailingOnes and The second parameter TotalCoeff) is arranged in order to obtain the first parameter TrailingOnes and the second parameter TotalCoeff according to the index value.
  • the step of decoding is performed according to determining different decoding modes and selecting a corresponding preset decoding formula by using the prefix, and obtaining an index value may be:
  • Index is the index value
  • PrefixNum is the intermediate variable
  • Suffix is the suffix
  • "" means the bitwise left shift operation.
  • Index is the index value
  • PrefixNum is the intermediate variable
  • Suffix is the suffix
  • "" means the bitwise left shift operation.
  • the obtaining the index value, obtaining the first parameter and the second parameter according to the index value may be: after obtaining the index value, in determining one of the first to fourth decoding modes, according to The index value searches for a preset parameter table, and obtains a first parameter and a second parameter corresponding to the index value.
  • the corresponding parameter table of the search preset is Table 2
  • the first variable length code table (VLC-1) in the second decoding mode, the parameter table of the corresponding search preset is Table 3.
  • the corresponding parameter table for finding the preset is Table 5, the fourth variable length code table (VLC-4).
  • the current codeword determined in step 101 is a fixed length codeword; if the fixed length codeword length is a preset length, the index value Index is set to be equal to the fixed length codeword; and the first parameter is obtained according to the index value.
  • the preset length of the fixed length codeword is an integer not less than log 2 N, and N is the number of values of the syntax element; in this example, the preset length may be 6.
  • the step may be: when determining that the current codeword is a fixed length codeword, after setting the index value equal to the fixed length codeword, searching for the preset fixed length code table according to the index value, and obtaining the first parameter corresponding to the index value and The second parameter.
  • step 105 since it is determined to be the first decoding mode
  • PrefixNum is the intermediate variable
  • Suffix is the suffix
  • Suffixlength is the suffix length
  • && means "and”
  • (judgment condition) ? a: b” means: when the judgment condition is established, then a, when the judgment condition is not true Take b.
  • step 102 a binary bit stream OOlOllOxxxxx is obtained, and the prefix part is 0010110;
  • the intermediate variable is obtained.
  • a binary bit stream OOOO Ol lOlxxxx is obtained, then the prefix part is 0000 01;
  • step 105 since it is determined to be the second decoding mode
  • PrefixNum is the intermediate variable
  • Suffix is the suffix
  • Suffixlength is the suffix length
  • "? : " is the conditional operator.
  • step 102 a binary bit stream 011011 lxxx is obtained, and the prefix part is 01;
  • step 102 a binary bit stream 0000 OllOlxxxx is obtained, and the prefix part is 000001;
  • step 105 since it is determined to be the third decoding mode
  • Index ((PrefixNum-3) «2) Ten Suffix where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
  • step 102 a binary bit 10011 lxxx is obtained, then the prefix part is
  • TrailingOnes 3 (Suffix/4)+(Suffix%4) (l-Suffix/4)
  • the suffix "001" can be obtained according to the binary bit stream 10011 lxxx;
  • TrailingOnes are actually the same, the former one is simple calculation, and the latter one is based on bit operation;
  • TrailingOnes is the first parameter
  • TotalCoeff is the second parameter
  • Prefix is the prefix
  • step 102 a binary bit stream OOOO OlOOlxxxx is obtained, and the prefix part is 0000 01;
  • step 105 since it is determined to be the fourth decoding mode;
  • Index ((PrexfixNum-3) «2)
  • Index is the index value
  • PrefixNum is the intermediate variable
  • Suffix is the suffix. "" indicates a bitwise left shift operation.
  • TrailingOnes is the first parameter
  • TotalCoeff is the second parameter
  • PrefixNum is the intermediate variable
  • PrefixNum [1:0] represents the 1-bit binary number from the 1st to the 0th
  • Suffix[l:l] Indicates the 1-bit binary number of the first
  • Suffix[0:0] represents the 1-bit binary number of the 0th bit. " ⁇ " indicates that the bit is inverted.
  • the codeword is a fixed length codeword"; therefore, it can be determined that the current codeword is a fixed length codeword;
  • step 106 a binary bit 10011 lxxx is obtained.
  • the embodiment of the present invention further provides an entropy decoding apparatus.
  • the apparatus includes: an acquiring unit, a codeword type determining unit, and a decoding unit;
  • the obtaining unit is configured to acquire a first variable according to a binary bit stream;
  • a codeword type determining unit configured to determine a type of the current codeword according to a range of the first variable
  • a decoding unit configured to perform decoding according to a type of the current codeword by using a corresponding decoding method.
  • the obtaining unit includes:
  • bitstream acquisition unit configured to acquire a binary bitstream
  • the first variable acquisition unit is configured to acquire the first variable.
  • the first variable acquiring unit is configured to: obtain the first variable specifically:
  • the first variable the number of second non-zero coefficients
  • the first variable the number of first non-zero coefficients.
  • the obtaining unit further includes a prefix obtaining unit, configured to obtain a prefix portion of the current codeword according to the binary bit stream;
  • the codeword type determining unit is further configured to determine, according to a range of the first variable, that the type of the current codeword is a variable length codeword;
  • the decoding unit includes: a decoding mode determining unit, a determining unit, and a special short code decoding unit; a mode determining unit, configured to: when determining that the current codeword is a variable length codeword, determine that the decoding mode is a variable length codeword decoding mode;
  • a determining unit configured to determine, according to a prefix portion of the codeword, whether the current codeword is a special short code when determining that the decoding mode is a variable length codeword decoding mode
  • a special short code decoding unit configured to determine a current codeword as a special short code according to a preset
  • the special short code decoding formula is decoded to obtain the first parameter and the second parameter.
  • the codeword type determining unit is configured to determine, according to the range of the first variable, that the type of the current codeword is a variable length codeword, which is specifically: when -1 ⁇ the first variable ⁇ 8, the type of the current codeword is determined.
  • Variable length code word is specifically: when -1 ⁇ the first variable ⁇ 8, the type of the current codeword is determined.
  • the structure of the decoding mode determining unit is shown in FIG. 4.
  • the unit includes: a first decoding mode determining unit, a second decoding mode determining unit, a third decoding mode determining unit, and a fourth decoding mode determining unit;
  • a first decoding mode determining unit configured to determine that if 0 ⁇ the first variable ⁇ 2, determine to decode the first decoding mode
  • a second decoding mode determining unit configured to determine that if the second variable ⁇ 4, the second decoding mode is determined to be decoded
  • a third decoding mode determining unit configured to determine that if the third variable ⁇ 8, the third decoding mode is determined to be decoded; and the fourth decoding mode determining unit is configured to determine that if the first variable is -1, the determining is The fourth decoding mode is decoded.
  • the decoding mode determining unit determines that one of the first to fourth decoding modes is to be decoded
  • the determining unit is configured to determine, according to the prefix, whether the current codeword is a special short code according to the prefix when determining that the decoding mode is a variable length codeword decoding mode:
  • the structure of the special short code decoding unit is specifically as follows:
  • the special short code decoding unit includes a first special short code decoding unit;
  • the first special short code decoding unit is configured to, when determining to be the first decoding mode,
  • TrailingOnes is the first parameter
  • TotalCoeff is the second parameter
  • PrefixNum is the middle.
  • TrailingOnes is the first parameter
  • TotalCoeff is the second parameter
  • PrefixNum is the intermediate variable
  • Suffix is the suffix
  • Prefix is the prefix
  • Suffixlength is the suffix length
  • "" indicates the bitwise left shift operation
  • TrailingOnes is the first parameter
  • TotalCoeff is the second parameter
  • PrefixNum is the intermediate variable
  • PrefixNum [1:0] represents the 1-bit binary number from the 1st to the 0th
  • PrefixNum[l:l] represents the 1st.
  • Bit binary number PrefixNum [0:0] represents the 1-bit binary number of the 0th bit
  • " ⁇ " means the bit is inverted.
  • the decoding unit further includes: a non-special short code decoding unit, configured to: when determining, according to the prefix portion of the codeword, that the current codeword is not a special short code, according to the variable length codeword decoding mode, The prefix part of the codeword is selected to be decoded by the corresponding preset decoding formula to obtain an index value, and the first parameter and the second parameter are obtained according to the index value.
  • the non-special short code decoding unit further includes a second decoding unit; when used to determine the second decoding mode,
  • Index (PrefixNum-3) «2) + Suffix
  • Index is the index value
  • PrefixNum is the intermediate variable
  • Suffix is the suffix
  • "" means the bitwise left shift operation
  • Index (PrefixNum-3) «3) + Suffix
  • Index is the index value
  • PrefixNum is the intermediate variable
  • Suffix is the suffix.
  • "" indicates a bitwise left shift operation.
  • the "acquiring index value, obtaining the first parameter and the second parameter according to the index value" described in the non-special short code decoding unit is specifically: after obtaining the index value, in the determined variable length decoding mode And searching for the preset parameter table according to the index value, and acquiring the first parameter and the second parameter corresponding to the index value.
  • the decoding mode determining unit further includes: a fixed length codeword decoding mode determining unit; a fixed length codeword decoding mode determining unit, configured to determine that if the first variable is ⁇ 8, determine that the fixed length codeword decoding mode is performed.
  • the decoding unit further includes: a fixed length codeword decoding unit, configured to determine that the decoding mode is a fixed length codeword decoding mode; set an index value value equal to a fixed length codeword value, and search for a preset according to the index value.
  • the fixed length code table obtains the first parameter and the second parameter corresponding to the index value.
  • An object of the embodiments of the present invention is to provide an entropy decoding method and apparatus.
  • the codeword rules and the order of the code tables are newly designed, according to the codeword rules.
  • the order index of the code words in the code table is calculated, and the syntax elements in the code table are indexed and sorted, thereby implementing a fast decoding operation.
  • a special short codeword with a high frequency of use is directly calculated into a simple arithmetic expression to calculate the corresponding syntax element value.
  • the embodiment of the invention eliminates the operation of traversing the binary tree and the operation of matching the codeword, thereby greatly reducing the requirement of the entropy coding algorithm for hardware such as memory.

Abstract

An entropy decoding method and device is disclosed. The method includes: acquiring a binary bit stream; acquiring a first variable; determining the type of the current code word based on the range of the first variable; and performing decoding with the corresponding decoding method based on the type of the current code word. The device includes: an acquiring unit, a code word type determining unit and a decoding unit. The solution designs the rule of code words and the order of code tables by analyzing the probability distribution of syntax elements, calculates the sequential index of the code words in the code tables based on the rule of code words, and indexes and sorts the syntax elements in the code tables so that the fast decoding is implemented.

Description

技术领域 Technical field
本发明涉及视频编解码领域, 尤其涉及一种熵解码方法、 装置。  The present invention relates to the field of video coding and decoding, and in particular, to an entropy decoding method and apparatus.
背景技术 Background technique
视频编码技术作为多媒体通信中最重要的环节之一,有效地解决了海量数 字视频数据的编码压缩问题, 它是数字信息传输、 存储、 播放等环节的前提。 目前主流的视频压缩国际标准主要有 MPEG-x和 H.26x等,这些视频编码算法 都是基于块的混合编码方法, 即通过运动估计和运动补偿消除视频时间冗余, 对差值图像进行离散余弦变换变换消除空间冗余,对量化后的系数进行可变长 编码消除统计冗余。  As one of the most important links in multimedia communication, video coding technology effectively solves the problem of encoding and compressing massive digital video data. It is the premise of digital information transmission, storage and playback. At present, the mainstream international standards for video compression mainly include MPEG-x and H.26x. These video coding algorithms are block-based hybrid coding methods, which eliminate video time redundancy by motion estimation and motion compensation, and discretize the difference image. The cosine transform transform eliminates spatial redundancy and performs variable length coding on the quantized coefficients to eliminate statistical redundancy.
2003年, ISO/IEC (动态图像专家组) 的运动图像专家组(MPEG Moving Pictures Experts Group/Motion Pictures Experts Group )与 ITU-T (ITU-T for ITU Telecommunication Standardization Sector 国际电信联盟远程通信标准化组织) 的视频编码专家组 (VCEG) 联手制定了最新的视频编码标准 H.264/AVC (集 合 H.263+和 MPEG-4的优点联合推出的最新标准),其主要目的是获得更高的 编码效率和更好的网络亲和性。在相同重构图象质量下,与 H.263 +和 MPEG-4 ASP标准相比,节约 50%的码流。 H.264的高压缩性能是以高编解码复杂度为 代价的。 诸多新的编码算法被采用: 帧内预测、 多参考帧运动补偿、 增强的熵 编码、 去方块滤波等。这导致了视频编解码的复杂性显著增大, 庞大的运算量 会造成严重的功耗, 这些都对嵌入式平台的视频熵解码实现提出挑战。  In 2003, ISO/IEC (Moving Picture Experts Group) Motion Picture Experts Group and ITU-T (ITU-T for ITU Telecommunication Standardization Sector) The Video Coding Experts Group (VCEG) has teamed up to develop the latest video coding standard H.264/AVC (the latest standard jointly introduced by the advantages of H.263+ and MPEG-4), with the main purpose of achieving higher coding efficiency. And better network affinity. Compared to the H.263+ and MPEG-4 ASP standards, 50% of the code stream is saved under the same reconstructed image quality. The high compression performance of H.264 comes at the cost of high codec complexity. A number of new coding algorithms have been adopted: intra prediction, multiple reference frame motion compensation, enhanced entropy coding, deblocking filtering, and so on. This leads to a significant increase in the complexity of video codecs, and the huge amount of computation can cause severe power consumption, which challenges the implementation of video entropy decoding for embedded platforms.
在 H.264/AVC标准中, 残差数据经过整数变换、 量化后被送往熵编码器 进行编码。 H.264采用了两大类熵编码方法: 算术编码和可变长度编码。 可变 长编码又分为指数哥伦布编码 Exp-Golomb 和基于上下文的自适应变长编码 CAVLC。 指数哥伦布编码采用固定的编码规则对各种语法元素进行编码, 如 图像序列参数、 图像层参数、 片层参数、 宏块类型、 编码块类型等; 而预测残 差系数的编码需要根据熵编码模式来选择使用基于上下文的 CAVLC自适应变 长编码 (Context-based Adaptive Variable Length Coding, 自适应变长编码)或是 基于上下文的二进制算术编码(Context-based Adaptive Binary Arithmetic Coding, CAB AC) H.264/AVC视频编码标准的 CAVLC熵编码充分利用了上下 文信息, 通过建立多个码表自适应选择优化, 取得了良好的编码效果。 H.264/AVC的 CABAC熵编码属于算术编码器,算术编码的性能要优于变长编 码, 而且 CABAC通过自适应的概率估计和更新以及二进制算术编码, 更加逼 近香农定理, 编码效果更高, 但其算法计算复杂度高, 硬件实现要求复杂, 是 一种以软硬件的复杂度换取编码效率的提高。 In the H.264/AVC standard, residual data is integer-transformed and quantized, and then sent to an entropy encoder for encoding. H.264 uses two broad categories of entropy coding methods: arithmetic coding and variable length coding. Variable length coding is further divided into exponential Columbus coded Exp-Golomb and context-based adaptive variable length coding CAVLC. Index Columbus coding uses a fixed coding rule to encode various syntax elements, such as image sequence parameters, image layer parameters, slice parameters, macroblock types, coding block types, etc.; and prediction residual coefficients are encoded according to entropy coding mode. To choose context-based Adaptive Variable Length Coding (Cycle-based Adaptive Variable Length Coding) or Context-based Adaptive Binary Arithmetic Coding (CAB AC) H.264 The CAVLC entropy coding of the /AVC video coding standard makes full use of the context information, and achieves a good coding effect by establishing multiple code table adaptive selection optimization. The CABAC entropy coding of H.264/AVC belongs to arithmetic coder. The performance of arithmetic coding is better than that of variable length coding, and CABAC is closer to Shannon's theorem through adaptive probability estimation and update and binary arithmetic coding. However, the computational complexity of the algorithm is high, and the hardware implementation requirements are complex. It is an improvement of the coding efficiency by the complexity of software and hardware.
对于移动视频等实时视频通信这类应用场合, 熵编解码技术一般采用 CAVLC编解码和指数哥伦布编解码。 CAVLC仍采用了哈夫曼编码的思想依据 字符出现概率来构造带权路径长度最小的二叉树从而实现平均码字长度最短, 且各个符号编码的字头都是相异的,即任何一个符号的编码都不会成为另一个 符号编码的前缀。 CAVLC在传统变长编码方法的基础上, 通过引入上下文的 自适应模型, 定义了多组码表, 根据编码码字特征, 动态的进行码表切换, 因 此, CAVLC是以目前已发布视频标准中编码效率最高的上下文自适应变长编 码技术。  For applications such as real-time video communication such as mobile video, the entropy codec technology generally uses CAVLC codec and index Columbus codec. CAVLC still adopts the Huffman coding idea to construct a binary tree with the smallest length of the weighted path according to the probability of occurrence of characters, so that the average codeword length is the shortest, and the prefixes of each symbol code are different, that is, the coding of any symbol. Neither will be a prefix for another symbolic code. Based on the traditional variable length coding method, CAVLC defines multiple sets of code tables by introducing an adaptive model of context, and dynamically switches the code table according to the characteristics of coded code words. Therefore, CAVLC is in the currently published video standard. The most efficient coding adaptive variable length coding technique.
传统的熵解码操作的主要步骤如下: 读取接收到的二进制码流, 然后逐位 遍历查找表匹配码字, 这需要反复查询变长码表, 确定了完全匹配的码字, 从 而确定码字, 根据码字在码表和相应语法元素的相应关系进行解码, 获得相应 语法元素的数值。但是,这也导致了 CAVLC的解码过程计算量过大。一方面, CAVLC解码必须从连续的比特流中分辨各个长度不定的码字, 如采用全搜索 算法需要遍历整个二叉树, 需要进行多次读取和判断, 因此查表过程耗费时间 很多; 另一方面, 由于码字树很稀疏, 码表的存储空间随着码字长度的增加成 指数增长, 但其中的绝大部分是空置的, 没有得到有效利用。 The main steps of the traditional entropy decoding operation are as follows: Read the received binary code stream and then traverse the lookup table matching codeword bit by bit. This requires repeatedly querying the variable length code table to determine the exact matching codeword, thereby determining the codeword. Decoding according to the corresponding relationship between the codeword and the corresponding syntax element, and obtaining the value of the corresponding syntax element. However, this also causes the CAVLC decoding process to be too computationally intensive. On the one hand, CAVLC decoding must distinguish codewords of different lengths from successive bitstreams. For example, the full search algorithm needs to traverse the entire binary tree, which requires multiple readings and judgments. Therefore, the table lookup process takes a lot of time; Since the codeword tree is sparse, the storage space of the code table increases with the length of the codeword. The index has grown, but most of it is vacant and has not been used effectively.
具体来看, 这里的查找表操作主要涉及两个技术问题: 1 ) 如何确定变长 的完整码字; 2) 由码字通过查表间接获得相应的语法元素。 显然, 要解决这 两个技术问题, 首先需要内存中保存着复杂的变长码表, 其次, 逐位遍历查找 表匹配码字, 反复读写内存操作也会导致功耗的剧增。  Specifically, the lookup table operation here mainly involves two technical problems: 1) How to determine the complete codeword of variable length; 2) Indirectly obtain the corresponding syntax element from the codeword by looking up the table. Obviously, to solve these two technical problems, it is first necessary to store a complex variable length code table in the memory. Secondly, bit by bit traversing the lookup table to match the code words, and repeatedly reading and writing memory operations will also lead to a sharp increase in power consumption.
综上所述, CAVLC的编码高效率是以众多的码表为代价的, 过多的码表 意味着编解码操作需要更多的计算资源。 熵解码的操作一般可以采用查找表 (Look Up Table, LUT)结构实现, 查找表模式会通过占用内存空间而获得较好 的速度, 但是这些方法对于诸如手机、 PDA 等嵌入式终端而言, 内存资源往 往是非常有限的, 而且解码过程中逐位遍历查找表匹配码字, 反复读写内存操 作也会导致功耗的剧增,因此有必要提出一种适用于嵌入式平台低资源要求的 熵解码实现方法。  In summary, the high efficiency of CAVLC coding is at the expense of numerous code tables. Too many code tables mean that the codec operation requires more computing resources. The operation of entropy decoding can generally be implemented by a Look Up Table (LUT) structure. The lookup table mode can obtain better speed by occupying memory space, but these methods are suitable for embedded terminals such as mobile phones and PDAs. Resources are often very limited, and the lookup table traverses the lookup table to match the codewords in the decoding process. Repeated read and write memory operations also lead to a sharp increase in power consumption. Therefore, it is necessary to propose an entropy suitable for low resource requirements of embedded platforms. Decoding implementation method.
发明内容 Summary of the invention
本发明实施例的目的在于提出一种熵解码方法、 装置。  An object of the embodiments of the present invention is to provide an entropy decoding method and apparatus.
该熵解码方法具体为:  The entropy decoding method is specifically:
根据所述的二进制比特流获取码字的前缀部分;  Obtaining a prefix portion of the codeword according to the binary bit stream;
根据二进制比特流获取第一变量; 若第一变量在变长码字参数范围内, 则 确定解码模式为第一至第四解码模式其中之一; 若在定长码字参数范围内, 则 确定当前码字为定长码字;  Obtaining a first variable according to the binary bit stream; if the first variable is within a variable length codeword parameter, determining that the decoding mode is one of the first to fourth decoding modes; if within the fixed length codeword parameter range, determining The current codeword is a fixed length codeword;
在所述确定的第一至第四其中之一解码模式下,根据所述前缀判断当前码 字是否为特殊短码; 若是, 根据预置相应的特殊短码解码公式进行解码, 获得 第一参数和第二参数;若否则根据所述码字的前缀部分选择预置相应的解码公 式进行解码, 获得索引值, 根据索引值获得第一参数和第二参数;  Determining, according to the prefix, whether the current codeword is a special short code according to the prefix, and if so, decoding according to a preset special short code decoding formula to obtain the first parameter And the second parameter; if otherwise, according to the prefix portion of the codeword, the preset corresponding decoding formula is selected for decoding, and an index value is obtained, and the first parameter and the second parameter are obtained according to the index value;
当确定当前码字为定长码字时, 则设置索引值等于定长码字; 根据所述索 引值获取第一参数和第二参数。 相应于该方法, 本发明实施例还提供了一种熵解码装置, 所述装置包括: 获取单元、 解码模式确定单元、 变长码解码单元、 定长码解码单元; 获取单元,用于获取二进制比特流, 根据所述的二进制比特流获取码字的 前缀部分; 根据二进制比特流获取第一变量; When it is determined that the current codeword is a fixed length codeword, the index value is set to be equal to the fixed length codeword; and the first parameter and the second parameter are obtained according to the index value. Corresponding to the method, an embodiment of the present invention further provides an entropy decoding apparatus, where the apparatus includes: an acquiring unit, a decoding mode determining unit, a variable length code decoding unit, and a fixed length code decoding unit; and an acquiring unit, configured to acquire a binary a bitstream, obtaining a prefix portion of the codeword according to the binary bitstream; acquiring the first variable according to the binary bitstream;
解码模式确定单元,用于在获取第一变量后进行判断; 若第一变量在变长 码字参数范围内, 则确定解码模式为第一至第四解码模式其中之一; 若在定长 码字参数范围内, 则确定当前码字为定长码字; 变长码解码单元,用于在所述确定的第一至第四其中之一解码模式下, 根 据所述前缀判断当前码字是否为特殊短码;若是根据预置相应的特殊短码解码 公式进行解码, 获得第一参数和第二参数; 若否则根据所述码字的前缀部分选 择预置相应的解码公式进行解码, 获得索引值, 根据索引值获得第一参数和第 二参数; 定长码解码单元,用于当确定当前码字为定长码字时, 则设置索引值等于 定长码字; 根据所述索引值获取第一参数和第二参数。  a decoding mode determining unit, configured to determine after acquiring the first variable; if the first variable is within the variable length codeword parameter range, determining that the decoding mode is one of the first to fourth decoding modes; Within the range of the word parameters, determining that the current codeword is a fixed length codeword; a variable length code decoding unit, configured to determine, according to the prefix, whether the current codeword is based on the prefix in one of the determined first to fourth decoding modes It is a special short code; if it is decoded according to a preset special short code decoding formula, the first parameter and the second parameter are obtained; if otherwise, the corresponding decoding formula is selected according to the prefix part of the code word for decoding, and an index is obtained. a value, the first parameter and the second parameter are obtained according to the index value; the fixed length code decoding unit is configured to: when determining that the current codeword is a fixed length codeword, set an index value equal to the fixed length codeword; obtain according to the index value The first parameter and the second parameter.
本发明实施例的目的在于提供一种熵解码方法、装置。通过分析语法元素 的概率分布情况,对码字规则和码表排列顺序进行全新设计, 根据码字规则计 算出码表中码字的顺序索引,对码表中的语法元素进行索引排序,进而实现快 速解码操作。此外,将部分高使用频率的特殊短码字直接简单算术表达式计算 出相应的语法元素数值。本发明实施例实施例消除了遍历二叉树的操作和匹配 码字的操作, 从而极大降低熵编码算法对内存等硬件的要求。  An object of the embodiments of the present invention is to provide an entropy decoding method and apparatus. By analyzing the probability distribution of the syntax elements, the codeword rules and the order of the code table are newly designed. The order index of the codewords in the code table is calculated according to the codeword rules, and the syntax elements in the code table are indexed and sorted. Fast decoding operation. In addition, a special short codeword with a high frequency of use is directly calculated into a simple arithmetic expression to calculate the corresponding syntax element value. The embodiment of the present invention eliminates the operation of traversing the binary tree and the operation of matching the codeword, thereby greatly reducing the requirement of the entropy coding algorithm for hardware such as memory.
附图说明 DRAWINGS
图 1是本发明的熵解码方法的优选实施例的流程图;  1 is a flow chart of a preferred embodiment of the entropy decoding method of the present invention;
图 2是本发明的熵解码方法的优选实施例的当前宏块与左边、上面宏块位 置关系图; 图 3是本发明的熵解码装置的优选实施例的结构示意图; 2 is a diagram showing a relationship between a current macroblock and a left and upper macroblock of a preferred embodiment of the entropy decoding method of the present invention; 3 is a schematic structural diagram of a preferred embodiment of an entropy decoding apparatus of the present invention;
图 4 是本发明的熵解码装置的优选实施例中的解码模式确定单元的 图 5 是本发明的熵解码装置的优选实施例中的特殊短码解码单元的 图 6 是本发明的熵解码装置的优选实施例中的非特殊短码解码单元的  4 is a decoding mode determining unit in a preferred embodiment of the entropy decoding apparatus of the present invention. FIG. 5 is a special short code decoding unit in a preferred embodiment of the entropy decoding apparatus of the present invention. FIG. 6 is an entropy decoding apparatus of the present invention. Non-special short code decoding unit in a preferred embodiment
具体实施方式 为了使本发明的目的、技术方案及优点更加清楚明白, 以下结合附图和实 施例, 对本发明进行进一步详细说明, 为了便于说明, 仅示出了与本发明实施 例相关的部分。 应当理解, 此处所描写的具体实施例, 仅仅用于解释本发明, 并不用以限制本发明。 The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. For the convenience of description, only the parts related to the embodiments of the present invention are shown. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
在视频编码中, 宏块是视频编码的基本单元, 宏块大小为 16x16, 每个宏 块由 4个 4x4块组成, 每个块由 1个 4x4亮度块和 2个色度块组成。 对于图 像块而言,预测和量化后的残差系数需要通过扫描获得图像块残差系数的相应 的语法元素。这些需要编码的语法元素主要有: Level (非零系数的幅值)、 Run (一个非零系数前的连续零系数游程)以及数据结束符等。通常熵编码先对预 测变换量化后的系统进行 Zigzag扫描进行预处理, 把扫描中遇到的非零系数 记为 Level, —个非零系数前的连续零系数游程记为 Run。 当然, 视频编码的 熵编码除了残差系数的语法元素进行编码,还有其他各种辅助信息的语法元素 需要进行编码, 如运动矢量、 图像序列参数、 图片层参数、 片层参数、 宏块类 型、 编码块类型等。  In video coding, a macroblock is the basic unit of video coding. The macroblock size is 16x16. Each macroblock consists of four 4x4 blocks, each block consisting of one 4x4 luma block and two chroma blocks. For image blocks, the predicted and quantized residual coefficients require the corresponding syntax elements of the image block residual coefficients to be obtained by scanning. The syntax elements that need to be encoded are: Level (the magnitude of non-zero coefficients), Run (a continuous zero-coefficient run before a non-zero coefficient), and data terminators. Usually, the entropy coding performs pre-processing on the Zigzag scan of the system after the prediction transform is quantized, and the non-zero coefficient encountered in the scan is recorded as Level, and the continuous zero-coefficient run before the non-zero coefficient is recorded as Run. Of course, the entropy coding of video coding is encoded in addition to the syntax elements of the residual coefficients, and other syntax elements of the auxiliary information need to be encoded, such as motion vectors, image sequence parameters, picture layer parameters, slice parameters, macroblock types. , coding block type, etc.
H.264/AVC视频编码标准的 CAVLC在传统变长编码方法的基础上, 通过 引入上下文的自适应模型, 定义了多组码表, 根据编码码字特征, 动态的进行 码表切换, 将 Level、 Run分开进行编码, 取得了目前已发布视频标准中最佳 编码效率效果。 CAVLC的编码基本原理仍然遵循 Huffman编码原理, 即大概 率的符号分配短码字、小概率的符号分配长码字, 从而达到平均码长最短的目 的。 Based on the traditional variable length coding method, CAVLC of H.264/AVC video coding standard defines multiple sets of code tables based on the adaptive model of context, and dynamically according to the characteristics of coded code words. The code table is switched, and the Level and Run are separately coded, and the best coding efficiency effect in the currently released video standard is obtained. The basic principle of CAVLC coding still follows the Huffman coding principle, that is, the symbol with high probability is assigned a short codeword, and the symbol with a small probability is assigned a long codeword, so as to achieve the shortest average code length.
因此,本发明实施例将遵循 H.264/AVC视频编码标准的 CAVLC编码方法 基本思想和相应的语法元素的统计概率分布, 但对码表进行了全新的设计。 因 此, 需要处理的残差系数语法元素主要包括: (a) coeff— token (非零系数个数 TotalCoeff 和拖尾系数的个数 TrailingOnes ) ; ( b ) 拖尾系数的符号 trailing— ones— sign— flag; ( c ) 非零系数巾 §值 (Level ); ( d ) total— zeros ; ( e ) run— before。  Therefore, the embodiment of the present invention will follow the basic idea of the CAVLC coding method of the H.264/AVC video coding standard and the statistical probability distribution of the corresponding syntax elements, but the code table is completely new. Therefore, the residual coefficient syntax elements that need to be processed mainly include: (a) coeff_token (the number of non-zero coefficients TotalCoeff and the number of trailing coefficients TrailingOnes); (b) the sign of the trailing coefficient trailing- ones-sign- Flag; (c) non-zero coefficient § value (Level); (d) total-zeros; (e) run- before.
这些参数系数语法元素的解码操作主要需要两个技术条件:内存资源的要 求和逐位遍历查找表的功耗问题, 这对嵌入式终端的视频解码设计带来了挑 战。本发明实施例通过对码字规则和语法元素的概率分布分析,通过引入码表 顺序索引对码字进行了排序,并且将部分高使用频率的特殊短码字直接简单算 术表达式计算出相应的语法元素数值,消除了遍历二叉树的操作和匹配码字的 操作, 从而极大降低熵编码算法对内存等硬件的要求, 非常适合于嵌入式终端 的熵解码应用的方法和系统。  The decoding operation of these parameter coefficient syntax elements mainly requires two technical conditions: the requirement of memory resources and the power consumption of the bit-by-bit traversal lookup table, which poses a challenge to the video decoding design of the embedded terminal. In the embodiment of the present invention, the codewords are sorted by introducing a code table sequential index by analyzing the probability distribution of the codeword rules and the syntax elements, and the special short expressions of the high-frequency special short codewords are directly calculated into corresponding corresponding expressions. The value of the syntax element eliminates the operation of traversing the binary tree and the operation of matching the codeword, thereby greatly reducing the requirement of the entropy coding algorithm for hardware such as memory, and is very suitable for the method and system for entropy decoding application of the embedded terminal.
为了获得高的熵编码下来, 每个残差系数的语法元素, 设计了多张码表, 通过上下文自适应选择。 Huffman编码原理, 即大概率的符号分配短码字、 小 概率的符号分配长码字, 从而达到平均码长最短的目的。码表中的码字完全依 据语法元素出现概率来构造带权路径长度最小的二叉树从而实现平均码字长 度最短, 且各个符号编码的字头都是相异的, 即任何一个语法符号的编码都不 会成为另一个语法符号编码的前缀。 实施例 1, 依据上述思想, 本发明实施例提供了一种熵解码方法, 该方法可以是: 根据二进制比特流获取第一变量;  In order to obtain high entropy coding, each syntax element of the residual coefficient is designed with multiple code tables, which are adaptively selected through context. The Huffman coding principle, that is, a symbol with a high probability of assigning a short codeword and a symbol with a small probability of a long codeword, thereby achieving the shortest average code length. The codeword in the code table constructs the binary tree with the smallest length of the weighted path according to the probability of occurrence of the syntax element, so that the average codeword length is the shortest, and the prefixes of each symbol code are different, that is, the coding of any syntax symbol is It does not become a prefix for another syntax symbol encoding. Embodiment 1 According to the above idea, an embodiment of the present invention provides an entropy decoding method, where the method may be: acquiring a first variable according to a binary bit stream;
根据第一变量的范围确定当前码字的类型; 根据当前码字的类型采用相应的解码方法进行解码。 Determining the type of the current codeword according to the range of the first variable; According to the type of the current codeword, the corresponding decoding method is used for decoding.
其中如果当前码字的类型为变长码字,那么在所述的 "根据当前码字的类 型采用相应的解码方法进行解码"之前还包括步骤: 获取二进制比特流中码字 的前缀部分;  If the type of the current codeword is a variable length codeword, the method further includes the step of: obtaining a prefix portion of the codeword in the binary bitstream before the "decoding according to the type of the current codeword using the corresponding decoding method";
"根据当前码字的类型采用相应的解码方法进行解码"可以为: 当确定当 前码字为变长码字时, 则确定解码模式为变长码字解码模式; 根据所述码字的 前缀部分判断当前码字是否为特殊短码,若是则根据预置相应的特殊短码解码 公式进行解码, 获得第一参数和第二参数; 若否则在变长码字解码模式下根据 所述前缀选择相应的预置解码公式进行解码, 获得索引值, 根据所述的索引值 获得第一参数和第二参数。 "Decoding according to the type of the current codeword by using a corresponding decoding method" may be: when determining that the current codeword is a variable length codeword, determining that the decoding mode is a variable length codeword decoding mode; according to the prefix portion of the codeword Determining whether the current codeword is a special short code, if yes, decoding according to a preset special short code decoding formula to obtain a first parameter and a second parameter; if otherwise, selecting according to the prefix in the variable length codeword decoding mode The preset decoding formula is decoded to obtain an index value, and the first parameter and the second parameter are obtained according to the index value.
如果当前码字的类型为定长码字, "根据当前码字的类型采用相应的解码 方法进行解码 "可以为: 确定解码模式为定长码字解码模式; 设置索引值数值 等于定长码字数值, 根据所述的索引值查找预置的定长码表, 获取索引值相应 的第一参数与第二参数。  If the type of the current codeword is a fixed length codeword, "decoding according to the type of the current codeword using the corresponding decoding method" may be: determining that the decoding mode is a fixed length codeword decoding mode; setting the index value value equal to the fixed length codeword The value is used to find a preset fixed length code table according to the index value, and obtain a first parameter and a second parameter corresponding to the index value.
参见图 1, 该方法具体为: See Figure 1, the method is specifically:
在本发明实施例中, 设置第一参数为拖尾系数的个数 TrailingOnes, 设置 第二参数为非零系数个数 TotalCoeff;  In the embodiment of the present invention, setting the first parameter to the number of trailing coefficients TrailingOnes, setting the second parameter to the number of non-zero coefficients TotalCoeff;
步骤 101 : 获取第一变量 (NC) ; 若第一变量 (NC)在变长码字参数范围 内, 例如可以是 -1≤NC<8; 则确定解码模式为第一至第四解码模式其中之一; 若第一变量(NC)在定长码字参数范围内, 例如可以是 NC≥8, 则确定当前码 字为定长码字, 执行步骤 106; 该步骤中所述的"获取的第一变量 (Ncy的方法可以为: Step 101: Obtain a first variable (NC); if the first variable (NC) is within a variable length codeword parameter range, for example, may be -1≤NC<8; then determine that the decoding mode is the first to fourth decoding modes. If the first variable (NC) is within the range of the fixed length codeword parameter, for example, NC ≥ 8, then the current codeword is determined to be a fixed length codeword, and step 106 is performed; The first variable obtained in this step (the method of Ncy can be:
( 1 ) 预先计算当前宏块左边 4X4宏块的第一非零系数数目 (NA) 和当 前宏块上面 4X4宏块的第二非零系数数目 (NB) ; 当前宏块与左边、 上面宏 块位置关系图, 参见图 2。  (1) Pre-calculating the first non-zero coefficient number (NA) of the 4X4 macroblock to the left of the current macroblock and the second non-zero coefficient number (NB) of the 4X4 macroblock above the current macroblock; the current macroblock and the left and upper macroblocks Position map, see Figure 2.
当 NA和 NB都有效时, NC=(NA+NB)/2;当 NB有效, NA无效时, NC=NB; 当 NB无效, NA有效时, NC=NA; 表 1 NC与 NA和 NB的相应关系  When both NA and NB are valid, NC=(NA+NB)/2; when NB is valid, NA is invalid, NC=NB; when NB is invalid, NA is valid, NC=NA; Table 1 NC and NA and NB Corresponding relationship
Figure imgf000009_0001
Figure imgf000009_0001
(2)该步骤中所述的"若 -1≤NC<8; 则确定解码模式为第一至第四解码模 式其中之一"可以为:  (2) "If -1 ≤ NC < 8 in the step; then determining that the decoding mode is one of the first to fourth decoding modes" may be:
例如: 若 0≤NC<2, 则选择第一解码模式 (表 2, 第一变长码表 VLC-1 ) 进行解码;  For example: If 0≤NC<2, select the first decoding mode (Table 2, the first variable length code table VLC-1) for decoding;
若 2≤NC<4, 则选择第二解码模式 (表 3, 第二变长码表 VLC-2 ) 进行解 码;  If 2 ≤ NC < 4, the second decoding mode (Table 3, second variable length code table VLC-2) is selected for decoding;
若 5≤NC<8, 则选择第三解码模式 (表 4, 第三变长码表 VLC-3 ) 进行解 码; 若 NC=-1,则选择第四解码模式 (表 5, 第四变长码表 VLC-4) ; If 5≤NC<8, the third decoding mode (Table 4, third variable length code table VLC-3) is selected for decoding; If NC = -1, the fourth decoding mode is selected (Table 5, fourth variable length code table VLC-4);
(3 ) 该步骤中所述当 NC≥8, 则确定当前码字为定长码字进行解码; 步骤 102: 获取二进制比特流, 根据所述的二进制比特流获取码字的前缀 部分;  (3) in the step, when NC≥8, determining that the current codeword is a fixed-length codeword for decoding; Step 102: Acquiring a binary bitstream, and obtaining a prefix portion of the codeword according to the binary bitstream;
例如可以通过首" 1"检测器来获取前缀部分; 步骤 103 : 在步骤 101中确定的第一至第四解码模式下, 根据所述前缀判 断当前码字是否为特殊短码; 若是则执行步骤 104; 若否则执行步骤 105 ; 该步骤可以为:将所述前缀部分的" 0"的个数赋予中间变量 PrefixNum,然 后根据所述的中间变量 PrefixNum 与阈值的关系, 来确定码字是否为特殊短 码。 阈值 S可以根据所述的第一变量 NC来决定, 例如:  For example, the prefix portion may be obtained by using a first "1" detector; Step 103: In the first to fourth decoding modes determined in step 101, determining whether the current codeword is a special short code according to the prefix; if yes, performing the step 104; If otherwise, step 105 is performed; the step may be: assigning the number of "0"s of the prefix part to the intermediate variable PrefixNum, and then determining whether the codeword is special according to the relationship between the intermediate variable PrefixNum and the threshold. Short code. The threshold S can be determined according to the first variable NC, for example:
当 0≤NC<2 时为第一解码模式, 那么此时阈值 S 可以设置为 3, 当 PrefixNum<3时, 则确定当前码字为特殊短码;  When 0≤NC<2, it is the first decoding mode, then the threshold S can be set to 3, and when PrefixNum<3, it is determined that the current codeword is a special short code;
当 2≤NC<4 时为第二解码模式, 那么此时阈值 S 可以设置为 2, 当 PrefixNum<2时, 则确定当前码字为特殊短码;  When 2≤NC<4, it is the second decoding mode, then the threshold S can be set to 2, and when PrefixNum<2, it is determined that the current codeword is a special short code;
当 5≤NC<8 时为第三解码模式, 那么此时阈值 S 可以设置为 1, 当 PrefixNum<l时, 则确定当前码字为特殊短码;  When 5≤NC<8, it is the third decoding mode, then the threshold S can be set to 1, and when PrefixNum<1, it is determined that the current codeword is a special short code;
当 NC=-1 时为第四解码模式, 那么此时阈值 S 可以设置为 3, 当 PrefixNum<3时, 则确定当前码字为特殊短码; 步骤 104: 在步骤 101中确定的第一至第四其中之一解码模式下根据预置 相应的特殊短码解码公式进行解码, 获得第一参数 TrailingOnes 和第二参数 TotalCoeff; When NC=-1 is the fourth decoding mode, then the threshold S can be set to 3, and when the PrefixNum<3, the current codeword is determined to be a special short code; Step 104: The first to the determined in step 101 In one of the fourth decoding modes, decoding is performed according to a preset special short code decoding formula, and the first parameter TrailingOnes and the second parameter are obtained. TotalCoeff;
例如: ( 1 ) 当确定 0≤NC<2时为第一解码模式:  For example: (1) When it is determined that 0≤NC<2, it is the first decoding mode:
TrailingOnes=TotalCoeff=PrefixNum  TrailingOnes=TotalCoeff=PrefixNum
(2 ) 当确定 2≤NC<4时为第二解码模式:  (2) When it is determined that 2≤NC<4, it is the second decoding mode:
第二解码模式下特殊短码时, 根据预置的 SUffixlength=l读取二进制比特 流, 获取 Suffix; When the special short code is in the second decoding mode, the binary bit stream is read according to the preset S U ffixl en gth=l, and Suffix is obtained;
TrailingOnes=TotalCoeff=(Prefix«l)+Suffix;  TrailingOnes=TotalCoeff=(Prefix«l)+Suffix;
(3 ) 当确定 5≤NC<8时为第三解码模式:  (3) When it is determined that 5≤NC<8, it is the third decoding mode:
第三解码模式下特殊短码时, 根据预置的 SUffixlength=3读取二进制比特 流, 获取 Suffix; When the special short code is in the third decoding mode, the binary bit stream is read according to the preset S U ffixl en gth=3, and Suffix is obtained;
TotalCoeff= Suffix  TotalCoeff= Suffix
TrailingOnes=3 (Suffix/4)+(Suffix%4) (l- Suffix/4)  TrailingOnes=3 (Suffix/4)+(Suffix%4) (l-Suffix/4)
或 TrailingOnes= 3xSuffix[2:2]+suffix[l :0] x(〜 Suffix[2:2])  Or TrailingOnes= 3xSuffix[2:2]+suffix[l :0] x(~ Suffix[2:2])
其中, 获得 TrailingOnes的 2个公式实际是相同的, 前一个是简单计算, 后一个是根据位操作;  Among them, the two formulas for obtaining TrailingOnes are actually the same, the former one is simple calculation, and the latter one is based on bit operation;
(4 ) 当确定 NC=-1时为第四解码模式,  (4) When determining NC=-1, it is the fourth decoding mode.
TrailingOnes = TotalCoeff = 2 PrefixNum[l : l] + ( 〜 PrefixNum[0:0]) (- PrefixNum[l : l])  TrailingOnes = TotalCoeff = 2 PrefixNum[l : l] + ( ~ PrefixNum[0:0]) (- PrefixNum[l : l])
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 Prefix 为前缀、 Suffix为后缀, Suffix[2:0]表示第 2位到第 0位的 3比 特二进制数, Suffix[l :0]表示第 1位至第 0位的 2比特二进制数, Suffix[2:2] 表 示第 2位的 1比特二进制数。 PrefixNum [1 :0]表示第 1位到第 0位的 2比特二 进制数, PrefixNum[l : l]表示第 1为的 1比特二进制数, PrefixNum [0:0] 表示 第 0位的 1比特二进制数。 "/"表示除法运算符, "% "表示取余运算符, "~"表 示位取反运算符。 步骤 105; 在步骤 101中确定的第一至第四其中之一解码模式下根据所述 前缀选择相应的预置解码公式进行解码, 获得索引值, 索引值表征了语法元素 (第一参数 TrailingOnes和第二参数 TotalCoeff) 的排列顺序, 根据索引值获 得第一参数 TrailingOnes和第二参数 TotalCoeff。 Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Prefix is the prefix, Suffix is the suffix, Suffix[2:0] represents the 2nd to 0th bit of the 3-bit binary number, Suffix[l: 0] represents a 2-bit binary number from the 1st to the 0th bit, and Suffix[2:2] represents a 1-bit binary number of the 2nd bit. PrefixNum [1 : 0] represents the 2-bit binary number from bit 1 to bit 0, PrefixNum[l : l] represents the 1-bit binary number of the first, and PrefixNum [0:0] represents The 1-bit binary number of the 0th bit. "/" means the division operator, "%" means the remainder operator, and "~" means the bit is the inverse operator. Step 105: Decoding according to the prefix selection corresponding preset decoding formula in the first to fourth decoding modes determined in step 101, obtaining an index value, and the index value characterizing the syntax element (the first parameter TrailingOnes and The second parameter TotalCoeff) is arranged in order to obtain the first parameter TrailingOnes and the second parameter TotalCoeff according to the index value.
该步骤根据确定不同的解码模式、所述前缀选择相应的预置解码公式进行 解码, 获得索引值可以为:  The step of decoding is performed according to determining different decoding modes and selecting a corresponding preset decoding formula by using the prefix, and obtaining an index value may be:
( 1 ) 确定为第一解码模式时, (1) When determining the first decoding mode,
Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix; Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 Read the binary bit stream according to the Suffixlength to obtain Suffix;
((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9
Index = Index =
((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3  ((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3
56 + Suffix 13≤ Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "&&"表示逻辑与运算符、 "? : "表示条件运算符、 "«"表示按 位左移运算;  56 + Suffix 13 ≤ Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, "&&" means the logical AND operator, "? : " means the conditional operator, and "«" means Bit shift operation
(2 ) 当确定为第二解码模式时, (2) When determined to be the second decoding mode,
Suffixlength=(PrefixNum>=7) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix; Suffixlength=(PrefixNum>=7) ? 3 : 2 Read the binary bit stream according to the Suffixlength to obtain Suffix;
Index = ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7  Index = ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7
((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "? : "表示条件运算符" <<"表示按位左移运算。 ((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength For the suffix length, "? : " means that the conditional operator "<<" means a bitwise left shift operation.
(3 )当确定为第三解码模式时,根据预置的 SUffiXlength=3读取二进制比 特流, 获取 Suffix; (3) when determined to be the third decoding mode, read the binary bit stream according to the preset S U ffi X length = 3, to obtain Suffix;
Index= ((PrefixNum-3)«2) + Suffix;  Index= ((PrefixNum-3)«2) + Suffix;
其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
(4)当确定为第四解码模式时,根据预置的 SUffiXlength=2读取二进制比 特流, 获取 Suffix; (4) when determined to be the fourth decoding mode, read the binary bit stream according to the preset S U ffi X length = 2, to obtain Suffix;
Index=(PrefixNum-3)«3) + Suffix  Index=(PrefixNum-3)«3) + Suffix
其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
并且在步骤 105中, 所述的"获得索引值, 根据索引值获得第一参数和第 二参数 "可以为: 获得索引值后, 在确定的第一至第四其中之一解码模式下, 根据所述索引值查找预置的参数表, 获取索引值相应的第一参数与第二参数。 其中在第一解码模式时, 相应的查找预置的参数表为表 2, 第一变长码表 (VLC-1 ) ; 在第二解码模式时, 相应查找预置的参数表为表 3, 第二变长码 表 (VLC-2 ) ; 其中在第三解码模式时, 相应的查找预置的参数表为表 4, 第 三变长码表 (VLC-3 ) ; 在第四解码模式时, 相应查找预置的参数表为表 5, 第四变长码表 (VLC-4) 。 步骤 106: 在步骤 101中确定的当前码字是定长码字; 则设置定长码字长 度为预置长度, 则设置索引值 Index等于定长码字; 根据所述索引值获取第一 参数和第二参数。 定长码字的预置长度为不低于 log2 N的整数, N是语法元素取值的个数; 本例中预置长度可以为 6。 And in step 105, the obtaining the index value, obtaining the first parameter and the second parameter according to the index value may be: after obtaining the index value, in determining one of the first to fourth decoding modes, according to The index value searches for a preset parameter table, and obtains a first parameter and a second parameter corresponding to the index value. In the first decoding mode, the corresponding parameter table of the search preset is Table 2, the first variable length code table (VLC-1); in the second decoding mode, the parameter table of the corresponding search preset is Table 3. The second variable length code table (VLC-2); wherein in the third decoding mode, the corresponding parameter table of the search preset is Table 4, the third variable length code table (VLC-3); in the fourth decoding mode The corresponding parameter table for finding the preset is Table 5, the fourth variable length code table (VLC-4). Step 106: The current codeword determined in step 101 is a fixed length codeword; if the fixed length codeword length is a preset length, the index value Index is set to be equal to the fixed length codeword; and the first parameter is obtained according to the index value. And the second parameter. The preset length of the fixed length codeword is an integer not less than log 2 N, and N is the number of values of the syntax element; in this example, the preset length may be 6.
该步骤可以为: 当确定当前码字为定长码字时, 设置索引值等于定长码字 后, 根据所述索引值查找预置的定长码表, 获取索引值相应的第一参数与第二 参数。 下面从具体码字的角度来进行描述:  The step may be: when determining that the current codeword is a fixed length codeword, after setting the index value equal to the fixed length codeword, searching for the preset fixed length code table according to the index value, and obtaining the first parameter corresponding to the index value and The second parameter. The following describes from the perspective of a specific codeword:
( 1 ) 第一解码模式的非特殊短码情况:  (1) Non-special short code case of the first decoding mode:
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=1, 那么根据步骤 101中确定解码模式中"若 0≤NC<2, 则选择第一解码模式(VLC-1码表)进行 解码", 可以确定当前解码模式为第一解码模式;  According to the method of step 101, according to the macroblock situation, the current NC=1 is obtained, then according to the determination in step 101, if "0≤NC<2, the first decoding mode (VLC-1 code table) is selected for decoding. ", can determine that the current decoding mode is the first decoding mode;
根据步骤 102的方法, 获取一个二进制比特流 OOOO Ol lOxxxxx,那么前缀 部分为 0000 01 ;  Obtain a binary bit stream OOOO Ol lOxxxxx according to the method of step 102, then the prefix part is 0000 01;
根据步骤 103 的方法, 由于前缀部分为 0000 01, 那么得到中间变量 PrefixNum=5 ; 由于是在第一解码模式下, 阈值 S=3, 那么 PrefixNum=5>3, 因此该码字不是特殊短码;  According to the method of step 103, since the prefix part is 0000 01, the intermediate variable PrefixNum=5 is obtained; since it is in the first decoding mode, the threshold S=3, then PrefixNum=5>3, so the codeword is not a special short code. ;
根据步骤 105的方法, 由于确定是第一解码模式;  According to the method of step 105, since it is determined to be the first decoding mode;
那么根据预置的公式: Suffixlength=(PrefixNum>=9 && PrefixNum<13)? 3: 2 =(5>=9 && 5<13)? 3: 2=2  Then according to the preset formula: Suffixlength=(PrefixNum>=9 && PrefixNum<13)? 3: 2 =(5>=9 && 5<13)? 3: 2=2
PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "&&" 表示"与"、 " (判断条件) ? a: b"表示: 当判断条件成立时, 则取 a, 当判断 条件不成立时则取 b。  PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, "&&" means "and", "(judgment condition) ? a: b" means: when the judgment condition is established, then a, when the judgment condition is not true Take b.
根据所述的 Suffixlength=2读取二进制比特流 0000 01 ΙΟχχχχχ,获取 Suffix 为" 10"; Obtain Suffix according to the Suffixlength=2 read binary bit stream 0000 01 ΙΟχχχχχ Is "10";
((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9
Index = Index =
((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3  ((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3
56 + Suffix 13≤ Pr efixNum 由于 PrefixNum=5, 那么根据公式 ((PrefixNum-3)«2) + Suffix进行计算, 获 取 索 引 值 Index , 那 么 最 后 得 到 Index=(PrefixNumb-3)«2+Suffix)=((5-3)«2)+2=10。  56 + Suffix 13 ≤ Pr efixNum Since PrefixNum=5, then calculate according to the formula ((PrefixNum-3)«2) + Suffix, get the index value Index, then finally get Index=(PrefixNumb-3)«2+Suffix)= ((5-3)«2)+2=10.
然后根据 Index=10, 至第一变长码表 (VLC-1 ) 查表获取第一参数 TrailingOnes和第二参数 TotalCoeff; 那么通过表 1-第一变长码表 VLC-1以及 索引值 10可以查找到 TrailingOnes为 0、 TotalCoeff为 3。  Then according to Index=10, to the first variable length code table (VLC-1) lookup table to obtain the first parameter TrailingOnes and the second parameter TotalCoeff; then through the table 1 - the first variable length code table VLC-1 and the index value 10 can Find TrailingOnes as 0 and TotalCoeff as 3.
表 2 第一变长码表 VLC-1  Table 2 The first variable length code table VLC-1
Figure imgf000015_0001
Figure imgf000016_0001
Figure imgf000015_0001
Figure imgf000016_0001
(2 ) 第一解码模式的特殊短码情况: (2) The special short code case of the first decoding mode:
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=1, 那么根据步骤 101中确定解码模式中"若 0≤NC<2, 则选择第一解码模式(VLC-1码表)进行 解码", 可以确定当前解码模式为第一解码模式;  According to the method of step 101, according to the macroblock situation, the current NC=1 is obtained, then according to the determination in step 101, if "0≤NC<2, the first decoding mode (VLC-1 code table) is selected for decoding. ", can determine that the current decoding mode is the first decoding mode;
根据步骤 102的方法, 获取一个二进制比特流 OOlOllOxxxxx, 那么前缀 部分为 0010110;  According to the method of step 102, a binary bit stream OOlOllOxxxxx is obtained, and the prefix part is 0010110;
根据步骤 103 的方法, 由于前缀部分为 0000 01, 那么得到中间变量 PrefixNum=2; 由于是在第一解码模式下, 阈值 S=3, 那么 PrefixNum=2<3, 因此该码字是特殊短码; According to the method of step 103, since the prefix part is 0000 01, the intermediate variable is obtained. PrefixNum=2; Since it is in the first decoding mode, the threshold S=3, then PrefixNum=2<3, so the codeword is a special short code;
根据步骤 104中的方法, 根据 TrailingOnes=TotalCoeff=PrefixNum; 可以得知 TrailingOnes=TotalCoeff=2。 According to the method in step 104, TrailingOnes=TotalCoeff=2 can be known according to TrailingOnes=TotalCoeff=PrefixNum ;
(3 ) 第二解码模式的非特殊短码情况; (3) a non-special short code condition of the second decoding mode;
根据步骤 102的方法, 获取一个二进制比特流 OOOO Ol lOlxxxx,那么前缀 部分为 0000 01 ; 根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=3, 那么根据步骤 10x 中确定解码模式中"若 2≤NC<4, 则选择第二解码模式 (第二变长码表 VLC-2码表) 进行解码", 可以确定当前解码模式为第二解码模式;  According to the method of step 102, a binary bit stream OOOO Ol lOlxxxx is obtained, then the prefix part is 0000 01; according to the method of step 101, according to the macro block situation, the current NC=3 is obtained, then according to the decoding mode determined in step 10x" If 2≤NC<4, selecting the second decoding mode (the second variable length code table VLC-2 code table) for decoding", it may be determined that the current decoding mode is the second decoding mode;
根据步骤 103 的方法, 由于前缀部分为 0000 01, 那么得到中间变量 PrefixNum=5 ; 由于是在第二解码模式下, 阈值 S=2, 那么 PrefixNum=5>2, 因此该码字不是特殊短码;  According to the method of step 103, since the prefix part is 0000 01, the intermediate variable PrefixNum=5 is obtained; since it is in the second decoding mode, the threshold S=2, then PrefixNum=5>2, so the codeword is not a special short code. ;
根据步骤 105的方法, 由于确定是第二解码模式;  According to the method of step 105, since it is determined to be the second decoding mode;
那么根据预置的公式: Suffixlength=(PrefixNum>=7) ? 3 : 2 =(5>=7 )? 3 : 2  Then according to the preset formula: Suffixlength=(PrefixNum>=7) ? 3 : 2 =(5>=7 )? 3 : 2
PrefixNum为中间变量、 Suffix为后缀, Suffixlength为后缀长度, "? : " 表示条件运算符。 PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, and "? : " is the conditional operator.
根据所述的 Suffixlength=3读取二进制比特流 0000 01 ΙΟΙχχχχ,获取 Suffix 为 "101";  Reading the binary bit stream 0000 01 根据 according to the Suffixlength=3, and obtaining Suffix as "101";
Index = <! ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7  Index = <! ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7
((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum 由于 PrefixNum=5, 那么根据公式((PrefixNum-3)«2) + Suffix进行计算, 获 取 索 引 值 Index , 那 么 最 后 得 到 Index=(PrefixNumb-2)«2+Suffix)=((5-2)«2)+5 = 17 ((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum Since PrefixNum=5, then according to the formula ((PrefixNum-3)«2) + Suffix calculation, get the index value Index, then finally get Index=(PrefixNumb-2)«2+Suffix)=((5-2)« 2) +5 = 17
然后根据 Index=17, 至第二变长码表 (VLC-2 ) 查表获取第一参数 TrailingOnes和第二参数 TotalCoeff; 那么通过表 2-第二变长码表 VLC-2以及 索引值 14可以查找到 TrailingOnes为 2、 TotalCoeff为 6。  Then according to Index=17, to the second variable length code table (VLC-2) lookup table to obtain the first parameter TrailingOnes and the second parameter TotalCoeff; then through Table 2 - the second variable length code table VLC-2 and the index value 14 can Find TrailingOnes as 2. TotalCoeff is 6.
表 3 第二变长码表 VLC-2  Table 3 Second variable length code table VLC-2
Figure imgf000018_0001
Figure imgf000019_0001
Figure imgf000018_0001
Figure imgf000019_0001
(4) 第二解码模式的特殊短码情况: (4) Special short code case for the second decoding mode:
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=3, 那么根据步骤 101中确定解码模式中"若 2≤NC<4, 则选择第二解码模式(VLC-2码表)进行 解码", 可以确定当前解码模式为第二解码模式;  According to the method of step 101, according to the macroblock situation, the current NC=3 is obtained, then according to the determination in step 101, if "2≤NC<4, the second decoding mode (VLC-2 code table) is selected for decoding. ", can determine that the current decoding mode is the second decoding mode;
根据步骤 102的方法, 获取一个二进制比特流 011011 lxxx, 那么前缀部 分为 01 ;  According to the method of step 102, a binary bit stream 011011 lxxx is obtained, and the prefix part is 01;
根据步骤 103 的方法, 由于前缀部分为 01, 那么得到中间变量 PrefixNum=l ; 由于是在第二解码模式下, 阈值 S=2, 那么 PrefixNum=l<2, 因此该码字是特殊短码; According to the method of step 103, since the prefix part is 01, the intermediate variable PrefixNum=l is obtained ; since it is in the second decoding mode, the threshold S=2, then PrefixNum=l<2, so the codeword is a special short code;
根据步骤 104中的方法, 根据: 根据预置的 SUffiXlength=l读取二进制比 TrailingOnes=TotalCoeff=(Prefix«l)+Suffix= (1«1) +1=2+1=3; According to the method in step 104, according to: reading the binary ratio according to the preset S U ffi X length=l TrailingOnes=TotalCoeff=(Prefix«l)+Suffix= (1«1) +1=2+1=3;
(5) 第三解码模式的非特殊短码情况:  (5) Non-special short code case of the third decoding mode:
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=6, 那么根据步骤 101中确定解码模式中"若 5≤NC<8, 则选择第三解码模式(VLC-1码表)进行 解码", 可以确定当前解码模式为第三解码模式;  According to the method of step 101, according to the macroblock situation, the current NC=6 is obtained, then according to the determination in step 101, if "5≤NC<8, the third decoding mode (VLC-1 code table) is selected for decoding. ", can determine that the current decoding mode is the third decoding mode;
根据步骤 102的方法, 获取一个二进制比特流 0000 OllOlxxxx,那么前缀 部分为 000001;  According to the method of step 102, a binary bit stream 0000 OllOlxxxx is obtained, and the prefix part is 000001;
根据步骤 103 的方法, 由于前缀部分为 0000 01, 那么得到中间变量 PrefixNum=5; 由于是在第三解码模式下, 阈值 S=l, 那么 PrefixNum=5>l, 因此该码字不是特殊短码;  According to the method of step 103, since the prefix part is 0000 01, the intermediate variable PrefixNum=5 is obtained; since it is in the third decoding mode, the threshold S=l, then PrefixNum=5>l, so the codeword is not a special short code. ;
根据步骤 105的方法, 由于确定是第三解码模式;  According to the method of step 105, since it is determined to be the third decoding mode;
那么根据预置的公式:  Then according to the preset formula:
Index=((PrefixNum-3 )«2)十 Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Index=((PrefixNum-3)«2) Ten Suffix where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
其中, 在第三解码模式下, 由于码字后缀长度预置为 3, 那么可以根据二 进制比特流 0000 OllOlxxxx获取后缀为 "101"; 因此 Index= ( (5-3) «2) +5 = 8+5=13;  Wherein, in the third decoding mode, since the codeword suffix length is preset to 3, the suffix "101" can be obtained according to the binary bit stream 0000 OllOlxxxx; therefore Index=((5-3) «2) +5 = 8 +5=13;
那么通过 Index=13查找第三变长码表(VCL-3 )可以获得 TrailingOnes = 1、 TotalCoeff=7  Then find the third variable length code table (VCL-3) by Index=13 to get TrailingOnes = 1, TotalCoeff=7
表 4 变长码表 3 (VLC-3)
Figure imgf000021_0001
Figure imgf000022_0001
Table 4 Variable Length Code Table 3 (VLC-3)
Figure imgf000021_0001
Figure imgf000022_0001
( 6) 第三解码模式的特殊短码情况: (6) Special short code case for the third decoding mode:
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=6, 那么根据步骤 101 中确定解码模式中"若 5≤NC<8, 则选择第三解码模式进行解码", 可以确 定当前解码模式为第三解码模式;  According to the method of step 101, according to the macroblock situation, the current NC=6 is obtained, then according to the determination in step 101, if "5≤NC<8, then the third decoding mode is selected for decoding", the current decoding mode can be determined. Is the third decoding mode;
根据步骤 102的方法, 获取一个二进制比特 10011 lxxx, 那么前缀部分为 According to the method of step 102, a binary bit 10011 lxxx is obtained, then the prefix part is
10; 10;
根据步骤 103的方法,由于前缀部分为 1,那么得到中间变量 PrefixNum=0; 由于是在第三解码模式下, 阈值 S=l, 因此该码字是特殊短码;  According to the method of step 103, since the prefix portion is 1, the intermediate variable PrefixNum=0 is obtained; since it is in the third decoding mode, the threshold S=l, the codeword is a special short code;
根据步骤 104中的方法, 根据预置的 Suffixlength=3读取二进制比特流, 获取 Suffix=001 ;  According to the method in step 104, the binary bit stream is read according to the preset Suffixlength=3, and Suffix=001 is obtained;
TotalCoeff= Suffix  TotalCoeff= Suffix
TrailingOnes=3 (Suffix/4)+(Suffix%4) (l- Suffix/4)  TrailingOnes=3 (Suffix/4)+(Suffix%4) (l-Suffix/4)
或 TrailingOnes= 3xSuffix[2:2]+suffix[l :0] x(〜 Suffix[2:2])  Or TrailingOnes= 3xSuffix[2:2]+suffix[l :0] x(~ Suffix[2:2])
其中, 在第三解码模式下, 由于码字后缀长度预置为 3, 那么可以根据二 进制比特流 10011 lxxx获取后缀为" 001";  In the third decoding mode, since the codeword suffix length is preset to 3, the suffix "001" can be obtained according to the binary bit stream 10011 lxxx;
其中, 获得 TrailingOnes的 2个公式实际是相同的, 前一个是简单计算, 后一个是根据位操作;  Among them, the two formulas for obtaining TrailingOnes are actually the same, the former one is simple calculation, and the latter one is based on bit operation;
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 Prefix 为前缀、 Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, Prefix is the prefix,
Suffix后缀; Suffix[2:0]表示第 3位到第 0位的 3比特二进制数, Suffix[l :0] 表示第 2为至第 0位的 3比特二进制数, Suffix[2:2] 表示第 2位的 1比特二进 制数。 "/"表示除法运算符, "% "表示取余运算符, " ~"表示位取反运算符; 那 么 通 过 : TrailingOnes=3xSuffix[3:3]+suffix[2:0] x(〜 Suffix[3:3])=3x0+l x(~ 0)=0+1 1 = 1。 Suffix suffix; Suffix[2:0] represents the 3-bit binary number from bit 3 to bit 0, Suffix[l:0] A 3-bit binary number indicating the 2nd to the 0th bit, and Suffix[2:2] indicating the 1-bit binary number of the 2nd bit. "/" means the division operator, "%" means the remainder operator, "~" means the bit is the inverse operator; then by: TrailingOnes=3xSuffix[3:3]+suffix[2:0] x(~ Suffix[ 3:3])=3x0+lx(~ 0)=0+1 1 = 1.
(7) 第四解码模式的非特殊短码情况: (7) Non-special short code case of the fourth decoding mode:
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=-1, 那么根据步骤 101中确定解码模式中" NC=-1,则选择第四解码模式( VLC-4码表)进行解码", 可以确定当前解码模式为第四解码模式;  According to the method of step 101, according to the macroblock situation, the current NC=-1 is obtained, then according to the determination in step 101, "NC=-1, then select the fourth decoding mode (VLC-4 code table) for decoding" , determining that the current decoding mode is the fourth decoding mode;
根据步骤 102的方法, 获取一个二进制比特流 OOOO OlOOlxxxx,那么前缀 部分为 0000 01 ;  According to the method of step 102, a binary bit stream OOOO OlOOlxxxx is obtained, and the prefix part is 0000 01;
根据步骤 103 的方法, 由于前缀部分为 0000 01, 那么得到中间变量 PrefixNum=5 ; 由于是在第四解码模式下, 阈值 S=3, 那么 PrefixNum=5>3, 因此该码字不是特殊短码;  According to the method of step 103, since the prefix part is 0000 01, the intermediate variable PrefixNum=5 is obtained; since it is in the fourth decoding mode, the threshold S=3, then PrefixNum=5>3, so the codeword is not a special short code. ;
根据步骤 105的方法, 由于确定是第四解码模式;  According to the method of step 105, since it is determined to be the fourth decoding mode;
那么根据预置的公式:  Then according to the preset formula:
Index=((PrexfixNum-3 )«2)十 Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Index=((PrexfixNum-3)«2) Ten Suffix where Index is the index value, PrefixNum is the intermediate variable, and Suffix is the suffix. "" indicates a bitwise left shift operation.
其中, 在第三解码模式下, 由于码字后缀长度预置为 3, 那么可以根据二 进制比特流 OOOO OlOOlxxxx获取后缀为" 001"; 因此 Index= ( ( 5-3 ) «2 ) +1 = 9; 那么通过 Index=9;查找第四变长码表(VCL-4)可以获得 TrailingOnes=2、 TotalCoeff=4o 表 5 变长码表 4 (VLC-4) Wherein, in the third decoding mode, since the codeword suffix length is preset to 3, the suffix is "001" according to the binary bit stream OOOOOOOOxxxx; therefore Index=((5-3) «2) +1 = 9 ; Then, by Index=9; find the fourth variable length code table (VCL-4), you can get TrailingOnes=2, TotalCoeff=4o, Table 5, Variable Length Code Table 4 (VLC-4)
Figure imgf000024_0001
Figure imgf000024_0001
(8) 第四解码模式的特殊短码情况: 根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=-1, 那么根据步骤 101 中确定解码模式中" NC=-1, 则选择第四解码模式进行解码", 可以确定当 前解码模式为第四解码模式; 根据步骤 102的方法, 获取一个二进制比特 10011 lxxx, 那么前缀部分为 (8) Special short code case of the fourth decoding mode: According to the method of step 101, according to the macroblock situation, the current NC=-1 is obtained, then according to the determination in step 101, "NC=-1, then select the first The fourth decoding mode is decoded. "The current decoding mode can be determined to be the fourth decoding mode. According to the method of step 102, a binary bit 10011 lxxx is obtained, and the prefix portion is
10; 根据步骤 103的方法,由于前缀部分为 1,那么得到中间变量 PrefixNum=0; 由于是在第四解码模式下, 阈值 S=3, 因此该码字是特殊短码。 那么根据公式 10; According to the method of step 103, since the prefix portion is 1, the intermediate variable PrefixNum = 0 is obtained; since it is in the fourth decoding mode, the threshold S = 3, the code word is a special short code. Then according to the formula
TrailingOnes=TotalCoefF= 2xPrefixNum[l:l]+(〜 PrefixNum[0:0])x(〜 PrefixNum[l:l]) = 2x0+0x1=0  TrailingOnes=TotalCoefF= 2xPrefixNum[l:l]+(~ PrefixNum[0:0])x(~ PrefixNum[l:l]) = 2x0+0x1=0
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中 间变量、 PrefixNum [1:0]表示第 1位到第 0位的 2比特二进制数, Suffix[l:l] 表示第 1为的 1比特二进制数, Suffix[0:0] 表示第 0位的 1比特二进制数。" ~" 表示位取反运算符。 Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, PrefixNum [1:0] represents the 1-bit binary number from the 1st to the 0th, Suffix[l:l] Indicates the 1-bit binary number of the first, and Suffix[0:0] represents the 1-bit binary number of the 0th bit. "~" indicates that the bit is inverted.
(9 ) 定长码字情况  (9) Fixed length codewords
根据步骤 101的方法, 根据宏块情况, 获取到当前 NC=9, 那么根据步骤 101 中确定解码模式中"若第一变量 (NC) 在定长码字参数范围内 NC≥8, 则 确定当前码字为定长码字"; 因此可以确定当前码字为定长码字;  According to the method of step 101, according to the macroblock situation, the current NC=9 is obtained, then according to the determination in step 101, if the first variable (NC) is within the fixed length codeword parameter range, NC≥8, the current current is determined. The codeword is a fixed length codeword"; therefore, it can be determined that the current codeword is a fixed length codeword;
那么根据步骤 106的方法, 获取一个二进制比特 10011 lxxx, 本例中的由 于定长码字长度为 6,设置索引值 Index=定长码字 =100111=39,根据 Index=39 至表五-定长码表获取 TrailingOnes=0; TotalCoeff=12。  Then, according to the method of step 106, a binary bit 10011 lxxx is obtained. In this example, since the fixed length codeword length is 6, the index value Index=fixed length codeword=100111=39 is set, according to Index=39 to Table V- The long code table gets TrailingOnes=0; TotalCoeff=12.
Figure imgf000025_0001
Figure imgf000026_0001
在本发明实施例提供的表 1至表 4中, 为了说明方便, 能够索引值直接在 表中快速找到 TrailingOnes和 TotalCoeff分别列出了 TrailingOnes、 TotalCoeff 和 Index, 实际在系统中, 表 1至表 4只有 TrailingOnes和 TotalCoeff两项。 实施例 2, 相应于实施例 1的熵解码方法, 本发明实施例还提供一种熵解 码装置, 参见图 3, 该装置包括: 获取单元、 码字类型确定单元、 解码单元; 所述获取单元, 用于根据二进制比特流获取第一变量;
Figure imgf000025_0001
Figure imgf000026_0001
In Tables 1 to 4 provided by the embodiments of the present invention, for the convenience of description, the index values can be quickly found in the table. TrailingOnes and TotalCoeff respectively list TrailingOnes, TotalCoeff and Index, which are actually in the system, Tables 1 to 4 Only TrailingOnes and TotalCoeff are two. Embodiment 2, corresponding to the entropy decoding method of Embodiment 1, the embodiment of the present invention further provides an entropy decoding apparatus. Referring to FIG. 3, the apparatus includes: an acquiring unit, a codeword type determining unit, and a decoding unit; The obtaining unit is configured to acquire a first variable according to a binary bit stream;
码字类型确定单元, 用于根据第一变量的范围确定当前码字的类型; 解码单元, 用于根据当前码字的类型采用相应的解码方法进行解码。  And a codeword type determining unit, configured to determine a type of the current codeword according to a range of the first variable; and a decoding unit, configured to perform decoding according to a type of the current codeword by using a corresponding decoding method.
其中, 所述的获取单元包括:  The obtaining unit includes:
比特流获取单元, 用于获取二进制比特流;  a bitstream acquisition unit, configured to acquire a binary bitstream;
第一变量获取单元, 用于获取第一变量。 其中, 所述的第一变量获取单元: 用于获取第一变量具体为:  The first variable acquisition unit is configured to acquire the first variable. The first variable acquiring unit is configured to: obtain the first variable specifically:
用于预先计算当前宏块左边 4X4块的第一非零系数数目和当前宏块上面 For pre-calculating the number of first non-zero coefficients of the 4X4 block to the left of the current macroblock and the current macroblock
4X4块的第二非零系数数目; The number of second non-zero coefficients of the 4X4 block;
当第一非零系数数目和第二非零系数数目都有效时,第一变量 第一非零 系数数目 +第二非零系数数目、11  When both the first non-zero coefficient number and the second non-zero coefficient number are valid, the first variable first non-zero coefficient number + second non-zero coefficient number, 11
当第二非零系数数目有效, 第一非零系数数目无效时, 第一变量=第二非 零系数数目;  When the number of second non-zero coefficients is valid, and the number of first non-zero coefficients is invalid, the first variable = the number of second non-zero coefficients;
当第二非零系数数目无效, 第一非零系数数目有效时, 第一变量=第一非 零系数数目。  When the number of second non-zero coefficients is invalid and the number of first non-zero coefficients is valid, the first variable = the number of first non-zero coefficients.
其中,所述的获取单元进一步包括前缀获取单元,用于根据所述的二进制 比特流, 获取当前码字的前缀部分;  The obtaining unit further includes a prefix obtaining unit, configured to obtain a prefix portion of the current codeword according to the binary bit stream;
所述码字类型确定单元,进一步用于根据第一变量的范围确定当前码字的 类型为变长码字; 所述解码单元包括:解码模式确定单元、判断单元以及特殊短码解码单元; 解码模式确定单元,用于当确定所述当前码字为变长码字时, 则确定解码 模式为变长码字解码模式;  The codeword type determining unit is further configured to determine, according to a range of the first variable, that the type of the current codeword is a variable length codeword; the decoding unit includes: a decoding mode determining unit, a determining unit, and a special short code decoding unit; a mode determining unit, configured to: when determining that the current codeword is a variable length codeword, determine that the decoding mode is a variable length codeword decoding mode;
判断单元,用于当确定解码模式为变长码字解码模式时, 根据所述码字的 前缀部分判断当前码字是否为特殊短码;  a determining unit, configured to determine, according to a prefix portion of the codeword, whether the current codeword is a special short code when determining that the decoding mode is a variable length codeword decoding mode;
特殊短码解码单元,用于当确定当前码字为特殊短码时, 根据预置相应的 特殊短码解码公式进行解码, 获得第一参数和第二参数。 a special short code decoding unit, configured to determine a current codeword as a special short code according to a preset The special short code decoding formula is decoded to obtain the first parameter and the second parameter.
其中,所述的码字类型确定单元,用于根据第一变量的范围确定当前码字 的类型为变长码字具体为: 当 -1≤第一变量<8时确定为当前码字的类型为变长 码字;  The codeword type determining unit is configured to determine, according to the range of the first variable, that the type of the current codeword is a variable length codeword, which is specifically: when -1 ≤ the first variable <8, the type of the current codeword is determined. Variable length code word;
所述的解码模式确定单元结构图请参见图 4, 该单元包括: 第一解码模式 确定单元、第二解码模式确定单元、第三解码模式确定单元、第四解码模式确 定单元;  The structure of the decoding mode determining unit is shown in FIG. 4. The unit includes: a first decoding mode determining unit, a second decoding mode determining unit, a third decoding mode determining unit, and a fourth decoding mode determining unit;
第一解码模式确定单元, 用于判断若 0≤第一变量<2, 则确定为第一解码 模式进行解码;  a first decoding mode determining unit, configured to determine that if 0≤the first variable<2, determine to decode the first decoding mode;
第二解码模式确定单元, 用于判断若 2≤第一变量<4, 则确定为第二解码 模式进行解码;  a second decoding mode determining unit, configured to determine that if the second variable <4, the second decoding mode is determined to be decoded;
第三解码模式确定单元, 用于判断若 5≤第一变量<8, 则确定为第三解码 模式进行解码; 第四解码模式确定单元, 用于判断若第一变量 =-1,则确定为第四解码模式 进行解码。  a third decoding mode determining unit, configured to determine that if the third variable <8, the third decoding mode is determined to be decoded; and the fourth decoding mode determining unit is configured to determine that if the first variable is -1, the determining is The fourth decoding mode is decoded.
其中,所述的解码模式确定单元当确定第一至第四其中之一解码模式进行 解码时,  Wherein the decoding mode determining unit determines that one of the first to fourth decoding modes is to be decoded,
所述的判断单元,用于当确定解码模式为变长码字解码模式时, 根据所述 前缀判断当前码字是否为特殊短码具体为:  The determining unit is configured to determine, according to the prefix, whether the current codeword is a special short code according to the prefix when determining that the decoding mode is a variable length codeword decoding mode:
将所述前缀部分的" 0"的个数赋予中间变量, 在所述第一至第四其中之一 的解码模式下, 若所述的中间变量小于阈值, 则确定当前码字为特殊短码; 若 中间变量大于或等于阈值, 则确定当前码字为非特殊短码;  And assigning the number of “0”s of the prefix part to an intermediate variable, and in the decoding mode of one of the first to fourth, if the intermediate variable is smaller than a threshold, determining that the current codeword is a special short code If the intermediate variable is greater than or equal to the threshold, determining that the current codeword is a non-special short code;
参见图 5, 所述的特殊短码解码单元的结构具体为:  Referring to FIG. 5, the structure of the special short code decoding unit is specifically as follows:
所述的特殊短码解码单元包括第一特殊短码解码单元; 所述第一特殊短码解码单元, 用于当确定为第一解码模式时,The special short code decoding unit includes a first special short code decoding unit; The first special short code decoding unit is configured to, when determining to be the first decoding mode,
TrailingOnes=TotalCoeff=PrefixNum; TrailingOnes=TotalCoeff=PrefixNum;
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间  Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, and PrefixNum is the middle.
其中, 所述的特殊短码解码单元进一步包括第二特殊短码解码单元; 所述第二特殊短码解码单元, 用于根据预置的 SUffiXlength=l读取二进制 比特流, 获取 Suffix; The special short code decoding unit further includes a second special short code decoding unit, and the second special short code decoding unit is configured to read the binary bit stream according to the preset S U ffi X length=l, and obtain Suffix;
TrailingOnes=TotalCoeff=(Prefix« 1 )+Suffix;  TrailingOnes=TotalCoeff=(Prefix« 1 )+Suffix;
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 Suffix为后缀、 Prefix 为前缀、 Suffixlength为后缀长度、 "《"表示按位 左移运算;  Among them, TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Suffix is the suffix, Prefix is the prefix, Suffixlength is the suffix length, and "" indicates the bitwise left shift operation;
其中, 所述的特殊短码解码单元进一步包括第三特殊短码解码单元; 所述的第三特殊短码解码单元,用于当确定为第三解码模式时, 根据预置 的 Suffixlength=3读取二进制比特流, 获取 Suffix;  The special short code decoding unit further includes a third special short code decoding unit, and the third special short code decoding unit is configured to: when determined to be the third decoding mode, read according to a preset Suffixlength=3 Take a binary bit stream, get Suffix;
TotalCoeff= Suffix; Trailing0nes=3 (Suffix/4)+(Suffix%4) ( 1 - Suffix/4) 或 TrailingOnes= 3 Suffix[2:2]+suffix[l :0] x(〜 Suffix[2:2]); 其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 Prefix 为前缀、 Suffix为后缀, Suffix[2:0]表示第 2位到第 0位的 3比 特二进制数, Suffix[l :0]表示第 1位至第 0位的 2比特二进制数, Suffix[2:2] 表 示第 2位的 1比特二进制数。 "/"表示除法运算符, "% "表示取余运算符, "~" 表 示位取反运算符。 TotalCoeff= Suffix; Trailing0nes=3 (Suffix/4)+(Suffix%4) (1 - Suffix/4) or TrailingOnes= 3 Suffix[2:2]+suffix[l:0] x(~ Suffix[2:2 ]); where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Prefix is the prefix, Suffix is the suffix, Suffix[2:0] represents the 2nd to 0th bit of the 3-bit binary number, Suffix [l:0] represents a 2-bit binary number from the 1st to the 0th bit, and Suffix[2:2] represents a 1-bit binary number of the 2nd bit. "/" means the division operator, "%" means the remainder operator, and "~" means the bit negation operator.
其中, 所述的特殊短码解码单元进一步包括第四特殊短码解码单元; 所述的第四特殊短码解码单元, 用于当确定为第四解码模式时, TrailingOnes = TotalCoeff = 2xPrefixNum[l : l] + ( 〜 PrefixNum[0:0]) (- PrefixNum[l : l]) The special short code decoding unit further includes a fourth special short code decoding unit, and the fourth special short code decoding unit is configured to: when determined to be the fourth decoding mode, TrailingOnes = TotalCoeff = 2xPrefixNum[l: l] + ( ~ PrefixNum[0:0]) (- PrefixNum[l : l])
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 PrefixNum [1 :0]表示第 1位到第 0位的 2比特二进制数, PrefixNum[l : l] 表示第 1为的 1比特二进制数, PrefixNum [0:0] 表示第 0位的 1比特二进制 数," ~"表示位取反运算符。  Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, PrefixNum [1:0] represents the 1-bit binary number from the 1st to the 0th, and PrefixNum[l:l] represents the 1st. Bit binary number, PrefixNum [0:0] represents the 1-bit binary number of the 0th bit, and "~" means the bit is inverted.
其中, 所述的解码单元进一步包括: 非特殊短码解码单元, 用于当根据所 述码字的前缀部分判断当前码字不是特殊短码时,则在变长码字解码模式下根 据所述码字的前缀部分选择相应的预置解码公式进行解码, 获得索引值, 根据 所述的索引值获得第一参数和第二参数。 其中, 所述的非特殊短码解码单元结构参见图 6, 包括: 第一解码单元; 用于 Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix;  The decoding unit further includes: a non-special short code decoding unit, configured to: when determining, according to the prefix portion of the codeword, that the current codeword is not a special short code, according to the variable length codeword decoding mode, The prefix part of the codeword is selected to be decoded by the corresponding preset decoding formula to obtain an index value, and the first parameter and the second parameter are obtained according to the index value. The structure of the non-special short code decoding unit is as shown in FIG. 6, including: a first decoding unit; for Suffixlength=(PrefixNum>=9 && PrefixNum<13)? 3: 2 reading binary bits according to the Suffixlength Stream, get Suffix;
((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9
Index = Index =
((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3  ((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3
56 + Suffix 13≤ Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "&&"表示逻辑与运算符、 "? : "表示条件运算符、 "«"表示按 位左移运算。  56 + Suffix 13 ≤ Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, "&&" means the logical AND operator, "? : " means the conditional operator, and "«" means Bit left shift operation.
其中,所述的非特殊短码解码单元进一步包括第二解码单元;用于当确定 为第二解码模式时,  The non-special short code decoding unit further includes a second decoding unit; when used to determine the second decoding mode,
Suffixlength=(PrefixNum>=7) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix;  Suffixlength=(PrefixNum>=7) ? 3 : 2 Read the binary bit stream according to the Suffixlength to obtain Suffix;
Index = ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7  Index = ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7
((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "? : "表示条件运算符, "<<"表示按位左移运算。 其中,所述的非特殊短码解码单元进一步包括第三解码单元,用于根据预 置的 Suffixlength=3读取二进制比特流, 获取 Suffix; ((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength For the suffix length, "? : " indicates the conditional operator, and "<<" indicates a bitwise left shift operation. The non-special short code decoding unit further includes a third decoding unit, configured to read the binary bit stream according to the preset Suffixlength=3, and obtain Suffix;
Index=(PrefixNum-3)«2) + Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Index=(PrefixNum-3)«2) + Suffix where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
其中,所述的非特殊短码解码单元进一步包括第四解码单元,用于当确定 为第四解码模式时,根据预置的 SUffiXlength=2读取二进制比特流,获取 Suffix; The non-special short code decoding unit further includes a fourth decoding unit, configured to read the binary bit stream according to the preset S U ffi X length=2 when the fourth decoding mode is determined, to obtain Suffix;
Index=(PrefixNum-3)«3) + Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。 在上述的熵解码装置中, 非特殊短码解码单元中所述的"获得索引值, 根 据索引值获得第一参数和第二参数 "具体为: 获得索引值后,在确定的变长解码模式下, 根据所述索引值查找预置的参 数表, 获取索引值相应的第一参数与第二参数。 其中,所述的解码模式确定单元进一步包括:定长码字解码模式确定单元; 定长码字解码模式确定单元, 用于判断若第一变量≥8,则确定为定长码字 解码模式进行解码; 所述的解码单元进一步包括: 定长码字解码单元,用于确定解码模式为定 长码字解码模式; 设置索引值数值等于定长码字数值, 根据所述的索引值查找 预置的定长码表, 获取索引值相应的第一参数与第二参数。  Index=(PrefixNum-3)«3) + Suffix where Index is the index value, PrefixNum is the intermediate variable, and Suffix is the suffix. "" indicates a bitwise left shift operation. In the above-described entropy decoding apparatus, the "acquiring index value, obtaining the first parameter and the second parameter according to the index value" described in the non-special short code decoding unit is specifically: after obtaining the index value, in the determined variable length decoding mode And searching for the preset parameter table according to the index value, and acquiring the first parameter and the second parameter corresponding to the index value. The decoding mode determining unit further includes: a fixed length codeword decoding mode determining unit; a fixed length codeword decoding mode determining unit, configured to determine that if the first variable is ≥8, determine that the fixed length codeword decoding mode is performed. The decoding unit further includes: a fixed length codeword decoding unit, configured to determine that the decoding mode is a fixed length codeword decoding mode; set an index value value equal to a fixed length codeword value, and search for a preset according to the index value. The fixed length code table obtains the first parameter and the second parameter corresponding to the index value.
本发明实施例的目的在于提供一种熵解码方法、装置。通过分析语法元素 的概率分布情况,对码字规则和码表排列顺序进行全新设计, 根据码字规则计 算出码表中码字的顺序索引,对码表中的语法元素进行索引排序,进而实现快 速解码操作。此外,将部分高使用频率的特殊短码字直接简单算术表达式计算 出相应的语法元素数值。本发明实施例消除了遍历二叉树的操作和匹配码字的 操作, 从而极大降低熵编码算法对内存等硬件的要求。 An object of the embodiments of the present invention is to provide an entropy decoding method and apparatus. By analyzing the probability distribution of the syntax elements, the codeword rules and the order of the code tables are newly designed, according to the codeword rules. The order index of the code words in the code table is calculated, and the syntax elements in the code table are indexed and sorted, thereby implementing a fast decoding operation. In addition, a special short codeword with a high frequency of use is directly calculated into a simple arithmetic expression to calculate the corresponding syntax element value. The embodiment of the invention eliminates the operation of traversing the binary tree and the operation of matching the codeword, thereby greatly reducing the requirement of the entropy coding algorithm for hardware such as memory.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件完成,该程序可以存储于一种计算机可读存 储介质中, 上述提到的存储介质可以是只读存储器, 磁盘或光盘等。  A person skilled in the art can understand that all or part of the steps of implementing the above embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable storage medium, and the above mentioned storage medium can be It is a read-only memory, a disk or a disc.
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本发 明的精神和原则之内所作的任何修改、等同替换和改进等, 均应包含在本发明 的保护范围之内。  The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. Within the scope.

Claims

权 利 要 求 Rights request
1、 一种熵解码方法, 其特征在于, 所述的方法具体为: An entropy decoding method, characterized in that: the method is specifically:
根据二进制比特流获取第一变量;  Obtaining the first variable according to the binary bit stream;
根据所述第一变量的范围确定当前码字的类型;  Determining a type of the current codeword according to a range of the first variable;
根据所述当前码字的类型采用相应的解码方法进行解码。  Decoding is performed according to the type of the current codeword by using a corresponding decoding method.
2、 根据权利要求 1所述的熵解码方法, 其特征在于, 所述的 "根据二进 制比特流获取第一变量" 的方法具体为: 预先计算当前宏块左边 4X4块的第 一非零系数数目和当前宏块上面 4X4块的第二非零系数数目; The entropy decoding method according to claim 1, wherein the method of “acquiring a first variable according to a binary bit stream” is specifically: pre-calculating the number of first non-zero coefficients of a 4×4 block on the left side of the current macroblock And the number of second non-zero coefficients of the 4X4 block above the current macroblock;
当所述第一非零系数数目和所述第二非零系数数目都有效时,所述第一变 量 所述第一非零系数数目 +所述第二非零系数数目 2 ; When the first non-zero coefficient number and the second non-zero coefficient number are both valid, the first variable the first non-zero coefficient number + the second non-zero coefficient number 2 ;
当所述第二非零系数数目有效,所述第一非零系数数目无效时, 所述第一 变量 =所述第二非零系数数目;  When the number of the second non-zero coefficients is valid, and the number of the first non-zero coefficients is invalid, the first variable = the number of the second non-zero coefficients;
当所述第二非零系数数目无效,所述第一非零系数数目有效时, 所述第一 变量 =所述第一非零系数数目。  When the number of the second non-zero coefficients is invalid and the number of the first non-zero coefficients is valid, the first variable = the number of the first non-zero coefficients.
3、 根据权利要求 1所述的熵解码方法, 其特征在于,  3. The entropy decoding method according to claim 1, wherein:
所述的 "根据当前码字的类型采用相应的解码方法进行解码"之前还包括 步骤: 获取所述二进制比特流中码字的前缀部分;  The step of: "decoding according to the type of the current codeword by using a corresponding decoding method" further includes the steps of: obtaining a prefix portion of the codeword in the binary bitstream;
"根据所述当前码字的类型采用相应的解码方法进行解码"具体为: 当确 定所述当前码字为变长码字时, 则确定所述解码模式为变长码字解码模式; 根 据所述码字的前缀部分判断当前码字是否为特殊短码,若是则根据预置的特殊 短码解码公式进行解码, 获得第一参数和第二参数。  Decoding according to the type of the current codeword by using a corresponding decoding method, specifically: when determining that the current codeword is a variable length codeword, determining that the decoding mode is a variable length codeword decoding mode; The prefix portion of the codeword determines whether the current codeword is a special short code, and if so, decodes according to a preset special short code decoding formula to obtain a first parameter and a second parameter.
4、 根据权利要求 3所述的熵解码方法, 其特征在于, "根据所述码字的 前缀部分判断当前码字是否为特殊短码"具体为:  The entropy decoding method according to claim 3, wherein "determining whether the current codeword is a special short code according to a prefix portion of the codeword" is specifically:
将所述前缀部分的" 0"的个数赋予中间变量,  Assigning the number of "0"s of the prefix portion to the intermediate variable,
在所述变长码字解码模式下, 若所述中间变量小于阈值, 则确定当前码字 为特殊短码, 若否则确定当前码字为非特殊短码。 In the variable length codeword decoding mode, if the intermediate variable is less than the threshold, determining the current codeword For special short codes, otherwise determine that the current codeword is a non-special short code.
5、 根据权利要求 4所述熵解码方法, 其特征在于, 所述的变长码字解码 模式包括第一至第四解码模式;  The entropy decoding method according to claim 4, wherein the variable length codeword decoding mode comprises first to fourth decoding modes;
若 0≤所述第一变量 <2, 则确定使用第一解码模式进行解码, 所述阈值为 若 2≤所述第一变量 <4, 则确定使用第二解码模式进行解码, 所述阈值为 If 0 ≤ the first variable <2, it is determined that decoding is performed using the first decoding mode, and if the threshold is 2 ≤ the first variable <4, determining to decode using the second decoding mode, the threshold is
2; 2;
若 5≤所述第一变量 <8, 则确定使用第三解码模式进行解码, 所述阈值为 If 5 ≤ the first variable <8, it is determined that decoding is performed using a third decoding mode, the threshold is
1; 1;
若所述第一变量 =-1,则确定使用第四解码模式进行解码, 所述阈值为 3。  If the first variable = -1, it is determined that decoding is performed using a fourth decoding mode, the threshold being three.
6、 权利要求 5所述的熵解码方法, 其特征在于, "根据预置的特殊短码 解码公式进行解码, 获得第一参数和第二参数"具体为: The entropy decoding method according to claim 5, characterized in that: "decoding according to a preset special short code decoding formula to obtain a first parameter and a second parameter" is specifically:
当 确 定 使 用 所 述 第 一 解 码 模 式 进 行 解 码 时 , TrailingOnes=TotalCoeff=PrefixNum;  TrailingOnes=TotalCoeff=PrefixNum; when it is determined that the first decoding mode is used for decoding.
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中 间变量。  Among them, TrailingOnes is the first parameter, TotalCoeff is the second parameter, and PrefixNum is the intermediate variable.
7、 权利要求 5所述的熵解码方法, 其特征在于, "根据预置的特殊短码 解码公式进行解码, 获得第一参数和第二参数"具体为:  7. The entropy decoding method according to claim 5, wherein: "decoding according to a preset special short code decoding formula to obtain a first parameter and a second parameter" is specifically:
当确定使用所述第二解码模式进行解码时, 根据预置的 SUffiXlength=l读 取二进制比特流, 获取 Suffix; When it is determined that the second decoding mode is used for decoding, reading the binary bit stream according to the preset S U ffi X length=l, obtaining Suffix;
TrailingOnes=TotalCoeff=(Prefix«l)+Suffix;  TrailingOnes=TotalCoeff=(Prefix«l)+Suffix;
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中 间变量、 Prefix 为前缀、 Suffix为后缀、 Suffixlength为后缀长度、 "《"表示按 位左移运算。  Among them, TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Prefix is the prefix, Suffix is the suffix, Suffixlength is the suffix length, and "" indicates the bitwise left shift operation.
8、 权利要求 5所述的熵解码方法, 其特征在于, "根据预置的特殊短码 解码公式进行解码, 获得第一参数和第二参数"具体为: 当确定使用所述第三解码模式进行解码时, 根据预置的 SUffiXlength=3读 取二进制比特流, 获取 Suffix; 8. The entropy decoding method according to claim 5, wherein: "the special short code according to the preset The decoding formula is decoded to obtain the first parameter and the second parameter. Specifically, when it is determined that the third decoding mode is used for decoding, the binary bit stream is read according to the preset S U ffi X length=3, and Suffix is obtained.
TotalCoeff= Suffix; TrailingOnes=3 (Suffix/4)+(Suffix%4) ( 1 - Suffix/4) 或 TrailingOnes= 3 Suffix[2:2]+suffix[l :0] x(〜 Suffix[2:2]); 其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 Prefix 为前缀、 Suffix为后缀, Suffix[2:0]表示第 2位到第 0位的 3比 特二进制数, Suffix[l :0]表示第 1位至第 0位的 2比特二进制数, Suffix[2:2] 表 示第 2位的 1比特二进制数 ,"/"表示除法运算符, "% "表示取余运算符," ~"表 示位取反运算符。 TotalCoeff= Suffix; TrailingOnes=3 (Suffix/4)+(Suffix%4) (1 - Suffix/4) or TrailingOnes= 3 Suffix[2:2]+suffix[l:0] x(~ Suffix[2:2 ]); where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Prefix is the prefix, Suffix is the suffix, Suffix[2:0] represents the 2nd to 0th bit of the 3-bit binary number, Suffix [l:0] represents a 2-bit binary number from bit 1 to bit 0, Suffix[2:2] represents a 1-bit binary number of the second bit, "/" represents a division operator, and "%" represents a remainder operation The character "~" indicates that the bit is inverted.
9、 根据权利要求 5所述的熵解码方法, 其特征在于, "根据预置的特殊 短码解码公式进行解码, 获得第一参数和第二参数"具体为: 当确定使用所述第四解码模式进行解码时,  The entropy decoding method according to claim 5, wherein "decoding according to a preset special short code decoding formula to obtain a first parameter and a second parameter" is specifically: when determining to use the fourth decoding When the mode is decoded,
TrailingOnes=TotalCoeff= 2 PrefixNum[l : l] + ( 〜 PrefixNum[0:0]) (- PrefixNum[l : l]); 其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 PrefixNum [1 :0]表示第 1位到第 0位的 2比特二进制数, PrefixNum[l : l] 表示第 1为的 1比特二进制数, PrefixNum [0:0] 表示第 0位的 1比特二进制 数," ~"表示位取反运算符。  TrailingOnes=TotalCoeff= 2 PrefixNum[l : l] + ( ~ PrefixNum[0:0]) (- PrefixNum[l : l]); where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, PrefixNum [1:0] represents a 2-bit binary number from bit 1 to bit 0, PrefixNum[l: l] represents the 1-bit binary number of the first, and PrefixNum [0:0] represents the 1-bit binary number of the 0th bit. , "~" means the bit is inverted.
10、根据权利要求 5所述的熵解码方法, 其特征在于, 当根据所述码字的 前缀部分判断当前码字不是特殊短码时,则在所述变长码字解码模式下根据所 述码字的前缀部分选择预置解码公式进行解码, 获得索引值, 并根据所述的索 引值获得第一参数和第二参数。  The entropy decoding method according to claim 5, wherein when the current codeword is not a special short code according to the prefix portion of the codeword, then according to the variable length codeword decoding mode, The prefix portion of the codeword selects a preset decoding formula for decoding, obtains an index value, and obtains a first parameter and a second parameter according to the index value.
11、 根据权利要求 10所述的熵解码方法, 其特征在于, 所述的 "在所述 变长码字解码模式下根据所述码字的前缀部分选择预置解码公式进行解码, 得索引值"具体为: 当使用第一解码模式进行解码时, 11. The entropy decoding method according to claim 10, wherein: said "in said In the variable length codeword decoding mode, the preset decoding formula is selected according to the prefix portion of the codeword for decoding, and the index value is specifically: when decoding is performed using the first decoding mode,
Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix; Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 Read the binary bit stream according to the Suffixlength to obtain Suffix;
((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9
Index = Index =
((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3  ((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3
56 + Suffix 13≤ Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "&&"表示逻辑与运算符、 "? : "表示条件运算符、 "<<"表示按 位左移运算。  56 + Suffix 13 ≤ Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, "&&" means the logical AND operator, "? : " means the conditional operator, "<<" means Bitwise left shift operation.
12、 根据权利要求 10所述的熵解码方法, 其特征在于, 所述的 "在所述 变长码字解码模式下根据所述码字的前缀部分选择预置解码公式进行解码,获 得索引值"具体为: 当使用第二解码模式进行解码时, Suffixlength=(PrefixNum>=7) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix;  The entropy decoding method according to claim 10, wherein: "in the variable length codeword decoding mode, a preset decoding formula is selected according to a prefix portion of the codeword for decoding, and an index value is obtained. "Specifically: when decoding is performed using the second decoding mode, Suffixlength=(PrefixNum>=7) ? 3 : 2 reading the binary bit stream according to the Suffixlength to obtain Suffix;
Index = <j ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7  Index = <j ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7
((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "? : "表示条件运算符" <<"表示按位左移运算。  ((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, and "? :" means the conditional operator " <<" means Bitwise left shift operation.
13、 根据权利要求 10所述的熵解码方法, 其特征在于, 所述的 "在所述 变长码字解码模式下根据所述码字的前缀部分选择预置解码公式进行解码,获 得索引值"具体为:  The entropy decoding method according to claim 10, wherein: in the variable length codeword decoding mode, a preset decoding formula is selected according to a prefix portion of the codeword for decoding, and an index value is obtained. "Specifically:
当使用第三解码模式进行解码时, 根据预置的 SUffiXlength=3读取二进制 比特流, 获取 Suffix; When decoding is performed using the third decoding mode, the binary is read according to the preset S U ffi X length=3 Bitstream, get Suffix;
Index=(PrefixNum-3)«2) + Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Index=(PrefixNum-3)«2) + Suffix where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
14、 根据权利要求 10所述的熵解码方法, 其特征在于, 所述的 "在所述 变长码字解码模式下根据所述码字的前缀部分选择预置解码公式进行解码,获 得索引值"具体为:  The entropy decoding method according to claim 10, wherein: "in the variable length codeword decoding mode, a preset decoding formula is selected according to a prefix portion of the codeword for decoding, and an index value is obtained. "Specifically:
当使用第四解码模式进行解码时, 根据预置的 SUffiXlength=2读取二进制 比特流, 获取 Suffix; When decoding is performed using the fourth decoding mode, the binary bit stream is read according to the preset S U ffi X length=2, and Suffix is obtained;
Index=(PrefixNum-3)«3) + Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Index=(PrefixNum-3)«3) + Suffix where Index is the index value, PrefixNum is the intermediate variable, and Suffix is the suffix. "" indicates a bitwise left shift operation.
15、 根据权利要求 10所述的熵解码方法, 其特征在于, 所述的 "根据所 述的索引值获得第一参数和第二参数"具体为: The entropy decoding method according to claim 10, wherein the obtaining the first parameter and the second parameter according to the index value is specifically:
在确定的变长解码模式下, 根据所述索引值查找预置的参数表, 获取所述 索引值相应的第一参数与第二参数。  In the determined variable length decoding mode, the preset parameter table is searched according to the index value, and the first parameter and the second parameter corresponding to the index value are obtained.
16、 根据权利要求 1所述的熵解码方法, 其特征在于, "根据所述当前 码字的类型采用相应的解码方法进行解码"具体为: 当确定所述当前码字为定 长码字时, 则确定所述解码模式为定长码字解码模式; 设置索引值数值等于定 长码字数值, 根据所述索引值查找预置的定长码表, 获取所述索引值相应的第 一参数与第二参数。  The entropy decoding method according to claim 1, wherein "decoding according to the type of the current codeword by using a corresponding decoding method" is specifically: when determining that the current codeword is a fixed length codeword Determining, the decoding mode is a fixed-length codeword decoding mode; setting an index value value equal to a fixed-length codeword value, searching a preset fixed-length code table according to the index value, and acquiring a first parameter corresponding to the index value With the second parameter.
17、 根据权利要求 16所述的熵解码方法, 其特征在于, 所述的 "确定所 述解码模式为定长解码模式 "具体为: 若所述第一变量≥8, 则确定当前码字为 定长码字, 确定解码模式为定长解码模式。 The entropy decoding method according to claim 16, wherein the determining that the decoding mode is a fixed length decoding mode is: if the first variable is ≥ 8, determining that the current codeword is The fixed length codeword determines that the decoding mode is a fixed length decoding mode.
18、 一种熵解码装置, 其特征在于, 所述的装置包括: 获取单元、 码字类 型确定单元以及解码单元; 18. An apparatus for entropy decoding, the apparatus comprising: an acquiring unit, a codeword type determining unit, and a decoding unit;
所述获取单元, 用于根据二进制比特流获取第一变量;  The obtaining unit is configured to acquire a first variable according to a binary bit stream;
所述码字类型确定单元,用于根据所述第一变量的范围确定当前码字的类 型;  The codeword type determining unit is configured to determine a type of the current codeword according to the range of the first variable;
所述解码单元,用于根据所述当前码字的类型采用相应的解码方法进行解 码。  The decoding unit is configured to perform decoding according to the type of the current codeword by using a corresponding decoding method.
19、 根据权利要求 18所述的熵解码装置, 其特征在于, 所述的获取单元 包括:  The entropy decoding apparatus according to claim 18, wherein the acquiring unit comprises:
比特流获取单元, 用于获取二进制比特流;  a bitstream acquisition unit, configured to acquire a binary bitstream;
第一变量获取单元, 用于获取第一变量。  The first variable acquisition unit is configured to acquire the first variable.
20、 根据权利要求 19所述的熵解码装置, 其特征在于, 所述的第一变量 获取单元具体: The entropy decoding apparatus according to claim 19, wherein the first variable acquiring unit is specifically:
用于预先计算当前宏块左边 4X4块的第一非零系数数目和当前宏块上面 For pre-calculating the number of first non-zero coefficients of the 4X4 block to the left of the current macroblock and the current macroblock
4X4块的第二非零系数数目; The number of second non-zero coefficients of the 4X4 block;
当所述第一非零系数数目和所述第二非零系数数目都有效时,所述第一变 量 所述第一非零系数数目 +所述第二非零系数数目 2 ; When the first non-zero coefficient number and the second non-zero coefficient number are both valid, the first variable the first non-zero coefficient number + the second non-zero coefficient number 2 ;
当所述第二非零系数数目有效,所述第一非零系数数目无效时, 所述第一 变量 =所述第二非零系数数目;  When the number of the second non-zero coefficients is valid, and the number of the first non-zero coefficients is invalid, the first variable = the number of the second non-zero coefficients;
当所述第二非零系数数目无效,所述第一非零系数数目有效时, 所述第一 变量 =所述第一非零系数数目。  When the number of the second non-zero coefficients is invalid and the number of the first non-zero coefficients is valid, the first variable = the number of the first non-zero coefficients.
21、 根据权利要求 18所述的熵解码装置, 其特征在于, 所述获取单元进 一步包括前缀获取单元, 用于获取所述二进制比特流中码字的前缀部分; 所述码字类型确定单元,进一步用于根据第一变量的范围确定当前码字的 类型为变长码字; 所述解码单元包括:解码模式确定单元、判断单元以及特殊短码解码单元; 所述解码模式确定单元,用于当确定所述当前码字为变长码字时, 则确定 所述解码模式为变长码字解码模式; The entropy decoding apparatus according to claim 18, wherein the obtaining unit further comprises a prefix obtaining unit, configured to acquire a prefix portion of the codeword in the binary bitstream; the codeword type determining unit, Further for determining, according to the range of the first variable, that the type of the current codeword is a variable length codeword; The decoding unit includes: a decoding mode determining unit, a determining unit, and a special short code decoding unit. The decoding mode determining unit is configured to determine, when the current codeword is a variable length codeword, the decoding mode is Variable length codeword decoding mode;
判断单元,用于当确定所述解码模式为变长码字解码模式时, 根据所述码 字的前缀部分判断当前码字是否为特殊短码;  a determining unit, configured to determine, according to a prefix portion of the codeword, whether the current codeword is a special short code when determining that the decoding mode is a variable length codeword decoding mode;
特殊短码解码单元,用于当确定当前码字为特殊短码时, 根据预置特殊短 码解码公式进行解码, 获得第一参数和第二参数。  The special short code decoding unit is configured to: when determining that the current codeword is a special short code, perform decoding according to a preset special short code decoding formula to obtain the first parameter and the second parameter.
22、 根据权利要求 21所述的熵解码装置, 其特征在于, 22. The entropy decoding apparatus according to claim 21, wherein:
所述判断单元的用于当确定解码模式为变长码字解码模式时,根据所述前 缀判断当前码字是否为特殊短码具体为:  When the determining unit determines that the decoding mode is the variable length codeword decoding mode, determining whether the current codeword is a special short code according to the prefix is specifically:
将所述前缀部分的" 0"的个数赋予中间变量,在所述变长码字解码模式下, 若所述的中间变量小于阈值, 则确定当前码字为特殊短码; 若否则确定当前码 字为非特殊短码。  And assigning the number of “0”s of the prefix part to an intermediate variable, in the variable length codeword decoding mode, if the intermediate variable is smaller than a threshold, determining that the current codeword is a special short code; The code word is a non-special short code.
23、 根据权利要求 22所述的熵解码装置, 其特征在于, 所述码字类型确 定单元的 "根据所述码字的部分前缀判断当前码字是否为特殊短码"具体为: 当 -1≤第一变量<8时确定为当前码字的类型为变长码字;  The entropy decoding apparatus according to claim 22, wherein the codeword type determining unit determines "whether the current codeword is a special short code according to a partial prefix of the codeword", specifically: when -1 ≤ when the first variable <8, it is determined that the type of the current codeword is a variable length codeword;
所述的解码模式确定单元包括:第一解码模式确定单元、第二解码模式确 定单元、 第三解码模式确定单元以及第四解码模式确定单元;  The decoding mode determining unit includes: a first decoding mode determining unit, a second decoding mode determining unit, a third decoding mode determining unit, and a fourth decoding mode determining unit;
第一解码模式确定单元, 用于判断若 0≤第一变量<2, 则确定为第一解码 模式进行解码, 所述阈值为 3 ;  a first decoding mode determining unit, configured to determine, if 0 ≤ the first variable <2, to determine to decode the first decoding mode, where the threshold is 3;
第二解码模式确定单元, 用于判断若 2≤第一变量<4, 则确定为第二解码 模式进行解码, 所述阈值为 2;  a second decoding mode determining unit, configured to determine that if 2 ≤ the first variable <4, determining to decode the second decoding mode, the threshold is 2;
第三解码模式确定单元, 用于判断若 5≤第一变量<8, 则确定为第三解码 模式进行解码, 所述阈值为 1 ; 第四解码模式确定单元, 用于判断若第一变量 =-1,则确定为第四解码模式 进行解码, 所述阈值为 3。 a third decoding mode determining unit, configured to determine, if 5≤the first variable<8, to determine to decode the third decoding mode, the threshold value is 1; The fourth decoding mode determining unit is configured to determine that if the first variable=−1, determine to decode the fourth decoding mode, where the threshold is 3.
24、 根据权利要求 23所述的熵解码装置, 其特征在于, 所述的特殊短码 解码单元包括第一特殊短码解码单元;  The entropy decoding apparatus according to claim 23, wherein the special short code decoding unit comprises a first special short code decoding unit;
所述第一特殊短码解码单元,用于当确定使用所述第一解码模式进行解码 时, TrailingOnes=TotalCoeff=PrefixNum;  The first special short code decoding unit is configured to: when determining to use the first decoding mode for decoding, TrailingOnes=TotalCoeff=PrefixNum;
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间  Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, and PrefixNum is the middle.
25、 根据权利要求 23所述的熵解码装置, 其特征在于, 所述的特殊短码 解码单元进一步包括第二特殊短码解码单元; The entropy decoding apparatus according to claim 23, wherein the special short code decoding unit further comprises a second special short code decoding unit;
所述第二特殊短码解码单元,用于当确定使用所述第二解码模式进行解码 时, 根据预置的 Suffixlength=l读取二进制比特流, 获取 Suffix;  The second special short code decoding unit is configured to: when determining to use the second decoding mode for decoding, reading a binary bit stream according to a preset Suffixlength=l, acquiring Suffix;
TrailingOnes=TotalCoeff=(Prefix« 1 )+Suffix;  TrailingOnes=TotalCoeff=(Prefix« 1 )+Suffix;
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 Prefix 为前缀、 Suffix为后缀、 Suffixlength为后缀长度、 "《"表示按位 左移运算。  Among them, TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Prefix is the prefix, Suffix is the suffix, Suffixlength is the suffix length, and "" indicates the bitwise left shift operation.
26、 根据权利要求 23所述的熵解码装置, 其特征在于, 所述的特殊短码 解码单元进一步包括第三特殊短码解码单元; 所述的第三特殊短码解码单元,用于当确定使用所述第三解码模式进行解 码时, 根据预置的 Suffixlength=3读取二进制比特流, 获取 Suffix;  The entropy decoding apparatus according to claim 23, wherein the special short code decoding unit further comprises a third special short code decoding unit; and the third special short code decoding unit is configured to determine When decoding is performed using the third decoding mode, reading a binary bit stream according to a preset Suffixlength=3, acquiring Suffix;
TotalCoeff= Suffix; Trailing0nes=3 (Suffix/4)+(Suffix%4) ( 1 - Suffix/4) 或 TrailingOnes= 3 Suffix[2:2]+suffix[l :0] x(〜 Suffix[2:2]);  TotalCoeff= Suffix; Trailing0nes=3 (Suffix/4)+(Suffix%4) (1 - Suffix/4) or TrailingOnes= 3 Suffix[2:2]+suffix[l:0] x(~ Suffix[2:2 ]);
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 Prefix 为前缀、 Suffix为后缀, Suffix[2:0]表示第 2位到第 0位的 3比 特二进制数, Suffix[l :0]表示第 1位至第 0位的 2比特二进制数, Suffix[2:2] 表 示第 2位的 1比特二进制数, "/"表示除法运算符, "% "表示取余运算符, "~" 表 示位取反运算符。 Among them, TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, Prefix is the prefix, Suffix is the suffix, and Suffix[2:0] represents the 3rd to the 0th. The special binary number, Suffix[l:0] represents the 2-bit binary number from the 1st to the 0th bit, Suffix[2:2] represents the 1-bit binary number of the 2nd bit, "/" represents the division operator, "% "Indicates the remainder operator, "~" indicates that the bit is inverted.
27、 根据权利要求 23所述的熵解码装置, 其特征在于, 所述的特殊短码 解码单元进一步包括第四特殊短码解码单元; 所述的第四特殊短码解码单元,用于当确定使用所述第四解码模式进行解 码时, TrailingOnes = TotalCoeff = 2 PrefixNum[l : l] + (〜 PrefixNum[0:0]) x (~ PrefixNum[ 1 : 1]);  The entropy decoding apparatus according to claim 23, wherein the special short code decoding unit further comprises a fourth special short code decoding unit; and the fourth special short code decoding unit is configured to determine When decoding using the fourth decoding mode, TrailingOnes = TotalCoeff = 2 PrefixNum[l : l] + (~ PrefixNum[0:0]) x (~ PrefixNum[ 1 : 1]);
其中 TrailingOnes是第一参数、 TotalCoeff是第二参数、 PrefixNum为中间 变量、 PrefixNum [1 :0]表示第 1位到第 0位的 2比特二进制数, PrefixNum[l : l] 表示第 1为的 1比特二进制数, PrefixNum [0:0] 表示第 0位的 1比特二进制 数," ~"表示位取反运算符。  Where TrailingOnes is the first parameter, TotalCoeff is the second parameter, PrefixNum is the intermediate variable, PrefixNum [1:0] represents the 1-bit binary number from the 1st to the 0th, and PrefixNum[l:l] represents the 1st. Bit binary number, PrefixNum [0:0] represents the 1-bit binary number of the 0th bit, and "~" means the bit is inverted.
28、 根据权利要求 23所述的熵解码装置, 其特征在于, 所述的解码单元 进一步包括: 非特殊短码解码单元,用于当根据所述码字的前缀部分判断当前 码字不是特殊短码时,则在所述变长码字解码模式下根据所述码字的前缀部分 选择预置解码公式进行解码, 获得索引值, 并根据所述的索引值获得第一参数 和第二参数。  The entropy decoding apparatus according to claim 23, wherein the decoding unit further comprises: a non-special short code decoding unit, configured to determine, according to a prefix portion of the codeword, that the current codeword is not a special short In the code length, the preset decoding formula is selected according to the prefix portion of the codeword for decoding in the variable length codeword decoding mode, an index value is obtained, and the first parameter and the second parameter are obtained according to the index value.
29、 根据权利要求 28所述的熵解码装置, 其特征在于, 所述的非特殊短 码解码单元包括: 第一解码单元; 用于当使用第一解码模式进行解码时, The entropy decoding apparatus according to claim 28, wherein the non-special short code decoding unit comprises: a first decoding unit; configured to perform decoding when using the first decoding mode,
Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix; Suffixlength=(PrefixNum>=9 && PrefixNum<13) ? 3 : 2 Read the binary bit stream according to the Suffixlength to obtain Suffix;
((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9((PrefixNum-3)«2) + Suffix 3 < Pr efixNum < 9
Index = Index =
((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3  ((PrefixNum-9)«3)+Suffix+24 9 < Pr efixNum<l 3
56 + Suffix 13≤ Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "&&"表示逻辑与运算符、 "? : "表示条件运算符、 "<<"表示按 位左移运算。 56 + Suffix 13 ≤ Pr efixNum Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, "&&" means the logical AND operator, "?:" means the conditional operator, and "<<" means the bitwise left shift operation.
30、 根据权利要求 28所述的熵解码装置, 其特征在于, 所述的非特殊短 码解码单元进一步包括第二解码单元; 用于当使用第二解码模式进行解码时, Suffixlength=(PrefixNum>=7) ? 3 : 2 根据所述的 Suffixlength读取二进制比特流, 获取 Suffix;  The entropy decoding apparatus according to claim 28, wherein the non-special short code decoding unit further comprises a second decoding unit; and Suffixlength=(PrefixNum> when decoding is performed using the second decoding mode. =7) ? 3 : 2 Read the binary bit stream according to the Suffixlength, and obtain Suffix;
Index = <j ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7  Index = <j ((PrefixNum-2)«2)+Suffix 2 < Pr efixNum<7
((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, Suffixlength 为后缀长度, "? : "表示条件运算符, "<<"表示按位左移运算。  ((PrefixNum-7)«3)+Suffix+20 7 < Pr efixNum where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, Suffixlength is the suffix length, "? : " indicates the conditional operator, "<<" Represents a bitwise left shift operation.
31、 根据权利要求 28所述的熵解码装置, 其特征在于, 所述的非特殊短 码解码单元进一步包括第三解码单元, 用于当使用第三解码模式进行解码时, 根据预置的 Suffixlength=3读取二进制比特流, 获取 Suffix; The entropy decoding apparatus according to claim 28, wherein the non-special short code decoding unit further comprises a third decoding unit, configured to: when the decoding is performed using the third decoding mode, according to a preset Suffixlength =3 reads the binary bit stream, gets Suffix;
Index=(PrefixNum-3)«2) + Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。  Index=(PrefixNum-3)«2) + Suffix where Index is the index value, PrefixNum is the intermediate variable, Suffix is the suffix, and "" means the bitwise left shift operation.
32、 根据权利要求 28所述的熵解码单元, 其特征在于, 所述的非特殊短 码解码单元进一步包括第四解码单元, 用于当使用第四解码模式进行解码时, 根据预置的 Suffixlength=2读取二进制比特流, 获取 Suffix;  The entropy decoding unit according to claim 28, wherein the non-special short code decoding unit further comprises a fourth decoding unit, configured to use a fourth decoding mode for decoding, according to a preset Suffixlength =2 reads the binary bit stream, gets Suffix;
Index=(PrefixNum-3)«3) + Suffix 其中 Index为索引值、 PrefixNum为中间变量、 Suffix为后缀, "《"表示 按位左移运算。 Index=(PrefixNum-3)«3) + Suffix where Index is the index value, PrefixNum is the intermediate variable, and Suffix is the suffix. "" indicates a bitwise left shift operation.
33、 根据权利要求 28所述的熵解码单元, 其特征在于, 所述非特殊短码 解码单元中所述的"获得索引值,并根据索引值获得第一参数和第二参数"具体 为: 33. The entropy decoding unit according to claim 28, wherein the non-special short code Determining the "index value in the decoding unit and obtaining the first parameter and the second parameter according to the index value" is specifically:
在确定的变长解码模式下, 根据所述索引值查找预置的参数表, 获取所述 索引值相应的第一参数与第二参数。  In the determined variable length decoding mode, the preset parameter table is searched according to the index value, and the first parameter and the second parameter corresponding to the index value are obtained.
34、 根据权利要求 21所述的熵解码装置, 其特征在于, 所述的解码模式 确定单元进一步包括: 定长码字解码模式确定单元;  The entropy decoding apparatus according to claim 21, wherein the decoding mode determining unit further comprises: a fixed length codeword decoding mode determining unit;
定长码字解码模式确定单元, 用于判断若第一变量≥8,则确定为定长码字 解码模式进行解码;  a fixed length codeword decoding mode determining unit, configured to determine, if the first variable is ≥8, determine to decode the fixed length codeword decoding mode;
所述的解码单元进一步包括: 定长码字解码单元,用于当确定所述当前码 字为定长码字时, 则确定所述解码模式为定长码字解码模式; 设置索引值数值 等于定长码字数值, 根据所述索引值查找预置的定长码表, 获取所述索引值相 应的第一参数与第二参数。  The decoding unit further includes: a fixed length codeword decoding unit, configured to: when determining that the current codeword is a fixed length codeword, determine that the decoding mode is a fixed length codeword decoding mode; And determining a preset fixed length code table according to the index value, and acquiring a first parameter and a second parameter corresponding to the index value.
35、 一种记录介质, 其特征在于, 该介质包括权利要求 1至 17其中之一 的熵解码方法的程序。  A recording medium, characterized in that the medium comprises the program of the entropy decoding method of one of claims 1 to 17.
PCT/CN2011/076357 2011-05-25 2011-06-25 Entropy decoding method and device WO2012159295A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110139078.8 2011-05-25
CN201110139078.8A CN102355578B (en) 2011-05-25 2011-05-25 A kind of entropy decoding method, device

Publications (1)

Publication Number Publication Date
WO2012159295A1 true WO2012159295A1 (en) 2012-11-29

Family

ID=45579066

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/076357 WO2012159295A1 (en) 2011-05-25 2011-06-25 Entropy decoding method and device

Country Status (2)

Country Link
CN (1) CN102355578B (en)
WO (1) WO2012159295A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103384329A (en) * 2013-05-07 2013-11-06 广东工业大学 CAVLC decoding method based on no code table lookup
CN103533360B (en) * 2013-10-19 2016-06-08 山东大学 A kind of AVS coding chip is optimized the method that code table stores
CN106303531B (en) * 2015-06-09 2019-08-16 富士通株式会社 Coding method, device and the image processing equipment of copy information
US10601440B2 (en) * 2015-07-03 2020-03-24 Kinematicsoup Technologies Inc. Method of compression for fixed-length data
CN110446047A (en) * 2019-08-16 2019-11-12 苏州浪潮智能科技有限公司 The coding/decoding method and device of video code flow

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101175210A (en) * 2006-10-30 2008-05-07 中国科学院计算技术研究所 Entropy decoding method and device used for decoding video estimation residual error coefficient
CN101198051A (en) * 2006-12-07 2008-06-11 深圳艾科创新微电子有限公司 Method and device for implementing entropy decoder based on H.264
US7830963B2 (en) * 2003-07-18 2010-11-09 Microsoft Corporation Decoding jointly coded transform type and subblock pattern information

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101072034B (en) * 2007-06-12 2010-06-02 华为技术有限公司 Variable length decoding method and its device
CN101370138B (en) * 2007-08-17 2011-02-09 中国科学院计算技术研究所 Decoding method for H.264 standard CAVLC residual error coefficient

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7830963B2 (en) * 2003-07-18 2010-11-09 Microsoft Corporation Decoding jointly coded transform type and subblock pattern information
CN101175210A (en) * 2006-10-30 2008-05-07 中国科学院计算技术研究所 Entropy decoding method and device used for decoding video estimation residual error coefficient
CN101198051A (en) * 2006-12-07 2008-06-11 深圳艾科创新微电子有限公司 Method and device for implementing entropy decoder based on H.264

Also Published As

Publication number Publication date
CN102355578A (en) 2012-02-15
CN102355578B (en) 2016-12-07

Similar Documents

Publication Publication Date Title
US9338478B2 (en) Video compression using multiple variable length coding methods for multiple types of transform coefficient blocks
KR101356733B1 (en) Method and apparatus for Context Adaptive Binary Arithmetic Coding and decoding
KR101187243B1 (en) Fast parsing of variable-to-fixed-length codes
US8265162B2 (en) Context adaptive position and amplitude coding of coefficients for video compression
US8520965B2 (en) Context adaptive hybrid variable length coding
TWI657692B (en) Rice parameter initialization for coefficient level coding in video coding process
RU2506710C2 (en) Method of modelling video signal coding information for compressing/decompressing coding information
US7839311B2 (en) Architecture for multi-stage decoding of a CABAC bitstream
TWI556632B (en) Method and apparatus for arithmetic encoding of video, and method and apparatus for arithmetic decoding of video
WO2020253828A1 (en) Coding and decoding method and device, and storage medium
TWI662830B (en) Data encoding and decoding
TWI629895B (en) Apparatus for video decoding
WO2005027521A1 (en) Entropy coding method for encoding remanet coefficient in video predicting
CN115361561B (en) Method and device for coding and decoding residual error and coefficient
JP5881747B2 (en) Coding and decoding method and apparatus for transform coefficient
WO2012159301A1 (en) Method, device and medium for video entropy encoding and entropy decoding
JP7439841B2 (en) In-loop filtering method and in-loop filtering device
WO2012159295A1 (en) Entropy decoding method and device
WO2022193386A1 (en) Coefficient encoding method and device, coefficient decoding method and device, terminal and storage medium
WO2023272533A1 (en) Encoding and decoding method, encoder, decoder, and storage medium
TW202348026A (en) Image coding and decoding method and device, electronic equipment and storage medium
TW202406335A (en) Encode and decode methods, apparatuses and devices
Dai et al. Adaptive Binarization for Arithmetic Coding in Video Compression

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: 11865964

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS (EPO FORM 1205A DATED 16-04-2014)

122 Ep: pct application non-entry in european phase

Ref document number: 11865964

Country of ref document: EP

Kind code of ref document: A1