A kind of video entropy code, entropy decoding method, device
Technical field
The present invention relates to technical field of video coding, more particularly to a kind of video entropy code, entropy decoding method, device.
Background technology
Video compression international standard MPEG-x and the Mixing compression algorithm for H.26x etc. being all based on block, pass through motion
Estimation/motion compensation eliminates video time redundancy, and discrete cosine transform conversion is carried out to error image and eliminates spatial redundancy, to amount
Coefficient after change carries out entropy code and eliminates statistical redundancy.Entropy encoding/decoding is the important component of Video coding, pair of entropy code
As if a series of syntactic elements that various functions module is generated in video coding algorithm, the purpose is to effectively remove the system of data
Count redundancy.These syntactic elements can classify two classes:Residual error coefficient syntactic element and non-residual error coefficient syntactic element.Residual error coefficient language
The information content of method element is maximum, is the design emphasis of entropy code, the syntactic element of residual error coefficient is by being scanned across conversion and measuring
Block residual error coefficient after change processing is obtained.The syntactic element of non-residual error system is regarded by such as infra-frame prediction, inter prediction and quantization etc.
Frequency coding link generate and is input to what entropy code module was handled, the syntactic element of non-residual error system including macro block (mb) type,
Reference frame index, quantization parameter, motion vector residual error, encoding model, intra prediction mode etc..In Video coding, macro block is
The elementary cell of Video coding, macroblock size is 16 × 16, and each macro block is constituted by 44 × 4 pieces, and each block is 4 × 4 bright by 1
Spend block and 2 chrominance block compositions.
MPEG-1, H.261, MPEG-2, H.263, MPEG-4 and newest H.264 video standard be to block prediction residual system
Several coding methods are classified as follows:
(1) H.261,2D-VLC (Variable Length Coding) entropy code of MPEG-1, Moving Picture Experts Group-2;
(2) H.263, the 3D-VLC entropy codes of MPEG-4 standards;
(3) H.264/AVC the adaptive variable length based on context of standard encodes CAVL (Context-Based
Adaptive Variable Length Coding, CAVLC) and binary arithmetic coding CABAC based on context
(Context-Based Adaptive Binary Arithmetic Coding,CABAC)。
The residual error coefficient of image block can obtain a two-dimentional residual error coefficient, in order to enter after the processing of change quantization link
One step is handled, and typically two-dimentional coefficient can be converted into one-dimensional sequence using scanning;To the characterizing method of this one-dimensional sequence
There are various ways, different characterizing methods defines respective syntactic element;Conversely, going out one-dimensional sequence using syntactic element restructural
Row.The residual coding parameter related to these syntactic elements mainly has:Level, Run and end-data symbol EOB (End of
Block) etc..Coefficient progress Zigzag scannings after usual entropy code first quantifies to predictive transformation are pre-processed, in scanning
The continuous zero coefficient distance of swimming that the nonzero coefficient run into is designated as before Level, a nonzero coefficient is designated as Run.
Specifically:2D-VLC entropy codes use combined coding (Level, Run) data pair of residual error coefficient, and to EOB
Coding, EOB individually distributes a code word;3D-VLC entropy coders are by end of data information integration to (Level, Run) data pair
In, three-dimensional data group (Level, Run, Last) is formed, Last represents whether current coefficient is last coefficient in block, so
Can be without being encoded to end mark symbol, and play Level, Run and EOB joint probability;H.264/AVC video is compiled
The CAVLC entropy codes of code standard take full advantage of contextual information, and 4 × 4 pieces of residual information is entered by setting up multiple code tables
Good optimization is gone, Level, Run points is opened and is encoded, good encoding efficiency is achieved.Above-mentioned entropy coding method is all
It is to belong to variable length encoder, it encodes general principle and still follows Huffman (Huffman) coding principle, the i.e. symbol of maximum probability
The symbol distribution long code word of short code word, small probability is distributed, so as to reach mean code length most short purpose.H.264/AVC CABAC
Entropy code belongs to arithmetic encoder, and the performance of arithmetic coding is better than variable-length encoding, and CABAC is estimated by the probability of self adaptation
Meter and renewal and binary arithmetic coding, more approach Shannon's theorems, encoding efficiency is higher, but its algorithm computation complexity
Height, hardware, which is realized, requires complicated, is the raising that a kind of complexity with software and hardware exchanges code efficiency for.
As can be seen that above-mentioned video encoding standard passes through the probability statistics under analysis block prediction residual coefficient different conditions point
Cloth, higher code efficiency can be obtained by carrying out the coding based on context.H.264/AVC the CAVLC in standard makes full use of
Probability statistical distribution under residual error coefficient different conditions, adaptively encodes a corresponding grammer first using multiple code tables
Element, CAVLC is to have issued code efficiency highest context-adaptive variable-length encoding technology in video standard at present.For moving
For this kind of application scenarios of live video communication such as dynamic video, entropy encoding/decoding technology employs exp-Golomb coding Exp-
Golomb and CAVLC, exp-Golomb coding is encoded primarily directed to the non-residual information such as motion vector;CAVLC is encoded
Encoded mainly for prediction residual.Exp-Golomb coding and CAVLC coding all meet the basic think of of Huffman codings
Think:Short code word represents high probability information, and long code word represents low probability information.But exp-Golomb coding is a kind of general based on symbol
The regular variable-length encoding that rate statistics is carried out;CAVLC is on the basis of traditional variable length encoding method, by introducing content-adaptive
Model, defines the different code table of multigroup structure, according to coding codeword feature, dynamic to carry out code table switching, improves coding effect
Rate.CAVLC decoding process amount of calculation is excessive, on the one hand, CAVLC decodings must differentiate each length from continuous bit stream
Different code words, such as needs to travel through whole binary tree, it is necessary to repeatedly be read and judged, therefore table look-up using full-search algorithm
It is many that process expends the time;On the other hand, because code word tree is very sparse, memory space being added to code word size of code table
Exponential increase, but it is therein mostly vacant, it is not utilized effectively.
H.264 entropy code obtains good code efficiency by good context-adaptive design, but these are all
It is that, using excessive code table as cost, excessive code table means that coding-decoding operation needs more computing resources.Particularly to moving
For dynamic video service system, due to factors, Gao Fu such as computing hardware, the limited resources of battery power consumption of portable mobile termianl
The video entropy decoding of miscellaneous degree, which is realized, is also faced with problems:Many code tables of entropy decoder are needed by look-up table LUT (Look
Up Table) structure realization, larger memory headroom is taken, generally requires to travel through look-up table matching code by turn during entropy decoding process
Word, repeatedly read/write memory operation also results in the sharp increase of power consumption.
The content of the invention
The purpose of the embodiment of the present invention is to propose a kind of video entropy coding method, it is intended to solve prior art tradition elongated
Code table takes larger memory headroom, needs traversing operation, the problem of entropy encoding/decoding complexity is high by turn.
The method of the embodiment of the present invention is achieved in that a kind of video entropy coding method, and methods described includes:
Obtain the syntactic element to be encoded in block to be encoded;
The syntactic element to be encoded is converted into code index;
The code index is converted into code word numerical value;
The code word numerical value is encoded according to codeword coding rule, final code word is obtained.
Second purpose of the embodiment of the present invention is to propose a kind of video entropy code device, and described device includes:
Syntax elements encoded acquisition module, for obtaining the syntactic element to be encoded in block to be encoded;
First conversion module, for the syntactic element to be encoded to be converted into code index;
Second conversion module, for the code index to be converted into code word numerical value;It is described to convert the code index
It is probability statistical distribution mapping or the mapping of non-probability statistical distribution for the mapping mode of code word numerical value;
First code word acquisition module, for being encoded to the code word numerical value according to codeword coding rule, obtains final
Code word.
3rd purpose of the embodiment of the present invention is to propose a kind of recording medium, including described video entropy coding method
Program.
4th purpose of the embodiment of the present invention is to propose a kind of video entropy decoding method, and methods described includes:
The binary bit stream after entropy code is read, is calculated according to codeword coding rule, obtains complete binary system
Code word;
The binary code word is calculated into code word numerical value according to the codeword coding rule;
The code word numerical value is converted into code index;
Corresponding syntactic element is obtained according to the code index.
5th purpose of the embodiment of the present invention is to propose a kind of video entropy decoding device, and described device includes:
Complete code acquisition module, for reading the binary bit stream after entropy code, is carried out according to codeword coding rule
Calculate, obtain complete binary code word;
Code word numerical value acquisition module, for the binary code word to be calculated into code word according to the codeword coding rule
Numerical value;
3rd conversion module, for the code word numerical value to be converted into code index;
Second syntactic element acquisition module, for obtaining corresponding syntactic element according to code index.
6th purpose of the embodiment of the present invention is to propose a kind of recording medium, including described video entropy decoding method
Program.
Beneficial effects of the present invention
The embodiment of the present invention is turned the syntactic element to be encoded by obtaining the syntactic element to be encoded in block to be encoded
Turn to code index, the code index be converted into code word numerical value, the code word numerical value is carried out regular variable-length encoding or
Block code, obtains final code word;The key idea of the embodiment of the present invention is to go to match syntactic element by regular code word
Context adapts to probability distribution, and CAVLC many code tables design is replaced by introducing code index, traditional variable length code is eliminated
Table needs to take larger memory headroom and needs traversing operation by turn, under the premise of code efficiency has been ensured, greatly reduces shifting
Entropy code and the implementation complexity of entropy decoding on dynamic terminal device, it is adaptable to the limited portable terminal of hardware resource.
Brief description of the drawings
Fig. 1 is a kind of video entropy coding method flow chart of the embodiment of the present invention;
Fig. 2 is the Zigzag scanning sequency figures of the prediction residue block of the brightness of the embodiment of the present invention 4 × 4;
A kind of video entropy code apparatus structure schematic diagram of Fig. 3 embodiment of the present invention;
Fig. 4 is a kind of video entropy decoding method flow chart of the embodiment of the present invention;
Fig. 5 is a kind of video entropy decoding device structural representation of the embodiment of the present invention.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated, for convenience of description, illustrate only the part related to the embodiment of the present invention.It should manage
Solution, the specific embodiment that this place is described is used only for explaining the present invention, is not intended to limit the invention.
The embodiment of the present invention is turned the syntactic element to be encoded by obtaining the syntactic element to be encoded in block to be encoded
Turn to code index, the code index be converted into code word numerical value, the code word numerical value is carried out regular variable-length encoding or
Block code, obtains final code word;The embodiment of the present invention by introducing code index and regular elongated/block code method,
Each syntactic element code table of brand-new design, realizes that quick code table is retrieved by code index, and eliminating traditional variable length code table needs
Take larger memory headroom and need traversing operation by turn, on the premise of code efficiency is ensured, greatly improve mobile whole
The implementation complexity that entropy decoding is operated in end equipment, it is adaptable to the limited portable terminal of hardware resource.
Embodiment one
Fig. 1 show a kind of video entropy coding method flow chart of the embodiment of the present invention, the described method comprises the following steps:
S101, obtains the syntactic element to be encoded in block to be encoded;
The syntactic element to be encoded includes:Residual error coefficient syntactic element or non-residual error coefficient syntactic element;
The method for obtaining residual error coefficient syntactic element is as follows:
A the block to be encoded residual error coefficient after) quantifying to prediction reorders according to scanning sequency, by two-dimentional residual error coefficient
It is arranged in one-dimensional sequence;
The scanning sequency is that Zigzag scans method for reordering;
B block to be encoded residual error coefficient syntactic element) is obtained according to the one-dimensional sequence;
Obtaining block to be encoded residual error coefficient syntactic element according to the one-dimensional sequence is specially:According to residual error in one-dimensional sequence
The statistical nature of coefficient, obtains corresponding syntactic element;Corresponding syntactic element can characterize one-dimensional sequence.
Syntactic element can characterize all information of one-dimensional sequence, that is, only rely on syntactic element and reconstruct one-dimensional sequence.But
It is to be used as the entropy code part of Video coding, it is often desired to using the statistical nature of residual error coefficient, reduce and preserve these information
Digit.One illustrate below:
Example:The one-dimensional sequence serial data of one 16 element:0,3,0,1, -1, -1,0,1,0,0,0,0,0,0,0,0.Adopt
With the thought of Run- Length Coding:If 0 distance of swimming is run, nonzero coefficient is level, using (run, the level) distance of swimming to representing described one
Bit sequence is (1,3), (1,1), (0, -1), (0, -1), (1,1) and an end mark EOB.It can be seen that nondestructively to preserve
16 one-dimensional sequence residual informations, it is necessary to information digit be 16 × H (H be each coefficient preserve need binary digit
Number);And use after Run- Length Coding, 5 (run, level) distances of swimming pair can be obtained, if defining the distance of swimming to for syntactic element,
Do not consider the distance of swimming it is right/the probability distribution situation of syntactic element (equiprobability situation, entropy is maximum) when, give distance of swimming centering each data
Distribution H, required total information position is 11 × H, wherein, end mark EOB distributes H).Therefore, required digit will far be lacked
The digit needed for original series are preserved.Moreover, the probability distribution of actually syntactic element is non-probability distribution, and its entropy is less than etc.
The entropy of probability, in other words, can preserve all data with less digit.
As according to H.264, MPEG-2, MPEG-4 coding standard can divide the syntactic element acquisition modes of the one-dimensional sequence
It is forms data mode, data to mode or data group mode;
The residual error coefficient syntactic element obtained by forms data mode includes:The number TotalCoeffs of nonzero coefficient, drag
The number TrailingOnes of tail coefficient, the number Total_zeros of nonzero coefficient leading zero, nonzero coefficient amplitude Level and trip
Journey Run_before;
The residual error coefficient syntactic element obtained by data to mode includes:(Level, Run) data pair and end of data
Symbol;
The residual error coefficient syntactic element obtained by data group mode includes:Three-dimensional data group (Level, Run, Last);
The non-residual error coefficient syntactic element include macro block (mb) type, reference frame index, quantization parameter, motion vector residual error,
Encoding model or intra prediction mode;
S102, code index CodeIndex is converted into by the syntactic element to be encoded;
The syntactic element to be encoded includes:Residual error coefficient syntactic element or non-residual error coefficient syntactic element;
It is described by syntactic element to be encoded be converted into code index method can for probability statistical distribution mapping method or
Non- probability statistical distribution mapping method;
Syntactic element to be encoded is converted into the probability statistical distribution mapping method of code index, is specially:
A), the probability statistical distribution information of the syntactic element to be encoded in block to be encoded is obtained;The probability statistical distribution
Information is the probability distribution statistical value of syntactic element to be encoded;
Specially:
1) the block to be encoded residual error coefficient after prediction quantifies is obtained;
2) the probability statistical distribution value of the syntactic element based on context model is counted, the syntactic element to be encoded is used as
Probability statistical distribution value;
The context model is the joint probability set up according to the relation of interdependence of front and rear information.Before and after described
Information represents the data granularities, this hair such as reduced data unit and current pending data unit, including image sets, frame, piece, block
Front and rear information in bright embodiment is processed piece and currently pending piece;
The data relation of interdependence includes:A) spatial coherence between adjacent block;Due to adjacent block in same frame
Often there is significantly spatial coherence, the information of current block can be predicted by adjacent block.B) between syntactic element originally
Come the mathematics restricting relation possessed.In Video coding, typically by context model referred to as into context, its information theory theory exists
In:Combination entropy is less than information source entropy sum, so as to further improve compression efficiency.
Further, the close probability statistical distribution information of probability statistical distribution value can also be merged, after being merged
The probability statistical distribution value of syntactic element, is used as the probability statistical distribution value of the syntactic element to be encoded.
B), probability sorting is carried out to the syntactic element to be encoded according to the probability statistical distribution value;The probability row
Sequence can be ascending order or descending;
C), the mapping relations of the syntactic element to be encoded and code index are set up;
In " the probability statistical distribution mapping for the setting up syntactic element and code index " step, non-residual error coefficient language is set up
The mapping of method element and code index, can set up single non-residual error coefficient syntactic element and code index CodeIndex
Map or set up multiple non-residual error coefficient syntactic elements and the Joint Mapping of code index CodeIndex mapping.
Described " setting up multiple non-residual error coefficient syntactic elements and the Joint Mapping of code index CodeIndex mapping " can
Think the joint probability distribution situation of comprehensive multiple non-residual error coefficient syntactic elements to set up corresponding non-residual error coefficient grammer member
Plain mapping table, or comprehensively encode after being grouped to the syntactic element of the non-residual error coefficient.
Further,
Non- residual error coefficient syntactic element in syntactic element to be encoded is converted into the non-probability statistical distribution of code index
Mapping method includes directly mapping without symbol, has symbol to be converted into symbol mapping or mapping table mode:
(1) directly mapped without symbol.The syntactic element of this mapping mode includes macro block (mb) type, parameter frame index etc..
CodeNum=CodeIndex=v, v are the numerical value of non-residual error coefficient syntactic element
(2) there is symbol mapping.The syntactic element of this mapping mode mainly includes motion vector difference, quantizing factor increment
Deng.
V is the numerical value of non-residual error coefficient syntactic element
(3) mapping table.Provide non-residual error coefficient syntactic element to the second code index CodeIndex by formulating mapping table
Mapping relations.It is mainly used in the isoparametric mapping of block coding mode, intra prediction mode.
Table 7 is the luminance block intra prediction mode of the embodiment of the present invention 4 × 4 and code index CodeIndex mapping table pass
It is table, this table is mapped with code index single non-residual error coefficient syntactic element.
Table 7
S103:The code index CodeIndex is converted into code word numerical value CodeNum;
The mapping method that the code index CodeIndex is converted into code word numerical value CodeNum can be probability
Statistical distribution mapping method or non-probability statistical distribution mapping method;
It is by the code index CodeIndex probability statistical distribution mapping methods for being converted into code word numerical value CodeNum:
The mapping relations of the code index and code word numerical value are set up according to the probability statistical distribution of syntactic element to be encoded;Wherein, institute
State mapping relations and follow the most short principle of mean code length, the code word numerical value and code of mapping are instructed by the probability of syntactic element to be encoded
Word:Maximum probability code word numerical value distributes short code word, small probability code word numerical value distribution long code word;
The code index CodeIndex is converted into code word numerical value CodeNum non-probability statistical distribution mapping method
For:
By code index CodeIndex and code word numerical value CodeNum linear correlations, i.e. CodeIndex=α × CodeNum+
β (wherein, α and β are integers);Or the mapping relations of code index and code word numerical value are set up by formulating mapping table;
S104:The code word numerical value CodeNum is encoded according to codeword coding rule, final code word is obtained;
The codeword coding rule can be regular variable-length encoding or regular block code;
The code word has well-regulated codeword structure, and the code word numerical value CodeNum and code word CodeWord are directly present
The mathematical relationship of determination, can generate code word by code word numerical computations, code word numerical value can be also calculated by code word;
The regular variable-length encoding can be that this Golomb-Rice of Columbus's Lay of different rank or index Columbus are compiled
Code Exp-Golomb coding rules;Golomb-Rice and Exp-Golomb belong to Columbus's coding, and the exponent number is Columbus
The parameter of coding, different exponent number its to encode formula different.
The code word is binary format, including prefix and suffix portion, and the prefix is general to be opened by multiple 0 plus one 1
Head;
The embodiment of the present invention lists Columbus's Lay this Golomb-Rice and exp-Golomb coding Exp-Golomb part
Coding structure, when being exponent number k=0,1,2,3 as shown in table 1, Golomb-Rice partial codeword;Table 2 show exponent number k=0,
When 1,2,3, the partial codeword of Exp-Golomb codings.
Table 1
Table 2
The embodiment of the present invention by introducing code index and regular elongated/block code method, brand-new design each
Syntactic element code table, realizes that quick code table is retrieved by code index, and regular elongated/block code enters without preserving actual two
Code word processed, eliminating traditional variable length code table needs to take larger memory headroom and needs traversing operation by turn, is ensureing coding effect
On the premise of rate, the implementation complexity that entropy decoding is operated on mobile terminal device is greatly improved, it is adaptable to which hardware resource is limited
Portable terminal.
Embodiment two
The following is with using prediction residue block progress entropy code of the H.264/AVC CAVLC entropy codes to 4 × 4 brightness
Exemplified by come be described in detail the present invention implementation process.It is illustrated in figure 2 the prediction residue block of the brightness of the embodiment of the present invention 4 × 4
Zigzag scanning sequency figures, wherein, the numerical value in square represents brightness residual numerical value, and arrow represents the order of scanning.
4 × 4 pieces of residual error coefficient is by one-dimensional sequence of the Zigzag Sequential Mappings for 16 elements:0,3,0,1, -1, -
1,0,1,0,0,0,0,0,0,0,0.
If the residual error coefficient syntactic element for needing coding using H.264/AVC CAVLC entropy codes includes:
(a) number (TotalCoeffs)=5 He of nonzero coefficient
The number (TrailingOnes)=3 of hangover coefficient;
(b) number (Total_zeros)=3 of nonzero coefficient leading zero;
(c) Level (i)=1i=1,0;
(d) Run_before (i) i=4,3,2,1,0.
CAVLC coding rules are followed, compression stream can be obtained:000010001110010111101101;Wherein, residual error system
Number syntactic element Coeff_token (the number TotalCoeffs of nonzero coefficient and the number TrailingOnes of hangover coefficient)
Coding is output as 0000100.
Just to residual error coefficient syntactic element Coeff_token, (the number TotalCoeffs of nonzero coefficient and hangover are below
Several number TrailingOnes) coding exemplified by, further illustrate the embodiment of the present invention propose a kind of video entropy code side
Coding flow of the method to the residual error coefficient syntactic element Coeff_token.
S201, scans the prediction residue block of 4 × 4 brightness, obtains residual error coefficient syntactic element to be encoded;
The prediction residue block Zigzag Sequential Mappings of 4 × 4 brightness are the serial data of 16 elements:0,3,0,1, -1, -1,
0,1,0,0,0,0,0,0,0,0;
Obtaining residual error coefficient syntactic element to be encoded includes:Syntactic element Coeff_token (the numbers of nonzero coefficient
(TotalCoeffs)=5 with the number (TrailingOnes)=3 of hangover coefficient);
S202, code index CodeIndex is converted into by the residual error coefficient syntactic element to be encoded;
According to the probability distribution of the residual error coefficient syntactic element Coeff_token to be encoded, arranged from big to small,
It is used as residual error coefficient syntactic element to be encoded (the number TotalCoeffs of nonzero coefficient with code index CodeIndex
With hangover coefficient number TrailingOnes) mapping relations;
As shown in table 3 for the residual error coefficient syntactic element Coeff_token to be encoded and code index CodeIndex's
Mapping table;
As can be seen from Table 3 for the residual error coefficient syntactic element Coeff_token to be encoded, the number of nonzero coefficient
During number (TrailingOnes)=3 of mesh (TotalCoeffs)=5 and hangover coefficient, code index CodeIndex=8.
Table 3
The code index CodeIndex is converted into code word numerical value CodeNum by S203;
The present embodiment sets up coding rope according to the probability statistical distribution of syntactic element to be encoded and well-regulated coding
Draw the mapping relations with code word numerical value;This example uses Golomb-Rice coding rules, in fact, this part of the present embodiment is
Table lookup operation, tables look-up 4 according to index CodeIndex, obtains the parameter (exponent number etc.) of code word numerical value and regular coding.
It is code index CodeIndex and code word numerical value CodeNum mapping relations as shown in table 4, as can be seen from Table 4,
The embodiment of the present invention employs the Golomb-Rice codes of tetra- kinds of exponent numbers of k=0,1,2,3;
As can be seen from Table 4, in the embodiment of the present invention during code index CodeIndex=8, corresponding code word numerical value
CodeNum=22, exponent number k=2;
Table 4
S204, encodes according to codeword coding rule to the code word numerical value CodeNum, obtains final code word;
According to code word numerical value and codeword coding rule, code word can be generated by code word numerical computations;
The embodiment of the present invention uses Golomb-Rice, the CodeNum=22 of the rank of variable-length encoding mode 2, according to Golomb-
Rice coding rules understand to be output as:0000 0110;
It is as shown in table 5 the embodiment of the present invention code word numerical value CodeNum and code word CodeWord (Golomb-Rice codes)
Mapping table.
Table 5
The embodiment of the present invention by introducing code index and regular elongated/block code method, brand-new design each
Syntactic element code table, realizes that quick code table is retrieved by code index, and regular elongated/block code enters without preserving actual two
Code word processed, eliminating traditional variable length code table needs to take larger memory headroom and needs traversing operation by turn, is ensureing coding effect
On the premise of rate, the implementation complexity that entropy decoding is operated on mobile terminal device is greatly improved, it is adaptable to which hardware resource is limited
Portable terminal.
Embodiment three
Fig. 3 show a kind of video entropy code apparatus structure schematic diagram of the embodiment of the present invention, and described device includes coding language
Method element acquisition module, the first conversion module, the second conversion module, code word acquisition module.
Syntax elements encoded acquisition module, for obtaining the syntactic element to be encoded in block to be encoded;
The syntactic element to be encoded includes residual error coefficient syntactic element or non-residual error coefficient syntactic element;
The non-residual error coefficient syntactic element include macro block (mb) type, reference frame index, quantization parameter, motion vector residual error,
Encoding model or intra prediction mode;
First conversion module, for the syntactic element to be encoded to be converted into code index;Including probability statistical distribution
Mapping block;
The probability statistical distribution mapping block, the probability statistics for obtaining the syntactic element to be encoded in block to be encoded
Distributed intelligence, probability sorting is carried out according to the probability statistical distribution value to the syntactic element to be encoded, set up described in wait to compile
The mapping relations of code syntactic element and code index;
Further, first conversion module also includes non-probability statistical distribution mapping block;
The non-probability statistical distribution mapping block, for according to non-probability statistical distribution mapping method by grammer to be encoded
Non- residual error coefficient syntactic element in element is converted into code index;The non-probability statistical distribution mapping method is included without symbol
Directly map, there is symbol to be converted into symbol mapping or mapping table mode;
Second conversion module, for the code index to be converted into code word numerical value;It is described by the code index
The mapping mode that CodeIndex is converted into code word numerical value CodeNum can be probability statistical distribution mapping or non-probability statistics point
Cloth maps;
It is by the code index CodeIndex probability statistical distribution mapping modes for being converted into code word numerical value CodeNum:
The mapping relations of the code index and code word numerical value are set up according to the probability statistical distribution of syntactic element to be encoded;Wherein, institute
State mapping relations and follow the most short principle of mean code length, the code word numerical value and code of mapping are instructed by the probability of syntactic element to be encoded
Word:Maximum probability code word numerical value distributes short code word, small probability code word numerical value distribution long code word;
The code index CodeIndex is converted into code word numerical value CodeNum non-probability statistical distribution mapping mode
For:
By code index CodeIndex and code word numerical value CodeNum linear correlations, i.e. CodeIndex=α × CodeNum+
β (wherein, α and β are integers);Or according to the mapping relations that code index and code word numerical value are set up by formulating mapping table;
Code word acquisition module, for being encoded according to codeword coding rule to the code word numerical value, obtains final code word;
The codeword coding rule can be regular variable-length encoding or regular block code;
The code word has well-regulated codeword structure, and the code word numerical value CodeNum and code word CodeWord are directly present
The mathematical relationship of determination, can generate code word by code word numerical computations, code word numerical value can be also calculated by code word;
The regular variable-length encoding can be that this Golomb-Rice of Columbus's Lay of different rank or index Columbus are compiled
Code Exp-Golomb coding rules;The exponent number is the parameter of Columbus's coding, different exponent number its to encode formula different;
The code word is binary format, including prefix and suffix portion, and the prefix is general to be opened by multiple 0 plus one 1
Head;
The embodiment of the present invention by introducing code index and regular elongated/block code method, brand-new design each
Syntactic element code table, realizes that quick code table is retrieved by code index, and regular elongated/block code enters without preserving actual two
Code word processed, eliminating traditional variable length code table needs to take larger memory headroom and needs traversing operation by turn, is ensureing coding effect
On the premise of rate, the implementation complexity that entropy decoding is operated on mobile terminal device is greatly improved, it is adaptable to which hardware resource is limited
Portable terminal.
Example IV
A kind of recording medium, includes the program of the video entropy coding method described in embodiment 1, the video entropy code side
Method has been described in detail in embodiment 1, will not be repeated here.
Embodiment five
Fig. 4 show a kind of video entropy decoding method flow chart of the embodiment of the present invention, the described method comprises the following steps:
S501:The binary bit stream after entropy code is read, is calculated according to codeword coding rule, obtains complete two
System code word CodeWord;
The codeword coding rule can be regular variable-length encoding or regular block code;
The code word has well-regulated codeword structure, and the code word numerical value CodeNum and code word CodeWord are directly present
The mathematical relationship of determination, can generate code word by code word numerical computations, code word numerical value can be also calculated by code word;
The regular variable-length encoding can be that this Golomb-Rice of Columbus's Lay of different rank or index Columbus are compiled
Code Exp-Golomb coding rules;The exponent number is the parameter of Columbus's coding, different exponent number its to encode formula different;
The code word is binary format, including prefix and suffix portion, and the prefix is general to be opened by multiple 0 plus one 1
Head;
It is described " to read the binary bit stream after entropy code, calculated according to codeword coding rule, obtain complete two
System code word CodeWord "
Specially:
A the binary bit stream after entropy code) is read;
B the number of " 0 " before first " 1 " in the binary bit stream) is obtained, the number is regard as code word knot
Prefix information in structure;
C) according to the prefix information and codeword coding rule, complete binary code word is obtained;
For example:The form of the prefix of code word is 1,01,001,0001,00001,000001 in binary bit stream,
0000001,00000001,000000001,0000000001,00000000001,000000000001,0000000000001,
00000000000001.During decoding, the general method using first " 1 " detector is exactly specifically, and binary bit stream is defeated
Enter, a string 0 are detected plus sequence as one 1 first and 0 number is counted.Such detector is usual
" 1 " detector headed by name.Detect after first " 1 ", by above 0 number be assigned to variable M_prefix be used for characterize before
Sew information, it can thus be concluded that the value for going out variable M_prefix is respectively 0,1,2,3,4,5,6,7,8,9,10,11,12,13.
S502:The binary code word CodeWord is calculated into code word numerical value according to the codeword coding rule
CodeNum;
S503:The code word numerical value CodeNum is converted into code index CodeIndex;
The mapping method that the code word numerical value CodeNum is converted into code index CodeIndex can be probability
Statistical distribution mapping method or non-probability statistical distribution mapping method;
It is by the code word numerical value CodeNum probability statistical distribution mapping methods for being converted into code index CodeIndex:
The mapping relations of the code index and code word numerical value are set up according to the probability statistical distribution of syntactic element to be encoded;Wherein, institute
State mapping relations and follow the most short principle of mean code length, the code word numerical value and code of mapping are instructed by the probability of syntactic element to be encoded
Word:Maximum probability code word numerical value distributes short code word, small probability code word numerical value distribution long code word;
The code word numerical value CodeNum is converted into code index CodeIndex non-probability statistical distribution mapping method
For:
By code index CodeIndex and code word numerical value CodeNum linear correlations, i.e. CodeIndex=α × CodeNum+
β (wherein, α and β are integers);Or the mapping relations of code index and code word numerical value are set up by formulating mapping table;
S504:Corresponding syntactic element is obtained according to code index Codeindex;
The syntactic element to be encoded includes residual error coefficient syntactic element or non-residual error coefficient syntactic element;
The embodiments of the invention provide a kind of entropy decoding method of low complex degree, compared to H.264CAVLC listing context
Multiple VLC forms constructed by self adaptation, the embodiment of the present invention need to only control code index CodeIndex and code word numerical value
Mapping relations between CodeNum, it is possible to reach the effect of multiple VLC forms, and regular elongated/block code is real without preserving
Border binary code word CodewWord, the request memory ratio for preserving codeword data and code index preserves binary code word
CodeWord is low, more saves resource.
Embodiment six
The following is the embodiment of the present invention to the binary bit stream after entropy code, entropy is carried out using Golomb coding rule
Decoding obtains syntactic element Coeff_token process step:
S601, reads the binary bit stream after entropy code, according to Golomb codeword coding Rule it is complete two
System code word;
The embodiment of the present invention is read out using first " 1 " detector to the code word of compression bit stream, and legal-code typically has
The prefix characteristic for having a string 0 to add one 1, can so be detected after first " 1 ", above 0 number is assigned to described
Variable M_prefix, then by Golomb coding rule, obtain whole binary code word;The variable M_prefix is used for table
Levy the prefix information in codeword structure;
If the binary bit stream after entropy code is 0000 0110xxxxx, by detecting the binary bit stream, obtain
The number of " 0 " before first " 1 " in the binary bit stream is taken, the number of " 0 " is 5, and variable M_ is assigned to by 5
Prefix, M_prefix=5, according to Golomb-Rice coding rule, determine exponent number k=2 (4<M_prefix<=9), from
And determining that this complete form of codewords is 0000 01xx, length is 8, and 8 binary strings are read so continuing to shift:0000
0110。
S602, according to Golomb-Rice coding rule and exponent number k=2, calculates code word numerical value CodeNum=22;
S603, according to code index CodeIndex and code word numerical value CodeNum mapping table (table in such as embodiment 2
Shown in 4), obtain as code word numerical value CodeNum=22, code index CodeIndex=8
S604, according to residual error coefficient syntactic element Coeff_token and code index CodeIndex mapping table
(as shown in table 3 in embodiment 2), is obtained as code index Codeindex=8, obtains corresponding syntactic element Coeff_
token:The number (TotalCoeffs)=5 of nonzero coefficient and the number (TrailingOnes)=3 of hangover coefficient.
The decoding process of contrast H.264CAVLC, because H.264 code table code word does not have rule, therefore is pressed from compression bit stream
After position is read, VLC forms will be traveled through, if this is the code word of a n-bit, this needs to read contrast variable length code table 62n times
VLC data, just can confirm that this complete code, such as code word is 7 bits, and this just needs oh 7 × 62=432 times behaviour that tables look-up
Make, this will certainly expend substantial amounts of computing resource, and read-write operation repeatedly can also increase power consumption.The embodiments of the invention provide one
The entropy decoding method of kind low complex degree, compared to multiple the VLC forms H.264CAVLC listed constructed by context-adaptive, sheet
Inventive embodiments need to only control mapping relations between code index CodeIndex and code word numerical value CodeNum, it is possible to reach multiple
The effect of VLC forms, and regular elongated/block code need not preserve actual binary code word CodewWord, preserve code word number
It is low according to the request memory ratio preservation binary code word CodeWord with code index, more save resource.
Embodiment seven
The following is the embodiment of the present invention to the binary bit stream after entropy code, entropy is carried out using Golomb coding rule
Decoding obtains the number Total_zeros of syntactic element nonzero coefficient leading zero process step:
Table 6 (including table 6a and table 6b) give embodiment of the present invention syntactic element Total_zeros, code index
CodeIndex and code word numerical value CodeNum mapping relations.
For convenience of decoding, embodiment of the present invention setting code index CodeIndex is equal to syntactic element Total_zeros,
Golomb-Rice codes are used for coding rule.
S701, reads the binary bit stream after entropy code, and complete two are obtained according to Golomb-Rice coding rule
System code word;
The embodiment of the present invention is read out using first " 1 " detector to the code word of compression bit stream, and legal-code typically has
The prefix characteristic for having a string 0 to add one 1, can so detect after first " 1 ", above 0 number is assigned into variable
M_prefix, in the coding rule by Golomb, obtains whole binary code word;The variable M_prefix is used for mask
Prefix information in word structure;
If the binary bit stream after entropy code is 010110xxxxx, by detecting the binary bit stream, institute is obtained
The number of " 0 " before first " 1 " in binary bit stream is stated, the number of " 0 " is 1, and variable M_ is assigned to by 1
Prefix, M_prefix=1, according to Golomb-Rice coding rule and exponent number k=2 (TotalCoeffs is equal to 5), from
And determine that this complete form of codewords is 01xx, read 4 bit word CodeWord:0101;
S702, according to Golomb-Rice coding rule and exponent number k=2, according to calculating code word numerical value CodeNum=5;
S703, according to the mapping relations of table 6 (a), is obtained as code word numerical value CodeNum=5, code index
CodeIndex=2;
S704, syntactic element Total_zeros is obtained equal to 2 according to code index Codeindex=2;
Embodiment of the present invention setting code index CodeIndex is equal to syntactic element Total_zeros, therefore according to coding rope
The value drawn can immediately arrive at syntactic element Total_zeros value;
Table 6a syntactic elements Total_zeros, code index CodeIndex and code word numerical value CodeNum mapping relations
Table 6 (b) syntactic element Total_zeros, code index CodeIndex and code word numerical value CodeNum mapping are closed
System
The embodiment of the present invention can quickly determine complete code, without tradition due to the regular structure of code word
The troublesome operation for reading by turn, traveling through VLC forms that the decoding of variable length code table needs, reduces the computation complexity of entropy decoding,
It is suitable for resource-constrained application scenario.This code table can improve with reference to first " 1 " detection method, code word be optimized, for example
0001 10 be most it is long be also unique length here code word, it is possible to by judging to ignore " 0 " after digital " 1 ", reached
The effect of code word is further refined, more preferable compression ratio is obtained.The embodiments of the invention provide a kind of entropy decoding of low complex degree
Method, compared to multiple the VLC forms H.264CAVLC listed constructed by context-adaptive, the embodiment of the present invention only needs control
Mapping relations between code index CodeIndex and code word numerical value CodeNum, it is possible to reach the effect of multiple VLC forms, and have
Regular elongated/block code need not preserve actual binary code word CodewWord, preserve the internal memory of codeword data and code index
It is required that it is lower than preserving binary code word CodeWord, more save resource.
Embodiment eight
Fig. 5 show a kind of video entropy decoding device structural representation of the embodiment of the present invention, and described device includes:Full code
Word acquisition module, code word numerical value acquisition module, the 3rd conversion module, syntactic element acquisition module.
Complete code acquisition module, including binary bit stream read module, prefix of code word data obtaining module and second
Code word acquisition module, for reading the binary bit stream after entropy code, is calculated according to codeword coding rule, obtains complete
Binary code word;
The codeword coding rule can be regular variable-length encoding or regular block code;
The regular variable-length encoding can be that this Golomb-Rice of Columbus's Lay of different rank or index Columbus are compiled
Code Exp-Golomb coding rules;The exponent number is the parameter of Columbus's coding, different exponent number its to encode formula different;
The code word is binary format, including prefix and suffix portion, and the prefix is general to be opened by multiple 0 plus one 1
Head;
Binary bit stream read module, for reading the binary bit stream after entropy code;
Prefix of code word data obtaining module, for obtaining " 0 " before first " 1 " in the binary bit stream
Number, regard the number as the prefix information in codeword structure;
Second code word acquisition module, for, according to the prefix information and codeword coding rule, being obtained according to described
Complete binary code word;
Code word numerical value acquisition module, for the binary code word to be calculated into code word according to the codeword coding rule
Numerical value;
3rd conversion module, for the code word numerical value to be converted into code index;
The mapping mode that the code word numerical value CodeNum is converted into code index CodeIndex can be probability
Statistical distribution mapping mode or non-probability statistical distribution mapping mode;
It is by the code word numerical value CodeNum probability statistical distribution mapping modes for being converted into code index CodeIndex:
The mapping relations of the code index and code word numerical value are set up according to the probability statistical distribution of syntactic element to be encoded;Wherein, institute
State mapping relations and follow the most short principle of mean code length, the code word numerical value and code of mapping are instructed by the probability of syntactic element to be encoded
Word:Maximum probability code word numerical value distributes short code word, small probability code word numerical value distribution long code word;
The code word numerical value CodeNum is converted into code index CodeIndex non-probability statistical distribution mapping mode
For:
By code index CodeIndex and code word numerical value CodeNum linear correlations, i.e. CodeIndex=α × CodeNum+
β (wherein, α and β are integers);Or the mapping relations of code index and code word numerical value are set up by formulating mapping table;
Second syntactic element acquisition module, for obtaining corresponding syntactic element according to code index;
The embodiments of the invention provide a kind of entropy decoding method of low complex degree, compared to H.264CAVLC listing context
Multiple VLC forms constructed by self adaptation, the embodiment of the present invention need to only control code index CodeIndex and code word numerical value
Mapping relations between CodeNum, it is possible to reach the effect of multiple VLC forms, and regular elongated/block code is real without preserving
Border binary code word CodewWord, the request memory ratio for preserving codeword data and code index preserves binary code word
CodeWord is low, more saves resource.
Embodiment nine
A kind of recording medium, includes the program of the video entropy decoding method described in embodiment 5, the video entropy decoding side
Method has been described in detail in embodiment 5, will not be repeated here.
Can it will be understood by those skilled in the art that realizing that all or part of step in above-described embodiment method is
With what is completed by programmed instruction related hardware, described program can be stored in a computer read/write memory medium,
Described storage medium can be ROM, RAM, disk, CD etc..
Presently preferred embodiments of the present invention is the foregoing is only, is not intended to limit the invention, all essences in the present invention
Any modification, equivalent and improvement made within refreshing and principle etc., should be included within the scope of the present invention.