To method and the device of the decoding of video image entropy
Technical field
The present invention relates to video image encoding and decoding technology, particularly a kind of side to the decoding of video image entropyMethod and device.
Background technology
H.264 standard is that International Organization for Standardization and International Telecommunication Union propose jointlyContinue Motion Picture Expert Group standard 4(MPEG4) after new-generation digital video compression format.H.264 one of video coding and decoding technology standard that is ITU-T taking series H.26x as name nominating. This markThe accurate exploitation that is referred to as project H.26L that comes from the earliest ITU-T. Although H.26L this title is notToo common, but used always. H.264 standard is ITU-T taking series H.26x as name nominatingOne of standard.
H.264 standard is to set up on the basis of MPEG-4 technology, and its coding flow process is mainComprise 5 parts: interframe and infra-frame prediction (Estimation), conversion (Transform) and contravariantChange, quantize (Quantization) and inverse quantization, loop filtering (LoopFilter) and entropy coding (EntropyCoding). Its decode procedure is exactly the inverse process of cataloged procedure.
H.264 the main target of standard is: compared with other existing video encoding standard, identicalMore outstanding video quality is provided under bandwidth. By this standard, the compression effect under equal video qualityRate improves 2 times of left and right than MPEG2.
When video image has passed through interframe and infra-frame prediction, conversion and inverse transformation, quantification and inverse quantization, ringAfter the filtering of road, obtain residual block quantization parameter, this residual block quantization parameter is capable through the Z of quantization parameterAfter sequence (Zig-Zag) scanning, carry out entropy coding. Entropy coding be suitable for transmission and the bit stream that stores alsoSymbol data is compressed, and it is, based on standard H.264, video image is carried out to the last of cataloged procedureA link is also an important link. Scan through Zig-Zag at residual block quantization parameterAfter data carry out entropy when coding, a kind of mode is based on contextual self-adapting changeable long codes(CAVLC). This CAVLC be mainly used in to video image through based on H.264 coding after,The entropy coding of the 4*4 arriving or the 2*2 residual block quantization parameter data after Zig-Zag scanning.
At present, the cataloged procedure of CAVLC is:
First, coding nonzero coefficient number and hangover coefficient number;
Hangover coefficient refers in residual block+and-1, the number of hangover coefficient is less than or equal to 3, by residualIn poor piece last three+-1 be as hangover coefficient, other according to normal encoding;
In the time of coding, there are four code tables to select, comprise a fixed length code table and three variable length code tables, respectivelyThe different situations that may occur has been carried out to different code words to be set. Code table selective dependency is encoded in adjacentThe nonzero coefficient number of macro block, according to the nonzero coefficient number of adjacent coded macroblocks H.264 mark of foundation againAccurate conversion obtains the nonzero coefficient number nC of this macro block, then determines corresponding code according to nC spanTable, tables look-up and encodes.
Secondly, coding hangover coefficient;
Because the amplitude perseverance of hangover coefficient is 1, only need to encode to its amplitude, CAVLCMiddle use 0 represents positive sign, and 1 represents negative sign, encodes from high frequency to low frequency according to inverted order.
Again, coding nonzero coefficient;
In CALVC, except the nonzero coefficient of hangover coefficient represented by amplitude, amplitude is by two partsComposition, is respectively prefix and suffix, and suffix length is self adaptation along with the amplitude of each coding codeword rankChange. First determine after suffix length, can calculate the prefix of code word amplitude and suffix.
Again, the encode number of high frequency nonzero coefficient leading zero;
Coding use be fixing variable-length encoding look-up table.
Finally, the encode number of each nonzero coefficient leading zero.
Through after entropy coding, bit stream will be transferred on entropy decoder and decode, decode procedureAs shown in Figure 1, comprising:
Step 101, determine the nC value of bit stream;
Step 102, according to nC value difference do not try to achieve nonzero coefficient number and hangover coefficient number;
Step 103, to the decoding of hangover coefficient entropy;
Step 104, to decoding except the nonzero coefficient entropy of hangover coefficient;
Step 105, try to achieve the number of high frequency nonzero coefficient leading zero;
Step 106, try to achieve the number of each nonzero coefficient leading zero.
In to bit stream entropy decode procedure, need to be according to bit stream coefficient number, the non-zero system that obtains trailingNumber and each nonzero coefficient of several numbers, hangover coefficient, nonzero coefficient, high frequency nonzero coefficient leading zeroThe number of leading zero. Here, carrying out entropy when decoding, hangover coefficient number, nonzero coefficient number, dragTail coefficient, nonzero coefficient and each nonzero coefficient leading zero number are the mode entropy decodings that adopts poll to table look-upObtain, due to the encoded radio variable-length in bit stream, the table look-at during therefore than coding is gotThe simple realization of value, needs whole code table corresponding to search when entropy decoding, not only time-consuming, and time delayVery large.
The explanation of giving one example, as shown in table 1, table 1 is hangover coefficient number and nonzero coefficient numberQuestion blank:
Table 1
In the time that bit stream arrives entropy decoder by bit transfer, just need to first determine nC value, and then timeEphemeris 1 and other unshowned code stream tables, just can obtain trail coefficient number and nonzero coefficient number, prolongsTime larger. This finally can affect the decoding image quality of video image. With full HD, i.e. 1080P60 bitStream is example, and the maximum code stream decoding capability that conventionally can realize is 20 MBPSs (Mbps), asFruit will further be improved image quality, certainly will will improve the decoding speed to bit stream, further will improve contrastThe entropy decode rate of special stream.
Summary of the invention
In view of this, the invention provides a kind of method to the decoding of video image entropy, the method can improveTo the entropy decode rate of video image.
The present invention also provides a kind of device to the decoding of video image entropy, and this device can improve video figureThe entropy decode rate of picture.
For achieving the above object, technical scheme of the invention process is specifically achieved in that
To a method for video image entropy decoding, comprising:
Adopt address bit mapping code table information, address bit is by coding schedule mark, bit stream encoded radio and bitStream encryption length is determined, is mapped in corresponding code table information;
Receive bit stream by bit, determine address bit according to bit stream encoded radio and bit stream code length,By the code table information of determined address bit mapping, as entropy decode value.
Described coding schedule mark takies 2 bits, and bit stream encoded radio takies 4 bits, and bit stream is compiledCode length takies 4 bits, and address bit adopts 10 bit compositions altogether;
Code table information is 8 bits, and effectively whether 1 bit wherein for list item value, and remaining is entropyDecode value.
By the code table information of determined address bit mapping, as the process of entropy decode value be:
When the list item value in the code table information of mapping is while being effective, determine the code table of this bit stream coding mappingInformation is the entropy decode value obtaining.
Described entropy decode value is: hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficientAnd each nonzero coefficient leading zero number.
To a device for video image entropy decoding, comprising: mapping table arranges module and entropy decoder module,Wherein,
Mapping table arranges module, for adopting address bit mapping code table information, address bit by coding schedule mark,Bit stream encoded radio and bit stream code length are determined, are mapped to corresponding code table information;
Entropy decoder module, for receiving bit stream by bit, according to bit stream encoded radio and bit stream codingLength is determined address bit, by the code table information of determined address bit mapping, as entropy decode value.
Described mapping table arranges module, also takies 2 bits, bit stream encoded radio for coding schedule markTake 4 bits, bit stream code length takies 4 bits, and address bit adopts 10 bit groups altogetherBecome; Code table information is 8 bits, and effectively whether 1 bit wherein for list item value, and remaining is entropyDecode value.
Described entropy decoder module, while being also effective for the list item value when the code table information of shining upon, determinesThe code table information of this bit stream coding mapping is the entropy decode value obtaining.
Described entropy decode value is: hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficientAnd each nonzero coefficient leading zero number.
As can be seen from the above scheme, the present invention resets entropy decoding look-up table, adopts address bit mappingCode table information, address bit is determined by coding schedule mark, bit stream encoded radio and bit stream code length, is reflectedBe mapped in corresponding code table information, code table information can comprise hangover coefficient number, nonzero coefficient number,Hangover coefficient, nonzero coefficient and the decoding of each nonzero coefficient leading zero number constant entropy need poll to table look-up to obtainEntropy decode value. In the time that bit stream is decoded by bit entropy, according to bit stream code length and bit stream encoded radioDetermine corresponding address bit, obtain code table information according to corresponding address bit mapping. Due to set entropyDecoding look-up table addressing space is 1024, namely adopts 10 bits that address bit is set, so carry out entropyIn decode procedure, can complete with 100Mbps the entropy decoding of bit stream, improve the entropy to video imageDecode rate.
Brief description of the drawings
Fig. 1 is the method flow diagram that prior art is carried out entropy decoding to the bit stream receiving;
Fig. 2 is the method flow diagram based on H.264 standard is decoded to video image entropy provided by the invention;
Fig. 3 is provided by the invention based on the H.264 apparatus structure signal of standard to the decoding of video image entropyFigure.
Detailed description of the invention
For making object of the present invention, technical scheme and advantage clearer, develop simultaneously referring to accompanying drawingEmbodiment, is described in further detail the present invention.
In the time that entropy decoder receives bit stream, just need to carry out entropy decoding based on standard H.264, at entropyIn decode procedure, need to solve hangover coefficient number, nonzero coefficient number, hangover coefficient, non-by bitZero coefficient, the number of high frequency nonzero coefficient leading zero and the number of each nonzero coefficient leading zero. In background skillIn art, while carrying out entropy decoding, hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficientAnd each nonzero coefficient leading zero number is that the mode entropy decoding that adopts poll to table look-up obtains, dragging whereinTail coefficient number and nonzero coefficient number be due to corresponding bit stream coding random length, thus may based onCode table just has multiple, in the time searching, need to further determine four according to the nC value of upper macro block and left macro blockOne in look-up table is carried out poll and searches, and this will increase time delay. For the mode of tabling look-up by poll, also there is this problem in other entropy decode values that carry out entropy decoding.
Because the whole entropy decoding table of search is more time-consuming, time delay is larger, in order to reduce time delay, if adoptedRealize the whole entropy decoding table of traversal fast with the Content Addressable Memory (CAM) of pure hardware, byVariable length in entropy coding causes whole entropy decoding table capacity huge, causes CAM capacity and cost huge.
Therefore, the present invention resets entropy decoding look-up table, adopts address bit mapping code table information, addressPosition is determined by coding schedule mark, bit stream encoded radio and bit stream code length, is mapped to corresponding code tableIn information, code table information can comprise hangover coefficient number, nonzero coefficient number, hangover coefficient, non-zeroThe entropy decode value that the decoding of coefficient and each nonzero coefficient leading zero number constant entropy needs poll to table look-up to obtain. ThanWhen special stream is decoded by bit entropy, determine corresponding address according to bit stream code length and bit stream encoded radioPosition, obtains code table information according to corresponding address bit mapping. Due to set entropy decoding look-up table addressingSpace is 1024, namely adopts 10 bits that address bit is set, thus carry out in entropy decode procedure, canTo complete the entropy decoding of bit stream with 100Mbps, improve the entropy decode rate to video image. ThisThe hardware store resource that the decoding table of bright structure takies is few, and cost is low.
The entropy decoding scheme key component providing in the present invention completes with lookup table mode, so entropy decoding performanceRise to internal storage access speed, can be competent at the entropy decoding of the above H.264 bit stream of 100Mbps completely,Thereby for performance bottleneck has been eliminated in high image quality, full HD even 4K, the decoding of 8K high definition, and high code check is highImage quality decoding is that embedded platform is incompetent. And the present invention is by entropy decoding scheme provided by the inventionBe applied on FPGA platform, just can break through this bottleneck. Method proposed by the invention, for FPGAThe feature that on sheet, internal memory is few is optimized, and is applicable to very much FPGA platform and realizes.
In the present invention, when entropy decoding look-up table is set, can be shifted by bit by bit stream, record moves downThe figure place entering, last four of immigration are designated as significance bit, then in conjunction with definite nC value, the decoding of structure entropyThe address bit of look-up table, then corresponds to this address bit in corresponding code table information. Wherein, nC valueTo calculate according to the nonzero coefficient number solving and the nonzero coefficient number of adjacent macroblocks.
Fig. 2 is the method flow diagram based on H.264 standard is decoded to video image entropy provided by the invention,Its concrete steps are:
Step 201, employing address bit mapping code table information, address bit is compiled by coding schedule mark, bit streamCode value and bit stream code length are determined, are mapped in corresponding code table information;
Here, coding schedule mark takies 2 bits, and bit stream encoded radio takies 4 bits, bitStream encryption length takies 4 bits, and address bit adopts 10 bit compositions altogether;
Code table information is 8 bits, and 1 bit is wherein the list item value searching, and remaining is concreteEntropy decode value, such as having 2 bits for hangover coefficient, 5 bits are nonzero coefficient etc.;
Step 202, by bit receive bit stream, true according to bit stream encoded radio and bit stream code lengthDetermine address bit, by the code table information of determined address bit mapping, as entropy decode value;
In this step, when the list item value in the code table information of mapping is while being effective, determine that this bit stream compilesThe code table information of code mapping is the entropy decode value obtaining, and then receives subsequent bits stream by bit, pressesContinue to carry out according to the process of step 202.
Lift an object lesson explanation.
According to the step 201 of Fig. 2, the table of structure address bit mapping code table information is table 2:
Table 2
In the time that entropy decoder receives bit stream by bit, code length value is cumulative according to moving into bit number,The encoded radio of the rear four Bit Significance corresponding address positions of encoded radio, code identification value is according to top macro block and a left sideLimit macro block nC value converts and draws by agreement H.264, and here the first macroblock coding is designated " 00 ",Address bit has just been determined like this, and table look-at can obtain coding significance bit, when this position is ' 0 ', continuesMove into H.264 bit value of the next one, when this position is ' 1 ', represent that this bit stream encoded radio is effective, straightConnecing tables look-up obtains nonzero coefficient and hangover coefficient.
In the time that this table 2 is set, bit rate coding length is that physical length subtracts 1.
In the time that bit stream is " 0000000111 ", the process that entropy decoder carries out entropy decoding is:
Move into code stream " 0 ". Coding schedule is designated " 00 ", and code length is " 0000 ", encoded radioFor " 0000 ", the code table information obtaining is " 00000000 ";
Move into code stream " 00 ". Coding schedule is designated " 00 ", and code length is " 0001 ", encoded radioFor " 0000 ", the code table information obtaining is " 00000000 ";
Move into code stream " 000 ". Coding schedule is designated " 00 ", and code length is " 0010 ", codingValue is " 0000 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 0000 ". Coding schedule is designated " 00 ", and code length is " 0011 ", codingValue is " 0000 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 00000 ". Coding schedule is designated " 00 ", and code length is " 0100 ", compilesCode value is " 0000 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 000000 ". Coding schedule is designated " 00 ", and code length is " 0101 ", compilesCode value is " 0000 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 0000000 ". Coding schedule is designated " 00 ", and code length is " 0110 ",Encoded radio is " 0000 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 00000001 ". Coding schedule is designated " 00 ", and code length is " 0111 ",Encoded radio is " 0001 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 000000011 ", coding schedule is designated " 00 ", and code length is " 1000 ",Encoded radio is " 0011 ", and the code table information obtaining is " 00000000 ";
Move into code stream " 0000000111 ", coding schedule is designated " 00 ", and code length is " 1001 ",Encoded radio is " 0111 ", and the code table information obtaining is " 10010000 ".
At this moment, the list item value obtaining is " 1 ", shows entropy decoding effectively, the nonzero coefficient sum obtainingNumber is that " 00100 " and hangover coefficient number are " 00 ".
Fig. 3 is provided by the invention based on the H.264 apparatus structure signal of standard to the decoding of video image entropyFigure, comprising: mapping table arranges module and entropy decoder module, wherein,
Mapping table arranges module, for adopting address bit mapping code table information, address bit by coding schedule mark,Bit stream encoded radio and bit stream code length are determined, are mapped to corresponding code table information;
Entropy decoder module, for receiving bit stream by bit, according to bit stream encoded radio and bit stream codingLength is determined address bit, by the code table information of determined address bit mapping, as entropy decode value.
In this device, mapping table arranges module, also takies 2 bits, bit for coding schedule markStream encryption value takies 4 bits, and bit stream code length takies 4 bits, and address bit adopts 10 altogetherIndividual bit composition; Code table information is 8 bits, and 1 bit is wherein the list item value searching, all the otherBe concrete entropy decode value.
In this device, entropy decoder module, is also effective for the list item value of the code table information when mappingTime, determine that the code table information of this bit stream coding mapping is the entropy decode value obtaining, and then by bitReception subsequent bits stream, continues to carry out according to said process.
In this device, described entropy decode value for hangover coefficient number, nonzero coefficient number, hangover coefficient,Nonzero coefficient and each nonzero coefficient leading zero number.
More than lift preferred embodiment, the object, technical solutions and advantages of the present invention have been carried out further in detailDescribe in detail brightly, institute it should be understood that and the foregoing is only preferred embodiment of the present invention, not in order toRestriction the present invention, within the spirit and principles in the present invention all, any amendment of doing, be equal to replace andImprove etc., within all should being included in protection scope of the present invention.