Method and device to the decoding of video image entropy
Technical field
The present invention relates to the video image encoding and decoding technology, particularly a kind of method and device to the decoding of video image entropy.
Background technology
H.264 standard be International Organization for Standardization and International Telecommunication Union common propose continue Motion Picture Expert Group standard 4(MPEG4) after the new-generation digital video compression format.H.264 be that H.26x ITU-T be take series and be one of video coding and decoding technology standard of name nominating.This standard comes from the exploitation that is referred to as project H.26L of ITU-T the earliest.Although H.26L this title is not too common, is being used always.H.264 standard is that H.26x ITU-T be take series and be one of standard of name nominating.
H.264 standard is to set up on the basis of MPEG-4 technology, and its coding flow process mainly comprises 5 parts: interframe and infra-frame prediction (Estimation), conversion (Transform) and inverse transformation, quantification (Quantization) and inverse quantization, loop filtering (Loop Filter) and entropy coding (Entropy Coding).Its decode procedure is exactly the inverse process of cataloged procedure.
H.264 the main target of standard is: with other existing video encoding standard, compare, more outstanding video quality is provided under identical bandwidth.By this standard, the compression efficiency under equal video quality improves 2 times of left and right than MPEG2.
After video image has passed through interframe and infra-frame prediction, conversion and inverse transformation, quantification and inverse quantization, loop filtering, obtain the residual block quantization parameter, this residual block quantization parameter, after Z line ordering (Zig-Zag) scanning of quantization parameter, carries out the entropy coding.Entropy coding is suitable for transmitting and the bit stream that stores symbol data is compressed, and it is based on H.264 standard and video image is carried out to last link of cataloged procedure, is also an important link.When the data of residual block quantization parameter after Zig-Zag scanning were carried out the entropy coding, a kind of mode was based on contextual self-adapting changeable long codes (CAVLC).This CAVLC is mainly used in video image through based on after coding H.264, and the 4*4 obtained or 2*2 residual block quantization parameter are through the entropy coding of the data after Zig-Zag scanning.
At present, the cataloged procedure of CAVLC is:
At first, coding nonzero coefficient number and hangover coefficient number;
The hangover coefficient refers in residual block+-1, the number of hangover coefficient is less than or equal to 3, using last three+-1 in residual block as the coefficient that trails, other according to normal encoding;
When coding, there are four code tables to select, comprise a fixed length code table and three variable length code tables, respectively the different situations that may occur has been carried out to different code words and set.The code table selective dependency is in the nonzero coefficient number of adjacent coded macroblocks, according to the nonzero coefficient number of adjacent coded macroblocks, according to standard H.264, convert and obtain the nonzero coefficient number nC of this macro block again, then according to the nC span, determine corresponding code table, table look-up and encode.
Secondly, coding hangover coefficient;
Because the amplitude perseverance of hangover coefficient is 1, only need to encode and get final product its amplitude, in CAVLC, mean positive sign with 0,1 represents negative sign, encodes from the high frequency to the low frequency according to inverted order.
Again, coding nonzero coefficient;
In CALVC, meaned by amplitude except the nonzero coefficient of hangover coefficient, amplitude is comprised of two parts, is respectively prefix and suffix, the adaptive change along with each other amplitude of coding codeword level of suffix length.After first determining suffix length, the prefix of code word amplitude and suffix can have been calculated.
Again, the encode number of high frequency nonzero coefficient leading zero;
The coding use be the variable-length encoding look-up table of fixing.
Finally, the encode number of each nonzero coefficient leading zero.
Through after entropy coding, bit stream will be transferred on entropy decoder and decode, and decode procedure as shown in Figure 1, comprising:
Step 101, determine the nC value of bit stream;
Step 102, according to the nC value difference do not try to achieve the nonzero coefficient number and the hangover coefficient number;
Step 103, to the decoding of hangover coefficient entropy;
Step 104, to except the nonzero coefficient entropy of hangover coefficient, decoding;
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 obtain trailing coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient, the number of high frequency nonzero coefficient leading zero and the number of each nonzero coefficient leading zero.Here, when carrying out the entropy decoding, hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient and each nonzero coefficient leading zero number are to adopt the mode entropy decoding that poll is tabled look-up to obtain, due to the encoded radio variable-length in bit stream, the simple realization of the table look-at value during therefore than coding, during the entropy decoding, need to search for corresponding whole code table, not only time-consuming, and also time delay is very large.
The explanation of giving one example, as shown in table 1, table 1 is the question blank of hangover coefficient number and nonzero coefficient number:
Table 1
When bit stream arrives entropy decoder by bit transfer, just need at first determine the nC value, and then traversal list 1 and other unshowned code stream tables, just can obtain trail coefficient number and nonzero coefficient number, time delay is larger.This finally can affect the decoding image quality of video image.With full HD, be that the 1080P60 bit stream is example, the maximum code stream decoding capability that usually can realize is 20 MBPSs (Mbps), if further improve image quality, certainly will to improve the decoding speed to bit stream, further will improve the entropy decode rate to bit 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 improve the entropy decode rate to video image.
The present invention also provides a kind of device to the decoding of video image entropy, and this device can improve the entropy decode rate to video image.
For achieving the above object, technical scheme of the invention process specifically is achieved in that
A kind of method to the decoding of video image entropy comprises:
Adopt address bit mapping code table information, address bit is determined by coding schedule sign, bit stream encoded radio and bit stream code length, is mapped on corresponding code table information;
By bit received bit stream, according to bit stream encoded radio and bit stream code length, determine address bit, by the code table information of determined address bit mapping, as the entropy decode value.
Described coding schedule sign takies 2 bits, and the bit stream encoded radio takies 4 bits, and the bit stream code length takies 4 bits, and address bit adopts 10 bits to form altogether;
Code table information is 8 bits, and effectively whether 1 bit wherein for the list item value, and remaining is the entropy decode value.
By the code table information of determined address bit mapping, as the process of entropy decode value be:
List item value in the code table information of mapping while being effective, determines that the code table information of this bit stream coding mapping is the entropy decode value obtained.
Described entropy decode value is: hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient and each nonzero coefficient leading zero number.
A kind of device to the decoding of video image entropy, comprising: mapping table arranges module and entropy decoder module, wherein,
Mapping table arranges module, and be used to adopting address bit mapping code table information, address bit is determined by coding schedule sign, bit stream encoded radio and bit stream code length, is mapped to corresponding code table information;
The entropy decoder module, for by bit received bit stream, 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 the entropy decode value.
Described mapping table arranges module, also for the coding schedule sign, takies 2 bits, and the bit stream encoded radio takies 4 bits, and the bit stream code length takies 4 bits, and address bit adopts 10 bits to form altogether; Code table information is 8 bits, and effectively whether 1 bit wherein for the list item value, and remaining is the entropy decode value.
Described entropy decoder module, while for the list item value of code table information when mapping, being also effective, determine that the code table information of this bit stream coding mapping is the entropy decode value obtained.
Described entropy decode value is: hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient and each nonzero coefficient leading zero number.
As can be seen from the above scheme, the present invention resets entropy decoding look-up table, adopt address bit mapping code table information, address bit is determined by coding schedule sign, bit stream encoded radio and bit stream code length, be mapped on corresponding code table information, code table information can comprise the entropy decode value that 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 obtain.When bit stream is decoded by the bit entropy, according to bit stream code length and bit stream encoded radio, determine corresponding address bit, according to corresponding address bit mapping, obtain code table information.Because set entropy decoding look-up table addressing space is 1024, namely adopt 10 bits that address bit is set, so carry out in the entropy decode procedure, can with 100Mbps, complete the entropy decoding of bit stream, improve the entropy decode rate to video image.
The accompanying drawing explanation
Fig. 1 is the method flow diagram that prior art is carried out the entropy decoding to the bit stream received;
Fig. 2 is provided by the invention based on the method flow diagram to the decoding of video image entropy of standard H.264;
Fig. 3 is provided by the invention based on the apparatus structure schematic diagram to the decoding of video image entropy of standard H.264.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, referring to the accompanying drawing embodiment that develops simultaneously, the present invention is described in further detail.
When entropy decoder receives bit stream, just need to carry out the entropy decoding based on standard H.264, in the entropy decode procedure, need to solve hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient, the number of high frequency nonzero coefficient leading zero and the number of each nonzero coefficient leading zero by bit.In background technology, while carrying out the entropy decoding, hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient and each nonzero coefficient leading zero number are to adopt the mode entropy decoding that poll is tabled look-up to obtain, hangover coefficient number wherein and nonzero coefficient number are due to corresponding bit stream coding random length, so may based on code table just have a plurality of, when searching, need to further determine one in four look-up tables according to the nC value of upper macro block and left macro block and come poll to search, this will increase time delay.For the mode of tabling look-up by poll, carry out other entropy decode values of entropy decoding, also have this problem.
Because the whole entropy decoding table of search is more time-consuming, time delay is larger, in order to reduce time delay, if adopt the Content Addressable Memory (CAM) of pure hardware, realize the whole entropy decoding table of traversal fast, the variable length due to the 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, adopt address bit mapping code table information, address bit is determined by coding schedule sign, bit stream encoded radio and bit stream code length, be mapped on corresponding code table information, code table information can comprise the entropy decode value that 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 obtain.When bit stream is decoded by the bit entropy, according to bit stream code length and bit stream encoded radio, determine corresponding address bit, according to corresponding address bit mapping, obtain code table information.Because set entropy decoding look-up table addressing space is 1024, namely adopt 10 bits that address bit is set, so carry out in the entropy decode procedure, can with 100Mbps, complete the entropy decoding of bit stream, improve the entropy decode rate to video image.The hardware store resource that the decoding table of the present invention's structure takies is few, and cost is low.
The entropy decoding scheme key component provided in the present invention completes with lookup table mode, so the entropy decoding performance rises to internal storage access speed, can be competent at the H.264 entropy of bit stream decoding more than 100Mbps fully, thereby for performance bottleneck has been eliminated in high image quality, full HD even 4K, the decoding of 8K high definition, and the decoding of high code check high image quality is that embedded platform is incompetent.And the present invention is applied in entropy decoding scheme provided by the invention on the FPGA platform, just can break through this bottleneck.Method proposed by the invention, optimize for the characteristics that on the FPGA sheet, internal memory is few, is applicable to very much the FPGA platform and realizes.
In the present invention, when entropy decoding look-up table is set, can by bit, be shifted by bit stream, record the figure place of immigration, last four of immigration are designated as significance bit, then in conjunction with the nC value of determining, the address bit of structure entropy decoding look-up table, then correspond to this address bit on corresponding code table information.Wherein, the nC value is to calculate according to the nonzero coefficient number solved and the nonzero coefficient number of adjacent macroblocks.
Fig. 2 is provided by the invention based on the method flow diagram to the decoding of video image entropy of standard H.264, and its concrete steps are:
Step 201, employing address bit mapping code table information, address bit is determined by coding schedule sign, bit stream encoded radio and bit stream code length, is mapped on corresponding code table information;
Here, the coding schedule sign takies 2 bits, and the bit stream encoded radio takies 4 bits, and the bit stream code length takies 4 bits, and address bit adopts 10 bits to form altogether;
Code table information is 8 bits, and 1 bit wherein is the list item value searched, and remaining is concrete entropy decode value, and such as there being 2 bits to be the hangover coefficient, 5 bits are nonzero coefficient etc.;
Step 202, by bit received bit stream, according to bit stream encoded radio and bit stream code length, determine address bit, by the code table information of determined address bit mapping, as the entropy decode value;
In this step, the list item value in the code table information of mapping while being effective, determining that the code table information of this bit stream coding mapping is the entropy decode value obtained, and then receives subsequent bits stream by bit, continues 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
When entropy decoder receives bit stream by bit, the 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, the code identification value converts and draws by agreement H.264 according to top macro block and left side macro block nC value, here the first macroblock coding is designated " 00 ", address bit has just been determined like this, table look-at can obtain the coding significance bit, when this position is ' 0 ', continue to move into H.264 bit value of the next one, when this position is ' 1 ', mean that this bit stream encoded radio is effective, table look-at obtains nonzero coefficient and hangover coefficient.
When this table 2 was set, bit rate coding length was that physical length subtracts 1.
When bit stream was " 0000000111 ", the process that entropy decoder carries out the entropy decoding was:
Move into code stream " 0 ".Coding schedule is designated " 00 ", and code length is " 0000 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 00 ".Coding schedule is designated " 00 ", and code length is " 0001 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 000 ".Coding schedule is designated " 00 ", and code length is " 0010 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 0000 ".Coding schedule is designated " 00 ", and code length is " 0011 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 00000 ".Coding schedule is designated " 00 ", and code length is " 0100 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 000000 ".Coding schedule is designated " 00 ", and code length is " 0101 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 0000000 ".Coding schedule is designated " 00 ", and code length is " 0110 ", and encoded radio is " 0000 ", and the code table information obtained is " 00000000 ";
Move into code stream " 00000001 ".Coding schedule is designated " 00 ", and code length is " 0111 ", and encoded radio is " 0001 ", and the code table information obtained is " 00000000 ";
Move into code stream " 000000011 ", coding schedule is designated " 00 ", and code length is " 1000 ", and encoded radio is " 0011 ", and the code table information obtained is " 00000000 ";
Move into code stream " 0000000111 ", coding schedule is designated " 00 ", and code length is " 1001 ", and encoded radio is " 0111 ", and the code table information obtained is " 10010000 ".
At this moment, the list item value obtained is " 1 ", shows the entropy decoding effectively, and the nonzero coefficient sum number obtained is that " 00100 " and hangover coefficient number are " 00 ".
Fig. 3 is that provided by the invention comprise: mapping table arranges module and entropy decoder module based on the apparatus structure schematic diagram to the decoding of video image entropy of standard H.264, wherein,
Mapping table arranges module, and be used to adopting address bit mapping code table information, address bit is determined by coding schedule sign, bit stream encoded radio and bit stream code length, is mapped to corresponding code table information;
The entropy decoder module, for by bit received bit stream, 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 the entropy decode value.
In this device, mapping table arranges module, also for the coding schedule sign, takies 2 bits, and the bit stream encoded radio takies 4 bits, and the bit stream code length takies 4 bits, and address bit adopts 10 bits to form altogether; Code table information is 8 bits, and 1 bit wherein is the list item value searched, and remaining is concrete entropy decode value.
In this device, the entropy decoder module, while for the list item value of code table information when mapping, being also effective, determine that the code table information of this bit stream coding mapping is the entropy decode value obtained, and then receive subsequent bits stream by bit, according to said process, continue to carry out.
In this device, described entropy decode value is hangover coefficient number, nonzero coefficient number, hangover coefficient, nonzero coefficient and each nonzero coefficient leading zero number.
Above act preferred embodiment; the purpose, technical solutions and advantages of the present invention are further described; institute is understood that; the foregoing is only preferred embodiment of the present invention; not in order to limit the present invention; within the spirit and principles in the present invention all, any modification of doing, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.