• 沒有找到結果。

The Definition of the Encoding Symbol Groups

3.3. The Proposed Group-Based VLC Encoding and Decoding

3.3.2. The Definition of the Encoding Symbol Groups

3.3.2.

3.3.2.

3.3.2. The Definition of the Encoding Symbol Groups

In the conventional group-based VLC codec system, there was no special definition of the encoding symbol groups. It used CBS-LUT for the encoding process to look up the base address of the symbol address memory. However, if we can define the encoding symbol groups, we will get some benefits about the usage of memories.

group run level encoding_num encoding_offset attribute

0 1 1 0 encoding_min

Table 3-5 : An example of MPEG-2 encoding symbol groups

An example of MPEG-2 encoded symbols and symbol grouping is shown in Table 3-5. According to conventional CBS-LUT method, when run is equal to 0, the number of mapping levels is 40, but when run is greater than 7, the number of mapping levels is less than 3. Finally, one run will map to one memory address. Therefore, we consider that we can also define the encoding symbol groups like decoding codeword groups to save the usage of memories. In the symbol grouping procedure, we count the number of the mapping symbols for one symbol. For example, when the value of run is equal to 0, the number of mapping levels is 40. Perhaps, when the value of level is equal to 1, the number of mapping runs is 28. Based on the result of this procedure, the proposed symbol groups are a set of the most symbols mapping to one symbol.

According to this definition, the symbol groups have the following properties.

 In a group, the value of the changed symbol is called encoding_num, since the other symbol is fixed.

 The value of the changed symbol has the smallest encoding_num in a group is denoted encoding_min.

 An encoding_offset is the offset value between the encoding_min and the encoding_num.

In Table 3-5, the levels from 1 to 31 belong to the symbol groups G0. In this group, the runs have the same value, 0. Therefore, the encoding_nums are from 1 to 31, the encoding_min is 1 and the encoding_offsets are from 0 to 30. Source symbols which are not combined will belong to different groups. When the value of the level is equal to 1, the runs from 4 to 31 belong to G5. In symbol groups for MPEG-2 VLC tables, the group, G1, is particular to other groups. The value of the fixed symbol, run, is the same as G0, but we still separate it to another group. The reason is if we combine G0 and G1 as a symbol group, we will use more memories.

group run level

G0 0 1~31

G1 0 32~40

G2 1 1~18

G3 2 1~5

G4 3 1~4

G5 4~31 1

G6 4~16 2

G7 4~6 3

Table 3-6 : The symbol groups for MPEG-2 VLC tables

The total symbol groups for MPEG-2 VLC tables are shown in Table 3-6, and both table B14 and B15 use the symbol groups, because the symbols of them are the same.

The similar approach is also used in CAVLC coeff_token encoding process.

However, the procedure of symbol grouping in CAVLC is much easier than that in MPEG-2. TrailingOnes is the only choice to be the reference of group number, because each TrailingOnes can map most number of TotalCoeffs. The symbol groups of CAVLC coeff_token are shown in

group TrailingOnes TotalCoeff

G0 0 0 ~ 16 or 0 ~ 4

G1 1 1 ~ 16 or 1 ~ 4

G2 2 2 ~ 16 or 2 ~ 4

G3 3 3 ~ 16 or 3 ~ 4

Table 3-7 : The symbol groups of CAVLC coeff_token

3.3.3.

3.3.3.

3.3.3.

3.3.3. Intra-Group Decoding Procedure

In addition to grouping codewords, it is necessary for decoding procedures to map symbols onto memories and extract codeword group information. During intra-group symbol memory mapping, the memory address of a symbol in a group is calculated by the suffix_offset of this symbol and the base address which denotes the symbol address of the suffix_min of the group. In other words, the symbol address is the sum of the suffix_offset and the base address. After applying this arithmetic relation, suffix_offsets, decoded symbol addresses, and encoded codewords can be found by numerical calculations rather than pattern matching. Therefore, the group information to be stored is suffix_min, and base addresses.

Based on the memory map and the group information in Figure 3-9, intra-group decoding procedures can be described as follows.

Decoding procedure – assume the decoded codeword is (0000_0110)2:

 suffix_offset = suffix_num (10)2 – suffix_min (0) = 102 = 2;

 symbol_address = suffix_offset (2) + base_address (9) = 11;

 The decoded symbol, S2, is accessed by the symbol_address, 9;

Figure 3-9 : An example of intra-group memory map and group information

However, when calculating the suffix_offset, we have to get the value of suffix_num. That means we have to know the real suffix length of the relative suffix.

Therefore, the group information also has suffix length to fetch the correct suffix.

Besides, the suffix length has to be sent back to codeword boundary detector, and the codeword boundary detector can truncate the codewords which are decoded without any error.

Figure 3-10 : An example of the special case of suffix length

Some special cases will happen in VLC tables and Figure 3-10 shows an example of the special case of suffix length. The relative codeword of the symbol, S2, is

“00011” and the other codewords in this group are “00010x”. We can find the suffix length is different. Therefore, we have to handle the condition to avoid fetching the incorrect suffix; otherwise we will get the wrong suffix_offset to access the wrong location of the symbol memory. Even sending the incorrect suffix length to codeword boundary detector will result the current decoded block fails. To solve this problem,

we add an item called suffix_adjust to group information. When we get the group information and the suffix_adjust is set to 1, we have to examine the received suffix to see if we have to adjust the suffix length. The judgment of the suffix length adjusting is to examine if the first bit of the received suffix is 1. If the first bit of the received suffix is 1, the true suffix length is the suffix length of the group information minus 1.

Other the other hand, the true suffix length is equal to suffix length.

Figure 3-11 : An example of the complete group information

Based on the memory map and the group information in Figure 3-11, the complete intra-group decoding procedures can be described as follows.

Decoding procedure – assume the decoded codeword is (00011)2:

 The suffix_adjust is equal to 1, so we have to examine the first bit of the received suffix (1) 2. The first bit of the received suffix is also equal to 1, so suffix_num is set to (10) 2.

 suffix_offset = suffix_num (10)2 – suffix_min (0) = 102 = 2;

 symbol_address = suffix_offset (2) + base_address (3) = 5;

 The decoded symbol, S2, is accessed by the symbol_address, 5;

In order to save the usage of memories, we don’t save the whole base addresses to the group information, and we only save the least significant 7 bits. Therefore, when executing the CAVLC coeff_token decoding, the true base addresses have to be added 64, 128, and 192 for NUM_VLC1, NUM_VLC2, and NUM_VLC3. On the other hand, the true address has to be added 128 for MPEG-2 table B15.

group suffix_adjust leading_0s base_address suffix_length suffix_min

Table 3-8 : The codeword groups of MPEG-2

group suffix_adjust leading_0s base_address suffix_length suffix_min

40 0 1 59 1 0

Table 3-9 : The codeword groups of CAVLC coeff_token

相關文件