WO2012159301A1 - Method, device and medium for video entropy encoding and entropy decoding - Google Patents
Method, device and medium for video entropy encoding and entropy decoding Download PDFInfo
- Publication number
- WO2012159301A1 WO2012159301A1 PCT/CN2011/076455 CN2011076455W WO2012159301A1 WO 2012159301 A1 WO2012159301 A1 WO 2012159301A1 CN 2011076455 W CN2011076455 W CN 2011076455W WO 2012159301 A1 WO2012159301 A1 WO 2012159301A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- codeword
- coding
- encoded
- mapping
- index
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
- H04N19/423—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N19/91—Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
Definitions
- the present invention relates to the field of video coding technologies, and in particular, to a video entropy coding, an entropy decoding method, an apparatus, and a medium.
- Entropy codec is an important part of video coding.
- Entropy coding is a series of syntax elements generated by various functional modules in video coding algorithms. Its purpose is to effectively remove statistical redundancy of data. These syntax elements can be classified into two categories: residual coefficient syntax elements and non-residual coefficient syntax elements. The residual coefficient syntax element has the largest amount of information and is the processing focus of entropy coding.
- the syntax elements of the residual coefficient are obtained by scanning the block residual coefficients after transformation and quantization.
- the syntax elements of the non-residual system are generated by video coding links such as intra prediction, inter prediction, and quantization, and input to the entropy coding module for processing.
- the syntax elements of the non-residual system include macroblock type, reference frame index, and quantization. Parameters, motion vector residuals, coding models, intra prediction modes, etc.
- a macroblock is the basic unit of video coding.
- the macroblock size is 16 X 16
- each macroblock consists of four 4 X 4 blocks
- each block consists of one 4 X 4 luma block and two colors.
- the block is composed.
- CABAC Context-Based Adaptive Binary Arithmetic Coding
- a two-dimensional residual coefficient is obtained.
- the two-dimensional coefficient is generally converted into a one-dimensional sequence by scanning; There are many ways to represent a dimensional sequence. Different representation methods define their own syntax elements. Conversely, a one-dimensional sequence can be reconstructed using syntax elements.
- the residual coding parameters associated with these syntax elements are: Level, Run, and End of Block EOB (End of Block).
- the entropy coding first performs Zigzag scanning on the quantized coefficients of the prediction transform, and records the non-zero coefficients encountered in the scan as Level, and the continuous zero-coefficient run before the non-zero coefficients is recorded as Run.
- 2D-VLC entropy coding uses joint coding (Level, Run) data pairs of residual coefficients, and E0B coding, E0B is assigned a codeword separately;
- 3D-VLC entropy encoder integrates data end information into (Level , Run) data alignment, form a three-dimensional data set (Level, Run, Last), Last indicates whether the current coefficient is the last coefficient in the block, so that you can not encode the end identifier, and play the combination of Level, Run and E0B. Probability;
- the CAVLC entropy coding of the H.264/AVC video coding standard makes full use of the context information.
- the residual information of 4 ⁇ 4 blocks is optimized by establishing multiple code tables, and the Level and Run are separately coded.
- H. 264/AVC CABAC entropy coding belongs to arithmetic coder, the performance of arithmetic coding is better than variable length coding, and CABAC is closer to Shannon's theorem through adaptive probability estimation and update and binary arithmetic coding, and the coding effect is higher.
- 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.
- the above video coding standard can obtain higher coding efficiency by performing context-based coding by analyzing the probability distribution of the block prediction residual coefficients in different states.
- the CAVLC in the H.264/AVC standard makes full use of the probability and statistical distribution of different residual coefficients, and adaptively uses a plurality of code tables to encode a corresponding syntax element.
- CAVLC is the most efficient coding in the currently published video standard.
- Context adaptive variable length coding techniques For applications such as real-time video communication such as mobile video, the entropy codec technology uses the exponential Columbus code Exp-Golomb and CAVLC, and the index Columbus code mainly encodes non-residual information such as motion vectors; CAVLC coding is mainly for prediction.
- the residual is encoded.
- Both the index Columbus code and the CAVLC code conform to the basic idea of Huffman coding: short code words represent high probability information and long code words represent low probability information.
- the index Columbus coding is a regular variable length coding based on symbolic probability statistics.
- CAVLC defines multiple sets of different code tables by introducing content adaptive models. Word features, dynamic code table switching, improve coding efficiency.
- the decoding process of CAVLC is too large.
- 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. Table process consumption
- the codeword tree is sparse, the storage space of the codebook grows exponentially with the increase of the codeword length, but most of them are vacant and are not effectively utilized.
- the entropy coding of H.264 achieves good coding efficiency through good context adaptive design, but these are at the cost of too many code tables. Too many code tables mean that the codec operation requires more computing resources. . Especially for the mobile video service system, due to factors such as the computing hardware of the portable mobile terminal and the limited resources of the battery power consumption, the high complexity video entropy decoding implementation still faces many problems: many code tables of the entropy decoder need to be searched.
- the LUT Look Up Table
- the entropy decoding process often needs to traverse the lookup table to match the codewords bit by bit. Repeated read and write memory operations will also lead to a sharp increase in power consumption.
- the purpose of the embodiment of the present invention is to provide a video entropy coding method, which aims to solve the problem that the conventional variable length code table occupies a large memory space, requires a bit-by-bit traversal operation, and has high complexity of entropy coding and decoding.
- the method of the embodiment of the present invention is implemented as a video entropy coding method, where the method includes: acquiring a syntax element to be encoded in a block to be coded;
- the codeword value is encoded according to a codeword encoding rule to obtain a final codeword.
- a second object of the embodiments of the present invention is to provide a video entropy coding apparatus, where the apparatus includes: an encoding syntax element acquiring module, configured to acquire a syntax element to be encoded in a block to be encoded; Decoding the coding syntax element into a coding index;
- a second conversion module configured to convert the encoding index into a codeword value; the mapping manner of converting the encoding index into a codeword value comprises a probability statistical distribution mapping or a non-probability statistical distribution mapping; And a module, configured to encode the codeword value according to a codeword encoding rule to obtain a final codeword.
- a third object of embodiments of the present invention is to provide a recording medium including the program of the video entropy encoding method.
- a fourth object of the embodiments of the present invention is to provide a video entropy decoding method, where the method includes: reading an entropy encoded binary bit stream, performing calculation according to a codeword encoding rule, and obtaining a complete Binary code word
- a fifth object of the embodiments of the present invention is to provide a video entropy decoding apparatus, where the apparatus includes: a complete codeword acquisition module, configured to read an entropy encoded binary bit stream, perform calculation according to a codeword encoding rule, and obtain a complete Binary code word;
- a codeword value obtaining module configured to calculate, according to the codeword encoding rule, the codeword value
- a third conversion module configured to convert the codeword value into an encoding index
- the second syntax element obtaining module is configured to obtain a corresponding syntax element according to the encoding index.
- a sixth object of the embodiments of the present invention is to provide a recording medium including the program of the video entropy decoding method.
- the syntax element to be encoded in the block to be encoded is obtained, and the syntax element to be encoded is converted into a coding index, and the coded index is converted into a codeword value, and the codeword value is regularly lengthened. Coding or fixed length coding, obtaining the final codeword;
- the key idea of the embodiment of the present invention is to replace the context adaptation probability distribution of the syntax element by the regular codeword, and replace by introducing the coding index
- CAVLC's many code table designs eliminate the need for the traditional variable length code table to occupy a large memory space and need to be traversed bit by bit. Under the premise of ensuring coding efficiency, the entropy coding and entropy decoding on the mobile terminal device are greatly reduced. Implementation complexity, suitable for portable terminals with limited hardware resources.
- FIG. 1 is a flow chart of a preferred embodiment of a video entropy encoding method of the present invention
- 2 is a Zigzag scanning sequence diagram of a prediction residual block of 4 ⁇ 4 luminance of a preferred embodiment of the video entropy encoding method of the present invention
- Figure 3 is a diagram showing the structure of a preferred embodiment of the video entropy coding apparatus of the present invention ⁇
- FIG. 4 is a flow chart of a preferred embodiment of a video entropy decoding method of the present invention.
- FIG. 5 is a diagram showing the structure of a preferred embodiment of the video entropy encoding apparatus of the present invention ⁇
- 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.
- the syntax element to be encoded in the block to be encoded is obtained, and the syntax element to be encoded is converted into a coding index, and the coded index is converted into a codeword value, and the codeword value is regularly lengthened.
- Encoding or fixed length coding obtaining the final codeword;
- a code table of each syntax element is newly designed, and a fast code table retrieval is realized by the coding index to eliminate
- the traditional variable length code table needs to occupy a large memory space and needs to be traversed bit by bit. Under the premise of ensuring coding efficiency, the implementation complexity of the entropy decoding operation on the mobile terminal device is greatly improved, and the hardware resource is limited.
- Portable terminal Embodiment 1
- FIG. 1 is a flowchart of a video entropy coding method according to an embodiment of the present invention, where the method includes the following steps:
- the syntax element to be encoded includes: a residual coefficient syntax element or a non-residual coefficient syntax element; the method for obtaining the residual coefficient syntax element is as follows:
- the scanning sequence is a Zigzag scan reordering method
- Obtaining, according to the one-dimensional sequence, a block residual coefficient syntax element is: obtaining a corresponding syntax element according to a statistical feature of the residual coefficient in the one-dimensional sequence; and the corresponding syntax element can represent the one-dimensional sequence.
- a grammar element can represent all the information of a one-dimensional sequence, that is, it only reconstructs a one-dimensional order by relying on grammatical elements. Column. However, as part of the entropy coding of video coding, it is often desirable to use the statistical characteristics of the residual coefficients to reduce the number of bits in which the information is stored. The following example illustrates:
- the required number of bits of information is 16xH (H is the number of binary digits required for each coefficient preservation); and after run-length coding, 5 (run, Level ) Run pair, if the run pair is defined as a syntax element, regardless of the probability distribution of the run-pair/syntax element (the equal probability case, the entropy value is the largest), assign H bits to each data in the run-pair pair, required The total information bit is HxH, where the terminator E0B is assigned the H bit). Therefore, the number of bits required is much less than the number of bits required to save the original sequence. Moreover, the probability distribution of the grammatical elements is actually a non-probability distribution whose entropy value is less than the entropy value of the equal probability, in other words, all data can be saved with fewer bits.
- the syntax element acquisition manner of the one-dimensional sequence according to the H.264, MPEG_2, and MPEG-4 coding standards may be classified into a single data mode, a data pair mode, or a data group mode;
- the residual coefficient syntax elements obtained by the single data method include: the number of non-zero coefficients TotalCoeffs, the number of trailing coefficients Trai l ingOnes, the number of zeros before the zero coefficient Total_zeros, the non-zero coefficient magnitude Level and run Run — before;
- the residual coefficient syntax elements obtained by data pairing include: (Level, Run) data pair and data terminator;
- the residual coefficient syntax elements obtained by the data group method include: a three-dimensional data group (Level , Run, Last );
- the non-residual coefficient syntax element includes a macroblock type, a reference frame index, a quantization parameter, a motion vector residual, an encoding model, or an intra prediction mode;
- the syntax element to be encoded includes: a residual coefficient syntax element or a non-residual coefficient syntax element; the method for converting the syntax element to be encoded into a coding index may be a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method; A probability and statistical distribution mapping method for converting a syntax element to be encoded into a coding index, specifically:
- the probability distribution information is a probability distribution statistical value of the syntax element to be encoded;
- the context model is a joint probability established based on the interdependence of information before and after.
- the front and rear information indicates the processed data unit and the current data unit to be processed, including the image group, the frame, the slice, the block, and the like.
- the front and rear information in the embodiment of the present invention is the processed block and the current to-be-processed block; Interdependencies include: a) Spatial correlation between neighboring blocks; Since neighboring blocks in the same frame tend to have a large degree of spatial correlation, information of the current block can be predicted by neighboring blocks. b) The mathematical constraints inherent in the grammatical elements.
- the context model is generally referred to as context.
- the theory of information theory is that the joint entropy is smaller than the sum of the source entropy, which further improves the compression efficiency.
- the probability statistical distribution information of the probabilistic statistical distribution values may be combined to obtain a probability statistical distribution value of the merged syntax elements as the probability statistical distribution information of the syntax elements to be encoded.
- the probability ordering may be ascending or descending;
- establishing a mapping of non-residual coefficient syntax elements and coding indexes may be mapping of a single non-residual coefficient syntax element and a coding index Codelndex, or Is to create multiple non-residual coefficient syntax elements and coding index
- the "joining a joint map of a plurality of non-residual coefficient syntax elements and a code index of a code index” may be used to synthesize a joint probability distribution of a plurality of non-residual coefficient syntax elements to establish a corresponding A non-residual coefficient syntax element mapping table, or grouping the non-residual coefficient syntax elements and performing comprehensive coding.
- a non-probabilistic statistical distribution mapping method that converts non-residual coefficient syntax elements in a syntax element to be encoded into a coding index includes unsigned direct mapping, signed conversion to symbol mapping, or mapping table mode:
- the syntax elements of this mapping method mainly include motion vector difference values, quantization factor increments, and the like.
- mapping table The mapping relationship between the non-residual coefficient syntax element and the second coding index Codelndex is specified by formulating a mapping table. It is mainly used for mapping of parameters such as block coding mode and intra prediction mode.
- Table 7 is a mapping table relationship table of the X 4 luma block intra prediction mode and the encoding index Codelndex according to the embodiment of the present invention.
- the table maps a single non-residual coefficient syntax element and an encoding index.
- mapping method for converting the code index Codelndex into a codeword value CodeNum may be a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method
- the probability distribution distribution mapping method of converting the coding index Codelndex into the codeword value CodeNum is: establishing a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded; wherein the mapping relationship follows The principle of the shortest average code length, the codeword value and the codeword of the mapped by the probability of the syntax element to be encoded: the short codeword is assigned to the large probability codeword value, and the long codeword is assigned by the small probability codeword value;
- the non-probabilistic statistical distribution mapping method for converting the encoding index Codelndex into a codeword value CodeNum is:
- S104 Encoding the codeword value CodeNum according to a codeword encoding rule to obtain a final code.
- the codeword encoding rule may be a regular variable length coding or a regular fixed length coding;
- the codeword has a regular codeword structure, and the codeword value CodeNum and the codeword CodeWord directly have a determined mathematical relationship, and the codeword can be generated by calculating the codeword value, and the codeword value can also be calculated by the codeword;
- the regular variable length coding may be a Columbus-Golomb-Rice or an index Columbus coded Exp-Golomb coding rule of different order; Golomb-Rice and Exp-Golomb are both Columbus codes, and the order is a Columbus coded parameter. , different orders have different coding formulas.
- the codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
- each syntax element code table is newly designed, and a fast code table retrieval is realized by the coding index, and the rule variable length/fixed length coding does not need to save the actual binary.
- the codeword eliminates the need for a large memory space and requires a bit-by-bit traversal operation. Under the premise of ensuring coding efficiency, the implementation complexity of the entropy decoding operation on the mobile terminal device is greatly improved, and is applicable to A portable terminal with limited hardware resources.
- 2 is a Zigzag scanning sequence diagram of a prediction residual block of the luminance of the embodiment 4X4 according to the embodiment of the present invention, wherein the numerical values in the squares indicate the luminance residual values, and the arrows indicate the scanning order.
- the residual coefficients of the 4X4 block are mapped to a one-dimensional sequence of 16 elements by Zigzag order: 0, 3, 0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 , 0.
- the residual coefficient syntax elements that need to be encoded include:
- a compressed stream can be obtained: 000010001110010111101101; where the residual coefficient syntax element Coeff_token (the number of non-zero coefficients TotalCoeffs and the number of trailing coefficients Trail ingOnes) is encoded as 0000100.
- the encoding of the residual coefficient syntax element Coeff_ token (the number of non-zero coefficients TotalCoeffs and the number of trailing coefficients TrailingOnes) is taken as an example to further illustrate a video entropy coding method proposed by the embodiment of the present invention.
- the encoding process of the coefficient syntax element Coeff_token is taken as an example to further illustrate a video entropy coding method proposed by the embodiment of the present invention.
- 5201 Scan a 4 ⁇ 4 luma prediction residual block to obtain a residual coefficient syntax element to be encoded; 4 ⁇ 4 luma prediction residual block Zigzag order is mapped to a 16-element data string: 0, 3,
- the mapping relationship between the coding index and the codeword value is established according to the probability statistical distribution of the syntax element to be encoded and the regular coding; in this example, the Golomb-Rice coding rule is adopted.
- this part of the embodiment is a lookup table. Operation, according to the index Codelndex lookup table 4, the codeword value and the regularly encoded parameters (orders, etc.) are obtained.
- the codeword value CodeNum is coded according to the codeword encoding rule, and the final code is obtained according to the codeword value and the codeword encoding rule, and the codeword is generated by the codeword value calculation.
- FIG. 3 is a schematic structural diagram of a video entropy coding apparatus according to an embodiment of the present invention.
- the apparatus includes an encoding syntax element acquisition module, a first conversion module, a second conversion module, and a first codeword acquisition module.
- a coding syntax element obtaining module configured to acquire a syntax element to be encoded in a block to be encoded;
- the syntax element to be encoded includes a residual coefficient syntax element or a non-residual coefficient syntax element;
- the non-residual coefficient syntax element includes a macroblock Type, reference frame index, quantization parameter, motion vector residual, coding model or intra prediction mode;
- a first conversion module configured to convert the syntax element to be encoded into a coding index; and include a probability distribution distribution mapping module;
- the probabilistic statistical distribution mapping module is configured to obtain probability statistical distribution information of a syntax element to be encoded in a block to be encoded, perform probability ranking on the to-be-encoded syntax element according to the probability statistical distribution information, and establish the to-be-encoded syntax.
- the first conversion module further includes a non-probability statistical distribution mapping module, and the non-probabilistic statistical distribution mapping module is configured to convert the non-residual coefficient syntax elements in the syntax element to be encoded according to the non-probabilistic statistical distribution mapping method.
- An encoding index; the non-probabilistic statistical distribution mapping method includes an unsigned direct mapping, a signed conversion to a symbol mapping or a mapping table manner;
- a second conversion module configured to convert the coding index into a codeword value
- the mapping manner of converting the code index Codelndex into a codeword value CodeNum may be a probability statistical distribution map or a non-probabilistic statistical distribution map
- the method for converting the coding index Codelndex into the codeword value CodeNum is to: establish a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded; wherein the mapping relationship follows The principle of the shortest average code length, the codeword value and the codeword of the mapped by the probability of the syntax element to be encoded: the short codeword is assigned to the large probability codeword value, and the long codeword is assigned by the small probability codeword value;
- the non-probabilistic statistical distribution mapping method of converting the encoding index Codelndex into a codeword value CodeNum is:
- CodeIndex axCodeNum+p (where a and ⁇ are integers); or establishing a mapping relationship between the coded value and the codeword value according to the mapping table;
- a first codeword obtaining module configured to encode the codeword value according to a codeword encoding rule, to obtain a final codeword;
- the codeword encoding rule may be a regular variable length coding or a regular fixed length coding
- the codeword has a regular codeword structure, and the codeword value CodeNum and the codeword CodeWord directly have a determined mathematical relationship, and the codeword can be generated by calculating the codeword value, and the codeword value can also be calculated by the codeword;
- the regular variable length coding may be a Columbus-Rice or an index Columbus coded Exp-Golomb coding rule of different order; the order is a Columbus coded parameter, and the coding formulas of different orders are different;
- the codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
- each syntax element code table is newly designed, and a fast code table retrieval is realized by the coding index, and the rule variable length/fixed length coding does not need to save the actual binary.
- the codeword eliminates the need for a large memory space and requires a bit-by-bit traversal operation. Under the premise of ensuring coding efficiency, the implementation complexity of the entropy decoding operation on the mobile terminal device is greatly improved, and is applicable to Portable end of limited hardware resources.
- a recording medium including the program of the video entropy coding method described in Embodiment 1, the video entropy coding method is described in detail in Embodiment 1, and details are not described herein again.
- Embodiment 5 A recording medium, including the program of the video entropy coding method described in Embodiment 1, the video entropy coding method is described in detail in Embodiment 1, and details are not described herein again.
- FIG. 4 is a flowchart of a video entropy decoding method according to an embodiment of the present invention, where the method includes the following steps:
- the codeword encoding rule may be a regular variable length coding or a regular fixed length coding
- the codeword has a regular codeword structure, the codeword value CodeNum and the codeword CodeWord There is a certain mathematical relationship directly, and the codeword can be generated by calculating the codeword value, and the codeword value can also be calculated by the codeword;
- the regular variable length coding may be a Columbus-Rice or exponential Columbus coded Exp-Golomb coding rule of different order; the order is a Columbus coded parameter, and the coding formulas of different orders are different;
- the codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
- a prefix of a codeword in a binary bitstream is in the form of 1, 01, 001, 0001, 00001, 000001, 0000001, 00000001, 000000001, 0000000001, 00000000001, 000000000001, 0000000000001, 00000000000001
- the first "1" detector method is generally used. Specifically, the binary bit stream is input, and a sequence of 0 plus one is detected first. Count the number of 0s. Such detectors are often named the first "1" detector. After the first "1" is detected, the number of the first 0 is assigned to the variable M_prefix to represent the prefix information. It can be concluded that the value of the variable M_prefix is 0, 1, 2, 3, 4 respectively. , 5, 6, 7, 8, 9, 10, 11, 12, 13.
- the mapping method for converting the codeword value CodeNum into the encoding index Codelndex may be a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method;
- Converting the codeword value CodeNum into a probabilistic statistical distribution map of the encoding index Codelndex The method is: establishing a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded; wherein the mapping relationship follows the principle of the shortest average code length, and the code mapped by the probability of the syntax element to be encoded Word value and codeword: The large probability codeword value is assigned a short codeword, and the small probability codeword value is assigned a long codeword;
- the non-probabilistic statistical distribution mapping method for converting the codeword value CodeNum into the encoding index Codelndex is:
- the syntax element to be encoded includes a residual coefficient syntax element or a non-residual coefficient syntax element.
- the embodiment of the present invention provides a low complexity entropy decoding method, which is constructed according to H. 264 CAVLC listing context adaptation.
- the multiple VLC tables the embodiment of the present invention only needs to control the mapping relationship between the code index Codelndex and the codeword value CodeNum, so that the effect of multiple VLC tables can be achieved, and the regular variable length/fixed length coding does not need to save the actual binary code words.
- CodewWord, saving codeword data and encoding index memory requirements is lower than saving binary codeword Codeword, saving resources.
- the following is a process step of entropy decoding to obtain a syntax element Coeff_token by entropy decoding of the binary bit stream after entropy coding in the embodiment of the present invention:
- the first "1" detector is used to read the codeword of the compressed bit stream, and the legal codeword generally has a string of 0 plus a prefix feature of 1, so that the first "1" can be detected.
- the number of the preceding 0 is assigned to the variable M_prefix, and then the entire binary codeword is obtained by the encoding rule of Golomb; the variable M_prefix is used to represent the prefix information in the codeword structure;
- the entropy-encoded binary bit stream is 0000 Ol lOxxxxx
- the form is 0000 Olxx, the length is 8, so continue to shift to read the 8-bit binary string: 0000 0110.
- the H.264 code table code word has no regularity, after reading bit by bit from the compressed bit stream, it is necessary to traverse the VLC table. If this is an n-bit code word, this requires 62 ⁇ .
- the embodiment of the present invention provides a low-complexity entropy decoding method, and the embodiment of the present invention only needs to control the encoding index Codelndex and the codeword value compared to the H.264 CAVLC listing the multiple VLC tables constructed by the context adaptation.
- the mapping between CodeNum can achieve the effect of multiple VLC tables, and there is no need to save the actual binary codeword CodewWord with regular variable length/fixed length encoding.
- the memory requirement for saving codeword data and encoding index is lower than saving binary codeword CodeWord. More resource saving.
- Table 6 (including Table 6a and Table 6b) shows the mapping relationship between the syntax elements Total_zeros, the code index CodeIndex, and the codeword value CodeNum in the embodiment of the present invention.
- the embodiment of the present invention sets the encoding index Codelndex equal to the syntax element Total_zeros, and uses the Golomb-Rice code as the encoding rule. 5701, reading an entropy-encoded binary bit stream, and acquiring a complete binary codeword according to a coding rule of Golomb-Rice;
- the first "1" detector is used to read the codeword of the compressed bit stream, and the legal codeword generally has a string of 0 plus a prefix feature of 1, so that the first "1" can be detected.
- the number of the preceding 0 is assigned to the variable M_prefix, and the entire binary codeword is obtained by the encoding rule of Golomb; the variable M_prefix is used to represent the prefix information in the codeword structure;
- the entropy-encoded binary bit stream is OlOlOxxxxx
- the complete codeword can be quickly determined without the need for bit-by-bit reading of the traditional variable length code table and cumbersome operation of traversing the VLC table, thereby reducing the calculation of entropy decoding.
- Complexity suitable for resource-constrained applications.
- This code table can be improved by combining the first "1" detection method to optimize the codeword. For example, 0001 10 is the longest and only codeword of this length, so it can be reached by judging the "0" after the number "1" is ignored. Further refine the effect of the codeword to obtain a better compression ratio.
- Embodiments of the present invention provide a low complexity entropy decoding method, compared to
- H. 264 CAVLC lists multiple VLC tables constructed by context adaptation.
- only the mapping relationship between the code index Codelndex and the codeword value CodeNum can be controlled, and the effect of multiple VLC tables can be achieved, and the rules are changed.
- the long/fixed length encoding does not need to save the actual binary codeword CodewWord.
- the memory requirement for saving the codeword data and the encoding index is lower than saving the binary codeword Codeword, which saves resources.
- FIG. 5 is a schematic structural diagram of a video entropy decoding apparatus according to an embodiment of the present invention.
- the apparatus includes: a complete codeword acquisition module, a codeword value acquisition module, a third conversion module, and a second syntax element acquisition module.
- a complete codeword obtaining module configured to read the entropy-encoded binary bit stream, perform calculation according to the codeword encoding rule, and obtain a complete binary codeword
- the codeword encoding rule may be a regular variable length coding or a regular fixed length coding
- the regular variable length coding may be a Columbus-Rice or exponential Columbus coded Exp-Golomb coding rule of different order; the order is a Columbus coded parameter, and the coding formulas of different orders are different;
- the codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
- the complete codeword acquisition module includes a binary bit stream reading module and a codeword prefix information acquisition module.
- Block and second codeword acquisition module
- a binary bit stream reading module configured to read the entropy encoded binary bit stream
- a codeword prefix information obtaining module configured to acquire a number of “0”s before the first “1” in the binary bit stream, The number is used as prefix information in the codeword structure
- a second codeword obtaining module configured to obtain a complete binary codeword according to the prefix information and the codeword encoding rule
- a codeword value obtaining module configured to calculate, according to the codeword encoding rule, the codeword value
- a third conversion module configured to convert the codeword value into an encoding index
- the mapping manner of converting the codeword value CodeNum into the encoding index Codelndex may be a probability statistical distribution mapping manner or a non-probabilistic statistical distribution mapping manner;
- the probability distribution distribution mapping manner of converting the codeword value CodeNum into the coding index Codelndex is: establishing a mapping relationship between the coding index and the codeword value according to a probability statistical distribution of the syntax element to be encoded; wherein the mapping relationship follows an average The principle of the shortest code length, the codeword value and the codeword of the mapped by the probability of the syntax element to be encoded: the short codeword is assigned to the large probability codeword value, and the long codeword is assigned by the small probability codeword value;
- the non-probabilistic statistical distribution mapping method of converting the codeword value CodeNum into the encoding index Codelndex is:
- the second syntax element obtaining module is configured to obtain a corresponding syntax element according to the encoding index.
- the embodiment of the present invention provides a low complexity entropy decoding method, which is compared with the ⁇ . 264 CAVLC listing context adaptive The VLC table, the embodiment of the present invention only needs to control the mapping relationship between the code index Codelndex and the codeword value CodeNum, so that the effect of multiple VLC tables can be achieved, and the regular variable length/fixed length coding does not need to save the actual binary codeword CodewWord. Saving memory for codeword data and encoding index is lower than saving binary codeword Codeword, which saves resources.
- a recording medium including the program of the video entropy decoding method described in Embodiment 5, the video entropy decoding method is described in detail in Embodiment 5, and details are not described herein again.
- the storage medium may be a ROM, a RAM, a magnetic disk, an optical disk, or the like.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The present invention discloses a method, device and medium for video entropy encoding and entropy decoding. The entropy encoding method includes the following steps of: acquiring a syntactic element to be encoded wherein the syntactic element is in a block to be encoded; converting the syntactic element to be encoded into a code index; converting the code index into a codeword number; and encoding the codeword number according to a codeword code rule and acquiring a final codeword. By introducing code indexes and regular variable length/fixed length encoding methods, the present invention newly designs each syntactic element code table and realizes quick code table search by the code indexes, thereby avoiding the problems of that the conventional variable length code table requires to occupy biggish memory space and requires a bitwise traverse operation. On the premise of ensuring encoding efficiency, the present invention greatly reduces implementation complexities of entropy encoding and entropy decoding operations on a mobile terminal apparatus. The present invention is applied to a portable terminal whose hardware resources are restricted.
Description
一种视频熵编码、 熵解码方法、 装置及介质 Video entropy coding, entropy decoding method, device and medium
技术领域 Technical field
本发明涉及视频编码技术领域, 尤其涉及一种视频熵编码、 熵解码方法、 装置及介质。 The present invention relates to the field of video coding technologies, and in particular, to a video entropy coding, an entropy decoding method, an apparatus, and a medium.
背景技术 Background technique
视频压缩国际标准诸如 MPEG-x和 H. 26x等都是基于块的混合压缩算法, 通过运动估计 /运动补偿消除视频时间冗余, 对差值图像进行离散余弦变换变 换消除空间冗余,对量化后的系数进行熵编码消除统计冗余。熵编解码是视频 编码的重要组成部分,熵编码的对象是视频编码算法中各种功能模块生成的一 系列语法元素, 其目的是有效地去除数据的统计冗余。这些语法元素可分类两 类:残差系数语法元素和非残差系数语法元素。残差系数语法元素的信息量最 大, 是熵编码的处理重点,残差系数的语法元素通过扫描经过变换和量化处理 后的块残差系数获得。非残差系统的语法元素由如帧内预测、帧间预测和量化 等视频编码环节生成并输入到熵编码模块进行处理的,非残差系统的语法元素 包括宏块类型、 参考帧索引、 量化参数、 运动矢量残差、 编码模型、 帧内预测 模式等。 在视频编码中, 宏块是视频编码的基本单元, 宏块大小为 16 X 16, 每个宏块由 4个 4 X 4块组成, 每个块由 1个 4 X 4亮度块和 2个色度块组成。 International standards for video compression, such as MPEG-x and H.26x, are block-based hybrid compression algorithms that eliminate video temporal redundancy by motion estimation/motion compensation, discrete cosine transform transformation of difference images to eliminate spatial redundancy, and quantization The coefficients after entropy coding eliminate statistical redundancy. Entropy codec is an important part of video coding. Entropy coding is a series of syntax elements generated by various functional modules in video coding algorithms. Its purpose is to effectively remove statistical redundancy of data. These syntax elements can be classified into two categories: residual coefficient syntax elements and non-residual coefficient syntax elements. The residual coefficient syntax element has the largest amount of information and is the processing focus of entropy coding. The syntax elements of the residual coefficient are obtained by scanning the block residual coefficients after transformation and quantization. The syntax elements of the non-residual system are generated by video coding links such as intra prediction, inter prediction, and quantization, and input to the entropy coding module for processing. The syntax elements of the non-residual system include macroblock type, reference frame index, and quantization. Parameters, motion vector residuals, coding models, intra prediction modes, etc. In video coding, a macroblock is the basic unit of video coding. The macroblock size is 16 X 16, each macroblock consists of four 4 X 4 blocks, each block consists of one 4 X 4 luma block and two colors. The block is composed.
MPEG- 1、 H. 261、 MPEG- 2、 H. 263、 MPEG- 4以及最新的 H. 264视频标准对 块预测残差系数的编码方法分类如下: The encoding methods for block prediction residual coefficients of MPEG-1, H.261, MPEG-2, H.263, MPEG-4, and the latest H.264 video standards are classified as follows:
( 1 ) H. 261、 MPEG- 1、 MPEG- 2标准的 2D-VLC (Variable Length Coding) 熵编码; (1) 2D-VLC (Variable Length Coding) entropy coding of H. 261, MPEG-1, and MPEG-2 standards;
(2 ) H. 263、 MPEG- 4标准的 3D- VLC熵编码; (2) H. 263, 3D-VLC entropy coding of the MPEG-4 standard;
( 3 ) H. 264/AVC 标准的基于上下文的 自适应变长编码 CAVL (Context-Based Adaptive Variable Length Coding, CAVLC ) 禾口 基于上下文的二进制算术编码 CABAC ( Context-Based Adaptive Binary Arithmetic Coding, CABAC)。 (3) H. 264/AVC standard context-based adaptive variable length coding (CAVL) and context-based adaptive binary arithmetic coding CABAC (Context-Based Adaptive Binary Arithmetic Coding, CABAC) .
图像块的残差系数经过变换量化环节处理后, 会得到一个二维残差系数, 为了进一步进行处理, 一般会采用扫描将二维系数转换为一维序列; 对这个一
维序列的表征方法有多种方式, 不同的表征方法定义各自的语法元素; 反之, 采用语法元素可重构出一维序列。 与这些语法元素相关的残差编码参数主要 有: Level、 Run以及数据结束符 EOB (End of Block) 等。 通常熵编码先对预 测变换量化后的系数进行 Zigzag扫描进行预处理, 把扫描中遇到的非零系数 记为 Level , —个非零系数前的连续零系数游程记为 Run。 After the residual coefficient of the image block is processed by the transform quantization step, a two-dimensional residual coefficient is obtained. For further processing, the two-dimensional coefficient is generally converted into a one-dimensional sequence by scanning; There are many ways to represent a dimensional sequence. Different representation methods define their own syntax elements. Conversely, a one-dimensional sequence can be reconstructed using syntax elements. The residual coding parameters associated with these syntax elements are: Level, Run, and End of Block EOB (End of Block). Usually, the entropy coding first performs Zigzag scanning on the quantized coefficients of the prediction transform, and records the non-zero coefficients encountered in the scan as Level, and the continuous zero-coefficient run before the non-zero coefficients is recorded as Run.
具体来说: 2D-VLC 熵编码采用残差系数的联合编码 (Level , Run) 数据 对, 并对 E0B编码, E0B单独分配一个码字; 3D-VLC熵编码器将数据结束信息 整合到(Level , Run)数据对中, 形成三维数据组(Level , Run, Last ) , Last 表示当前系数是否为块内最后一个系数, 这样可以不用对结束标志符进行编 码,并且发挥 Level、Run和 E0B的联合概率; H. 264/AVC视频编码标准的 CAVLC 熵编码充分利用了上下文信息, 通过建立多个码表对 4 X 4块的残差信息进行 了很好的优化, 将 Level、 Run分开进行编码, 取得了很好的编码效果。 上述 熵编码方法都是属于变长编码器, 其编码基本原理仍然遵循哈夫曼(Huffman) 编码原理, 即大概率的符号分配短码字、 小概率的符号分配长码字, 从而达到 平均码长最短的目的。 H. 264/AVC的 CABAC熵编码属于算术编码器, 算术编码 的性能要优于变长编码,而且 CABAC通过自适应的概率估计和更新以及二进制 算术编码, 更加逼近香农定理, 编码效果更高, 但其算法计算复杂度高, 硬件 实现要求复杂, 是一种以软硬件的复杂度换取编码效率的提高。 Specifically: 2D-VLC entropy coding uses joint coding (Level, Run) data pairs of residual coefficients, and E0B coding, E0B is assigned a codeword separately; 3D-VLC entropy encoder integrates data end information into (Level , Run) data alignment, form a three-dimensional data set (Level, Run, Last), Last indicates whether the current coefficient is the last coefficient in the block, so that you can not encode the end identifier, and play the combination of Level, Run and E0B. Probability; The CAVLC entropy coding of the H.264/AVC video coding standard makes full use of the context information. The residual information of 4×4 blocks is optimized by establishing multiple code tables, and the Level and Run are separately coded. A good coding effect has been achieved. The above entropy coding methods are all variable length coder, and the basic principle of coding still follows the Huffman coding principle, that is, a large probability symbol assigns a short codeword, and a small probability symbol assigns a long codeword, thereby achieving an average code. The shortest purpose. H. 264/AVC CABAC entropy coding belongs to arithmetic coder, the performance of arithmetic coding is better than variable length coding, and CABAC is closer to Shannon's theorem through adaptive probability estimation and update and binary arithmetic coding, and the coding effect is higher. 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.
可以看出,上述视频编码标准通过分析块预测残差系数不同状态下的概率 统计分布, 进行基于上下文的编码可以获得更高的编码效率。 H. 264/AVC标准 中的 CAVLC充分利用了残差系数不同状态下的概率统计分布,自适应地采用多 个码表编码一个相应的语法元素, CAVLC是以目前已发布视频标准中编码效率 最高的上下文自适应变长编码技术。对于移动视频等实时视频通信这类应用场 合而言, 熵编解码技术采用了指数哥伦布编码 Exp-Golomb和 CAVLC, 指数哥 伦布编码主要是针对运动矢量等非残差信息进行编码; CAVLC编码主要对于预 测残差进行编码。指数哥伦布编码和 CAVLC的编码都符合 Huffman编码的基本 思想: 短码字表示高概率信息, 长码字表示低概率信息。但指数哥伦布编码是 一种基于符号概率统计进行的有规则变长编码; CAVLC在传统变长编码方法的 基础上, 通过引入内容自适应模型, 定义了多组结构不同的码表, 根据编码码 字特征,动态的进行码表切换,提高编码效率。 CAVLC的解码过程计算量过大, 一方面, CAVLC解码必须从连续的比特流中分辨各个长度不同的码字, 如采用 全搜索算法需要遍历整个二叉树, 需要进行多次读取和判断, 因此查表过程耗
费时间很多; 另一方面, 由于码字树很稀疏, 码表的存储空间随着码字长度的 增加成指数增长, 但其中的绝大部分是空置的, 没有得到有效利用。 It can be seen that the above video coding standard can obtain higher coding efficiency by performing context-based coding by analyzing the probability distribution of the block prediction residual coefficients in different states. The CAVLC in the H.264/AVC standard makes full use of the probability and statistical distribution of different residual coefficients, and adaptively uses a plurality of code tables to encode a corresponding syntax element. CAVLC is the most efficient coding in the currently published video standard. Context adaptive variable length coding techniques. For applications such as real-time video communication such as mobile video, the entropy codec technology uses the exponential Columbus code Exp-Golomb and CAVLC, and the index Columbus code mainly encodes non-residual information such as motion vectors; CAVLC coding is mainly for prediction. The residual is encoded. Both the index Columbus code and the CAVLC code conform to the basic idea of Huffman coding: short code words represent high probability information and long code words represent low probability information. However, the index Columbus coding is a regular variable length coding based on symbolic probability statistics. Based on the traditional variable length coding method, CAVLC defines multiple sets of different code tables by introducing content adaptive models. Word features, dynamic code table switching, improve coding efficiency. The decoding process of CAVLC is too large. 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. Table process consumption On the other hand, because the codeword tree is sparse, the storage space of the codebook grows exponentially with the increase of the codeword length, but most of them are vacant and are not effectively utilized.
H. 264的熵编码通过良好的上下文自适应设计获得了很好的编码效率, 但 这些都是以过多码表为代价的,过多的码表意味着编解码操作需要更多的计算 资源。特别是对移动视频业务系统而言, 由于便携式移动终端的计算硬件、 电 池功耗的有限资源等因素, 高复杂度的视频熵解码实现还面临诸多问题:熵解 码器的诸多码表需要通过查找表 LUT (Look Up Table ) 结构实现, 占用较大 的内存空间,熵解码过程时往往需要逐位遍历查找表匹配码字, 反复读写内存 操作也会导致功耗的剧增。 The entropy coding of H.264 achieves good coding efficiency through good context adaptive design, but these are at the cost of too many code tables. Too many code tables mean that the codec operation requires more computing resources. . Especially for the mobile video service system, due to factors such as the computing hardware of the portable mobile terminal and the limited resources of the battery power consumption, the high complexity video entropy decoding implementation still faces many problems: many code tables of the entropy decoder need to be searched. The LUT (Look Up Table) structure is implemented, which occupies a large memory space. The entropy decoding process often needs to traverse the lookup table to match the codewords bit by bit. Repeated read and write memory operations will also lead to a sharp increase in power consumption.
发明内容 Summary of the invention
本发明实施例的目的在于提出一种视频熵编码方法,旨在解决现有技术传 统变长码表占用较大的内存空间、需逐位遍历操作,熵编解码复杂度高的问题。 The purpose of the embodiment of the present invention is to provide a video entropy coding method, which aims to solve the problem that the conventional variable length code table occupies a large memory space, requires a bit-by-bit traversal operation, and has high complexity of entropy coding and decoding.
本发明实施例的方法是这样实现的,一种视频熵编码方法,所述方法包括: 获取待编码块中的待编码语法元素; The method of the embodiment of the present invention is implemented as a video entropy coding method, where the method includes: acquiring a syntax element to be encoded in a block to be coded;
将所述待编码语法元素转化为编码索引; Converting the syntax element to be encoded into a coding index;
将所述编码索引转化为码字数值; Converting the encoded index into a codeword value;
根据码字编码规则对所述码字数值进行编码, 获取最终码字。 The codeword value is encoded according to a codeword encoding rule to obtain a final codeword.
本发明实施例的第二目的在于提出一种视频熵编码装置, 所述装置包括: 编码语法元素获取模块, 用于获取待编码块中的待编码语法元素; 第一转化模块, 用于将所述待编码语法元素转化为编码索引; A second object of the embodiments of the present invention is to provide a video entropy coding apparatus, where the apparatus includes: an encoding syntax element acquiring module, configured to acquire a syntax element to be encoded in a block to be encoded; Decoding the coding syntax element into a coding index;
第二转化模块,用于将所述编码索引转化为码字数值;所述将所述编码索 引转化为码字数值的映射方式包括概率统计分布映射或非概率统计分布映射; 第一码字获取模块,用于根据码字编码规则对所述码字数值进行编码,获 取最终码字。 a second conversion module, configured to convert the encoding index into a codeword value; the mapping manner of converting the encoding index into a codeword value comprises a probability statistical distribution mapping or a non-probability statistical distribution mapping; And a module, configured to encode the codeword value according to a codeword encoding rule to obtain a final codeword.
本发明实施例的第三目的在于提出一种记录介质,包括所述的视频熵编码 方法的程序。 A third object of embodiments of the present invention is to provide a recording medium including the program of the video entropy encoding method.
本发明实施例的第四目的在于提出一种视频熵解码方法, 所述方法包括: 读取熵编码后的二进制比特流,根据码字编码规则进行计算,获取完整的
二进制码字; A fourth object of the embodiments of the present invention is to provide a video entropy decoding method, where the method includes: reading an entropy encoded binary bit stream, performing calculation according to a codeword encoding rule, and obtaining a complete Binary code word
将所述二进制码字按照所述码字编码规则计算得出码字数值; Calculating the codeword value according to the codeword encoding rule by using the binary codeword;
将所述码字数值转化为编码索引; Converting the codeword value into an encoding index;
根据所述编码索弓 I获取相应的语法元素。 Corresponding syntax elements are obtained according to the encoding.
本发明实施例的第五目的在于提出一种视频熵解码装置, 所述装置包括: 完整码字获取模块,用于读取熵编码后的二进制比特流, 根据码字编码规 则进行计算, 获取完整的二进制码字; A fifth object of the embodiments of the present invention is to provide a video entropy decoding apparatus, where the apparatus includes: a complete codeword acquisition module, configured to read an entropy encoded binary bit stream, perform calculation according to a codeword encoding rule, and obtain a complete Binary code word;
码字数值获取模块,用于将所述二进制码字按照所述码字编码规则计算得 出码字数值; a codeword value obtaining module, configured to calculate, according to the codeword encoding rule, the codeword value;
第三转化模块, 用于将所述码字数值转化为编码索引; a third conversion module, configured to convert the codeword value into an encoding index;
第二语法元素获取模块, 用于根据编码索引获取相应的语法元素。 The second syntax element obtaining module is configured to obtain a corresponding syntax element according to the encoding index.
本发明实施例的第六目的在于提出一种记录介质,包括所述的视频熵解码 方法的程序。 A sixth object of the embodiments of the present invention is to provide a recording medium including the program of the video entropy decoding method.
本发明的有益效果 Advantageous effects of the present invention
本发明实施例通过获取待编码块中的待编码语法元素, 将所述待编码语法 元素转化为编码索引,将所述编码索引转化为码字数值,对所述码字数值进行 有规则变长编码或定长编码, 获取最终码字; 本发明实施例的关键思想是通过 有规则码字去匹配语法元素的上下文适应概率分布,通过引入编码索引来替换 In the embodiment of the present invention, the syntax element to be encoded in the block to be encoded is obtained, and the syntax element to be encoded is converted into a coding index, and the coded index is converted into a codeword value, and the codeword value is regularly lengthened. Coding or fixed length coding, obtaining the final codeword; The key idea of the embodiment of the present invention is to replace the context adaptation probability distribution of the syntax element by the regular codeword, and replace by introducing the coding index
CAVLC的诸多码表设计, 消除了传统变长码表需要占用较大的内存空间和需逐 位遍历操作,在保障了编码效率前提下, 极大降低了移动终端设备上熵编码和 熵解码的实现复杂度, 适用于硬件资源受限的便携式终端。 CAVLC's many code table designs eliminate the need for the traditional variable length code table to occupy a large memory space and need to be traversed bit by bit. Under the premise of ensuring coding efficiency, the entropy coding and entropy decoding on the mobile terminal device are greatly reduced. Implementation complexity, suitable for portable terminals with limited hardware resources.
附图说明 DRAWINGS
图 1是本发明的视频熵编码方法的优选实施例的流程图; 1 is a flow chart of a preferred embodiment of a video entropy encoding method of the present invention;
图 2是本发明的视频熵编码方法的优选实施例的 4 X 4亮度的预测残差块 的 Zigzag扫描顺序图; 2 is a Zigzag scanning sequence diagram of a prediction residual block of 4×4 luminance of a preferred embodiment of the video entropy encoding method of the present invention;
图 3是本发明的视频熵编码装置的优选实施例的结构 ^ Figure 3 is a diagram showing the structure of a preferred embodiment of the video entropy coding apparatus of the present invention ^
图 4是本发明的视频熵解码方法的优选实施例的流程图; 4 is a flow chart of a preferred embodiment of a video entropy decoding method of the present invention;
图 5是本发明的视频熵编码装置的优选实施例的结构 ^
具体实施方式 为了使本发明的目的、技术方案及优点更加清楚明白, 以下结合附图和实 施例, 对本发明进行进一步详细说明, 为了便于说明, 仅示出了与本发明实施 例相关的部分。 应当理解, 此处所描写的具体实施例, 仅仅用于解释本发明, 并不用以限制本发明。 Figure 5 is a diagram showing the structure of a preferred embodiment of the video entropy encoding apparatus of the present invention ^ 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.
本发明实施例通过获取待编码块中的待编码语法元素,将所述待编码语法 元素转化为编码索引,将所述编码索引转化为码字数值,对所述码字数值进行 有规则变长编码或定长编码, 获取最终码字; 本发明实施例通过引入编码索引 和有规则变长 /定长编码方法, 全新设计了各个语法元素码表, 由编码索引实 现快速的码表检索,消除了传统变长码表需要占用较大的内存空间和需逐位遍 历操作, 在保障编码效率的前提下, 极大提高了移动终端设备上熵解码操作的 实现复杂度, 适用于硬件资源受限的便携式终端。 实施例一 In the embodiment of the present invention, the syntax element to be encoded in the block to be encoded is obtained, and the syntax element to be encoded is converted into a coding index, and the coded index is converted into a codeword value, and the codeword value is regularly lengthened. Encoding or fixed length coding, obtaining the final codeword; In the embodiment of the present invention, by introducing a coding index and a regular variable length/fixed length coding method, a code table of each syntax element is newly designed, and a fast code table retrieval is realized by the coding index to eliminate The traditional variable length code table needs to occupy a large memory space and needs to be traversed bit by bit. Under the premise of ensuring coding efficiency, the implementation complexity of the entropy decoding operation on the mobile terminal device is greatly improved, and the hardware resource is limited. Portable terminal. Embodiment 1
图 1所示为本发明实施例一种视频熵编码方法流程图,所述方法包括以下 步骤: FIG. 1 is a flowchart of a video entropy coding method according to an embodiment of the present invention, where the method includes the following steps:
S101 , 获取待编码块中的待编码语法元素; S101. Obtain a syntax element to be encoded in the block to be encoded.
所述待编码语法元素包括: 残差系数语法元素或非残差系数语法元素; 获取残差系数语法元素的方法如下: The syntax element to be encoded includes: a residual coefficient syntax element or a non-residual coefficient syntax element; the method for obtaining the residual coefficient syntax element is as follows:
A) 对预测量化后的待编码块残差系数按照扫描顺序进行重排序, 将二维 残差系数排列成一维序列; A) reordering the residual coefficients of the block to be coded after prediction and quantization according to the scanning order, and arranging the two-dimensional residual coefficients into a one-dimensional sequence;
所述扫描顺序为 Zigzag扫描重排序方法; The scanning sequence is a Zigzag scan reordering method;
B) 根据所述一维序列获取待编码块残差系数语法元素; B) acquiring a block residual coefficient syntax element to be coded according to the one-dimensional sequence;
根据所述一维序列获取待编码块残差系数语法元素具体为:根据一维序列 中残差系数的统计特征, 获取相应的语法元素; 相应的语法元素可以表征一维 序列。 Obtaining, according to the one-dimensional sequence, a block residual coefficient syntax element is: obtaining a corresponding syntax element according to a statistical feature of the residual coefficient in the one-dimensional sequence; and the corresponding syntax element can represent the one-dimensional sequence.
语法元素可以表征一维序列的所有信息,即只依赖语法元素重构出一维序
列。 但是, 作为视频编码的熵编码部分, 往往希望利用残差系数的统计特征, 减少保存这些信息的位数。 下面一示例说明: A grammar element can represent all the information of a one-dimensional sequence, that is, it only reconstructs a one-dimensional order by relying on grammatical elements. Column. However, as part of the entropy coding of video coding, it is often desirable to use the statistical characteristics of the residual coefficients to reduce the number of bits in which the information is stored. The following example illustrates:
示例: 一个 16元素的一维序列数据串: 0, 3, 0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0。 采用游程编码的思想: 设 0游程为 run, 非零系数为 level , 采用 (run, level )游程对表示所述一位序列即为 (1, 3 ), (1, 1 ), (0, -1 ) , (0, -1 ) , (1, 1 ) 和一个结束符 E0B。 可以看出要无损地保存 16个一维序列残差信息, 需要的信息位数为 16xH (H为每一个系数保存需要 的二进制位数); 而采用游程编码后, 可以获得 5个(run, level )游程对, 如 果定义游程对为语法元素, 在不考虑游程对 /语法元素的概率分布情况 (等概 率情况, 熵值最大) 时, 给游程对中每个数据分配 H位, 所需的总共信息位为 HxH, 其中, 结束符 E0B分配 H位)。 因此, 所需的位数要远少于原始序列保 存所需位数。而且, 实际上语法元素的概率分布是非概率分布, 其熵值小于等 概率的熵值, 换句话说, 可以用更少的位数保存所有数据。 Example: A 16-element one-dimensional sequence data string: 0, 3, 0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0. The idea of using run-length coding: Let 0 run as run, non-zero coefficient be level, and use (run, level) run pairs to represent the one-bit sequence is (1, 3), (1, 1), (0, - 1), (0, -1), (1, 1) and a terminator E0B. It can be seen that to preserve 16 one-dimensional sequence residual information losslessly, the required number of bits of information is 16xH (H is the number of binary digits required for each coefficient preservation); and after run-length coding, 5 (run, Level ) Run pair, if the run pair is defined as a syntax element, regardless of the probability distribution of the run-pair/syntax element (the equal probability case, the entropy value is the largest), assign H bits to each data in the run-pair pair, required The total information bit is HxH, where the terminator E0B is assigned the H bit). Therefore, the number of bits required is much less than the number of bits required to save the original sequence. Moreover, the probability distribution of the grammatical elements is actually a non-probability distribution whose entropy value is less than the entropy value of the equal probability, in other words, all data can be saved with fewer bits.
如根据 H. 264、 MPEG_2、 MPEG-4编码标准对所述一维序列的语法元素获取 方式可分为单数据方式、 数据对方式或数据组方式; For example, the syntax element acquisition manner of the one-dimensional sequence according to the H.264, MPEG_2, and MPEG-4 coding standards may be classified into a single data mode, a data pair mode, or a data group mode;
通过单数据方式获取的残差系数语法元素包括: 非零系数的数目 TotalCoeffs、 拖尾系数的数目 Trai l ingOnes、 非零系数前零的数目 Total— zeros、 非零系数幅值 Level禾口游程 Run— before; The residual coefficient syntax elements obtained by the single data method include: the number of non-zero coefficients TotalCoeffs, the number of trailing coefficients Trai l ingOnes, the number of zeros before the zero coefficient Total_zeros, the non-zero coefficient magnitude Level and run Run — before;
通过数据对方式获取的残差系数语法元素包括: (Level、 Run ) 数据对和 数据结束符; The residual coefficient syntax elements obtained by data pairing include: (Level, Run) data pair and data terminator;
通过数据组方式获取的残差系数语法元素包括:三维数据组(Level , Run, Last ) ; The residual coefficient syntax elements obtained by the data group method include: a three-dimensional data group (Level , Run, Last );
所述非残差系数语法元素包括宏块类型、参考帧索引、量化参数、运动矢 量残差、 编码模型或帧内预测模式; The non-residual coefficient syntax element includes a macroblock type, a reference frame index, a quantization parameter, a motion vector residual, an encoding model, or an intra prediction mode;
S102 , 将所述待编码语法元素转化为编码索引 Codelndex; S102, converting the syntax element to be encoded into an encoding index Codelndex;
所述待编码语法元素包括: 残差系数语法元素或非残差系数语法元素; 所述将待编码语法元素转化为编码索引的方法可以为概率统计分布映射 方法或非概率统计分布映射方法;
将待编码语法元素转化为编码索引的概率统计分布映射方法, 具体为:The syntax element to be encoded includes: a residual coefficient syntax element or a non-residual coefficient syntax element; the method for converting the syntax element to be encoded into a coding index may be a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method; A probability and statistical distribution mapping method for converting a syntax element to be encoded into a coding index, specifically:
A) ,获取待编码块中的待编码语法元素的概率统计分布信息;所述概率统 计分布信息是待编码语法元素的概率分布统计值; A) obtaining probability statistical distribution information of the syntax element to be encoded in the block to be coded; the probability distribution information is a probability distribution statistical value of the syntax element to be encoded;
具体为: Specifically:
1)获取预测量化后的待编码块残差系数; 1) obtaining a prediction residual quantized block residual coefficient;
2)根据所述待编码块残差系数统计基于上下文模型的语法元素的概率 统计分布值, 作为所述待编码语法元素的概率统计分布信息; 2) counting a probability statistical distribution value of the syntax element based on the context model according to the residual coefficient of the block to be encoded, as the probability statistical distribution information of the syntax element to be encoded;
所述上下文模型是根据前后信息的相互依赖关系建立起来的联合概率。 所述前后信息表示已处理数据单元和当前待处理数据单元, 包括图像组、 帧、 片、 块等数据粒度, 本发明实施例中的前后信息是已处理块和当前待处理块; 所述数据相互依赖关系包括: a)相邻块之间的空间相关性; 由于同一帧 中相邻块往往具有很大程度的空间相关性, 当前块的信息可以通过相邻块预 测。 b ) 语法元素之间本来具备的数学制约关系。 在视频编码里, 一般将上下 文模型简称成上下文, 其信息论理论在于: 联合熵要小于信源熵之和, 从而进 一步提高压缩效率。 The context model is a joint probability established based on the interdependence of information before and after. The front and rear information indicates the processed data unit and the current data unit to be processed, including the image group, the frame, the slice, the block, and the like. The front and rear information in the embodiment of the present invention is the processed block and the current to-be-processed block; Interdependencies include: a) Spatial correlation between neighboring blocks; Since neighboring blocks in the same frame tend to have a large degree of spatial correlation, information of the current block can be predicted by neighboring blocks. b) The mathematical constraints inherent in the grammatical elements. In video coding, the context model is generally referred to as context. The theory of information theory is that the joint entropy is smaller than the sum of the source entropy, which further improves the compression efficiency.
进一步地,还可以合并概率统计分布值接近的概率统计分布信息,得到合 并后的语法元素的概率统计分布值,作为所述待编码语法元素的概率统计分布 信息。 Further, the probability statistical distribution information of the probabilistic statistical distribution values may be combined to obtain a probability statistical distribution value of the merged syntax elements as the probability statistical distribution information of the syntax elements to be encoded.
B) ,根据所述概率统计分布信息对所述待编码语法元素进行概率排序;所 述概率排序可以为升序或降序; B), performing probability ordering on the syntax elements to be encoded according to the probability statistical distribution information; the probability ordering may be ascending or descending;
0, 建立所述待编码语法元素与编码索引的映射关系; 0, establishing a mapping relationship between the syntax element to be encoded and an encoding index;
所述"建立语法元素和编码索引的概率统计分布映射"步骤中,建立非残 差系数语法元素与编码索引的映射,可以是建立单个非残差系数语法元素与编 码索引 Codelndex的映射,也可以是建立多个非残差系数语法元素与编码索引 In the step of “establishing a probability and statistical distribution map of syntax elements and coding indexes”, establishing a mapping of non-residual coefficient syntax elements and coding indexes may be mapping of a single non-residual coefficient syntax element and a coding index Codelndex, or Is to create multiple non-residual coefficient syntax elements and coding index
Codelndex的映射的联合映射。 Joint mapping of the mapping of Codelndex.
所述"建立多个非残差系数语法元素与编码索引 Codelndex的映射的联合 映射"可以为综合多个非残差系数语法元素的联合概率分布情况来建立相应的
非残差系数语法元素映射表,或对所述非残差系数语法元素分组后进行综合编 码。 The "joining a joint map of a plurality of non-residual coefficient syntax elements and a code index of a code index" may be used to synthesize a joint probability distribution of a plurality of non-residual coefficient syntax elements to establish a corresponding A non-residual coefficient syntax element mapping table, or grouping the non-residual coefficient syntax elements and performing comprehensive coding.
进一步地, further,
将待编码语法元素中的非残差系数语法元素转化为编码索引的非概率统计 分布映射方法包括无符号直接映射、 有符号转化为符号映射或映射表方式: A non-probabilistic statistical distribution mapping method that converts non-residual coefficient syntax elements in a syntax element to be encoded into a coding index includes unsigned direct mapping, signed conversion to symbol mapping, or mapping table mode:
( 1 )无符号直接映射。这种映射方式的语法元素包括宏块类型、 参数帧索 引等。 (1) Unsigned direct mapping. The syntax elements of this mapping method include macroblock type, parameter frame index, and the like.
CodeNum=CodeIndex=v, v是非残差系数语法元素的数值 CodeNum=CodeIndex=v, v is the value of the non-residual coefficient syntax element
(2 )有符号转化为符号映射。这种映射方式的语法元素主要包括运动矢量 差值、 量化因子增量等。
(2) Signed into a symbol map. The syntax elements of this mapping method mainly include motion vector difference values, quantization factor increments, and the like.
(3 ) 映射表。 通过制定映射表规定非残差系数语法元素到第二编码索引 Codelndex的映射关系。 主要用于块编码模式、 帧内预测模式等参数的映射。 (3) Mapping table. The mapping relationship between the non-residual coefficient syntax element and the second coding index Codelndex is specified by formulating a mapping table. It is mainly used for mapping of parameters such as block coding mode and intra prediction mode.
表 7为本发明实施例 4 X 4亮度块帧内预测模式和编码索引 Codelndex的 映射表关系表, 此表对单个非残差系数语法元素与编码索引进行映射。 Table 7 is a mapping table relationship table of the X 4 luma block intra prediction mode and the encoding index Codelndex according to the embodiment of the present invention. The table maps a single non-residual coefficient syntax element and an encoding index.
表 7 Table 7
S103 : 将所述编码索引 Codelndex转化为码字数值 CodeNum; 所述将所述编码索引 Codelndex转化为码字数值 CodeNum的映射方法可以 为概率统计分布映射方法或非概率统计分布映射方法; S103: Convert the code index Codelndex into a codeword value CodeNum; the mapping method for converting the code index Codelndex into a codeword value CodeNum may be a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method;
将所述编码索引 Codelndex转化为码字数值 CodeNum的概率统计分布映射 方法为:根据待编码语法元素的概率统计分布信息建立所述编码索引和码字数 值的映射关系; 其中, 所述映射关系遵循平均码长最短原则, 由待编码语法元 素的概率指导映射的码字数值和码字: 大概率码字数值分配短码字, 小概率码 字数值分配长码字; The probability distribution distribution mapping method of converting the coding index Codelndex into the codeword value CodeNum is: establishing a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded; wherein the mapping relationship follows The principle of the shortest average code length, the codeword value and the codeword of the mapped by the probability of the syntax element to be encoded: the short codeword is assigned to the large probability codeword value, and the long codeword is assigned by the small probability codeword value;
将所述编码索引 Codelndex转化为码字数值 CodeNum的非概率统计分布映 射方法为: The non-probabilistic statistical distribution mapping method for converting the encoding index Codelndex into a codeword value CodeNum is:
将编码索引 Codelndex 和码字数值 CodeNum 线性关联, 即 CodeIndex=axCodeNum+p (其中, a和 β是整数); 或者通过制定映射表建立编 码索弓 I和码字数值的映射关系; The code index Codelndex is linearly associated with the codeword value CodeNum, that is, CodeIndex=axCodeNum+p (where a and β are integers); or the mapping relationship between the coded bow I and the codeword value is established by formulating a mapping table;
S104:根据码字编码规则对所述码字数值 CodeNum进行编码,获取最终码 所述码字编码规则可以为有规则变长编码或有规则定长编码; S104: Encoding the codeword value CodeNum according to a codeword encoding rule to obtain a final code. The codeword encoding rule may be a regular variable length coding or a regular fixed length coding;
所述码字具有规则的码字结构, 所述码字数值 CodeNum和码字 CodeWord 直接存在确定的数学关系, 可以通过码字数值计算生成码字, 也可由码字计算 出码字数值; The codeword has a regular codeword structure, and the codeword value CodeNum and the codeword CodeWord directly have a determined mathematical relationship, and the codeword can be generated by calculating the codeword value, and the codeword value can also be calculated by the codeword;
所述有规则变长编码可以是不同阶数的哥伦布莱斯 Golomb-Rice 或指数 哥伦布编码 Exp-Golomb编码规则; Golomb-Rice和 Exp-Golomb都属于哥伦布 编码, 所述阶数是哥伦布编码的参量, 不同的阶数其编码公式不同。 The regular variable length coding may be a Columbus-Golomb-Rice or an index Columbus coded Exp-Golomb coding rule of different order; Golomb-Rice and Exp-Golomb are both Columbus codes, and the order is a Columbus coded parameter. , different orders have different coding formulas.
所述码字为二进制格式, 包括前缀和后缀部分, 所述前缀一般由多个 0 加一个 1开头; The codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
本发明实施例列出哥伦布莱斯 Golomb-Rice 和指数哥伦布编码 Exp-Golomb的部分编码结构,如表 1所示为阶数 k=0、 1、 2、 3时, Golomb-Rice 的部分码字; 表 2所示为阶数 k=0, 1, 2, 3时, Exp-Golomb编码的部分码字。
表 1The embodiment of the present invention lists the partial coding structure of the Columbus-Golomb-Rice and the index Columbus code Exp-Golomb. As shown in Table 1, the partial codewords of Golomb-Rice are shown as the order k=0, 1, 2, 3. Table 2 shows the partial codewords of the Exp-Golomb code when the order k=0, 1, 2, 3. Table 1
表 2 Table 2
本发明实施例通过引入编码索引和有规则变长 /定长编码方法,全新设计了 各个语法元素码表, 由编码索引实现快速的码表检索, 有规则变长 /定长编码 无需保存实际二进制码字,消除了传统变长码表需要占用较大的内存空间和需 逐位遍历操作,在保障编码效率的前提下, 极大提高了移动终端设备上熵解码 操作的实现复杂度, 适用于硬件资源受限的便携式终端。
以下是以采用 H.264/AVC CAVLC熵编码对一个 4X4亮度的预测残差块进 行熵编码为例来详细描述本发明的实现过程。如图 2所示为本发明实施例 4X 4亮度的预测残差块的 Zigzag扫描顺序图, 其中, 方块中的数值表示亮度残 差数值, 箭头表示扫描的顺序。 In the embodiment of the present invention, by introducing a coding index and a regular variable length/fixed length coding method, each syntax element code table is newly designed, and a fast code table retrieval is realized by the coding index, and the rule variable length/fixed length coding does not need to save the actual binary. The codeword eliminates the need for a large memory space and requires a bit-by-bit traversal operation. Under the premise of ensuring coding efficiency, the implementation complexity of the entropy decoding operation on the mobile terminal device is greatly improved, and is applicable to A portable terminal with limited hardware resources. The following is a detailed description of the implementation process of the present invention by taking an entropy coding of a 4×4 luma prediction residual block using H.264/AVC CAVLC entropy coding. 2 is a Zigzag scanning sequence diagram of a prediction residual block of the luminance of the embodiment 4X4 according to the embodiment of the present invention, wherein the numerical values in the squares indicate the luminance residual values, and the arrows indicate the scanning order.
4X4块的残差系数经过 Zigzag顺序映射为一个 16元素的一维序列: 0, 3, 0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0。 The residual coefficients of the 4X4 block are mapped to a one-dimensional sequence of 16 elements by Zigzag order: 0, 3, 0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0 , 0.
如果采用 H.264/AVC CAVLC熵编码需要编码的残差系数语法元素包括: If the H.264/AVC CAVLC entropy coding is used, the residual coefficient syntax elements that need to be encoded include:
(a) 非零系数的数目(TotalCoeffs) =5和 (a) The number of non-zero coefficients (TotalCoeffs) = 5 and
拖尾系数的数目(Trailing0nes)=3; The number of trailing coefficients (Trailing0nes) = 3;
(b) 非零系数前零的数目(Total— zeros) =3; (b) The number of zeros before the non-zero coefficient (Total_zeros) = 3;
(c) Level (i)=l i=l, 0; (c) Level (i) = l i = l, 0;
(d) Run— before (i) i=4, 3, 2, 1, 0。 (d) Run— before (i) i=4, 3, 2, 1, 0.
遵循 CAVLC编码规则, 可以得到压缩流: 000010001110010111101101; 其 中, 残差系数语法元素 Coeff— token (非零系数的数目 TotalCoeffs和拖尾系 数的数目 Trail ingOnes) 编码输出为 0000100。 Following the CAVLC coding rules, a compressed stream can be obtained: 000010001110010111101101; where the residual coefficient syntax element Coeff_token (the number of non-zero coefficients TotalCoeffs and the number of trailing coefficients Trail ingOnes) is encoded as 0000100.
下面就对残差系数语法元素 Coeff— token (非零系数的数目 TotalCoeffs 和拖尾系数的数目 TrailingOnes) 的编码为例, 进一步说明本发明实施例提 出的一种视频熵编码方法对所述残差系数语法元素 Coeff— token的编码流程。 The encoding of the residual coefficient syntax element Coeff_ token (the number of non-zero coefficients TotalCoeffs and the number of trailing coefficients TrailingOnes) is taken as an example to further illustrate a video entropy coding method proposed by the embodiment of the present invention. The encoding process of the coefficient syntax element Coeff_token.
5201, 扫描 4X4亮度的预测残差块, 获取待编码残差系数语法元素; 4X4亮度的预测残差块 Zigzag顺序映射为一个 16元素的数据串: 0, 3, 5201: Scan a 4×4 luma prediction residual block to obtain a residual coefficient syntax element to be encoded; 4×4 luma prediction residual block Zigzag order is mapped to a 16-element data string: 0, 3,
0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0; 0, 1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0;
获取待编码残差系数语法元素包括: 语法元素 Coeff— token (非零系数的 数目 (TotalCoeffs) =5和拖尾系数的数目(TrailingOnes) =3); The syntax elements for obtaining residual coefficients to be encoded include: Syntax element Coeff_token (Number of non-zero coefficients (TotalCoeffs) = 5 and number of trailing coefficients (TrailingOnes) = 3);
5202, 将所述待编码残差系数语法元素转化为编码索引 Codelndex; 5202, converting the to-be-coded residual coefficient syntax element into an encoding index Codelndex;
根据所述待编码残差系数语法元素 Coeff— token的概率分布, 从大到小进 行排列, 用编码索引 Codelndex来作为所述待编码残差系数语法元素(非零系
数的数目 TotalCoeffs和拖尾系数的数目 Trai l ingOnes ) 的映射关系; 如表 3 所示为所述待编码残差系数语法元素 Coeff— token 与编码索引And according to the probability distribution of the to-be-coded residual coefficient syntax element Coeff_token, arranged from largest to smallest, using the coding index Codelndex as the syntax element of the residual coefficient to be encoded (non-zero system) The mapping relationship between the number of numbers TotalCoeffs and the number of trailing coefficients (Trai l ingOnes ); as shown in Table 3, the Coeff_ token and the encoding index of the residual coefficient syntax element to be encoded
Codelndex的映射关系表; Codelndex mapping table;
从表 3中可以看出对于所述待编码残差系数语法元素 Coeff— token, 非零 系数的数目(TotalCoeffs ) =5和拖尾系数的数目(Trai l ingOnes) =3时, 编码 索引
It can be seen from Table 3 that for the to-be-coded residual coefficient syntax element Coeff_token, the number of non-zero coefficients (TotalCoeffs) = 5 and the number of trailing coefficients (Trai lingOnes) = 3, the coding index
表 3 table 3
Trai l ingOnes TotalCoeff Codelndex Trai l ingOnes TotalCoeff Codelndex
0 0 0 0 0 0
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
0 1 4 0 1 4
1 2 5 1 2 5
3 4 6 3 4 6
2 3 7 2 3 7
3 5 8 3 5 8
0 2 9 0 2 9
1 3 10 1 3 10
2 4 11 2 4 11
3 6 12 3 6 12
0 3 13 0 3 13
1 4 14 1 4 14
2 5 15 2 5 15
3 7 16 3 7 16
0 4 17 0 4 17
1 5 18 1 5 18
2 6 19 2 6 19
3 8 20 3 8 20
0 5 21 0 5 21
1 6 22 1 6 22
2 7 23 2 7 23
3 9 24 3 9 24
0 6 25 0 6 25
1 7 26 1 7 26
2 8 27 2 8 27
3 10 28 3 10 28
0 7 29 0 7 29
1 8 30
2 9 31 1 8 30 2 9 31
0 8 32 0 8 32
0 9 33 0 9 33
1 9 34 1 9 34
2 10 35 2 10 35
3 11 36 3 11 36
0 10 37 0 10 37
1 10 38 1 10 38
2 11 39 2 11 39
3 12 40 3 12 40
0 11 41 0 11 41
1 11 42 1 11 42
2 12 43 2 12 43
3 13 44 3 13 44
0 12 45 0 12 45
1 12 46 1 12 46
2 13 47 2 13 47
3 14 48 3 14 48
0 13 49 0 13 49
1 14 50 1 14 50
2 14 51 2 14 51
3 15 52 3 15 52
0 14 53 0 14 53
1 15 54 1 15 54
2 15 55 2 15 55
3 16 56 3 16 56
0 15 57 0 15 57
1 16 58 1 16 58
2 16 59 2 16 59
0 16 60 0 16 60
1 13 61 1 13 61
S203将所述编码索引 Codelndex转化为码字数值 CodeNum; S203 converting the code index Codelndex into a codeword value CodeNum;
本实施例已经根据待编码语法元素的概率统计分布和有规则的编码建立 编码索引和码字数值的映射关系; 本例采用 Golomb-Rice编码规则, 实际上, 本实施例的这部分是查表操作, 根据索引 Codelndex查表 4, 得到码字数值和 有规则编码的参量 (阶数等)。 In this embodiment, the mapping relationship between the coding index and the codeword value is established according to the probability statistical distribution of the syntax element to be encoded and the regular coding; in this example, the Golomb-Rice coding rule is adopted. In fact, this part of the embodiment is a lookup table. Operation, according to the index Codelndex lookup table 4, the codeword value and the regularly encoded parameters (orders, etc.) are obtained.
如表 4所示为编码索引 Codelndex和码字数值 CodeNum的映射关系,从表
4可看出, 本发明实施例采用了 k=0, 1, 2, 3四种阶数的 Golomb-Rice码; 从表 4可看出, 本发明实施例中编码索引 CodeIndex=8时, 相应的码 值 CodeNum=22, 阶数 k=2; As shown in Table 4, the mapping relationship between the encoding index Codelndex and the codeword value CodeNum, from the table 4, it can be seen that the embodiment of the present invention adopts a Golomb-Rice code of four order of k=0, 1, 2, 3; as can be seen from Table 4, in the embodiment of the present invention, when the code index is CodeIndex=8, corresponding Code value CodeNum=22, order k=2;
表 4 Table 4
85 3 35 85 3 35
86 3 36 86 3 36
87 3 37 87 3 37
88 3 38 88 3 38
89 3 39 89 3 39
90 3 40 90 3 40
91 3 41 91 3 41
92 3 42 92 3 42
93 3 43 93 3 43
94 3 44 94 3 44
95 3 45 95 3 45
96 3 46 96 3 46
97 3 47 97 3 47
98 3 48 98 3 48
99 3 49 99 3 49
100 3 50 100 3 50
101 3 51 101 3 51
102 3 52 102 3 52
103 3 53 103 3 53
104 3 54 104 3 54
105 3 55 105 3 55
106 3 56 106 3 56
107 3 57 107 3 57
108 3 58 108 3 58
109 3 59 109 3 59
110 3 60 110 3 60
111 3 61 111 3 61
S204, 对所述码字数值 CodeNum根据码字编码规则进行编码, 获取最终码 根据码字数值和码字编码规则, 可以通过码字数值计算生成码字; 本发明实施例采用变长编码方式 2阶的 Golomb-Rice , CodeNum=22 , 根据 Golomb-Rice编码规则可知输出为: 0000 0110; S204, the codeword value CodeNum is coded according to the codeword encoding rule, and the final code is obtained according to the codeword value and the codeword encoding rule, and the codeword is generated by the codeword value calculation. The embodiment of the present invention adopts the variable length coding mode. Golomb-Rice of order, CodeNum=22, according to the Golomb-Rice coding rule, the output is: 0000 0110;
如表 5 所示为本发明实施例码字数值 CodeNum 和码字 CodeWord (Golomb-Rice码) 的映射关系表。 As shown in Table 5, the mapping relationship between the codeword value CodeNum and the codeword CodeWord (Golomb-Rice code) is shown in the embodiment of the present invention.
表 5 table 5
2 10 0000 0000 0011 01 0000 0000 001101 85 32 10 0000 0000 0011 01 0000 0000 001101 85 3
3 11 0000 0000 0011 00 0000 0000 001110 86 33 11 0000 0000 0011 00 0000 0000 001110 86 3
0 10 0000 0000 0010 11 0000 0000 001111 87 30 10 0000 0000 0010 11 0000 0000 001111 87 3
1 10 0000 0000 0010 10 0000 0000 0001000 88 31 10 0000 0000 0010 10 0000 0000 0001000 88 3
2 11 0000 0000 0010 01 0000 0000 0001001 89 32 11 0000 0000 0010 01 0000 0000 0001001 89 3
3 12 0000 0000 0010 00 0000 0000 0001010 90 33 12 0000 0000 0010 00 0000 0000 0001010 90 3
0 11 0000 0000 0001 111 0000 0000 0001011 91 30 11 0000 0000 0001 111 0000 0000 0001011 91 3
1 11 0000 0000 0001 110 0000 0000 001100 92 31 11 0000 0000 0001 110 0000 0000 001100 92 3
2 12 0000 0000 0001 101 0000 0000 0001101 93 32 12 0000 0000 0001 101 0000 0000 0001101 93 3
3 13 0000 0000 0001 100 0000 0000 0001110 94 33 13 0000 0000 0001 100 0000 0000 0001110 94 3
0 12 0000 0000 0001 on 0000 0000 0001111 95 30 12 0000 0000 0001 on 0000 0000 0001111 95 3
1 12 0000 0000 0001 010 0000 0000 00001000 96 31 12 0000 0000 0001 010 0000 0000 00001000 96 3
2 13 0000 0000 0001 001 0000 0000 00001001 97 32 13 0000 0000 0001 001 0000 0000 00001001 97 3
3 14 0000 0000 0001 000 0000 0000 00001010 98 33 14 0000 0000 0001 000 0000 0000 00001010 98 3
0 13 0000 0000 0000 1111 0000 0000 00001011 99 30 13 0000 0000 0000 1111 0000 0000 00001011 99 3
1 14 0000 0000 0000 1110 0000 0000 00001100 100 31 14 0000 0000 0000 1110 0000 0000 00001100 100 3
2 14 0000 0000 0000 1101 0000 0000 00001101 101 32 14 0000 0000 0000 1101 0000 0000 00001101 101 3
3 15 0000 0000 0000 1100 0000 0000 00001110 102 33 15 0000 0000 0000 1100 0000 0000 00001110 102 3
0 14 0000 0000 0000 1011 0000 0000 00001111 103 30 14 0000 0000 0000 1011 0000 0000 00001111 103 3
1 15 0000 0000 0000 1010 0000 0000 0000 01000 104 31 15 0000 0000 0000 1010 0000 0000 0000 01000 104 3
2 15 0000 0000 0000 1001 0000 0000 000001001 105 32 15 0000 0000 0000 1001 0000 0000 000001001 105 3
3 16 0000 0000 0000 1000 0000 0000 000001010 106 33 16 0000 0000 0000 1000 0000 0000 000001010 106 3
0 15 0000 0000 0000 0111 0000 0000 000001011 107 30 15 0000 0000 0000 0111 0000 0000 000001011 107 3
1 16 0000 0000 0000 0110 0000 0000 000001100 108 31 16 0000 0000 0000 0110 0000 0000 000001100 108 3
2 16 0000 0000 0000 0101 0000 0000 000001101 109 32 16 0000 0000 0000 0101 0000 0000 000001101 109 3
0 16 0000 0000 0000 0100 0000 0000 000001110 110 30 16 0000 0000 0000 0100 0000 0000 000001110 110 3
1 13 0000 0000 0000 001 0000 0000 000001111 111 3 本发明实施例通过引入编码索引和有规则变长 /定长编码方法,全新设计了 各个语法元素码表, 由编码索引实现快速的码表检索, 有规则变长 /定长编码 无需保存实际二进制码字,消除了传统变长码表需要占用较大的内存空间和需 逐位遍历操作,在保障编码效率的前提下, 极大提高了移动终端设备上熵解码 操作的实现复杂度, 适用于硬件资源受限的便携式终。 实施例三
图 3所示为本发明实施例一种视频熵编码装置结构示意图,所述装置包括 编码语法元素获取模块、 第一转化模块、 第二转化模块、 第一码字获取模块。 1 13 0000 0000 0000 001 0000 0000 000001111 111 3 In the embodiment of the present invention, by introducing a coding index and a regular variable length/fixed length coding method, a code table of each syntax element is newly designed, and a fast code table retrieval is realized by the coding index. The rule variable length/fixed length coding does not need to save the actual binary codeword, which eliminates the need for the traditional variable length code table to occupy a large memory space and needs to be traversed bit by bit. Under the premise of ensuring coding efficiency, the mobile terminal device is greatly improved. The implementation complexity of the upper entropy decoding operation is suitable for portable terminals with limited hardware resources. Embodiment 3 FIG. 3 is a schematic structural diagram of a video entropy coding apparatus according to an embodiment of the present invention. The apparatus includes an encoding syntax element acquisition module, a first conversion module, a second conversion module, and a first codeword acquisition module.
编码语法元素获取模块, 用于获取待编码块中的待编码语法元素; 所述待编码语法元素包括残差系数语法元素或非残差系数语法元素; 所述非残差系数语法元素包括宏块类型、 参考帧索引、 量化参数、运动矢 量残差、 编码模型或帧内预测模式; a coding syntax element obtaining module, configured to acquire a syntax element to be encoded in a block to be encoded; the syntax element to be encoded includes a residual coefficient syntax element or a non-residual coefficient syntax element; the non-residual coefficient syntax element includes a macroblock Type, reference frame index, quantization parameter, motion vector residual, coding model or intra prediction mode;
第一转化模块,用于将所述待编码语法元素转化为编码索引; 包括概率统 计分布映射模块; a first conversion module, configured to convert the syntax element to be encoded into a coding index; and include a probability distribution distribution mapping module;
所述概率统计分布映射模块,用于获取待编码块中的待编码语法元素的概 率统计分布信息,根据所述概率统计分布信息对所述待编码语法元素进行概率 排序, 建立所述待编码语法元素与编码索引的映射关系; The probabilistic statistical distribution mapping module is configured to obtain probability statistical distribution information of a syntax element to be encoded in a block to be encoded, perform probability ranking on the to-be-encoded syntax element according to the probability statistical distribution information, and establish the to-be-encoded syntax. The mapping relationship between the element and the encoding index;
进一步地, 所述第一转化模块还包括非概率统计分布映射模块; 所述非概率统计分布映射模块,用于根据非概率统计分布映射方法将待编 码语法元素中的非残差系数语法元素转化为编码索引;所述非概率统计分布映 射方法包括无符号直接映射、 有符号转化为符号映射或映射表方式; Further, the first conversion module further includes a non-probability statistical distribution mapping module, and the non-probabilistic statistical distribution mapping module is configured to convert the non-residual coefficient syntax elements in the syntax element to be encoded according to the non-probabilistic statistical distribution mapping method. An encoding index; the non-probabilistic statistical distribution mapping method includes an unsigned direct mapping, a signed conversion to a symbol mapping or a mapping table manner;
第二转化模块,用于将所述编码索引转化为码字数值;所述将所述编码索 引 Codelndex转化为码字数值 CodeNum的映射方式可以为概率统计分布映射或 非概率统计分布映射; a second conversion module, configured to convert the coding index into a codeword value; the mapping manner of converting the code index Codelndex into a codeword value CodeNum may be a probability statistical distribution map or a non-probabilistic statistical distribution map;
将所述编码索引 Codelndex转化为码字数值 CodeNum的概率统计分布映射 方式为:根据待编码语法元素的概率统计分布信息建立所述编码索引和码字数 值的映射关系; 其中, 所述映射关系遵循平均码长最短原则, 由待编码语法元 素的概率指导映射的码字数值和码字: 大概率码字数值分配短码字, 小概率码 字数值分配长码字; The method for converting the coding index Codelndex into the codeword value CodeNum is to: establish a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded; wherein the mapping relationship follows The principle of the shortest average code length, the codeword value and the codeword of the mapped by the probability of the syntax element to be encoded: the short codeword is assigned to the large probability codeword value, and the long codeword is assigned by the small probability codeword value;
将所述编码索引 Codelndex转化为码字数值 CodeNum的非概率统计分布映 射方式为: The non-probabilistic statistical distribution mapping method of converting the encoding index Codelndex into a codeword value CodeNum is:
将编码索引 Codelndex 和码字数值 CodeNum 线性关联, 即 CodeIndex=axCodeNum+p (其中, a和 β是整数); 或者根据通过制定映射表建 立编码索弓 I和码字数值的映射关系;
第一码字获取模块,用于根据码字编码规则对所述码字数值进行编码, 获 取最终码字; Coding the code index Codelndex and the codeword value CodeNum linearly, that is, CodeIndex=axCodeNum+p (where a and β are integers); or establishing a mapping relationship between the coded value and the codeword value according to the mapping table; a first codeword obtaining module, configured to encode the codeword value according to a codeword encoding rule, to obtain a final codeword;
所述码字编码规则可以为有规则变长编码或有规则定长编码; The codeword encoding rule may be a regular variable length coding or a regular fixed length coding;
所述码字具有规则的码字结构, 所述码字数值 CodeNum和码字 CodeWord 直接存在确定的数学关系, 可以通过码字数值计算生成码字, 也可由码字计算 出码字数值; The codeword has a regular codeword structure, and the codeword value CodeNum and the codeword CodeWord directly have a determined mathematical relationship, and the codeword can be generated by calculating the codeword value, and the codeword value can also be calculated by the codeword;
所述有规则变长编码可以是不同阶数的哥伦布莱斯 Golomb-Rice或指数哥 伦布编码 Exp-Golomb编码规则; 所述阶数是哥伦布编码的参量, 不同的阶数其 编码公式不同; The regular variable length coding may be a Columbus-Rice or an index Columbus coded Exp-Golomb coding rule of different order; the order is a Columbus coded parameter, and the coding formulas of different orders are different;
所述码字为二进制格式, 包括前缀和后缀部分, 所述前缀一般由多个 0 加一个 1开头; The codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
本发明实施例通过引入编码索引和有规则变长 /定长编码方法,全新设计了 各个语法元素码表, 由编码索引实现快速的码表检索, 有规则变长 /定长编码 无需保存实际二进制码字,消除了传统变长码表需要占用较大的内存空间和需 逐位遍历操作,在保障编码效率的前提下, 极大提高了移动终端设备上熵解码 操作的实现复杂度, 适用于硬件资源受限的便携式终。 实施例四 In the embodiment of the present invention, by introducing a coding index and a regular variable length/fixed length coding method, each syntax element code table is newly designed, and a fast code table retrieval is realized by the coding index, and the rule variable length/fixed length coding does not need to save the actual binary. The codeword eliminates the need for a large memory space and requires a bit-by-bit traversal operation. Under the premise of ensuring coding efficiency, the implementation complexity of the entropy decoding operation on the mobile terminal device is greatly improved, and is applicable to Portable end of limited hardware resources. Embodiment 4
一种记录介质, 包括实施例 1中所述的视频熵编码方法的程序, 所述视频 熵编码方法在实施例 1中已详细描述, 在此不再赘述。 实施例五 A recording medium, including the program of the video entropy coding method described in Embodiment 1, the video entropy coding method is described in detail in Embodiment 1, and details are not described herein again. Embodiment 5
图 4所示为本发明实施例一种视频熵解码方法流程图,所述方法包括以下 步骤: FIG. 4 is a flowchart of a video entropy decoding method according to an embodiment of the present invention, where the method includes the following steps:
S501 : 读取熵编码后的二进制比特流, 根据码字编码规则进行计算, 获取 完整的二进制码字 Codeword; S501: reading the entropy-encoded binary bit stream, performing calculation according to the codeword encoding rule, and obtaining a complete binary codeword Codeword;
所述码字编码规则可以为有规则变长编码或有规则定长编码; The codeword encoding rule may be a regular variable length coding or a regular fixed length coding;
所述码字具有规则的码字结构, 所述码字数值 CodeNum和码字 CodeWord
直接存在确定的数学关系, 可以通过码字数值计算生成码字, 也可由码字计算 出码字数值; The codeword has a regular codeword structure, the codeword value CodeNum and the codeword CodeWord There is a certain mathematical relationship directly, and the codeword can be generated by calculating the codeword value, and the codeword value can also be calculated by the codeword;
所述有规则变长编码可以是不同阶数的哥伦布莱斯 Golomb-Rice 或指数 哥伦布编码 Exp-Golomb编码规则; 所述阶数是哥伦布编码的参量, 不同的阶 数其编码公式不同; The regular variable length coding may be a Columbus-Rice or exponential Columbus coded Exp-Golomb coding rule of different order; the order is a Columbus coded parameter, and the coding formulas of different orders are different;
所述码字为二进制格式, 包括前缀和后缀部分, 所述前缀一般由多个 0 加一个 1开头; The codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
所述"读取熵编码后的二进制比特流, 根据码字编码规则进行计算, 获取 完整的二进制码字 Codeword" The "reading the entropy-encoded binary bit stream, calculating according to the codeword encoding rule, and obtaining the complete binary codeword Codeword"
具体为: Specifically:
A)读取熵编码后的二进制比特流; A) reading the entropy encoded binary bit stream;
B)获取所述二进制比特流中的第一个 " 1 "之前 "0 "的个数, 将所述个 数作为码字结构中的前缀信息; B) obtaining the number of "0"s before the first "1" in the binary bit stream, and using the number as the prefix information in the codeword structure;
0根据所述前缀信息和所述码字编码规则, 获取完整的二进制码字; 例如: 二进制比特流中码字的前缀的形式是 1, 01, 001, 0001, 00001, 000001, 0000001, 00000001, 000000001, 0000000001, 00000000001, 000000000001 , 0000000000001 , 00000000000001 解码时, 一般采用首 " 1 " 检测器的方法, 具体来说就是, 将二进制比特流输入, 首先对一串 0加上一个 1 这样的序列进行检测并对 0 的个数进行计数。 这样的检测器通常命名为首 " 1 "检测器。 检测到第一个 " 1 "后, 将前面 0的个数赋值给变量 M— prefix 用于表征前缀信息, 由此可得出变量 M— prefix 的值分别为 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13。 Obtaining a complete binary codeword according to the prefix information and the codeword encoding rule; for example: a prefix of a codeword in a binary bitstream is in the form of 1, 01, 001, 0001, 00001, 000001, 0000001, 00000001, 000000001, 0000000001, 00000000001, 000000000001, 0000000000001, 00000000000001 When decoding, the first "1" detector method is generally used. Specifically, the binary bit stream is input, and a sequence of 0 plus one is detected first. Count the number of 0s. Such detectors are often named the first "1" detector. After the first "1" is detected, the number of the first 0 is assigned to the variable M_prefix to represent the prefix information. It can be concluded that the value of the variable M_prefix is 0, 1, 2, 3, 4 respectively. , 5, 6, 7, 8, 9, 10, 11, 12, 13.
S502 :将所述二进制码字 Codeword按照所述码字编码规则计算得出码字数 值 CodeNum; S502: The binary codeword Codeword is calculated according to the codeword encoding rule to obtain a codeword value CodeNum;
S503 : 将所述码字数值 CodeNum转化为编码索引 Codelndex; S503: Convert the codeword value CodeNum into an encoding index Codelndex;
所述将所述码字数值 CodeNum转化为编码索引 Codelndex的映射方法可以 为概率统计分布映射方法或非概率统计分布映射方法; The mapping method for converting the codeword value CodeNum into the encoding index Codelndex may be a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method;
将所述码字数值 CodeNum转化为编码索引 Codelndex的概率统计分布映射
方法为:根据待编码语法元素的概率统计分布信息建立所述编码索引和码字数 值的映射关系; 其中, 所述映射关系遵循平均码长最短原则, 由待编码语法元 素的概率指导映射的码字数值和码字: 大概率码字数值分配短码字, 小概率码 字数值分配长码字; Converting the codeword value CodeNum into a probabilistic statistical distribution map of the encoding index Codelndex The method is: establishing a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded; wherein the mapping relationship follows the principle of the shortest average code length, and the code mapped by the probability of the syntax element to be encoded Word value and codeword: The large probability codeword value is assigned a short codeword, and the small probability codeword value is assigned a long codeword;
将所述码字数值 CodeNum转化为编码索引 Codelndex的非概率统计分布映 射方法为: The non-probabilistic statistical distribution mapping method for converting the codeword value CodeNum into the encoding index Codelndex is:
将编码索引 Codelndex 和码字数值 CodeNum 线性关联, 即 CodeIndex=axCodeNum+p (其中, a和 β是整数); 或者通过制定映射表建立编 码索弓 I和码字数值的映射关系; The code index Codelndex is linearly associated with the codeword value CodeNum, that is, CodeIndex=axCodeNum+p (where a and β are integers); or the mapping relationship between the coded bow I and the codeword value is established by formulating a mapping table;
S504: 根据编码索引 Codeindex获取相应的语法元素; S504: Obtain a corresponding syntax element according to the code index Codeindex;
所述待编码语法元素包括残差系数语法元素或非残差系数语法元素; 本发明实施例提供了一种低复杂度的熵解码方法, 相比于 H. 264 CAVLC列 出上下文自适应所构建的多张 VLC 表格, 本发明实施例只需控制编码索引 Codelndex和码字数值 CodeNum间映射关系,就可以达到多张 VLC表格的效果, 且有规则变长 /定长编码无需保存实际二进制码字 CodewWord, 保存码字数据 和编码索引的内存要求比保存二进制码字 Codeword低, 更加节省资源。 实施例六 The syntax element to be encoded includes a residual coefficient syntax element or a non-residual coefficient syntax element. The embodiment of the present invention provides a low complexity entropy decoding method, which is constructed according to H. 264 CAVLC listing context adaptation. The multiple VLC tables, the embodiment of the present invention only needs to control the mapping relationship between the code index Codelndex and the codeword value CodeNum, so that the effect of multiple VLC tables can be achieved, and the regular variable length/fixed length coding does not need to save the actual binary code words. CodewWord, saving codeword data and encoding index memory requirements is lower than saving binary codeword Codeword, saving resources. Embodiment 6
以下是本发明实施例对熵编码后的二进制比特流,采用 Golomb的编码规则 进行熵解码获取语法元素 Coeff— token的流程步骤: The following is a process step of entropy decoding to obtain a syntax element Coeff_token by entropy decoding of the binary bit stream after entropy coding in the embodiment of the present invention:
S601 ,读取熵编码后的二进制比特流,根据 Golomb的码字编码规则获取完 整的二进制码字; S601, reading an entropy-encoded binary bit stream, and acquiring a complete binary codeword according to Golomb's codeword encoding rule;
本发明实施例采用首 " 1 "检测器对压缩比特流的码字进行读取, 合法码字 一般具有一串 0加上一个 1的前缀特征, 这样可以检测到第一个 " 1 "后, 将 前面 0的个数赋值给所述变量 M— prefix, 再通过 Golomb的编码规则, 获得整 个二进制码字; 所述变量 M— prefix用于表征码字结构中的前缀信息; In the embodiment of the present invention, the first "1" detector is used to read the codeword of the compressed bit stream, and the legal codeword generally has a string of 0 plus a prefix feature of 1, so that the first "1" can be detected. The number of the preceding 0 is assigned to the variable M_prefix, and then the entire binary codeword is obtained by the encoding rule of Golomb; the variable M_prefix is used to represent the prefix information in the codeword structure;
若熵编码后的二进制比特流为 0000 Ol lOxxxxx, 通过检测所述二进制比特 流, 获取所述二进制比特流中的第一个 " 1 "之前 "0 " 的个数, 所述 " 0 " 的
个数为 5, 将 5赋值给变量 M— prefix, M— prefix=5, 根据 Golomb_Rice的编码 规则, 确定阶数 k=2 (4〈M— prefix〈=9 ), 从而确定这个完整的码字形式是 0000 Olxx, 长度为 8, 所以继续移位读取 8位二进制串: 0000 0110。 If the entropy-encoded binary bit stream is 0000 Ol lOxxxxx, the number of "0"s before the first "1" in the binary bit stream is obtained by detecting the binary bit stream, the "0" The number is 5, and 5 is assigned to the variable M_prefix, M_prefix=5. According to the encoding rule of Golomb_Rice, the order k=2 (4<M—prefix<=9) is determined to determine the complete codeword. The form is 0000 Olxx, the length is 8, so continue to shift to read the 8-bit binary string: 0000 0110.
S602,根据 Golomb-Rice的编码规则和阶数 k=2,算出码字数值 CodeNum=22; S602, according to the coding rule of Golomb-Rice and the order k=2, calculate the codeword value CodeNum=22;
5603 , 根据编码索引 Codelndex和码字数值 CodeNum的映射关系表 (如实 施例 2中表 4所示), 得到当码字数值 CodeNum=22时, 编码索引 CodeIndex=85603. According to the mapping relationship between the code index Codelndex and the codeword value CodeNum (as shown in Table 4 in Embodiment 2), when the codeword value CodeNum=22, the code index CodeIndex=8 is obtained.
5604, 根据残差系数语法元素 Coeff— token与编码索引 Codelndex的映射 关系表 (如实施例 2中表 3所示), 得到当编码索引 Codeindex=8时, 获得相 应的语法元素 Coeff— token: 非零系数的数目(TotalCoeff s ) =5和拖尾系数的 数目 (Trai l ingOnes) =3。 5604, according to the mapping table of the residual coefficient syntax element Coeff_token and the encoding index Codelndex (as shown in Table 3 in Embodiment 2), when the encoding index Codeindex=8, the corresponding syntax element Coeff_token is obtained: The number of zero coefficients (TotalCoeff s ) = 5 and the number of trailing coefficients (Trai l ingOnes) = 3.
对比 H. 264 CAVLC的解码过程, 由于 H. 264码表码字没有规律, 因此从压 缩比特流按位读取后, 都要遍历 VLC表格, 如果这是一个 n比特的码字, 这需 要 62η次读取对比变长码表 VLC的数据,才能确认这个完整码字,例如码字为 7比特, 这就需要 7 X 62=432次查表操作, 这势必会耗费大量的计算资源, 反 复的读写操作也会增加功耗。 本发明实施例提供了一种低复杂度的熵解码方 法, 相比于 H. 264 CAVLC列出上下文自适应所构建的多张 VLC表格, 本发明实 施例只需控制编码索引 Codelndex和码字数值 CodeNum间映射关系,就可以达 到多张 VLC 表格的效果, 且有规则变长 /定长编码无需保存实际二进制码字 CodewWord, 保存码字数据和编码索引的内存要求比保存二进制码字 CodeWord 低, 更加节省资源。 实施例七 Compared with the decoding process of H.264 CAVLC, since the H.264 code table code word has no regularity, after reading bit by bit from the compressed bit stream, it is necessary to traverse the VLC table. If this is an n-bit code word, this requires 62η. The data of the variable length code table VLC is read in order to confirm the complete code word, for example, the code word is 7 bits, which requires 7 X 62=432 table lookup operations, which will inevitably consume a lot of computing resources, repeated Read and write operations also increase power consumption. The embodiment of the present invention provides a low-complexity entropy decoding method, and the embodiment of the present invention only needs to control the encoding index Codelndex and the codeword value compared to the H.264 CAVLC listing the multiple VLC tables constructed by the context adaptation. The mapping between CodeNum can achieve the effect of multiple VLC tables, and there is no need to save the actual binary codeword CodewWord with regular variable length/fixed length encoding. The memory requirement for saving codeword data and encoding index is lower than saving binary codeword CodeWord. More resource saving. Example 7
以下是本发明实施例对熵编码后的二进制比特流,采用 Golomb的编码规则 进行熵解码获取语法元素非零系数前零的数目 Total— zeros的流程步骤: The following is an embodiment of the present invention for entropy-encoded binary bit stream, using Golomb encoding rules for entropy decoding to obtain the number of zeros of the non-zero coefficients of the syntax element Total-zeros:
表 6 (包括表 6a和表 6b )给出了本发明实施例语法元素 Total— zeros、 编 码索引 CodeIndex、 和码字数值 CodeNum的映射关系。 Table 6 (including Table 6a and Table 6b) shows the mapping relationship between the syntax elements Total_zeros, the code index CodeIndex, and the codeword value CodeNum in the embodiment of the present invention.
为方便解码, 本发明实施例设定编码索引 Codelndex 等于语法元素 Total— zeros , 采用 Golomb-Rice码为编码规则。
5701 , 读取熵编码后的二进制比特流, 根据 Golomb-Rice的编码规则获取 完整的二进制码字; To facilitate decoding, the embodiment of the present invention sets the encoding index Codelndex equal to the syntax element Total_zeros, and uses the Golomb-Rice code as the encoding rule. 5701, reading an entropy-encoded binary bit stream, and acquiring a complete binary codeword according to a coding rule of Golomb-Rice;
本发明实施例采用首 " 1 "检测器对压缩比特流的码字进行读取, 合法码字 一般具有一串 0加上一个 1的前缀特征, 这样可以检测到第一个 " 1 "后, 将 前面 0的个数赋值给变量 M— prefix, 在通过 Golomb的编码规则, 获得整个二 进制码字; 所述变量 M— prefix用于表征码字结构中的前缀信息; In the embodiment of the present invention, the first "1" detector is used to read the codeword of the compressed bit stream, and the legal codeword generally has a string of 0 plus a prefix feature of 1, so that the first "1" can be detected. The number of the preceding 0 is assigned to the variable M_prefix, and the entire binary codeword is obtained by the encoding rule of Golomb; the variable M_prefix is used to represent the prefix information in the codeword structure;
若熵编码后的二进制比特流为 OlOl lOxxxxx,通过检测所述二进制比特流, 获取所述二进制比特流中的第一个 " 1 "之前 "0 " 的个数, 所述 " 0 " 的个数 为 1, 将 1赋值给变量 M— prefix, M— prefix=l,, 根据 Golomb-Rice的编码规 则和阶数 k=2 (TotalCoeffs等于 5), 从而确定这个完整的码字形式是 Olxx, 读取 4位码字 Codeword: 0101 ; If the entropy-encoded binary bit stream is OlOlOxxxxx, the number of the "0"s before the first "1" in the binary bitstream is obtained by detecting the binary bitstream. For 1, assign 1 to the variable M_prefix, M_prefix=l, according to the coding rule of Golomb-Rice and the order k=2 (TotalCoeffs is equal to 5), to determine that the complete codeword form is Olxx, read Take the 4-digit codeword Codeword: 0101;
5702 , 根据 Golomb-Rice 的编码规则和阶数 k=2, 根据算出码字数值 CodeNum=5; 5702, according to the encoding rule of Golomb-Rice and the order k=2, according to the calculated codeword value CodeNum=5;
5703 , 根据表 6 (a) 的映射关系, 得到当码字数值 CodeNum=5时, 编码索 弓 I CodeIndex=2; 5703, according to the mapping relationship of Table 6 (a), when the codeword value CodeNum=5, the coded bow I CodeIndex=2;
5704, 根据编码索引 Codeindex=2得到语法元素 Total— zeros等于 2; 本发明实施例设定编码索引 Codelndex等于语法元素 Total— zeros , 故根 据编码索引的值可直接得出语法元素 Total— zeros的值; 表 6a语法元素 Total— zeros、 编码索引 CodeIndex、 和码字数值 CodeNum的映射关系 5704, the syntax element Total_zeros is equal to 2 according to the encoding index Codeindex=2; in the embodiment of the present invention, the encoding index Codelndex is equal to the syntax element Total_zeros, so the value of the syntax element Total_zeros can be directly obtained according to the value of the encoding index. ; Table 6a mapping relationship between the syntax element Total_zeros, the encoding index CodeIndex, and the codeword value CodeNum
本发明实施例由于码字的有规则结构, 可以快速地确定完整码字, 而不需 要传统变长码表的解码需要的逐位读取、遍历 VLC表格的繁琐操作, 降低了熵 解码的计算复杂度,适合于资源受限的应用场合。这个码表可以进步结合首 " 1 " 检测法, 对码字进行优化, 例如 0001 10是最长也是唯一这儿长度的码字, 所 以可以通过判定忽略数字 " 1 "后的 " 0 ", 已达到进一步细化码字的效果, 获 得更好的压缩比。 本发明实施例提供了一种低复杂度的熵解码方法, 相比于 In the embodiment of the present invention, due to the regular structure of the codeword, the complete codeword can be quickly determined without the need for bit-by-bit reading of the traditional variable length code table and cumbersome operation of traversing the VLC table, thereby reducing the calculation of entropy decoding. Complexity, suitable for resource-constrained applications. This code table can be improved by combining the first "1" detection method to optimize the codeword. For example, 0001 10 is the longest and only codeword of this length, so it can be reached by judging the "0" after the number "1" is ignored. Further refine the effect of the codeword to obtain a better compression ratio. Embodiments of the present invention provide a low complexity entropy decoding method, compared to
H. 264 CAVLC列出上下文自适应所构建的多张 VLC表格, 本发明实施例只需控 制编码索引 Codelndex和码字数值 CodeNum间映射关系, 就可以达到多张 VLC 表格的效果, 且有规则变长 /定长编码无需保存实际二进制码字 CodewWord, 保存码字数据和编码索引的内存要求比保存二进制码字 Codeword低, 更加节 省资源。 实施例八 H. 264 CAVLC lists multiple VLC tables constructed by context adaptation. In this embodiment of the present invention, only the mapping relationship between the code index Codelndex and the codeword value CodeNum can be controlled, and the effect of multiple VLC tables can be achieved, and the rules are changed. The long/fixed length encoding does not need to save the actual binary codeword CodewWord. The memory requirement for saving the codeword data and the encoding index is lower than saving the binary codeword Codeword, which saves resources. Example eight
图 5 所示为本发明实施例一种视频熵解码装置结构示意图, 所述装置包 括: 完整码字获取模块、 码字数值获取模块、 第三转化模块、 第二语法元素获 取模块。 FIG. 5 is a schematic structural diagram of a video entropy decoding apparatus according to an embodiment of the present invention. The apparatus includes: a complete codeword acquisition module, a codeword value acquisition module, a third conversion module, and a second syntax element acquisition module.
完整码字获取模块,用于读取熵编码后的二进制比特流, 根据码字编码规 则进行计算, 获取完整的二进制码字; a complete codeword obtaining module, configured to read the entropy-encoded binary bit stream, perform calculation according to the codeword encoding rule, and obtain a complete binary codeword;
所述码字编码规则可以为有规则变长编码或有规则定长编码; The codeword encoding rule may be a regular variable length coding or a regular fixed length coding;
所述有规则变长编码可以是不同阶数的哥伦布莱斯 Golomb-Rice 或指数 哥伦布编码 Exp-Golomb编码规则; 所述阶数是哥伦布编码的参量, 不同的阶 数其编码公式不同; The regular variable length coding may be a Columbus-Rice or exponential Columbus coded Exp-Golomb coding rule of different order; the order is a Columbus coded parameter, and the coding formulas of different orders are different;
所述码字为二进制格式, 包括前缀和后缀部分, 所述前缀一般由多个 0 加一个 1开头; The codeword is in a binary format, including a prefix and a suffix portion, and the prefix generally begins with a plurality of 0s plus a 1;
所述完整码字获取模块包括二进制比特流读取模块、码字前缀信息获取模
块和第二码字获取模块, The complete codeword acquisition module includes a binary bit stream reading module and a codeword prefix information acquisition module. Block and second codeword acquisition module,
二进制比特流读取模块, 用于读取熵编码后的二进制比特流; 码字前缀信息获取模块, 用于获取所述二进制比特流中的第一个 " 1 " 之前 "0 " 的个数, 将该个数作为码字结构中的前缀信息; a binary bit stream reading module, configured to read the entropy encoded binary bit stream; a codeword prefix information obtaining module, configured to acquire a number of “0”s before the first “1” in the binary bit stream, The number is used as prefix information in the codeword structure;
第二码字获取模块,用于根据所述根据所述前缀信息和所述码字编码规 则, 获取完整的二进制码字; a second codeword obtaining module, configured to obtain a complete binary codeword according to the prefix information and the codeword encoding rule;
码字数值获取模块,用于将所述二进制码字按照所述码字编码规则计算得 出码字数值; a codeword value obtaining module, configured to calculate, according to the codeword encoding rule, the codeword value;
第三转化模块, 用于将所述码字数值转化为编码索引; a third conversion module, configured to convert the codeword value into an encoding index;
所述将所述码字数值 CodeNum转化为编码索引 Codelndex的映射方式可以 为概率统计分布映射方式或非概率统计分布映射方式; The mapping manner of converting the codeword value CodeNum into the encoding index Codelndex may be a probability statistical distribution mapping manner or a non-probabilistic statistical distribution mapping manner;
将所述码字数值 CodeNum转化为编码索引 Codelndex的概率统计分布映射 方式为:根据待编码语法元素的概率统计分布建立所述编码索引和码字数值的 映射关系; 其中, 所述映射关系遵循平均码长最短原则, 由待编码语法元素的 概率指导映射的码字数值和码字: 大概率码字数值分配短码字, 小概率码字数 值分配长码字; The probability distribution distribution mapping manner of converting the codeword value CodeNum into the coding index Codelndex is: establishing a mapping relationship between the coding index and the codeword value according to a probability statistical distribution of the syntax element to be encoded; wherein the mapping relationship follows an average The principle of the shortest code length, the codeword value and the codeword of the mapped by the probability of the syntax element to be encoded: the short codeword is assigned to the large probability codeword value, and the long codeword is assigned by the small probability codeword value;
将所述码字数值 CodeNum转化为编码索引 Codelndex的非概率统计分布映 射方式为: The non-probabilistic statistical distribution mapping method of converting the codeword value CodeNum into the encoding index Codelndex is:
将编码索引 Codelndex 和码字数值 CodeNum 线性关联, 即 CodeIndex=axCodeNum+p (其中, a和 β是整数); 或者通过制定映射表建立编 码索弓 I和码字数值的映射关系; The code index Codelndex is linearly associated with the codeword value CodeNum, that is, CodeIndex=axCodeNum+p (where a and β are integers); or the mapping relationship between the coded bow I and the codeword value is established by formulating a mapping table;
第二语法元素获取模块, 用于根据编码索引获取相应的语法元素; 本发明实施例提供了一种低复杂度的熵解码方法, 相比于 Η. 264 CAVLC列 出上下文自适应所构建的多张 VLC 表格, 本发明实施例只需控制编码索引 Codelndex和码字数值 CodeNum间映射关系,就可以达到多张 VLC表格的效果, 且有规则变长 /定长编码无需保存实际二进制码字 CodewWord, 保存码字数据 和编码索引的内存要求比保存二进制码字 Codeword低, 更加节省资源。
实施例九 The second syntax element obtaining module is configured to obtain a corresponding syntax element according to the encoding index. The embodiment of the present invention provides a low complexity entropy decoding method, which is compared with the 上下文. 264 CAVLC listing context adaptive The VLC table, the embodiment of the present invention only needs to control the mapping relationship between the code index Codelndex and the codeword value CodeNum, so that the effect of multiple VLC tables can be achieved, and the regular variable length/fixed length coding does not need to save the actual binary codeword CodewWord. Saving memory for codeword data and encoding index is lower than saving binary codeword Codeword, which saves resources. Example nine
一种记录介质, 包括实施例 5中所述的视频熵解码方法的程序, 所述视频 熵解码方法在实施例 5中已详细描述, 在此不再赘述。 A recording medium, including the program of the video entropy decoding method described in Embodiment 5, the video entropy decoding method is described in detail in Embodiment 5, and details are not described herein again.
本领域的普通技术人员可以理解,实现上述实施例方法中的全部或部分步 骤是可以通过程序指令相关硬件来完成的,所述的程序可以存储于一计算机可 读取存储介质中, 所述的存储介质可以为 R0M、 RAM, 磁盘、 光盘等。 It will be understood by those skilled in the art that all or part of the steps of the foregoing embodiments may be implemented by a program instruction related hardware, and the program may be stored in a computer readable storage medium. The storage medium may be a ROM, a RAM, a magnetic disk, an optical disk, or the like.
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本发 明的精神和原则之内所作的任何修改、等同替换和改进等, 均应包含在本发明 的保护范围之内。
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
1、 一种视频熵编码方法, 其特征在于, 所述方法包括: A video entropy coding method, the method comprising:
获取待编码块中的待编码语法元素; Obtaining a syntax element to be encoded in the block to be encoded;
将所述待编码语法元素转化为编码索引; Converting the syntax element to be encoded into a coding index;
将所述编码索引转化为码字数值; Converting the encoded index into a codeword value;
根据码字编码规则对所述码字数值进行编码, 获取最终码字。 The codeword value is encoded according to a codeword encoding rule to obtain a final codeword.
2、 如权利要求 1所述的视频熵编码方法, 其特征在于, 所述待编码语法 元素包括: 残差系数语法元素或非残差系数语法元素。 The video entropy coding method according to claim 1, wherein the to-be-encoded syntax element comprises: a residual coefficient syntax element or a non-residual coefficient syntax element.
3、 如权利要求 2所述的视频熵编码方法, 其特征在于, 获取待编码块中 的残差系数语法元素的方法如下: The video entropy coding method according to claim 2, wherein the method for obtaining the residual coefficient syntax element in the block to be coded is as follows:
对预测量化后的待编码块的残差系数按照扫描顺序进行重排序,将二维残 差系数排列成一维序列; Recalculating the residual coefficients of the block to be coded after the prediction is performed in a scanning order, and arranging the two-dimensional residual coefficients into a one-dimensional sequence;
根据一维序列中残差系数的统计特征,获取所述待编码块的残差系数语法 元素。 Obtaining a residual coefficient syntax element of the block to be coded according to a statistical feature of the residual coefficient in the one-dimensional sequence.
4、 如权利要求 2所述的视频熵编码方法, 其特征在于, 所述将待编码语 法元素转化为编码索引的方法包括:概率统计分布映射方法或非概率统计分布 映射方法。 The video entropy coding method according to claim 2, wherein the method for converting a syntax element to be encoded into a coding index comprises: a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method.
5、 如权利要求 4所述的视频熵编码方法, 其特征在于, 5. The video entropy encoding method according to claim 4, wherein
当所述将待编码语法元素转化为编码索引的方法为概率统计分布映射方 法时, 所述将待编码语法元素转化为编码索引的方法具体为: When the method for converting a syntax element to be encoded into a coding index is a probability statistical distribution mapping method, the method for converting the syntax element to be encoded into an encoding index is specifically:
获取待编码块中的待编码语法元素的概率统计分布信息;根据所述概率统 计分布信息对所述待编码语法元素进行概率排序; Obtaining probability statistical distribution information of the syntax element to be encoded in the block to be coded; performing probability ranking on the syntax element to be encoded according to the probability distribution information;
建立所述待编码语法元素与所述编码索引的映射关系; Establishing a mapping relationship between the syntax element to be encoded and the encoding index;
当所述将待编码语法元素转化为编码索引的方法为非概率统计分布映射 方法时, 所述将待编码语法元素转化为编码索引的方法具体为: When the method for converting a syntax element to be encoded into a coding index is a non-probabilistic statistical distribution mapping method, the method for converting the syntax element to be encoded into an encoding index is specifically:
无符号直接映射、 有符号转化为符号映射或映射表方式。 Unsigned direct mapping, signed to symbolic mapping or mapping table mode.
6、 如权利要求 5所述的视频熵编码方法, 其特征在于, 所述获取待编码 块中的待编码语法元素的概率统计分布信息具体为: The video entropy coding method according to claim 5, wherein the obtaining probability statistical distribution information of the syntax element to be encoded in the block to be encoded is specifically:
获取预测量化后的待编码块残差系数; Obtaining a predictive quantized residual coefficient of the block to be coded;
根据所述待编码块残差系数统计基于上下文模型的语法元素的概率统计 分布值, 作为所述待编码语法元素的概率统计分布信息。 And calculating a probability statistical distribution value of the syntax element based on the context model according to the to-be-coded block residual coefficient, as the probability statistical distribution information of the syntax element to be encoded.
7、 如权利要求 6所述的视频熵编码方法, 其特征在于, 所述 "根据所述 待编码块残差系数统计基于上下文模型的语法元素的概率统计分布值,作为所 述待编码语法元素的概率统计分布信息"之后还包括: The video entropy coding method according to claim 6, wherein the "statistical statistical distribution value of a syntax element based on a context model is calculated according to the residual coefficient of the block to be encoded as the syntax element to be encoded. The probabilistic statistical distribution information" also includes:
合并概率统计分布值接近的概率统计分布信息,获取合并后的语法元素的 概率统计分布值, 作为所述待编码语法元素的概率统计分布信息。 The probabilistic statistical distribution information of the probabilistic statistical distribution value is obtained, and the probability statistical distribution value of the merged syntax element is obtained as the probability statistical distribution information of the syntax element to be encoded.
8、 如权利要求 5所述的视频熵编码方法, 其特征在于, 所述建立所述待 编码语法元素与所述编码索引的映射关系具体为;建立所述非残差系数语法元 素与所述编码索引的映射,为建立单个非残差系数语法元素与所述编码索引的 映射,或 /和建立多个非残差系数语法元素与所述编码索引的映射的联合映射。 The video entropy coding method according to claim 5, wherein the establishing a mapping relationship between the to-be-encoded syntax element and the coding index is specifically: establishing the non-residual coefficient syntax element and the The mapping of the encoded index is to establish a mapping of a single non-residual coefficient syntax element to the encoding index, or/and to establish a joint mapping of a plurality of mappings of non-residual coefficient syntax elements and the encoding index.
9、 如权利要求 8所述的视频熵编码方法, 其特征在于, 所述 "建立多个 非残差系数语法元素与所述编码索引的映射的联合映射"为综合至少两个非残 差系数语法元素的联合概率分布情况来建立相应的非残差系数语法元素映射 表, 或对所述非残差系数语法元素分组后进行综合编码。 The video entropy coding method according to claim 8, wherein the "joining a joint mapping of a plurality of mappings of non-residual coefficient syntax elements and the coding index" is to integrate at least two non-residual coefficients The joint probability distribution of the syntax elements is used to establish a corresponding non-residual coefficient syntax element mapping table, or the non-residual coefficient syntax elements are grouped and then comprehensively encoded.
10、如权利要求 1所述的视频熵编码方法, 其特征在于, 所述将所述编码 索引转化为码字数值的映射方法为概率统计分布映射方法。 The video entropy coding method according to claim 1, wherein the mapping method for converting the coding index into a codeword value is a probability statistical distribution mapping method.
11、 如权利要求 10所述的视频熵编码方法, 其特征在于, 所述将所述编 码索引转化为码字数值的映射方法具体为: The video entropy coding method according to claim 10, wherein the mapping method for converting the coding index into a codeword value is specifically:
根据待编码语法元素的概率统计分布信息建立所述编码索引和所述码字 数值的映射关系。 And establishing a mapping relationship between the encoding index and the codeword value according to probability statistical distribution information of a syntax element to be encoded.
12、如权利要求 1所述的视频熵编码方法, 其特征在于, 所述将所述编码 索弓 I转化为码字数值的映射方法为非概率统计分布映射方法。 The video entropy coding method according to claim 1, wherein the mapping method for converting the coding cable into a codeword value is a non-probabilistic statistical distribution mapping method.
13、 如权利要求 12所述的视频熵编码方法, 其特征在于, 所述将所述编 码索引转化为码字数值的映射方法具体为: 将所述编码索引和所述码字数值线性关联,或通过制定映射表建立所述编 码索弓 I和所述码字数值的映射关系; The video entropy coding method according to claim 12, wherein the mapping method for converting the coding index into a codeword value is specifically: And linearly associating the coding index with the codeword value, or establishing a mapping relationship between the coding cable and the codeword value by formulating a mapping table;
所述线性关联公式为: 编码索弓 Ι=αχ码字数值 +β, 其中, α和 β是整数。 The linear correlation formula is: Coded Ι = α χ code word value + β, where α and β are integers.
14、如权利要求 1所述的视频熵编码方法, 其特征在于, 所述码字编码规 则包括有规则变长编码或有规则定长编码。 The video entropy coding method according to claim 1, wherein the codeword coding rule comprises a regular variable length coding or a regular fixed length coding.
15、 如权利要求 14所述的视频熵编码方法, 其特征在于, 所述有规则变 长编码包括不同阶数的哥伦布莱斯或指数哥伦布编码。 The video entropy encoding method according to claim 14, wherein the regular variable encoding comprises Columbus or index Columbus encoding of different orders.
16、 一种视频熵编码装置, 其特征在于, 所述装置包括: 16. A video entropy coding apparatus, the apparatus comprising:
编码语法元素获取模块, 用于获取待编码块中的待编码语法元素; 第一转化模块, 用于将所述待编码语法元素转化为编码索引; a coding syntax element obtaining module, configured to obtain a syntax element to be encoded in the block to be coded; a first conversion module, configured to convert the syntax element to be encoded into a coding index;
第二转化模块,用于将所述编码索引转化为码字数值;所述将所述编码索 引转化为码字数值的映射方式包括概率统计分布映射或非概率统计分布映射; 第一码字获取模块,用于根据码字编码规则对所述码字数值进行编码,获 取最终码字。 a second conversion module, configured to convert the encoding index into a codeword value; the mapping manner of converting the encoding index into a codeword value comprises a probability statistical distribution mapping or a non-probability statistical distribution mapping; And a module, configured to encode the codeword value according to a codeword encoding rule to obtain a final codeword.
17、如权利要求 16所述的视频熵编码装置, 其特征在于, 所述第一转化模 块包括概率统计分布映射模块, The video entropy coding apparatus according to claim 16, wherein the first conversion module comprises a probability statistical distribution mapping module.
所述概率统计分布映射模块,用于获取待编码块中的待编码语法元素的概 率统计分布信息,根据所述概率统计分布信息对所述待编码语法元素进行概率 排序, 建立所述待编码语法元素与所述编码索引的映射关系。 The probabilistic statistical distribution mapping module is configured to obtain probability statistical distribution information of a syntax element to be encoded in a block to be encoded, perform probability ranking on the to-be-encoded syntax element according to the probability statistical distribution information, and establish the to-be-encoded syntax. The mapping relationship between the element and the encoding index.
18、如权利要求 16所述的视频熵编码装置, 其特征在于, 所述第一转化模 块进一步包括非概率统计分布映射模块, The video entropy coding apparatus according to claim 16, wherein the first conversion module further comprises a non-probabilistic statistical distribution mapping module.
所述非概率统计分布映射模块,用于根据非概率统计分布映射方法将待编 码语法元素中的非残差系数语法元素转化为编码索引;所述非概率统计分布映 射方法包括无符号直接映射、 有符号转化为符号映射或映射表方式。 The non-probabilistic statistical distribution mapping module is configured to convert a non-residual coefficient syntax element in a syntax element to be encoded into a coding index according to a non-probabilistic statistical distribution mapping method; the non-probabilistic statistical distribution mapping method includes an unsigned direct mapping, Signed into a symbol map or map table.
19、 如权利要求 16所述的视频熵编码装置, 其特征在于, 所述将所述编 码索引转化为码字数值的映射方式为概率统计分布映射,将所述编码索引转化 为码字数值的概率统计分布映射方式具体为:根据待编码语法元素的概率统计 分布信息建立所述编码索引和所述码字数值的映射关系。 The video entropy coding apparatus according to claim 16, wherein the mapping manner of converting the coding index into a codeword value is a probability statistical distribution map, and converting the coding index into a codeword value The probability distribution distribution mapping manner is specifically: establishing a mapping relationship between the coding index and the codeword value according to the probability statistical distribution information of the syntax element to be encoded.
20、 如权利要求 16所述的视频熵编码装置, 其特征在于, 所述将所述编 码索引转化为码字数值的映射方式为非概率统计分布映射,将所述编码索引转 化为码字数值的非概率统计分布映射方式具体为: The video entropy coding apparatus according to claim 16, wherein the mapping manner of converting the coding index into a codeword value is a non-probabilistic statistical distribution map, and converting the coding index into a codeword value The non-probabilistic statistical distribution mapping method is specifically as follows:
将所述编码索引和所述码字数值线性关联,或通过制定映射表建立所述编 码索弓 I和所述码字数值的映射关系; And linearly associating the coding index with the codeword value, or establishing a mapping relationship between the coding cable and the codeword value by formulating a mapping table;
所述线性关联公式为: 编码索弓 Ι=αχ码字数值 +β, 其中, α和 β是整数。 The linear correlation formula is: Coded Ι = α χ code word value + β, where α and β are integers.
21、 如权利要求 16所述的视频熵编码装置, 其特征在于, 所述码字编码 规则包括有规则变长编码或有规则定长编码。 The video entropy encoding apparatus according to claim 16, wherein the codeword encoding rule comprises a regular variable length coding or a regular fixed length coding.
22、 一种记录介质, 包括权利要求 1至 15中任意一项所述的视频熵编码 方法的程序。 A recording medium comprising the program of the video entropy encoding method according to any one of claims 1 to 15.
23、 一种视频熵解码方法, 其特征在于, 所述方法包括: A video entropy decoding method, the method comprising:
读取熵编码后的二进制比特流,根据码字编码规则进行计算,获取完整的 二进制码字; Reading the entropy-encoded binary bit stream, performing calculation according to the codeword encoding rule, and obtaining a complete binary codeword;
将所述二进制码字按照所述码字编码规则计算得出码字数值; Calculating the codeword value according to the codeword encoding rule by using the binary codeword;
将所述码字数值转化为编码索引; Converting the codeword value into an encoding index;
根据所述编码索弓 I获取相应的语法元素。 Corresponding syntax elements are obtained according to the encoding.
24、 如权利要求 23所述的视频熵解码方法, 其特征在于, 所述 "读取熵编 码后的二进制比特流, 根据码字编码规则进行计算, 获取完整的二进制码字" 具体为: The video entropy decoding method according to claim 23, wherein the reading the entropy encoded binary bit stream is performed according to a codeword encoding rule to obtain a complete binary codeword.
读取熵编码后的二进制比特流; Reading the entropy encoded binary bit stream;
获取所述二进制比特流中的第一个 " 1 "之前 " 0 "的个数, 将所述个数 作为码字结构中的前缀信息; Obtaining a number of “0”s before the first “1” in the binary bit stream, and using the number as the prefix information in the codeword structure;
根据所述前缀信息和所述码字编码规则, 获取完整的二进制码字。 Obtaining a complete binary codeword according to the prefix information and the codeword encoding rule.
25、 如权利要求 23所述的视频熵解码方法, 其特征在于, 所述将所述码 字数值转化为编码索引的映射方法包括概率统计分布映射方法或非概率统计 分布映射方法。 The video entropy decoding method according to claim 23, wherein the mapping method for converting the codeword value into a coding index comprises a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method.
26、 如权利要求 25所述的视频熵解码方法, 其特征在于, The video entropy decoding method according to claim 25, wherein
当所述将所述码字数值转化为编码索引的映射方法为概率统计分布映射 方法时, 所述将所述码字数值转化为编码索弓 I的映射方法具体为: 根据待编码语法元素的概率统计分布信息建立所述编码索引和所述码字 数值的映射关系; When the mapping method for converting the codeword value into a coding index is a probability statistical distribution mapping In the method, the mapping method for converting the codeword value into the coding function is as follows: establishing a mapping relationship between the coding index and the codeword value according to probability statistical distribution information of a syntax element to be encoded;
当所述将所述码字数值转化为编码索引的映射方法为非概率统计分布映 射方法时, 所述将所述码字数值转化为编码索引的映射方法具体为: When the mapping method for converting the codeword value into a coding index is a non-probabilistic statistical distribution mapping method, the mapping method for converting the codeword value into an encoding index is specifically:
将所述编码索引和所述码字数值线性关联,或通过制定映射表建立所述编 码索弓 I和所述码字数值的映射关系; And linearly associating the coding index with the codeword value, or establishing a mapping relationship between the coding cable and the codeword value by formulating a mapping table;
所述线性关联公式为: 编码索引 =αχ码字数值 +β, 其中, α和 β是整数。 The linear correlation formula is: Encoding index = α χ code word value + β, where α and β are integers.
27、 一种视频熵解码装置, 其特征在于, 所述装置包括: 27. A video entropy decoding apparatus, the apparatus comprising:
完整码字获取模块,用于读取熵编码后的二进制比特流, 根据码字编码规 则进行计算, 获取完整的二进制码字; a complete codeword obtaining module, configured to read the entropy-encoded binary bit stream, perform calculation according to the codeword encoding rule, and obtain a complete binary codeword;
码字数值获取模块,用于将所述二进制码字按照所述码字编码规则计算得 出码字数值; a codeword value obtaining module, configured to calculate, according to the codeword encoding rule, the codeword value;
第三转化模块, 用于将所述码字数值转化为编码索引; a third conversion module, configured to convert the codeword value into an encoding index;
第二语法元素获取模块, 用于根据编码索引获取相应的语法元素。 The second syntax element obtaining module is configured to obtain a corresponding syntax element according to the encoding index.
28、 如权利要求 27所述的视频熵解码装置, 其特征在于, 28. The video entropy decoding apparatus according to claim 27, wherein:
所述完整码字获取模块包括二进制比特流读取模块、码字前缀信息获取模 块和第二码字获取模块, The complete codeword acquisition module includes a binary bitstream reading module, a codeword prefix information acquisition module, and a second codeword acquisition module.
所述二进制比特流读取模块, 用于读取熵编码后的二进制比特流; 所述码字前缀信息获取模块,用于获取所述二进制比特流中的第一个 " 1 " 之前 " 0 " 的个数, 将该个数作为码字结构中的前缀信息; The binary bit stream reading module is configured to read the entropy-encoded binary bit stream; the codeword prefix information obtaining module is configured to acquire the first “1” before the “0” in the binary bit stream The number of the number, the number is used as the prefix information in the codeword structure;
所述第二码字获取模块,用于根据所述前缀信息和所述码字编码规则, 获 取完整的二进制码字。 The second codeword obtaining module is configured to obtain a complete binary codeword according to the prefix information and the codeword encoding rule.
29、 如权利要求 27所述的视频熵解码装置, 其特征在于, 所述将所述码 字数值转化为编码索引的映射方法包括概率统计分布映射方法或非概率统计 分布映射方法。 The video entropy decoding apparatus according to claim 27, wherein the mapping method for converting the codeword value into a coding index comprises a probability statistical distribution mapping method or a non-probabilistic statistical distribution mapping method.
30、如权利要求 29所述的视频熵解码装置, 其特征在于, 当所述将所述码 字数值转化为编码索引的映射方法为概率统计分布映射方法时,所述将所述码 字数值转化为编码索引的映射方法具体为: The video entropy decoding apparatus according to claim 29, wherein when the mapping method for converting the codeword value into a coding index is a probability statistical distribution mapping method, the code is The mapping method for converting a word value into a coding index is specifically as follows:
根据待编码语法元素的概率统计分布信息建立所述编码索引和所述码字 数值的映射关系; Establishing a mapping relationship between the encoding index and the codeword value according to probability statistical distribution information of a syntax element to be encoded;
当所述将所述码字数值转化为编码索引的映射方法为非概率统计分布映 射方法时, 所述将所述码字数值转化为编码索引的映射方法具体为: When the mapping method for converting the codeword value into a coding index is a non-probabilistic statistical distribution mapping method, the mapping method for converting the codeword value into an encoding index is specifically:
将所述编码索引和所述码字数值线性关联,或通过制定映射表建立所述编 码索弓 I和所述码字数值的映射关系; And linearly associating the coding index with the codeword value, or establishing a mapping relationship between the coding cable and the codeword value by formulating a mapping table;
所述线性关联公式为: 编码索弓 Ι=αχ码字数值 +β, 其中, α和 β是整数。 The linear correlation formula is: Coded Ι = α χ code word value + β, where α and β are integers.
31、一种记录介质,包括权利要求 23至 26中任意一项所述的视频熵解码 方法的程序。 A recording medium comprising the program of the video entropy decoding method according to any one of claims 23 to 26.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110139068.4A CN102238387B (en) | 2011-05-25 | 2011-05-25 | A kind of video entropy code, entropy decoding method, device |
CN201110139068.4 | 2011-05-25 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2012159301A1 true WO2012159301A1 (en) | 2012-11-29 |
Family
ID=44888536
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2011/076455 WO2012159301A1 (en) | 2011-05-25 | 2011-06-28 | Method, device and medium for video entropy encoding and entropy decoding |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN102238387B (en) |
WO (1) | WO2012159301A1 (en) |
Families Citing this family (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9866829B2 (en) * | 2012-01-22 | 2018-01-09 | Qualcomm Incorporated | Coding of syntax elements that correspond to coefficients of a coefficient block in video coding |
CN103260022A (en) * | 2012-02-21 | 2013-08-21 | 安凯(广州)微电子技术有限公司 | Low-power-consumption video decoding method and device |
KR101974320B1 (en) * | 2012-04-13 | 2019-04-30 | 캐논 가부시끼가이샤 | Method, apparatus and medium for encoding and decoding a sub block of transform units of video data |
US9077965B2 (en) * | 2012-10-12 | 2015-07-07 | Mediatek Inc. | Method and apparatus for performing lossy image compression through source quantization and lossless compression kernel, and related method and apparatus for image decompression |
CN103929651A (en) * | 2013-01-10 | 2014-07-16 | 乐金电子(中国)研究开发中心有限公司 | Depth intraframe coding mode index configuration method and apparatus |
CN104053007B (en) * | 2013-03-15 | 2019-05-07 | 乐金电子(中国)研究开发中心有限公司 | Depth image intra-frame encoding mode index value configuration method and device |
US9936200B2 (en) | 2013-04-12 | 2018-04-03 | Qualcomm Incorporated | Rice parameter update for coefficient level coding in video coding process |
CN104104950B (en) * | 2013-04-12 | 2018-03-02 | 浙江大学 | The decoding method and device of a kind of pattern information |
US10021419B2 (en) | 2013-07-12 | 2018-07-10 | Qualcomm Incorported | Rice parameter initialization for coefficient level coding in video coding process |
CN103414897B (en) * | 2013-07-31 | 2016-05-18 | 北京蛙视通信技术股份有限公司 | To method and the device of the decoding of video image entropy |
GB2521828A (en) * | 2013-12-23 | 2015-07-08 | Sony Corp | Data encoding and decoding |
CN104602030B (en) * | 2014-12-26 | 2018-03-23 | 北京奇艺世纪科技有限公司 | A kind of coding method, code device and server |
US20170180757A1 (en) * | 2015-12-18 | 2017-06-22 | Blackberry Limited | Binarizer selection for image and video coding |
CN106888380B (en) * | 2017-01-04 | 2019-05-03 | 西安万像电子科技有限公司 | The coding method of character block and device in image |
CN107580224B (en) * | 2017-08-08 | 2019-11-22 | 西安理工大学 | A kind of adaptive scanning method towards HEVC entropy coding |
EP3846133A4 (en) * | 2018-08-30 | 2021-10-20 | Panasonic Intellectual Property Corporation of America | Three-dimensional data encoding method, three-dimensional data decoding method, three-dimensional data encoding device, and three-dimensional data decoding device |
US20200143226A1 (en) * | 2018-11-05 | 2020-05-07 | Samsung Electronics Co., Ltd. | Lossy compression of neural network activation maps |
CN111669580B (en) * | 2019-03-09 | 2023-02-28 | 杭州海康威视数字技术股份有限公司 | Method, decoding end, encoding end and system for encoding and decoding |
CN111988630A (en) * | 2020-09-11 | 2020-11-24 | 北京锐马视讯科技有限公司 | Video transmission method and device, equipment and storage medium |
CN115361556A (en) * | 2022-07-12 | 2022-11-18 | 泽恩科技有限公司 | High-efficiency video compression algorithm based on self-adaption and system thereof |
CN116684003B (en) * | 2023-07-27 | 2023-10-24 | 南京中科齐信科技有限公司 | Quantum communication-based railway line air-ground comprehensive monitoring method and system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1650625A (en) * | 2002-04-26 | 2005-08-03 | 诺基亚有限公司 | Adaptive method and system for mapping parameter values to codeword indexes |
CN101283253A (en) * | 2005-10-05 | 2008-10-08 | Lg电子株式会社 | Method and apparatus for signal processing and encoding and decoding method, and apparatus thereof |
CN101741392A (en) * | 2008-11-27 | 2010-06-16 | 安凯(广州)软件技术有限公司 | Huffman decoding method for fast resolving code length |
CN101873496A (en) * | 2010-05-24 | 2010-10-27 | 杭州海康威视软件有限公司 | Context-based self-adaption variable length decoding method and device of H.264 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100593954C (en) * | 2007-03-28 | 2010-03-10 | 中国科学院微电子研究所 | Device and method for decoding Columbus code |
US8488668B2 (en) * | 2007-06-15 | 2013-07-16 | Qualcomm Incorporated | Adaptive coefficient scanning for video coding |
CN101895756B (en) * | 2010-07-15 | 2012-10-31 | 北京大学 | Method and system for coding, decoding and reconstructing video image blocks |
-
2011
- 2011-05-25 CN CN201110139068.4A patent/CN102238387B/en not_active Expired - Fee Related
- 2011-06-28 WO PCT/CN2011/076455 patent/WO2012159301A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1650625A (en) * | 2002-04-26 | 2005-08-03 | 诺基亚有限公司 | Adaptive method and system for mapping parameter values to codeword indexes |
CN101283253A (en) * | 2005-10-05 | 2008-10-08 | Lg电子株式会社 | Method and apparatus for signal processing and encoding and decoding method, and apparatus thereof |
CN101741392A (en) * | 2008-11-27 | 2010-06-16 | 安凯(广州)软件技术有限公司 | Huffman decoding method for fast resolving code length |
CN101873496A (en) * | 2010-05-24 | 2010-10-27 | 杭州海康威视软件有限公司 | Context-based self-adaption variable length decoding method and device of H.264 |
Also Published As
Publication number | Publication date |
---|---|
CN102238387B (en) | 2017-07-18 |
CN102238387A (en) | 2011-11-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2012159301A1 (en) | Method, device and medium for video entropy encoding and entropy decoding | |
TWI826519B (en) | Regular coded bin reduction for coefficient coding | |
TWI685245B (en) | Data encoding and decoding | |
US12108083B2 (en) | GOLOMB-RICE/EG coding technique for CABAC in HEVC | |
TWI657692B (en) | Rice parameter initialization for coefficient level coding in video coding process | |
JP2022123096A (en) | Context initialization in entropy coding | |
KR101187243B1 (en) | Fast parsing of variable-to-fixed-length codes | |
US8068043B2 (en) | Method and apparatus for video processing in context-adaptive binary arithmetic coding | |
TWI662830B (en) | Data encoding and decoding | |
WO2012173315A1 (en) | Method and apparatus for encoding/decoding video in intra prediction mode | |
JP7369191B2 (en) | Canonical coded bin reduction for coefficient decoding using thresholds and Rician parameters | |
US20080170625A1 (en) | Per block breakpoint determining for hybrid variable length coding | |
TWI827662B (en) | Regular coded bin reduction for coefficient coding | |
WO2005027521A1 (en) | Entropy coding method for encoding remanet coefficient in video predicting | |
KR20080082147A (en) | Method and apparatus for context adaptive binary arithmetic coding and decoding | |
WO2012021353A1 (en) | Coding blocks of data using one-to-one codes | |
WO2008112550A2 (en) | Data compression using variable-to-fixed length codes | |
WO2012016210A1 (en) | Coding blocks of data using a generalized form of golomb codes | |
US20220417563A1 (en) | Escape coding for coefficient levels | |
US10070127B2 (en) | Method and apparatus for arithmetic coding and termination | |
Albanese et al. | High speed CAVLC encoder suitable for field programmable platforms | |
WO2012159295A1 (en) | Entropy decoding method and device | |
JPWO2011148887A1 (en) | Moving image distribution system, moving image transmission apparatus, moving image distribution method, and moving image distribution program | |
US8421655B2 (en) | Apparatus for parallel entropy encoding and decoding | |
TWI856996B (en) | Escape coding for coefficient levels |
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: 11866048 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: 11866048 Country of ref document: EP Kind code of ref document: A1 |