CN100551064C - Variable length encoding method and device - Google Patents

Variable length encoding method and device Download PDF

Info

Publication number
CN100551064C
CN100551064C CN 200610164458 CN200610164458A CN100551064C CN 100551064 C CN100551064 C CN 100551064C CN 200610164458 CN200610164458 CN 200610164458 CN 200610164458 A CN200610164458 A CN 200610164458A CN 100551064 C CN100551064 C CN 100551064C
Authority
CN
China
Prior art keywords
run
sequence
level
pos
coding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN 200610164458
Other languages
Chinese (zh)
Other versions
CN101198056A (en
Inventor
金欣
崔春晖
熊联欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SnapTrack Inc
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN 200610164458 priority Critical patent/CN100551064C/en
Publication of CN101198056A publication Critical patent/CN101198056A/en
Application granted granted Critical
Publication of CN100551064C publication Critical patent/CN100551064C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a kind of variable length encoding method, comprise: the residual error coefficient sequence that obtains input block, this residual error coefficient sequence is carried out Run-Length Coding, after obtaining level sequence and run sequence, level sequence and run sequence are carried out Run-Length Coding respectively, and then to two distance of swimming code words that obtain to carrying out variable-length encoding respectively.The present invention discloses a kind of variable-length encoding device, comprising: pretreatment module and variable-length encoding module.It is the characteristic information of 1 level that the present invention has further utilized in the level sequence, with the characteristic information that in the run sequence is 0 run, reduced compression bit rate, improved Y-PSNR, the present invention can be applied to various encoders, and simultaneously also H.264 standard and domestic AVS standard are compatible fully with the existing world.

Description

Variable length encoding method and device
Technical field
The present invention relates to transfer of data and processing technology field, be specifically related to a kind of variable length encoding method and device.
Background technology
Entropy coding just is applied to video coding as far back as nineteen fifty, as last module of whole video coding framework.The a series of syntactic element to all modules generations before liking of entropy coding, comprise: macro block (mb) type, reference frame index, encoding block template (CBP, Coded Block Pattern), quantization step (QP), the residual error of motion vector, the residual error coefficient behind the transform and quantization etc.In all these syntactic elements, the data volume behind the amount of information of residual error coefficient and the final coding all is maximum, and it also is tool encoding compression space simultaneously, thereby all is the emphasis of entropy coding research all the time.
The mid-80 a new elongated entropy coding at discrete cosine transform (DCT) coefficient coding occurred promptly: two-dimensional variable length coding (2D-VLC) technology, this technology is shown as (run by zig-zag scanning with the piece coefficient table, level) form, and adopt a variable length code to this (run, level) several to encoding.
For improving the code efficiency of end of block character (EOB, End of Block), three-dimensional VLC (3D-VLC) technology has been proposed, this technology to (last, run is level) to carrying out combined coding, wherein, last represents whether the current block coefficient is last interior nonzero coefficient of piece.The method of different VLC code tables has appearred designing at (intra) prediction or interframe (inter) predicted method in the macro block employing frame simultaneously.
Elongated entropy coding is based on contextual coding techniques, mainly be that level and run branch are opened, respectively level and run are set up context and encode, perhaps encode based on the context of 2D-VLC, the core of this technology is the use of contextual information and the method that code table switches.
Fig. 1 is the flow chart of the variable length encoding method that proposes in the existing H.264 standard, and as shown in Figure 1, its concrete steps are as follows:
Step 101: current block is carried out zig-zag scanning, obtain the residual error coefficient sequence.
Step 102: the residual error coefficient sequence that obtains is carried out Run-Length Coding, obtain level and run.
Wherein, level is the nonzero coefficient in the current block, and run is the number that is positioned at each nonzero coefficient zero coefficient before in the current block.
Step 103: each level and each run are carried out variable-length encoding.
The shortcoming of prior art is, each level and each run carried out variable-length encoding respectively, and do not consider between each level and the contact between each run, therefore, may also have information redundancy, and code efficiency also can further improve.
Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of variable length encoding method and device, to reduce compression bit rate.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of variable length encoding method comprises:
Obtain the residual error coefficient sequence of input block, this residual error coefficient sequence is carried out Run-Length Coding, obtain nonzero coefficient level sequence and the number run sequence that appears at nonzero coefficient zero coefficient before;
Level sequence and run sequence are carried out Run-Length Coding respectively, and it is right to obtain corresponding distance of swimming code word respectively, to two distance of swimming code words that obtain to carrying out variable-length encoding respectively.
A kind of variable-length encoding device comprises:
Pretreatment module, be used for the level sequence of the input block received is carried out Run-Length Coding, the distance of swimming code word that obtains is right: (level, lev_pos) output to the variable-length encoding module, run sequence to the input block received is carried out Run-Length Coding, the distance of swimming code word that obtains is right: (run run_pos) outputs to the variable-length encoding module;
The variable-length encoding module, to the distance of swimming code word received to carrying out variable-length encoding.
Compared with prior art, the present invention is by scanning current block, obtain the residual error coefficient sequence, this residual error coefficient sequence is carried out traditional Run-Length Coding, after obtaining level sequence and run sequence, according to absolute value in the level sequence 1 level, and in the run sequence 0 run, level sequence and run sequence are carried out Run-Length Coding respectively, and then to two distance of swimming code words that obtain to carrying out variable-length encoding respectively, further having utilized in the level sequence is the characteristic information of 1 level, characteristic information with in the run sequence being 0 run has reduced compression bit rate, has improved Y-PSNR, the present invention can be applied to various encoders, and simultaneously also H.264 standard and domestic AVS standard are compatible fully with the existing world.
Description of drawings
Fig. 1 is the flow chart of the variable-length encoding that proposes in the existing H.264 standard;
The flow chart of the variable-length encoding that Fig. 2 provides for the embodiment of the invention one;
Fig. 3 be in the embodiment of the invention one to (level, lev_pos) sequence is to carrying out the flow chart of variable-length encoding;
Fig. 4 be in the embodiment of the invention one to (run, run_pos) sequence is to carrying out the flow chart of variable-length encoding;
The flow chart of the variable-length encoding that Fig. 5 provides for the embodiment of the invention two;
The device block diagram of the variable-length encoding that Fig. 6 provides for the embodiment of the invention;
The structural representation of the variable-length encoding module that Fig. 7 provides for the embodiment of the invention one;
The structural representation of the variable-length encoding module that Fig. 8 provides for the embodiment of the invention two;
The nonzero coefficient number coding module structural representation that Fig. 9 provides for the embodiment of the invention one and two;
(level, lev_pos) sequence mutual-coding's modular structure schematic diagram that Figure 10 provides for the embodiment of the invention one and two;
(run, run_pos) sequence mutual-coding's modular structure schematic diagram that Figure 11 provides for the embodiment of the invention one and two.
Embodiment
The present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
Fig. 2 is the flow chart of the variable-length encoding that provides of the embodiment of the invention one, and as shown in Figure 2, its concrete steps are as follows:
Step 201: coding side carries out zig-zag scanning to current block, obtains the residual error coefficient sequence.
In this step, also can adopt zig-zag mode in addition that current block is scanned.
The size of the piece of mentioning in the present embodiment can be 4 * 4 or 8 * 8 etc.Specifically choose the needs which kind of partitioned mode depends on whole encoder.
Step 202: coding side carries out traditional Run-Length Coding to the residual error coefficient sequence that obtains, and obtains level sequence and run sequence, the nonzero coefficient number of statistics current block: numcoeff, that is: the coefficient number that comprises in the level sequence.
Traditional Run-Length Coding in this step refers to, the Run-Length Coding of mentioning in the existing H.264 standard, that is: and level is the nonzero coefficient in the current block, run is the number that is positioned at each nonzero coefficient zero coefficient before in the current block.
Step 203: coding side is 1 level according to the absolute value that comprises in the Level sequence, and the level sequence is carried out Run-Length Coding further, obtain (level, lev_pos) sequence is right; According to what comprise in the run sequence is 0 run, and the run sequence is carried out Run-Length Coding further, obtains that (run, run_pos) sequence is right.
Here, (level, lev_pos) level of sequence centering refers to, the level of each absolute value non-1 in the level sequence from the front end to the low frequency end; Level_pos refers to, and the adjacent lower frequency side absolute value of the level of each absolute value non-1 is the number of 1 level continuously; (run, run_pos) run of sequence centering refers to, the run of each absolute value non-0 in the run sequence from the low frequency end to the front end; Run_pos refers to, and the adjacent high frequency side of the run of each absolute value non-0 is the number of 0 run continuously.
Therefore, mention in this step that the level sequence is carried out the process of further Run-Length Coding is as follows:
Scan promptly to low frequency end from the front end of level sequence: scanning from right to left, with the level of first absolute value non-1 as first to (level, lev_pos) level in, with the adjacent lower frequency side absolute value of this level be continuously the number of 1 level as first to (level, lev_pos) lev_pos in, after obtaining after the same method (level, lev_pos) sequence is right, until the end of scan.
Mention in this step that the run sequence is carried out the process of further Run-Length Coding is as follows:
Scan promptly to front end from the low frequency end of run sequence: scanning from left to right, with first run of non-0 as first to (run, run_pos) run in, the number that with the adjacent high frequency side of this run is 0 run continuously is as this first couple (run, run_pos) run_pos in, after obtaining in the same way (run, run_pos) sequence is right, until the end of scan.
Make that level sequence front end absolute value is that the number of 1 level is tailingones continuously, run sequence low frequency end is that the number of 0 run is tailingzeros continuously.
Step 204: coding side utilizes the last piece of current block and the nonzero coefficient number in the left piece, and the nonzero coefficient number in the current block is carried out adjacent piece prediction, obtains predicted value pred_num.
The last piece of current block refer to adjacent with current block and be positioned at current block directly over piece, it is adjacent with current block and be positioned at the piece of the front-left of current block that the left piece of current block refers to, setting the last piece of current block or left piece does not exist and is meant: current block with its on piece or left piece not in same band, or current block is in the top edge or the left hand edge of a frame picture.The process of then adjacent piece prediction is: establish the last piece of current block and the nonzero coefficient number in the left piece and be respectively: up_num and left_num, and then the predicted value pred_num of the nonzero coefficient number of current block is:
A, when last piece and left piece when all existing, pred_num=(up_num+left_num)/2.
B, there is and left piece when not existing pred_num=up_num when last piece.
C, there is not and left piece when existing pred_num=left_num when last piece.
D, when last piece and left piece when all not existing, pred_num=0.
Step 205: coding side utilizes pred_num to select the VLC table for numcoeff, by the mode of looking into the VLC table numcoeff is encoded, and the encoded radio that obtains is mail to decoding end.
Here, be used for the VLC table of numcoeff coding is generated according to conditional probability P (numcoeff|pred_num), coding codeword can adopt the Huffman sign indicating number.
Step 206: coding side from (level, lev_pos) front end that sequence is right is to low frequency end, order to each (level, lev_pos) sequence is to carrying out variable-length encoding, coding finishes, and the encoded radio that obtains is mail to decoding end.
Owing to numcoeff is encoded, therefore finish (level, lev_pos) behind the coding that sequence is right, coding side need not tailingones to be encoded again, the numcoeff that decoding end can obtain according to decoding and (level, lev_pos) sequence is to learning the value of tailingones.
Step 207: coding side to low frequency end, is the positive and negative encoding symbols of 1 level from the front end of level sequence to absolute value in the level sequence.
Because with absolute value in the level sequence is that 1 level is considered as the distance of swimming, and absolute value to be 1 level also comprise symbolic information promptly: be just or negative, so also need encode to this symbolic information.Here, represent that with a bit absolute value is the symbolic information of 1 level, that is: the symbol of 0 this level of expression is being for just, and the symbol of 1 this level of expression is for bearing.If comprise n absolute value in the sequence and be 1 level, then represent the symbol of this n level continuously from high frequency to the low frequency order with n bit, wherein, n is an integer.
Step 208: coding side from (run, run_pos) low frequency end that sequence is right is to front end, (run, run_pos) sequence is to carrying out variable-length encoding to each for order.
Because level and run are corresponding one by one, and finished coding to the level sequence, then decoding end can be learnt the number of the run that comprises in the run sequence according to the number of the level that comprises in the level sequence, therefore finish (run, run_pos) behind the coding that sequence is right, need not again coding to tailingzeros, decoding end can according to the number of level in the level sequence and decoding obtain (run, run_pos) number that sequence is right is learnt the value of tailingzeros.
Below be further elaborated with step 102~103 of a concrete application example to the embodiment of the invention one:
If the size of current block is 4 * 4, the residual error coefficient sequence that obtains after zig-zag scanning is:
-5;1;-1;4;-1;-2;0;-1;-3;0;-2;-1;0;0;-10
Wherein, the left end of sequence is a low frequency end, and right-hand member is a front end.
Be respectively through the run sequence that obtains level sequence and correspondence behind traditional Run-Length Coding:
The level sequence:
-5;1;-1;4;-1;-2;-1;-3;-2;-1;-1
The run sequence:
0;0;0;0;0;0;1;0;1;0;2
As can be seen: the nonzero coefficient number n umcoeff of current block is 11.
Level sequence and run sequence are further carried out Run-Length Coding, obtain respectively (level, lev_pos) sequence to (run, run_pos) sequence is right:
(level, lev_pos) sequence is right:
(-2,0);(-3,1);(-2,1);(4,2);(-5,0)
(run, run_pos) sequence is right:
(1,1);(1,1);(2,0)
Make that level sequence front end absolute value is that 1 number is tailingones continuously, tailingones is 2 herein.
Make that run sequence low frequency end is that 0 number is tailingzeros continuously, tailingzeros is 6 herein.
Below in the embodiment of the invention one to (level, lev_pos) sequence is elaborated to the process of carrying out variable-length encoding, Fig. 3 for the embodiment of the invention one provide to (level, lev_pos) sequence is to carrying out the flow chart of variable-length encoding, as shown in Figure 3, its concrete steps are as follows:
Step 301: coding side is that infra-frame prediction or inter prediction are chosen corresponding 2D_VLC table according to the residing macro block employing of current block.
The 2D_VLC table is infra-frame prediction or inter prediction according to the Forecasting Methodology that piece adopted, and is divided into two classes.
Step 302: coding side is determined the initial code table of first table for giving tacit consent in the 2D_VLC table.
Step 303: coding side uses the code table of determining to current (level, lev_pos) sequence mutual-coding.
Step 304: coding side judge whether all (level, lev_pos) sequence finishes to encoding, if, execution in step 308; Otherwise, execution in step 305.
Step 305: coding side according to should just encode (level, the lev_pos) absolute value of the level of sequence centering: abs (level), judge encode next (level, lev_pos) whether sequence needs renewal to used code table, if, execution in step 306; Otherwise, execution in step 307.
Here, can rule of thumb set a threshold value, if abs (level) greater than this threshold value, then determines to upgrade code table; Otherwise, determine not upgrade code table.
Step 306: coding side is according to (the level that has just encoded, lev_pos) absolute value of the level of sequence centering: abs (level), determine next (level of coding, lev_pos) sequence is to used code table, according to this code table to next (level, lev_pos) sequence mutual-coding goes to step 304.
Step 307: coding side adopt with just encoded (level, lev_pos) sequence is to identical code table, (level, lev_pos) sequence mutual-coding goes to step 304 to next.
Step 308: coding side adopts current code table to (level, lev_pos) end mark that sequence is right (EOL, End of Level) coding.
Below in the embodiment of the invention one to (run, run_pos) sequence is elaborated to the process of carrying out variable-length encoding, Fig. 4 for the embodiment of the invention one provide to (run, run_pos) sequence is to carrying out the flow chart of variable-length encoding, as shown in Figure 4, its concrete steps are as follows:
Step 401: coding side is that infra-frame prediction or inter prediction are chosen corresponding 2D_VLC table according to the residing macro block employing of current block.
Step 402: coding side is determined the initial code table of first table for giving tacit consent in the 2D_VLC table.
Step 403: coding side uses the code table of determining to current (run, run_pos) sequence mutual-coding.
Step 404: coding side judge whether all (run, run_pos) sequence finishes to encoding, if, execution in step 408; Otherwise, execution in step 405.
Step 405: coding side according to should just encode (run, the run_pos) value of the run of sequence centering, judgement be used to encode next (run, run_pos) whether sequence needs renewal to used code table, if, execution in step 406; Otherwise, execution in step 407.
Here, can rule of thumb set a threshold value, if just encoded (run, run_pos) value of the run of sequence centering then determines to upgrade code table greater than this threshold value; Otherwise, determine not upgrade code table.
Step 406: coding side according to just encode (run, the run_pos) value of the run of sequence centering, definite encode next (run, run_pos) sequence is to used code table, (run, run_pos) sequence mutual-coding goes to step 404 to next according to this code table.
Step 407: coding side adopt with just encoded (run, run_pos) sequence is to identical code table, (run, run_pos) sequence mutual-coding goes to step 404 to next.
Step 408: coding side adopts current code table to (run, run_pos) right end mark (EOR, End Of Run) is encoded.
The flow chart of the variable-length encoding that Fig. 5 provides for the embodiment of the invention two, as shown in Figure 5, its concrete steps are as follows:
Step 501~505 are identical with step 201~205.
Step 506: the number that to level sequence front end absolute value is 1 level continuously: trailingones coding.
Utilize numcoeff for trailingones selects the VLC table, utilize the mode of looking into the VLC table that trailingones is encoded.Be used for the VLC table of trailingones coding is generated according to conditional probability P (trailingones|numcoeff), coding codeword can adopt the Huffman sign indicating number.
Step 507: coding side from (level, lev_pos) front end that sequence is right is to low frequency end, (level, lev_pos) sequence is to carrying out variable-length encoding to each for order.
Step 508 is identical with step 207.
Step 509 is identical with step 208.
In the embodiment of the invention two, owing to will encode to trailingones, therefore to (level, when lev_pos) sequence mutual-coding finishes, decoding end can be learnt (level according to numcoeff and the trailingones that decoding obtains, lev_pos) whether sequence is to finishing, and coding side need not again to (level, the end mark coding that lev_pos) sequence is right.That is: the step 507 of the embodiment of the invention two: to (level, lev_pos) sequence comprises step 301 shown in Figure 3~307 to the process of carrying out variable-length encoding, and in the step 307, judging all (level, when lev_pos) sequence mutual-coding finishes, need not again to (level, the end mark coding that lev_pos) sequence is right.
Fig. 6 is the device block diagram of the variable-length encoding that provides of the embodiment of the invention, and as shown in Figure 6, it mainly comprises: pretreatment module 61 and variable-length encoding module 62, wherein:
Pretreatment module 61: be used for the current block of input is scanned, obtain the residual error coefficient sequence, this residual error coefficient sequence is carried out traditional Run-Length Coding, according to the absolute value that comprises in the level sequence that obtains 1 level, this level sequence is carried out further Run-Length Coding, with obtain (level, lev_pos) sequence is to outputing to variable-length encoding module 62; Run according in the run sequence that obtains being 0 carries out further Run-Length Coding to this run sequence, with obtain (run, run_pos) sequence is to outputing to variable-length encoding module 62.
As shown in Figure 6, pretreatment module 61 comprises: the first Run-Length Coding module 611 and the second Run-Length Coding module 612, wherein:
The first Run-Length Coding module 611: be used for the current block of input is scanned, obtain the residual error coefficient sequence, this residual error coefficient sequence is carried out Run-Length Coding, level sequence and the run sequence that obtains outputed to the second Run-Length Coding module 612.
The second Run-Length Coding module 612: absolute value is that 1 level carries out Run-Length Coding to the level sequence in the level sequence of sending according to the first Run-Length Coding module 611, and the distance of swimming code word that obtains is right: (level lev_pos) outputs to variable-length encoding module 62; According to the first Run-Length Coding module 611 send the run sequence in be that 0 run carries out Run-Length Coding to the run sequence, the distance of swimming code word that obtains is right: (run run_pos) outputs to variable-length encoding module 62.
Variable-length encoding module 62: to pretreatment module 61 send (level, lev_pos) sequence is to (run, run_pos) sequence outputs to decoding end to carrying out variable-length encoding respectively with the encoded radio that obtains.
Fig. 7 has provided the structural representation of the variable-length encoding module that the embodiment of the invention one provides, as shown in Figure 7, it mainly comprises: nonzero coefficient number coding module 731, (level, lev_pos) sequence mutual-coding's module 732, end mark coding module 733, symbolic coding module 734 and (run, run_pos) sequence mutual-coding's module 735, wherein:
Nonzero coefficient number coding module 731: be used for according to pretreatment module 61 send (level, lev_pos) sequence is carried out variable-length encoding to determining the nonzero coefficient number in the current block to this nonzero coefficient number, and the encoded radio that obtains is outputed to decoding end.
(level, lev_pos) sequence mutual-coding's module 732: be used for to pretreatment module 61 send (level, lev_pos) sequence is to carrying out variable-length encoding, coding finishes, the encoded radio that obtains is outputed to decoding end, and the code table of current employing is sent to end mark coding module 733.
End mark coding module 733: be used for receive (level, lev_pos) sequence mutual-coding's module 732 send code table the time, according to this code table to (level, end mark that lev_pos) sequence is right coding outputs to decoding end with the encoded radio that obtains.
Symbolic coding module 734: be used for according to pretreatment module 61 send (level, lev_pos) sequence is right, from the front end to the low frequency end, is the sign symbol coding of 1 level to each absolute value, and the code stream that obtains is outputed to decoding end.
(run, run_pos) sequence mutual-coding's module 735: be used for to pretreatment module 61 send (run, run_pos) sequence outputs to decoding end to carrying out variable-length encoding with the encoded radio that obtains.
Fig. 8 has provided the structural representation of the variable-length encoding module that the embodiment of the invention two provides, as shown in Figure 8, compare with Fig. 7, its difference is: do not comprise end mark coding module 733, and further comprise: absolute value is 1 level number coding module 736 continuously, this module is used for the (level that sends according to pretreatment module 61, lev_pos) sequence is right, the front end absolute value of determining the level sequence is the number of 1 level continuously, this number is carried out variable-length encoding, the encoded radio that obtains is outputed to decoding end.
And in the present embodiment, (level, lev_pos) sequence mutual-coding's module 732 need not to send the code table of current employing when coding finishes.
The structural representation of the nonzero coefficient number coding module that Fig. 9 provides for the embodiment of the invention one and two, as shown in Figure 9, it mainly comprises: nonzero coefficient number prediction module 911 and coding module 912, wherein:
Nonzero coefficient number prediction module 911: be used for the nonzero coefficient number that last piece and left piece according to current block comprise, the nonzero coefficient number that current block comprises is carried out adjacent piece prediction, predicted value is outputed to coding module 912.
Coding module 912 the: be used for (level that sends according to pretreatment module 61, lev_pos) sequence is to determining the nonzero coefficient number in the current block, select the VLC table according to the predicted value that nonzero coefficient number prediction module 911 is sent for the nonzero coefficient number of self determining, by searching nonzero coefficient the number encoder of this VLC table, the encoded radio that obtains is outputed to decoding end for self determining.
(the level that Figure 10 provides for the embodiment of the invention one and two, level_pos) structural representation of sequence mutual-coding's module, as shown in figure 10, it mainly comprises: the 2D_VLC table selects module 1021,2D_VLC table to preserve module 1022, (level, level_pos) coding module 1023 and code table upgrade judge module 1024, wherein:
The 2D_VLC table is selected module 1021: be used for infra-frame prediction or inter prediction mode according to current block macro block employing of living in, select corresponding 2D_VLC table, this 2D_VLC table is sent to 2D_VLC show to preserve module 1022.
The 2D_VLC table is preserved module 1022: be used to receive and preserve the 2D_VLC table that the 2D_VLC table selects module 1021 to send.
(level, level_pos) coding module 1023: receive (the level that pretreatment module 61 is sent, lev_pos) sequence is right, preserve module 1022 from the 2D_VLC table and obtain first code table, from the front end to the low frequency end, according to this code table order to each (level, lev_pos) sequence mutual-coding, intact one of every coding (level, lev_pos) sequence is right, upgrades judge module 1024 to code table and sends (the level that has just encoded, lev_pos) level of sequence centering, upgrade the renewal indication of carrying new code table that judge module 1024 is sent if receive code table afterwards, then this new code table of basis is to next (level, lev_pos) sequence mutual-coding; If that receives that code table upgrades that judge module 1024 sends does not upgrade indication, then adopt and (the level that has just encoded, lev_pos) sequence is to identical code table, to next (level, lev_pos) sequence mutual-coding, to own that (level, lev_pos) sequence mutual-coding finishes, and each encoded radio is sent to decoding end.
For the embodiment of the invention one, (level, level_pos) coding module 1023 is further used for, and will own that (level, lev_pos) sequence mutual-coding finishes, and sends the code table of current employing to end mark coding module 733.
Code table upgrades judge module 1024: when receiving (level, level_pos) level that sends of coding module 1023, absolute value according to this level judges whether that needs upgrade code table, if, then preserve at the 2D_VLC table and select a code table in the module 1022 according to the absolute value of this level, this code table is carried at upgrades in the indication and send to (level, level_pos) coding module 1023; Otherwise, to (level, level_pos) coding module 1023 sends and do not upgrade indication.
(the run that Figure 11 provides for the embodiment of the invention one and two, run_pos) structural representation of sequence mutual-coding's module, as shown in figure 11, it mainly comprises: the 2D_VLC table selects module 1151,2D_VLC table to preserve module 1152, (run, run_pos) coding module 1153 and code table upgrade judge module 1154, wherein:
The 2D_VLC table is selected module 1151: be used for infra-frame prediction or inter prediction mode according to current block macro block employing of living in, select corresponding 2D_VLC table, this 2D_VLC table is sent to 2D_VLC show to preserve module 1152.
The 2D_VLC table is preserved module 1152: be used to receive and preserve the 2D_VLC table that the 2D_VLC table selects module 1151 to send.
(run, run_pos) coding module 1153: receive (the run that pretreatment module 61 is sent, run_pos) sequence is right, preserve module 1152 from the 2D_VLC table and obtain first code table, from the front end to the low frequency end, according to this code table order to each (run, run_pos) sequence mutual-coding, intact one of every coding (run, run_pos) sequence is right, upgrades judge module 1154 to code table and sends (the run that has just encoded, run_pos) run of sequence centering, upgrade the renewal indication of carrying new code table that judge module 1154 is sent if receive code table afterwards, then this new code table of basis is to next (run, run_pos) sequence mutual-coding; If that receives that code table upgrades that judge module 1154 sends does not upgrade indication, then adopt and (the run that has just encoded, run_pos) sequence is to identical code table, to next (run, run_pos) sequence mutual-coding, to own that (run, run_pos) sequence mutual-coding finishes, and each encoded radio is sent to decoding end.
Code table upgrades judge module 1154: when receiving (run, run_pos) run that sends of coding module 1153, value according to this run judges whether that needs upgrade code table, if, then preserve at the 2D_VLC table and select a code table in the module 1152 according to the value of this run, this code table is carried at upgrades in the indication and send to (run, run_pos) coding module 1153; Otherwise, to (run, run_pos) coding module 1153 sends and do not upgrade indication.
The above only is process of the present invention and method embodiment, in order to restriction the present invention, all any modifications of being made within the spirit and principles in the present invention, is not equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (18)

1, a kind of variable length encoding method is characterized in that, comprising:
Obtain the residual error coefficient sequence of input block, this residual error coefficient sequence is carried out Run-Length Coding, obtain nonzero coefficient level sequence and the number run sequence that appears at nonzero coefficient zero coefficient before;
The level of each absolute value non-1 obtains (level, level_pos) level of sequence centering in the record level sequence; The adjacent lower frequency side of the level of each absolute value non-1 is the number of 1 level continuously in the record level sequence, obtains (level, level_pos) lev_pos of sequence centering;
Each run of non-0 in the record run sequence obtains (run, run_pos) run of sequence centering; The adjacent high frequency side of each run of non-0 is the number of 0 run continuously in the record run sequence, obtains (run, run_pos) run_pos of sequence centering;
To obtain (level, level_pos) sequence to, (run, run_pos) sequence is to carrying out variable-length encoding respectively.
2, the method for claim 1, it is characterized in that, the level of each absolute value non-1 in the described record level sequence, the adjacent lower frequency side of the level of each absolute value non-1 is that the number of 1 level is continuously in the record level sequence: from the front end of level sequence to low frequency end record successively.
3, the method for claim 1 is characterized in that, each run of non-0 in the described record run sequence, the adjacent high frequency side of each run of non-0 is that the number of 0 run is continuously in the record run sequence: from the low frequency end of run sequence to front end record successively.
4, the method for claim 1, it is characterized in that, described (the run that obtains, run_pos) after the run_pos of sequence centering, (level to obtaining, level_pos) sequence to, (run, run_pos) sequence further comprises before the variable-length encoding carrying out respectively: the number to the nonzero coefficient in the input block is carried out variable-length encoding.
5, method as claimed in claim 4, it is characterized in that, describedly nonzero coefficient number in the input block is carried out variable-length encoding comprise: according to the nonzero coefficient number that comprises in the last piece of input block and the left piece, nonzero coefficient number in the input block is carried out adjacent piece prediction, select variable-length encoding VLC table according to this predicted value, show the number encoder of the nonzero coefficient in the input block according to this VLC.
6, method as claimed in claim 4 is characterized in that, described to obtain (level, level_pos) sequence comprises carrying out variable-length encoding:
A1, what adopt according to the residing macro block of input block is that infra-frame prediction or inter prediction are chosen corresponding 2D_VLC table, determine the initial code table of first table in the 2D_VLC table for giving tacit consent to, right through the current distance of swimming code word that Run-Length Coding obtains with the 2D_VLC code table of determining: (level, lev_pos) sequence mutual-coding to the level sequence;
B1, judge whether all (level, lev_pos) sequence finishes to encoding, if, with the code table of determining to (level, lev_pos) right end mark coding; Otherwise, execution in step C1;
(the level that C1, basis should just have been encoded, lev_pos) absolute value of the level of sequence centering, judge coding next (level, lev_pos) whether sequence needs to upgrade to used 2D_VLC code table, if, according to described absolute value, determine coding next (level, lev_pos) sequence is to used code table, to next (level, lev_pos) sequence mutual-coding goes to step B1; Otherwise, adopt with just encoded (level, lev_pos) sequence is to identical code table, (level, lev_pos) sequence mutual-coding go to step B1 to next.
7, method as claimed in claim 4, it is characterized in that, described number to the nonzero coefficient in the input block is carried out after the variable-length encoding, (the level to obtaining, level_pos) sequence to, (run, run_pos) sequence further comprises before the variable-length encoding carrying out respectively: the individual number encoder that to the front end absolute value of level sequence is 1 level continuously.
8, method as claimed in claim 7, it is characterized in that, the number coding that to the front end absolute value of level sequence is 1 level continuously comprises: selecting the VLC table according to the nonzero coefficient number in the input block, is the individual number encoder of 1 level continuously to the front end absolute value of level sequence according to this VLC table.
9, method as claimed in claim 7 is characterized in that, described to obtain (level, level_pos) sequence comprises carrying out variable-length encoding:
A2, what adopt according to the residing macro block of input block is that infra-frame prediction or inter prediction are chosen corresponding 2D_VLC table, determine the initial code table of first table in the 2D_VLC table for giving tacit consent to, right through the current distance of swimming code word that Run-Length Coding obtains with the 2D_VLC code table of determining: (level, lev_pos) sequence mutual-coding to the level sequence;
B2, judge whether all (level, lev_pos) sequence finishes to encoding, if, determine (level, lev_pos) sequence mutual-coding finishes; Otherwise, execution in step C2;
(the level that C2, basis should just have been encoded, lev_pos) absolute value of the level of sequence centering, judge coding next (level, lev_pos) whether sequence needs to upgrade to used 2D_VLC code table, if, according to described absolute value, determine coding next (level, lev_pos) sequence is to used code table, to next (level, lev_pos) sequence mutual-coding goes to step B2; Otherwise, adopt with just encoded (level, lev_pos) sequence is to identical code table, (level, lev_pos) sequence mutual-coding go to step B2 to next.
10, as claim 1 or 6 or 9 described methods, it is characterized in that, (run run_pos) further comprises after the run_pos of sequence centering: scan to low frequency end from the front end of level sequence, be the sign symbol coding of 1 level to absolute value to described obtaining.
11, method as claimed in claim 10 is characterized in that, described is that the sign symbol coding of 1 level comprises to absolute value: when absolute value is that 1 level is timing, determine that the coding indicating bit is 1; When absolute value is 1 level when negative, determine that the coding indicating bit is 0.
12, as claim 1 or 6 or 9 described methods, it is characterized in that, described to obtain (run, run_pos) sequence comprises carrying out variable-length encoding:
A3, what adopt according to the residing macro block of input block is that infra-frame prediction or inter prediction are chosen corresponding 2D_VLC table, determine the initial code table of first table in the 2D_VLC table for giving tacit consent to, right through the current distance of swimming code word that Run-Length Coding obtains with the 2D_VLC code table of determining: (run, run_pos) sequence mutual-coding to the run sequence;
B3, judge whether all (run, run_pos) sequence finishes to encoding, if, with the code table of determining to (run, run_pos) right end mark coding; Otherwise, execution in step C3;
(the run that C3, basis should just have been encoded, run_pos) the run value of sequence centering, judge coding next (run, run_pos) whether sequence needs to upgrade to used 2D_VLC code table, if, according to described run value, determine coding next (run, run_pos) sequence is to used code table, to next (run, run_pos) sequence mutual-coding goes to step B3; Otherwise, adopt with just encoded (run, run_pos) sequence is to identical code table, (run, run_pos) sequence mutual-coding go to step B3 to next.
13, a kind of variable-length encoding device is characterized in that, comprising:
Pretreatment module is used for the residual error coefficient sequence of the input block received is carried out Run-Length Coding, obtains nonzero coefficient level sequence and appears at the number run sequence of the zero coefficient before the nonzero coefficient; The level of each absolute value non-1 in the record level sequence, obtain (level, level_pos) level of sequence centering, the adjacent lower frequency side of the level of each absolute value non-1 is the number of 1 level continuously in the record level sequence, obtain (level, level_pos) lev_pos of sequence centering, will (level, lev_pos) sequence is to outputing to the variable-length encoding module; Each run of non-0 in the record run sequence, obtain (run, run_pos) run of sequence centering, the adjacent high frequency side of each run of non-0 is the number of 0 run continuously in the record run sequence, obtain (run, run_pos) run_pos of sequence centering, with obtain (run, run_pos) sequence is to outputing to the variable-length encoding module;
The variable-length encoding module, to (level, level_pos) sequence to, (run, run_pos) sequence is to carrying out variable-length encoding respectively.
14, device as claimed in claim 13 is characterized in that, described variable-length encoding module comprises:
Nonzero coefficient number coding module, according to receive (level, lev_pos) sequence is carried out variable-length encoding to determining the nonzero coefficient number in the input block to this number;
(level, lev_pos) sequence mutual-coding's module, to receive (level, lev_pos) sequence is to carrying out variable-length encoding, coding finishes, and the code table of current employing is sent to the end mark coding module;
The end mark coding module, according to the code table of receiving to (level, end mark that lev_pos) sequence is right coding;
The symbolic coding module, according to receive (level, lev_pos) sequence is right, from the front end to the low frequency end, is that the sign symbol of 1 level is encoded to each absolute value;
(run, run_pos) sequence mutual-coding's module, to receive (run, run_pos) sequence is to carrying out variable-length encoding.
15, device as claimed in claim 13 is characterized in that, described variable-length encoding module comprises:
Nonzero coefficient number coding module, according to receive (level, lev_pos) sequence is carried out variable-length encoding to determining the nonzero coefficient number of input block to this number;
Absolute value is 1 level number coding module continuously, according to receive (level, lev_pos) sequence is right, the front end absolute value of determining the level sequence is the number of 1 level continuously, and this number is carried out variable-length encoding;
(level, lev_pos) sequence mutual-coding's module, to receive (level, lev_pos) sequence is to carrying out variable-length encoding;
The symbolic coding module, according to receive (level, lev_pos) sequence is right, from the front end to the low frequency end, is that the sign symbol of the level of l is encoded to each absolute value;
(run, run_pos) sequence mutual-coding's module, to receive (run, run_pos) sequence is to carrying out variable-length encoding.
As claim 14 or 15 described devices, it is characterized in that 16, described nonzero coefficient number coding module comprises:
Nonzero coefficient number prediction module is used for the nonzero coefficient number that last piece and left piece according to input block comprise, and the nonzero coefficient number that input block comprises is carried out adjacent piece prediction, and predicted value is outputed to coding module;
Coding module, be used for (the level that sends according to pretreatment module, lev_pos) sequence is to determining the nonzero coefficient number in the input block, select the VLC table according to the predicted value that nonzero coefficient number prediction module is sent for the nonzero coefficient number of self determining, by searching nonzero coefficient the number encoder of this VLC table for self determining.
17, as claim 14 or 15 described devices, it is characterized in that, described (level, level_pos) sequence mutual-coding's module comprises:
The 2D_VLC table is selected module, is used for infra-frame prediction or inter prediction mode according to input block macro block employing of living in, selects corresponding 2D_VLC table, this 2D_VLC table is sent to 2D_VLC show to preserve module;
The 2D_VLC table is preserved module, is used to preserve the 2D_VLC table of receiving;
(level, level_pos) coding module, receive (the level that pretreatment module is sent, lev_pos) sequence is right, preserve module from the 2D_VLC table and obtain first code table, from the front end to the low frequency end, (every coding finishes (a level for level, lev_pos) sequence mutual-coding to each according to this code table order, lev_pos) sequence is right, to code table upgrade judge module send just encode (level, the lev_pos) level of sequence centering indicate if receive the renewal of carrying new code table that code table renewal judge module is sent, then this new code table of basis is to next (level, lev_pos) sequence mutual-coding; If that receives that code table upgrades that judge module sends does not upgrade indication, then adopt with just encoded (level, lev_pos) sequence is to identical code table, to next (level, lev_pos) sequence mutual-coding;
Code table upgrades judge module, absolute value according to the level that receives judges whether that needs upgrade code table, if then preserve at the 2D_VLC table according to the absolute value of this level and select a code table in the module, this code table is carried to upgrade in the indication sends to (level, level_pos) coding module; Otherwise, to (level, level_pos) coding module sends and do not upgrade indication.
18, as claim 14 or 15 described devices, it is characterized in that, described (run, run_pos) sequence mutual-coding's module comprises:
The 2D_VLC table is selected module, is used for infra-frame prediction or inter prediction mode according to input block macro block employing of living in, selects corresponding 2D_VLC table, this 2D_VLC table is sent to 2D_VLC show to preserve module;
The 2D_VLC table is preserved module, is used to preserve the 2D_VLC table of receiving;
(run, run_pos) coding module, receive (the run that pretreatment module is sent, run_pos) sequence is right, preserve module from the 2D_VLC table and obtain first code table, from the front end to the low frequency end, (every coding finishes (a run for run, run_pos) sequence mutual-coding to each according to this code table order, run_pos) sequence is right, to code table upgrade judge module send just encode (run, the run_pos) run of sequence centering indicate if receive the renewal of carrying new code table that code table renewal judge module is sent, then this new code table of basis is to next (run, run_pos) sequence mutual-coding; If that receives that code table upgrades that judge module sends does not upgrade indication, then adopt with just encoded (run, run_pos) sequence is to identical code table, to next (run, run_pos) sequence mutual-coding;
Code table upgrades judge module, value according to the run that receives judges whether that needs upgrade code table, if then preserve at the 2D_VLC table according to the value of this run and select a code table in the module, this code table is carried to upgrade in the indication sends to (run, run_pos) coding module; Otherwise, to (run, run_pos) coding module sends and do not upgrade indication.
CN 200610164458 2006-12-05 2006-12-05 Variable length encoding method and device Expired - Fee Related CN100551064C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200610164458 CN100551064C (en) 2006-12-05 2006-12-05 Variable length encoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200610164458 CN100551064C (en) 2006-12-05 2006-12-05 Variable length encoding method and device

Publications (2)

Publication Number Publication Date
CN101198056A CN101198056A (en) 2008-06-11
CN100551064C true CN100551064C (en) 2009-10-14

Family

ID=39548150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200610164458 Expired - Fee Related CN100551064C (en) 2006-12-05 2006-12-05 Variable length encoding method and device

Country Status (1)

Country Link
CN (1) CN100551064C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013033895A1 (en) * 2011-09-07 2013-03-14 速压公司 Data compressing and decompressing method, program, storage medium, and electronic product
CN103188486B (en) * 2011-12-28 2016-04-20 联芯科技有限公司 H.263 the variable-length coding method of Video coding and system
CN111384968B (en) * 2018-12-28 2022-08-09 上海寒武纪信息科技有限公司 Data compression/decompression device and data decompression method
CN112399181B (en) 2019-08-19 2022-08-26 华为技术有限公司 Image coding and decoding method, device and storage medium
CN112449186B (en) * 2019-08-30 2021-10-12 腾讯科技(深圳)有限公司 Encoding method, decoding method, corresponding devices, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Context-Based 2D-VLC for Video Coding. Qiang,Wang,,Debin,Zhao,Siwei,Ma,,Yan,Lu,QingmingHuang,Wen,Gao.2004 IEEE International Conference on Multimedia and Expo(ICME),第1卷. 2004
Context-Based 2D-VLC for Video Coding. Qiang,Wang,Debin,Zhao,Siwei,Ma,Yan,Lu,QingmingHuang,Wen,Gao.2004 IEEE International Conference on Multimedia and Expo(ICME),第1卷. 2004 *

Also Published As

Publication number Publication date
CN101198056A (en) 2008-06-11

Similar Documents

Publication Publication Date Title
KR101984826B1 (en) Method and apparatus for entropy Coding and decoding of transformation coefficient
CN104185990B (en) The decoding of coefficient in video coding
CN1316433C (en) Video-information encoding method and video-information decoding method
CN107529704B (en) Decoder, decoding and encoded video method
JP3842803B2 (en) Signal encoding method, signal decoding method, signal encoding device, signal decoding device, signal encoding program, and signal decoding program
CN1980395A (en) Entropy coding method and decoding method based on text
CN101420614B (en) Image compression method and device integrating hybrid coding and wordbook coding
US20050012648A1 (en) Apparatus and methods for entropy-encoding or entropy-decoding using an initialization of context variables
CN104205831B (en) Coding and decoding methods are carried out for pair bit stream associated with conversion coefficient
US20080219578A1 (en) Method and apparatus for context adaptive binary arithmetic coding and decoding
CN102860006A (en) Managing predicted motion vector candidates
WO2003003745A1 (en) Image encoder, image decoder, image encoding method, and image decoding method
CN104054342A (en) High throughout coding for CABAC in HEVC
CN109923861A (en) For to the method and apparatus for indicating that the binary symbol sequence of syntactic element related with image data carries out context adaptive binary arithmetic coding
CN102783035A (en) Parallel entropy coding and decoding methods and devices
US10127913B1 (en) Method of encoding of data stream, method of decoding of data stream, and devices for implementation of said methods
CN101014129B (en) Video data compression method
CN102783154A (en) Encoding and decoding methods and devices employing dual codesets
CN100551064C (en) Variable length encoding method and device
CN101267553A (en) A method and device for coding and decoding
CN103931188A (en) Method and apparatus for context-adaptive binary arithmetic coding of syntax elements
CN100542293C (en) Variable-length code decode method and codec thereof
CN102473315A (en) Method and apparatus for reusing tree structures to encode and decode binary sets
CN109565596A (en) The method and apparatus of the binary symbol sequence of syntactic element relevant to video data are indicated for context adaptive binary arithmetic coding
CN102638680B (en) Hardware-based CABAC (Context-Based Adaptive Binary Arithmetic Coding) coding method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160422

Address after: American California

Patentee after: Snaptrack, Inc.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: Huawei Technologies Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20091014

Termination date: 20161205

CF01 Termination of patent right due to non-payment of annual fee