Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
The embodiment of the invention has proposed a kind of new AC component coding mode, this coded system can exist continuous when being 0 AC component ending more than 16 values at the DCT coefficient, at should Unified coding being that EOB code word ending place value is 0 AC component, coding earlier as much as possible obtains the ZRL code word, thereafter be that 0 AC component coding is EOB again with 16 values of ending place residue less than, being about to by ending place is the EOB code word that 0 AC component Unified coding obtains more than 16 values, is split as some ZRL code words, and be the EOB code word that 0 AC component coding obtains by the continuous value of ending residue.
But if only utilize above-mentioned new coded system, then for the described extreme case of background technology part, the ZRL code word of increase is still according to periodic regularity and is inserted in the bit stream data.Therefore, the embodiment of the invention also needs to select at random coded system or above-mentioned new coded system as shown in Figure 5 at continuous DCT coefficient, makes in the bit stream data behind the continuous DCT coefficient coding insertion position and the indefinite ZRL code word of quantity at random.
Referring to Fig. 7 a, in the DCT coefficient after continuous group of some quantifications, 63 AC components all are that a kind of extreme case of 0 is an example entirely, except the frequency of occurrences is the highest in an alternating manner DC component corresponding code word of institute and EOB code word, also inserted and be to have inserted some ZRL code words at random, thereby can upset the periodic regularity of corresponding code word of the DC component that alternately occurs in the bit stream data and EOB code word, and then reduce the EMI that bit stream data produced behind the DCT coefficient coding.
Referring to Fig. 7 b, in the DCT coefficient after continuous group of some quantifications, 63 AC components are not 0 entirely, but the identical another kind of extreme case of 63 AC components in every group of DCT coefficient is an example, except the order frequency of occurrences the highest corresponding code word of DC component in an alternating manner, the ZRL code word, outside non-zero codeword and the EOB code word, also between non-zero codeword and EOB code word, inserted, and be to have inserted some ZRL code words that quantity does not wait at random, thereby can upset the corresponding code word of the DC component that alternately occurs in the bit stream data, the ZRL code word, the periodic regularity that non-zero codeword and EOB code word constitute in proper order, and then the EMI that bit stream data produced behind the reduction DCT coefficient coding.
Below, earlier DCT coefficient coding method in the embodiment of the invention is elaborated.
DCT coefficient coding method in the embodiment of the invention, need according to existing mode current DCT coefficient to be quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Wherein, as shown in Figure 8, the AC component that respectively exchanges in the current DCT coefficient is encoded and comprised the steps:
Step 800, for current DCT coefficient produces first random number or second random number at random, is the coded system of 0 AC component in order to select at random the continuous value of ending place in the current DCT coefficient, if what produce is first random number, then jump to step 801, if what produce is second random number, then jump to step 802.
Step 801, for the current DCT coefficient that with continuous value is the ending of 0 AC component, all values that ending place is continuous are that 0 AC component Unified coding is the EOB code word; And for not being the current DCT coefficient of 0 AC component ending with continuous value, can be according to existing mode as step 306 among Fig. 5~309, earlier be that 0 AC component coding is the ZRL code word with the continuous value before the AC component of each value non-0, to remain continuous value again and be 0 AC component and encode, finish coding then current DCT coefficient with the AC component of this value non-0.
Step 802, for the current DCT coefficient that with continuous value is the ending of 0 AC component, wherein the part value of front is that 0 AC component coding obtains the ZRL code word earlier, wherein the residue value of back is that 0 AC component coding is the EOB code word again; And for not being the current DCT coefficient of 0 AC component ending with continuous value, can be according to existing mode as step 306 among Fig. 5~309, earlier be that 0 AC component coding is the ZRL code word with the continuous value before the AC component of each value non-0, to remain continuous value again and be 0 AC component and encode, finish coding then current DCT coefficient with the AC component of value non-0.
So far, this flow process finishes.
So, in the DCT of present embodiment coefficient coding method, when produce random number, when judge generation be first random number or second random number and how realize that aforementioned new coded system can have multiple implementation to insert the ZRL code word at random, therefore 6 kinds of method embodiment are provided below.
Method embodiment one
In the present embodiment, as shown in Figure 5 existing coded system and aforementioned new coded system are set, in beginning before the AC component encodes in to current DCT coefficient with the zigzag scanning sequency, earlier produce first random number or second random number at random, and the judgement generation is first random number or second random number for current DCT coefficient;
If what produce is first random number, then utilize existing coded system as shown in Figure 5, be after 0 in the AC component value of judging current scanning at every turn, judge again whether this AC component is last AC component of current DCT coefficient; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, and continues the next AC component of scanning; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient;
If what produce is second random number, then utilize aforementioned new coded system, in the AC component value of judging current scanning at every turn is after 0, as long as scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16, and then judge that whether this AC component is last of current DCT coefficient 16 values; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, and continues the next AC component of scanning; When judging this AC component and be last AC component, the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient.
Like this, just make continuous DCT coefficient select existing as shown in Figure 5 coded system randomly for use, or aforementioned new coded system, thereby the combination of DC component code word and EOB code word can appear in the bit stream data behind the DCT coefficient coding continuously randomly, or DC component and ZRL code word and EOB code word, thereby make in the bit stream data behind the continuous DCT coefficient coding that no longer DC component code word and EOB code word only alternately appear in periodic regularity ground, and then the discrete peak value in the EMI frequency spectrum of blanking code flow data transmission to a certain extent, promptly reduce the EMI that bit stream data produced behind the DCT coefficient coding.
The coding method of DCT coefficient in the present embodiment, according to existing mode current DCT coefficient is quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Fig. 9 is to the schematic flow sheet of AC component coding method in the DCT coefficient among the inventive method embodiment one.Referring to Fig. 9, the coding method of DCT coefficient is encoded to 63 AC components in the current DCT coefficient that has quantized according to following steps in the present embodiment:
Step 900 is provided with parameter K, is used to represent that current AC component order that scans and the initial value that K is set are 0; Parameters R is set, be used to represent continuous sweep to but the value of encoding is that 0 AC component number and the initial value that R is set are 0.
Step 901, for current DCT coefficient produces first random number or second random number at random, and what judge to produce is first random number or second random number, if first random number, then jump to the step 501 of flow process as shown in Figure 5, if second random number execution in step 902 then.
Step 902 scans next AC component, makes K=K+1.
Step 903 judges whether the value ZZ (K) of K AC component is 0, if then execution in step 904, otherwise execution in step 909.
Step 904 judges that this value is that whether to have before 0 the AC component more than 15 continuous values be that 0 AC component is encoded, and promptly whether R greater than 15, if then execution in step 905, otherwise execution in step 906.
Step 905, according to AC component Huffman table, be that 0 AC component Unified coding is 1 ZRL code word with continuous 16 values, and from the continuous sweep of record to but the value of encoding is 0 AC component number deducts 16, even R=R-16, execution in step 906 then.
Step 906 judges the current value that scans is whether 0 AC component is last, is whether K equals 63, if then execution in step 908, otherwise execution in step 907.
Step 907 wouldn't be that 0 AC component is encoded to the current value that scans, and to continuous sweep to but the value of encoding is 0 AC component number adds up, make R=R+1, be back to step 902 then.
Step 908, according to the value of last AC component of scanning in a zigzag is 0, and promptly 63 AC components are to be that 0 AC component is ending with value, according to AC component Huffman table, with ending place this moment uncoded continuous value be that 0 AC component Unified coding is 1 EOB code word, process ends then.
Step 909~step 913 is identical with the processing mode of step 506 as shown in Figure 5~step 510, and the AC component of judging the current value non-zero that scans in step 913 process ends otherwise return step 902 during for last, concrete processing procedure does not repeat them here.
So far, this flow process finishes.
Method embodiment two
In the present embodiment, as shown in Figure 5 existing coded system and aforementioned new coded system are set, in beginning before the AC component encodes in to current DCT coefficient with the zigzag scanning sequency, earlier produce first random number or second random number at random, and the judgement generation is first random number or second random number for current DCT coefficient;
If what produce is first random number, then utilize existing coded system as shown in Figure 5, be after 0 in the AC component value of judging current scanning at every turn, judge again whether this AC component is last AC component of current DCT coefficient; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, and continues the next AC component of scanning; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient; That is the processing mode when, producing first random number is identical with method embodiment one;
If what produce is second random number, then utilize aforementioned new coded system, be after 0 in the AC component value of judging current scanning at every turn, judge whether this AC component is last AC component of current DCT coefficient earlier; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, obtain as long as add up then scan but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16, continue the next AC component of scanning then 16 values; When judging this AC component and be last AC component, the continuous value that current DCT coefficient ending place is encoded this moment not yet is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient; Promptly, processing mode when producing second random number is than method embodiment one, difference is, as long as the current value that has scanned is 0 AC component is not last, then scanned but uncoded value is 1 AC component of 0 earlier current, calculating is scanning but uncoded continuous value is within 0 the AC component total quantity, and then judge add up scanning of obtaining but uncoded continuous value be whether enough 16 of 0 AC number of components, and coding obtain the ZRL code word.
Like this, still can produce approximate technique effect with method embodiment one.
The coding method of DCT coefficient in the present embodiment, according to existing mode current DCT coefficient is quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Figure 10 is to the schematic flow sheet of AC component coding method in the DCT coefficient among the inventive method embodiment two.Referring to Figure 10, the coding method of DCT coefficient is encoded to 63 AC components in the current DCT coefficient that has quantized according to following steps in the present embodiment:
Step 1000 is provided with parameter K, is used to represent that current AC component order that scans and the initial value that K is set are 0; Parameters R is set, be used to represent continuous sweep to but the value of encoding is that 0 AC component number and the initial value that R is set are 0.
Step 1001, for current DCT coefficient produces first random number or second random number at random, and what judge to produce is first random number or second random number, if first random number, then jump to the step 501 of flow process as shown in Figure 5, if second random number execution in step 1002 then.
Step 1002 scans next AC component, makes K=K+1.
Step 1003 judges whether the value ZZ (K) of K AC component is 0, if then execution in step 1004, otherwise execution in step 1009.
Step 1004 judges the current value that scans is whether 0 AC component is last, is whether K equals 63, if then execution in step 1008, otherwise execution in step 1005.
Step 1005 wouldn't be that 0 AC component is encoded to the current value that scans, and to continuous sweep to but the value of encoding is 0 AC component number adds up, make R=R+1, execution in step 1006 then.
Step 1006 judges that this value is that whether to have before 0 the AC component more than 15 continuous values be that 0 AC component is encoded, and promptly whether R if then execution in step 1007, otherwise return step 1002 continues scanning next AC component greater than 15.
Step 1007, according to AC component Huffman table, with continuous 16 values is that 0 AC component Unified coding is 1 ZRL code word, and from the continuous sweep of record to but the value of encoding is 0 AC component number deducts 16, even R=R-16 returns step 1002 then and continues the next AC component of scanning.
Step 1008, value according to last the AC component that scans in a zigzag is 0, promptly 63 AC components are to be that 0 AC component is ending with value, according to AC component Huffman table, with ending place this moment uncoded continuous value be that 0 AC component Unified coding is 1 EOB code word, process ends then.
Step 1009~step 1013 is identical with the processing mode of step 506 as shown in Figure 5~step 510, and the AC component of judging the current value non-zero that scans in step 1013 process ends otherwise return step 1002 during for last, concrete processing procedure does not repeat them here.
So far, this flow process finishes.
Method embodiment three
In the present embodiment, as shown in Figure 5 existing coded system and aforementioned new coded system are set, in beginning before the AC component encodes in to current DCT coefficient with the zigzag scanning sequency, earlier produce first random number or second random number at random, and the judgement generation is first random number or second random number for current DCT coefficient;
If what produce is first random number, then utilize existing coded system as shown in Figure 5, be after 0 in the AC component value of judging current scanning at every turn, judge again whether this AC component is last AC component of current DCT coefficient; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, and continues the next AC component of scanning; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient; That is the processing mode when, producing first random number is identical with method embodiment one, method embodiment two;
If what produce is second random number, then utilize aforementioned new existing coded system, the AC component value of at every turn judging current scanning is after 0, judges whether this AC component is last AC component of current DCT coefficient earlier; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, obtain as long as add up then scan but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16, continue the next AC component of scanning then 16 values; When judging this AC component and be last AC component, the continuous value that current DCT coefficient ending place is encoded this moment not yet is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient; Promptly, processing mode when producing second random number, difference than method embodiment one, method embodiment two is, having only the scanning value is 0 and during as the AC component of current DCT coefficient ending, judging adds up again scanning of obtaining but uncoded continuous value be whether enough 16 of 0 AC number of components, and coding obtain the ZRL code word.
Like this, still can produce approximate technique effect with method embodiment one, method embodiment two.
The coding method of DCT coefficient in the present embodiment, according to existing mode current DCT coefficient is quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Figure 11 is to the schematic flow sheet of AC component coding method in the DCT coefficient among the inventive method embodiment three.Referring to Figure 11, the coding method of DCT coefficient is encoded to 63 AC components in the current DCT coefficient that has quantized according to following steps in the present embodiment:
Step 1100 is provided with parameter K, is used to represent that current AC component order that scans and the initial value that K is set are 0; Parameters R is set, be used to represent continuous sweep to but the value of encoding is that 0 AC component number and the initial value that R is set are 0.
Step 1101, for current DCT coefficient produces first random number or second random number at random, and what judge to produce is first random number or second random number, if first random number, then jump to the step 501 of flow process as shown in Figure 5, if second random number execution in step 1102 then.
Step 1102 scans next AC component, makes K=K+1.
Step 1103 judges whether the value ZZ (K) of K AC component is 0, if then execution in step 1104, otherwise execution in step 1109.
Step 1104 judges the current value that scans is whether 0 AC component is last, is whether K equals 63, if then execution in step 1106, otherwise execution in step 1105.
Step 1105 wouldn't be that 0 AC component is encoded to the current value that scans, and to continuous sweep to but the value of encoding is 0 AC component number adds up, make R=R+1, be back to step 1102 then.
Step 1106 judges that this value is that whether to have before 0 the AC component more than 15 continuous values be that 0 AC component is encoded, and promptly whether R greater than 15, if then execution in step 1107, otherwise execution in step 1108.
Step 1107, according to AC component Huffman table, with continuous 16 values is that 0 AC component Unified coding is 1 ZRL code word, even and to the continuous sweep of record to but the value of encoding is 0 AC component number deducts 16 R=R-16, return step 1106 then.
Step 1108, value according to last the AC component that scans in a zigzag is 0, promptly 63 AC components are to be that 0 AC component is ending with value, according to AC component Huffman table, with ending place this moment uncoded continuous value be that 0 AC component Unified coding is 1 EOB code word, process ends then.
Step 1109~step 1113 is identical with the processing mode of step 506 as shown in Figure 5~step 510, and the AC component of judging the current value non-zero that scans in step 1113 process ends otherwise return step 1102 during for last, concrete processing procedure does not repeat them here.
So far, this flow process finishes.
Above-mentioned three method embodiment are that existing coded system and aforementioned new coded system are set to two flow processs respectively, and select arbitrary flow process to be carried out according to random number.Yet, consider that there is the identical treatment step of part in existing coded system with aforementioned new coded system, thereby, can also come multiplexing identical treatment step by a handling process is set, specifically referring to follow-up method embodiment four~six in order to save the processing resource.
Method embodiment four
In the present embodiment, a coding flow process is set, this coding flow process comprises existing coded system and the aforementioned new common treatment step of coded system as shown in Figure 5, also comprises as shown in Figure 5 existing coded system and the aforementioned new different treatment step of coded system simultaneously.Like this, before needs were carried out different treatment steps, what judge generation was first random number or second random number, and then selected according to the random number that produces.
Present embodiment beginning with the zigzag scanning sequency to current DCT coefficient in after the AC component, the AC component value of at every turn judging current scanning is 0 o'clock to be that the AC component of current scanning in the current DCT coefficient produces first random number or second random number at random, and judges that what produce is first random number or second random number;
If what produce is first random number, then when last AC component that to judge this AC component be not current DCT coefficient, adds up and scan but uncoded continuous value is 0 AC number of components, and continues the next AC component of scanning; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient;
If what produce is second random number, then as long as scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16, judge then whether this AC component is last AC component of current DCT coefficient 16 values; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components and continues the next AC component of scanning; When judging this AC component and be last AC component, the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient.
Like this, still can produce approximate technique effect with method embodiment one~three.In addition, present embodiment is than method embodiment one~three, and except resource was handled in further saving, because random number is to be that 0 AC component produces at each value, thereby it was also just higher to insert the randomness of ZRL code word.In other words, present embodiment one~depth of the night of code word combination kind ratio method embodiment that can produce many, with 63 AC components is that 0 extreme case is an example entirely, method embodiment one~three only can encode for 63 AC components in every group of DCT coefficient and obtain " ZRL; ZRL; ZRL; EOB ", or among " EOB " these two kinds any, present embodiment then can be encoded for 63 AC components in every group of DCT coefficient and be obtained " ZRL; ZRL; ZRL; EOB ", or " ZRL; ZRL; EOB ", or " ZRL; EOB ", or among " EOB " these four kinds any, thereby present embodiment is that 0 AC component generates a random number at each value, and comparing one group of DCT coefficient, unified to generate a random number more flexible.
The coding method of DCT coefficient in the present embodiment, according to existing mode current DCT coefficient is quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Figure 12 is to the schematic flow sheet of AC component coding method in the DCT coefficient among the inventive method embodiment four.Referring to Figure 12, the coding method of DCT coefficient is encoded to 63 AC components in the current DCT coefficient that has quantized according to following steps in the present embodiment:
Step 1200 is provided with parameter K, is used to represent that current AC component order that scans and the initial value that K is set are 0; Parameters R is set, be used to represent continuous sweep to but the value of encoding is that 0 AC component number and the initial value that R is set are 0.
Step 1201 scans next AC component, makes K=K+1.
Step 1202 judges whether the value ZZ (K) of K AC component is 0, if then execution in step 1203, otherwise execution in step 1209.
Step 1203, for the AC component of current scanning in the current DCT coefficient produces first random number or second random number at random, and judge that what produce is first random number or second random number, if first random number, direct execution in step 1204 then is if second random number execution in step 1206 then.
Step 1204 judges that this value is that whether to have before 0 the AC component more than 15 continuous values be that 0 AC component is encoded, and promptly whether R greater than 15, if then execution in step 1205, otherwise execution in step 1206.
Step 1205, according to AC component Huffman table, be that 0 AC component Unified coding is 1 ZRL code word with continuous 16 values, and from the continuous sweep of record to but the value of encoding is 0 AC component number deducts 16, even R=R-16, execution in step 1206 then.
Step 1206 judges the current value that scans is whether 0 AC component is last, is whether K equals 63, if then execution in step 1208, otherwise execution in step 1207.
Step 1207 wouldn't be that 0 AC component is encoded to the current value that scans, and to continuous sweep to but the value of encoding is 0 AC component number adds up, make R=R+1, return step 1201 then and continue the next AC component of scanning.
Step 1208, value according to last the AC component that scans in a zigzag is 0, promptly 63 AC components are to be that 0 AC component is ending with value, according to AC component Huffman table, with ending place this moment uncoded continuous value be that 0 AC component Unified coding is 1 EOB code word, process ends then.
Step 1209~step 1213 is identical with the processing mode of step 506 as shown in Figure 5~step 510, and the AC component of judging the current value non-zero that scans in step 1213 process ends otherwise return step 1201 during for last, concrete processing procedure does not repeat them here.
So far, this flow process finishes.
Method embodiment five
In the present embodiment, a coding flow process is set, this coding flow process comprises existing coded system and the aforementioned new common treatment step of coded system as shown in Figure 5, also comprises as shown in Figure 5 existing coded system and the aforementioned new different treatment step of coded system simultaneously.Like this, before needs were carried out different treatment steps, what judge generation was first random number or second random number, and then selected according to the random number that produces.
Present embodiment beginning with the zigzag scanning sequency to current DCT coefficient in after the AC component, earlier judge whether this AC component is last AC component of current DCT coefficient, when judging this AC component and be last AC component, the continuous value that current DCT coefficient ending place is encoded this moment not yet is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, AC component for current scanning in the current DCT coefficient produces first random number or second random number at random then, and the judgement generation is first random number or second random number;
If what produce is first random number, then continue the next AC component of scanning; That is, the processing mode when producing first random number is close in fact with method embodiment four;
If what produce is second random number, obtain as long as then add up scan but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16, continue the next AC component of scanning then 16 values; Promptly, processing mode when producing second random number is than method embodiment four, difference is, judge the difference on opportunity of random number, and, as long as the current value that has scanned is 0 AC component is not last, then scanned but uncoded value is 1 AC component of 0 earlier current, calculating is scanning but uncoded continuous value is within 0 the AC component total quantity, and then judge add up scanning of obtaining but uncoded continuous value be whether enough 16 of 0 AC number of components, and coding obtain the ZRL code word.
Like this, still can produce approximate technique effect with method embodiment one~four.In addition, present embodiment is than method embodiment one~three, and except resource was handled in further saving, because random number is to be that 0 AC component produces at each value, thereby it was also just higher to insert the randomness of ZRL code word.In other words, with method embodiment four in like manner, present embodiment one~depth of the night of code word combination kind ratio method embodiment that can produce many, thereby present embodiment is that 0 AC component generates a random number at each value, comparing one group of DCT coefficient, unified to generate a random number more flexible.
The coding method of DCT coefficient in the present embodiment, according to existing mode current DCT coefficient is quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Figure 13 is to the schematic flow sheet of AC component coding method in the DCT coefficient among the inventive method embodiment five.Referring to Figure 13, the coding method of DCT coefficient is encoded to 63 AC components in the current DCT coefficient that has quantized according to following steps in the present embodiment:
Step 1300 is provided with parameter K, is used to represent that current AC component order that scans and the initial value that K is set are 0; Parameters R is set, be used to represent continuous sweep to but the value of encoding is that 0 AC component number and the initial value that R is set are 0.
Step 1301 scans next AC component, makes K=K+1.
Step 1302 judges whether the value ZZ (K) of K AC component is 0, if then execution in step 1303, otherwise execution in step 1309.
Step 1303 judges the current value that scans is whether 0 AC component is last, is whether K equals 63, if then execution in step 1308, otherwise execution in step 1304.
Step 1304 wouldn't be that 0 AC component is encoded to the current value that scans, and to continuous sweep to but the value of encoding is 0 AC component number adds up, make R=R+1, execution in step 1305 then.
Step 1305, for the AC component of current scanning in the current DCT coefficient produces first random number or second random number at random, and the judgement generation is first random number or second random number, if first random number, then directly return step 1301 and continue the next AC component of scanning, if second random number execution in step 1306 then.
Step 1306 judges that this value is that whether to have before 0 the AC component more than 15 continuous values be that 0 AC component is encoded, and promptly whether R greater than 15, if then execution in step 1305, otherwise execution in step 1307.
Step 1307, according to AC component Huffman table, with continuous 16 values is that 0 AC component Unified coding is 1 ZRL code word, and from the continuous sweep of record to but the value of encoding is 0 AC component number deducts 16, even R=R-16 returns step 1301 then and continues the next AC component of scanning.
Step 1308, value according to last the AC component that scans in a zigzag is 0, promptly 63 AC components are to be that 0 AC component is ending with value, according to AC component Huffman table, with ending place this moment uncoded continuous value be that 0 AC component Unified coding is 1 EOB code word, process ends then.
Step 1309~step 1313 is identical with the processing mode of step 506 as shown in Figure 5~step 510, and the AC component of judging the current value non-zero that scans in step 1313 process ends otherwise return step 1301 during for last, concrete processing procedure does not repeat them here.
So far, this flow process finishes.
Method embodiment six
In the present embodiment, a coding flow process is set, this coding flow process comprises existing coded system and the aforementioned new common treatment step of coded system as shown in Figure 5, also comprises as shown in Figure 5 existing coded system and the aforementioned new different treatment step of coded system simultaneously.Like this, before needs were carried out different treatment steps, what judge generation was first random number or second random number, and then selected according to the random number that produces.
Present embodiment beginning with the zigzag scanning sequency to current DCT coefficient in after the AC component, judge whether this AC component is last AC component of current DCT coefficient earlier; When last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, and continues the next AC component of scanning; When judging this AC component and be last AC component, produce first random number or second random number at random for current DCT coefficient earlier, and what judge generation is first random number or second random number;
If what produce is first random number, all then that ending place of current DCT coefficient is continuous values are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient; That is, the processing mode when producing first random number is close in fact with method embodiment four and five;
If what produce is second random number, then as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value is that the AC component loop coding of front is the ZRL code word of 16 integral multiple quantity in 0 the AC component, and then be that 0 AC component Unified coding is the EOB code word, and finish coding to current DCT coefficient with the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL; Promptly, processing mode when producing second random number, difference than method embodiment four, method embodiment five is, judge the difference on opportunity of random number, and, having only the scanning value is 0 and during as the AC component of current DCT coefficient ending, judging adds up again scanning of obtaining but uncoded continuous value be whether enough 16 of 0 AC number of components, and coding obtain the ZRL code word.
Like this, still can produce approximate technique effect with method embodiment one~five.In addition, present embodiment further has and saves the technique effect of handling resource than method embodiment one~three.
The coding method of DCT coefficient in the present embodiment, according to existing mode current DCT coefficient is quantized earlier, with the AC component value that makes each the AC component in the DCT coefficient, especially corresponding high intensity of illumination change frequency as far as possible all is 0, and then according to existing mode to the direct current DC component coding in the current DCT coefficient after quantizing, at last, with the zigzag scanning sequency AC component that respectively exchanges in the current DCT coefficient is encoded again.
Figure 14 is to the schematic flow sheet of AC component coding method in the DCT coefficient among the inventive method embodiment six.Referring to Figure 14, the coding method of DCT coefficient is encoded to 63 AC components in the current DCT coefficient that has quantized according to following steps in the present embodiment:
Step 1400 is provided with parameter K, is used to represent that current AC component order that scans and the initial value that K is set are 0; Parameters R is set, be used to represent continuous sweep to but the value of encoding is that 0 AC component number and the initial value that R is set are 0.
Step 1401 scans next AC component, makes K=K+1.
Step 1402 judges whether the value ZZ (K) of K AC component is 0, if then execution in step 1403, otherwise execution in step 1409.
Step 1403 judges the current value that scans is whether 0 AC component is last, is whether K equals 63, if then execution in step 1405, otherwise execution in step 1404.
Step 1404 wouldn't be that 0 AC component is encoded to the current value that scans, and to continuous sweep to but the value of encoding is 0 AC component number adds up, make R=R+1, return step 1401 then and continue the next AC component of scanning.
Step 1405, for current DCT coefficient produces first random number or second random number at random, and what judge to produce is first random number or second random number, if first random number, direct execution in step 1408 then is if second random number execution in step 1406 then.
Step 1406 judges that this value is that whether to have before 0 the AC component more than 15 continuous values be that 0 AC component is encoded, and promptly whether R greater than 15, if, direct execution in step 1408 then, otherwise execution in step 1407.
Step 1407, according to AC component Huffman table, be that 0 AC component Unified coding is 1 ZRL code word with continuous 16 values, and from the continuous sweep of record to but the value of encoding is 0 AC component number deducts 16, even R=R-16, execution in step 1408 then.
Step 1408, value according to last the AC component that scans in a zigzag is 0, promptly 63 AC components are to be that 0 AC component is ending with value, according to AC component Huffman table, with ending place this moment uncoded continuous value be that 0 AC component Unified coding is 1 EOB code word, process ends then.
Step 1409~step 1413 is identical with the processing mode of step 506 as shown in Figure 5~step 510, and the AC component of judging the current value non-zero that scans in step 1413 process ends otherwise return step 1401 during for last, concrete processing procedure does not repeat them here.
So far, this flow process finishes.
Above-mentioned only is to have enumerated six method embodiment, in the practical application, basic principle based on these six method embodiment, select at random in order to realize aforementioned new coded system and to be implemented between existing coded system and the aforementioned new coded system, those skilled in the art can also list more embodiment, give unnecessary details no longer one by one at this.
Below, again the DCT coefficient coding device in the embodiment of the invention is elaborated.
Figure 15 is the exemplary configurations schematic diagram of DCT coefficient coding device in the embodiment of the invention.As shown in figure 15, the DCT coefficient coding device in the present embodiment comprises:
Quantification treatment unit 1501 is used for according to existing mode current DCT coefficient being quantized;
DC component unit 1502 is used for according to the direct current DC component coding of existing mode to the current DCT coefficient after quantizing;
Component scanning element 1503 is used for respectively exchanging the AC component according to existing mode with what the zigzag scanning sequency scanned current DCT coefficient;
Alternating current component unit 1505, for not being the current DCT coefficient of 0 AC component ending with continuous value, being used for earlier is that 0 AC component coding is the ZRL code word with the continuous value before the AC component of each value non-0, will remain continuous value again and be 0 AC component and encode with the AC component of this value non-0.
In addition, this code device also comprises:
Random number generation unit 1504 is used to current DCT coefficient to produce first random number or second random number at random, is the coded system of 0 AC component in order to select at random the continuous value of ending place in the current DCT coefficient;
And alternating current component unit 1505 is for the current DCT coefficient that with continuous value is the ending of 0 AC component, be used for the random number generation unit produce be first random number time, all values that ending place is continuous are that 0 AC component Unified coding is the EOB code word; The random number generation unit produce be second random number time, wherein the part value of front is that 0 AC component coding obtains zero persistence length ZRL code word earlier, wherein the residue value of back is that 0 AC component coding is the EOB code word again.
In the practical application, when random number generation unit 1504 produces random number, when alternating current component unit 1505 judges generation is first random number or second random number and how realizes that aforementioned new coded system is to insert the ZRL code word at random, multiple implementation can be arranged, thus, provide below 6 kinds the device embodiment, different alternating current component unit 1505 implementations are provided.
Device embodiment one
In the present embodiment, random number generation unit 1504 is before the AC component is encoded in beginning current DCT coefficient, for current DCT coefficient produces first random number or second random number at random.And as shown in figure 16, the alternating current component unit 1505 in the DCT coefficient coding device in the present embodiment comprises:
The first chooser unit 1600, be used for before beginning current DCT coefficient AC component encoded, what judge to produce is first random number or second random number, and the random number generation unit produce be first random number time trigger the first coding subelement 1601, the random number generation unit produce be second random number time trigger the second coding subelement 1602;
The first coding subelement 1601, being used in the AC component value of judging current scanning at every turn is after 0, earlier judge whether this AC component is last AC component of current DCT coefficient, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components and triggers the next AC component of component scanning element 1503 scannings; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient;
The second coding subelement 1602, being used in the AC component value of judging current scanning at every turn is after 0, as long as scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word with 16 values, and will scan but uncoded continuous value is 0 AC number of components deducts 16, then, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, and the next AC component of triggering component scanning element 153 scannings; When judging this AC component and be last AC component, the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient;
The first coding subelement 1601 and the second coding subelement 1602, also all be used for after scanning the AC component of value non-zero at every turn, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value be in 0 the AC component AC component loop coding of front be the ZRL code word and at each circulation time to scanning but uncoded continuous value is 0 AC number of components subtracts 16; Then, be 0 AC component with the continuous value of residue that is not sufficient to encode as the ZRL code word before this AC component, together encode with this AC component of value non-zero, and will scan but uncoded continuous value is 0 AC number of components zero clearing; At last, when the AC component of judging current scanning is not last AC component of current DCT coefficient, trigger the next AC component of component scanning element 1503 scannings, when judging this AC component and be last AC component, finish coding current DCT coefficient.
In the present embodiment, the first coding subelement 1601 specifically can carry out above-mentioned processing according to having the coding flow process as shown in Figure 5 now, the second coding subelement 1602 is then handled according to the basic principle of aforementioned new coded system, thereby present embodiment to can be regarded as at value be 0 AC component, provide a separate cover to handle resource and simultaneously based on the another set of processing resource of aforementioned new coded system based on existing coded system.
Device embodiment two
In the present embodiment, random number generation unit 1504 is before the AC component is encoded in beginning current DCT coefficient, for current DCT coefficient produces first random number or second random number at random.And as shown in figure 17, the alternating current component unit 1505 in the DCT coefficient coding device in the present embodiment comprises:
The second chooser unit 1700, be used for before beginning current DCT coefficient AC component encoded, what judge to produce is first random number or second random number, and the random number generation unit produce be first random number time trigger the 3rd coding subelement 1701, the random number generation unit produce be second random number time trigger the 4th coding subelement 1702;
The 3rd coding subelement 1701, being used in the AC component value of judging current scanning at every turn is after 0, earlier judge whether this AC component is last AC component of current DCT coefficient, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components and triggers the next AC component of component scanning element 1503 scannings; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient;
The 4th coding subelement 1702, being used in the AC component value of judging current scanning at every turn is after 0, earlier judge whether this AC component is last AC component of current DCT coefficient, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components, obtain as long as add up then scan but uncoded continuous value is enough 16 of 0 an AC number of components, then earlier be that 0 AC component coding obtains the ZRL code word with 16 values, and will scan but uncoded continuous value is 0 AC number of components deducts 16, trigger the next AC component of component scanning element 1503 scannings then; When judging this AC component and be last AC component, the continuous value that current DCT coefficient ending place is encoded this moment not yet is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient;
The 3rd coding subelement 1701, the 4th coding subelement 1702, also all be used for after scanning the AC component of value non-zero at every turn, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value be in 0 the AC component AC component loop coding of front be the ZRL code word and at each circulation time to scanning but uncoded continuous value is 0 AC number of components subtracts 16; Then, be 0 AC component with the continuous value of residue that is not sufficient to encode as the ZRL code word before this AC component, together encode with this AC component of value non-zero, and will scan but uncoded continuous value is 0 AC number of components zero clearing; At last, when the AC component of judging current scanning is not last AC component of current DCT coefficient, trigger the next AC component of component scanning element 1503 scannings, when judging this AC component and be last AC component, finish coding current DCT coefficient.
In the present embodiment, the 3rd coding subelement 1701 specifically can carry out above-mentioned processing according to having the coding flow process as shown in Figure 5 now, the 4th coding subelement 1702 is then handled according to the basic principle of aforementioned new coded system but concrete processing mode slightly is different from the coding of second among the device embodiment one subelement 1602, thereby present embodiment also to can be regarded as at value be 0 AC component, provide a separate cover to handle resource and simultaneously based on the another set of processing resource of aforementioned new coded system based on existing coded system.
Device embodiment three
In the present embodiment, random number generation unit 1504 is before the AC component is encoded in beginning current DCT coefficient, for current DCT coefficient produces first random number or second random number at random.And as shown in figure 18, the alternating current component unit 1505 in the DCT coefficient coding device of present embodiment comprises:
The 3rd chooser unit 1800, be used for before beginning current DCT coefficient AC component encoded, what judge to produce is first random number or second random number, and the random number generation unit produce be first random number time trigger the 5th coding subelement 1801, the random number generation unit produce be second random number time trigger the 6th coding subelement 1802;
The 5th coding subelement 1801, being used in the AC component value of judging current scanning at every turn is after 0, earlier judge whether this AC component is last AC component of current DCT coefficient, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components and triggers the next AC component of component scanning element 1503 scannings; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient;
The 6th coding subelement 1802, being used in the AC component value of judging current scanning at every turn is after 0, earlier judge whether this AC component is last AC component of current DCT coefficient, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components and triggers the next AC component of component scanning element 1503 scannings; When judging this AC component and be last AC component, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value is that the AC component loop coding of front is the ZRL code word of 16 integral multiple quantity in 0 the AC component, and then be that 0 AC component Unified coding is the EOB code word, and finish coding to current DCT coefficient with the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL;
The 5th coding subelement 1801 and the 6th coding subelement 1802, also all be used for after scanning the AC component of value non-zero at every turn, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value be in 0 the AC component AC component loop coding of front be the ZRL code word and at each circulation time to scanning but uncoded continuous value is 0 AC number of components subtracts 16; Then, be 0 AC component with the continuous value of residue that is not sufficient to encode as the ZRL code word before this AC component, together encode with this AC component of value non-zero, and will scan but uncoded continuous value is 0 AC number of components zero clearing; At last, when the AC component of judging current scanning is not last AC component of current DCT coefficient, trigger the next AC component of component scanning element 1503 scannings, when judging this AC component and be last AC component, finish coding current DCT coefficient.
In the present embodiment, the 5th coding subelement 1801 specifically can carry out above-mentioned processing according to having the coding flow process as shown in Figure 5 now, the 6th coding subelement 1802 is then handled according to the basic principle of aforementioned new coded system, but concrete processing mode slightly is different from coding subelement 1602 of second among device embodiment one and two and the 4th coding subelement 1702, thereby present embodiment also to can be regarded as at value be 0 AC component, provide a separate cover to handle resource simultaneously based on existing coded system, and based on the another set of processing resource of aforementioned new coded system.
Above-mentioned three device embodiment, it all is 0 AC component at value, provide a separate cover to handle resource and simultaneously based on the another set of processing resource of aforementioned new coded system based on existing coded system, then, consider no matter be to adopt which cover to handle resource, at value is that 0 AC component all can exist the identical processing procedure of part, thereby can also multiplexing identical processing resource, specifically referring to follow up device embodiment four~six.
Device embodiment four
Figure 19 is the structural representation of DCT coefficient coding device among apparatus of the present invention embodiment four.As shown in figure 19, the alternating current component unit 1505 in the DCT coefficient coding device of present embodiment comprises:
The first public subelement 19, whether the AC component value that is used to judge current scanning is 0;
The 4th chooser unit 1900, being used in the AC component value of judging current scanning at every turn is after 0, what judge to produce is first random number or second random number, and the random number generation unit produce be first random number time trigger the 7th coding subelement 1901, the random number generation unit produce be second random number time trigger the 8th coding subelement 1902;
The 7th coding subelement 1901 is used for when last AC component that to judge this AC component be not current DCT coefficient, adds up to scan but uncoded continuous value is 0 AC number of components and triggers the next AC component of component scanning element 1503 scannings; When judging this AC component and be last AC component, all values that ending place of current DCT coefficient is continuous are that 0 AC component Unified coding is the EOB code word, and finish the coding to current DCT coefficient;
The 8th coding single 1902, be used for scanning but uncoded continuous value when being enough 16 of 0 AC number of components, earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16 with 16 values, then, when last AC component that to judge this AC component be not current DCT coefficient, add up and scan but uncoded continuous value is 0 AC number of components and triggers the next AC component of component scanning element 1503 scannings; When judging this AC component and be last AC component, the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient;
The public subelement 1500 of non-zero, what no matter produce is first random number or second random number, all be used for after scanning the AC component of value non-zero at every turn, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value be in 0 the AC component AC component loop coding of front be the ZRL code word and at each circulation time to scanning but uncoded continuous value is 0 AC number of components subtracts 16; Then, be 0 AC component with the continuous value of residue that is not sufficient to encode as the ZRL code word before this AC component, together encode with this AC component of value non-zero, and will scan but uncoded continuous value is 0 AC number of components zero clearing; At last, when the AC component of judging current scanning is not last AC component of current DCT coefficient, trigger the next AC component of component scanning element 1503 scannings, when judging this AC component and be last AC component, finish coding current DCT coefficient.
And random number generation unit 1504 is after 0 in the AC component value of judging current scanning at every turn in the present embodiment, for the AC component of current scanning in the current DCT coefficient produces first random number or second random number at random.
Than device embodiment one~three, whether the AC component value that is used to judge current scanning in the present embodiment is 0 processing resource and is re-used at the processing resource of the AC component of value non-zero.And because random number is to be that 0 AC component produces at each value, thereby it is also just higher to insert the randomness of ZRL code word.In other words, present embodiment one~depth of the night of code word combination kind analog device embodiment that can produce many, thereby present embodiment is that 0 AC component generates a random number at each value, comparing one group of DCT coefficient, unified to generate a random number more flexible.
Device embodiment five
Figure 20 is the structural representation of DCT coefficient coding device among apparatus of the present invention embodiment five.As shown in figure 20, the alternating current component unit 1505 in the DCT coefficient coding device of present embodiment comprises:
The first public subelement 19, whether the AC component value that is used to judge current scanning is 0;
The second public subelement 20, being used in the AC component value of judging current scanning at every turn is after 0, judge whether this AC component is last AC component of current DCT coefficient, if not, then add up and scanned but uncoded continuous value is 0 AC number of components, if the continuous value that current DCT coefficient ending place is encoded this moment not yet is that 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient;
The 5th chooser unit 2000, be used for scanning but after uncoded continuous value is 0 AC number of components adding up at every turn, what judge to produce is first random number or second random number, and the random number generation unit produce be first random number time trigger the 9th coding subelement 2001, the random number generation unit produce be second random number time trigger the tenth coding subelement 2002;
The 9th coding subelement 2001 is used to trigger the next AC component of component scanning element 1503 scannings;
The tenth coding subelement 2002, be used for when add up scanning of obtaining but uncoded continuous value are enough 16 of 0 AC number of components, earlier be that 0 AC component coding obtains the ZRL code word, and will scan but uncoded continuous value is 0 AC number of components deducts 16, trigger the next AC component of component scanning element 1503 scannings then 16 values;
The public subelement 1500 of non-zero, what no matter produce is first random number or second random number, all be used for after scanning the AC component of value non-zero at every turn, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value be in 0 the AC component AC component loop coding of front be the ZRL code word and at each circulation time to scanning but uncoded continuous value is 0 AC number of components subtracts 16; Then, be 0 AC component with the continuous value of residue that is not sufficient to encode as the ZRL code word before this AC component, together encode with this AC component of value non-zero, and will scan but uncoded continuous value is 0 AC number of components zero clearing; At last, when the AC component of judging current scanning is not last AC component of current DCT coefficient, trigger the next AC component of component scanning element 1503 scannings, when judging this AC component and be last AC component, finish coding current DCT coefficient.
And in the present embodiment, random number generation unit 1504 scans but after uncoded continuous value is 0 AC number of components adding up at every turn, for the AC component of current scanning in the current DCT coefficient produces first random number or second random number at random.
Than device embodiment one~three, whether the AC component value that is used to judge current scanning in the present embodiment be 0 processing resource, be used to judge this AC component whether be last AC component of current DCT coefficient the processing resource, be used to add up scanned but uncoded continuous value be 0 AC number of components the processing resource, the processing resource that obtains the EOB code word and be re-used at the processing resource of the AC component of value non-zero is used to encode.And because random number is to be that 0 AC component produces at each value, thereby it is also just higher to insert the randomness of ZRL code word.In other words, present embodiment one~depth of the night of code word combination kind analog device embodiment that can produce many, thereby present embodiment is that 0 AC component generates a random number at each value, comparing one group of DCT coefficient, unified to generate a random number more flexible.
Device embodiment six
Figure 21 is the structural representation of DCT coefficient coding device among apparatus of the present invention embodiment six.As shown in figure 21, the alternating current component unit 1505 in the DCT coefficient coding device of present embodiment comprises:
The first public subelement 19, whether the AC component value that is used to judge current scanning is 0;
The 3rd public subelement 21, being used in the AC component value of judging current scanning at every turn is after 0, judge whether this AC component is last AC component of current DCT coefficient, if not, then add up and scanned but uncoded continuous value is 0 AC number of components, if then trigger the 6th selected cell;
The 6th selected cell 2100, what be used to judge generation is first random number or second random number, and the random number generation unit produce be first random number time trigger the 11 coding subelement 2101, the random number generation unit produce be second random number time trigger the 12 coding subelement 2102;
The 11 coding subelement 2101, being used for all values that ending place of current DCT coefficient is continuous and being 0 AC component Unified coding is the EOB code word, and finishes the coding to current DCT coefficient;
The 12 coding subelement 2102, be used for before this AC component, having scanned but uncoded continuous value when being enough 16 of 0 AC number of components, to scan earlier but uncoded continuous value is that the AC component loop coding of front is the ZRL code word of 16 integral multiple quantity in 0 the AC component, and then be that 0 AC component Unified coding is the EOB code word, and finish coding to current DCT coefficient with the continuous value of residue that ending place of current DCT coefficient is not encoded as ZRL;
The public subelement 1500 of non-zero, what no matter produce is first random number or second random number, all be used for after scanning the AC component of value non-zero at every turn, as long as before this AC component, scanned but uncoded continuous value is enough 16 of 0 an AC number of components, then will scan earlier but uncoded continuous value be in 0 the AC component AC component loop coding of front be the ZRL code word and at each circulation time to scanning but uncoded continuous value is 0 AC number of components subtracts 16; Then, be 0 AC component with the continuous value of residue that is not sufficient to encode as the ZRL code word before this AC component, together encode with this AC component of value non-zero, and will scan but uncoded continuous value is 0 AC number of components zero clearing; At last, when the AC component of judging current scanning is not last AC component of current DCT coefficient, trigger the next AC component of component scanning element 1503 scannings, when judging this AC component and be last AC component, finish coding current DCT coefficient.
And in the present embodiment, random number generation unit 1504 is when judging this AC component and be last AC component, for current DCT coefficient produces first random number or second random number at random.
Than device embodiment one~three, whether the AC component value that is used to judge current scanning in the present embodiment be 0 processing resource, be used to judge this AC component whether be last AC component of current DCT coefficient the processing resource, be used to add up and scanned but uncoded continuous value is the processing resource of 0 AC number of components and is re-used at the processing resource of the AC component of value non-zero.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to and replace and improvement etc., all should be included within protection scope of the present invention.