Ana səhifə

Contents Page


Yüklə 2.59 Mb.
səhifə9/35
tarix25.06.2016
ölçüsü2.59 Mb.
1   ...   5   6   7   8   9   10   11   12   ...   35

7 The video decoding process


This clause specifies the decoding process that a decoder shall perform to reconstruct frames from the coded bitstream.

With the exception of the Inverse Discrete Cosine Transform (IDCT) the decoding process is defined such that all decoders shall produce numerically identical results. Any decoding process that produces identical results to the process described here, by definition, complies with this specification.

The IDCT is defined statistically in order that different implementations for this function are allowed. The IDCT specification is given in Annex A.

In 7.1 through 7.6 the simplest decoding process is specified in which no scalability features are used. 7.7 to 7.11 specify the decoding process when scalable extensions are used. 7.12 defines the output of the decoding process.

Figure 7-1 is a diagram of the Video Decoding Process without any scalability. The diagram is simplified for clarity.

NOTE - Throughout this specification two dimensional arrays are represented as name[q][p] where ‘q’ is the index in the vertical dimension and ‘p’ the index in the horizontal dimension.





Figure 7-1. Simplified Video Decoding Process

7.1 Higher syntactic structures


The various parameters and flags in the bitstream for macroblock() and all syntactic structures above macroblock() shall be interpreted as indicated in clause  6. Many of these parameters and flags affect the decoding process described in the following clauses. Once all of the macroblocks in a given picture have been processed the entire picture will have been reconstructed.

Reconstructed fields shall be associated together in pairs to form reconstructed frames. (See “picture_structure” in 6.3.10.)

The sequence of reconstructed frames shall be reordered as described in 6.1.1.11.

If progressive_sequence == 1 the reconstructed frames shall be output from the decoding process at regular intervals of the frame period as shown in Figure 7-19.

If progressive_sequence == 0 the reconstructed frames shall be broken into a sequence of fields which shall be output from the decoding process at regular intervals of the field period as shown in Figure 7-20. In the case that a frame picture has repeat_first_field == 1 the first field of the frame shall be repeated after the second field. (See “repeat_first_field” in 6.3.10.)

7.2 Variable length decoding


7.2.1 specifies the decoding process used for the DC coefficient (n=0) in an intra coded block. (n is the index of the coefficient in the appropriate zigzag scanning order.) 7.2.2 specifies the decoding process for all other coefficients; AC coefficients (n≠0) and DC coefficients in non-intra coded blocks.

Let cc denote the colour component. It is related to the block number as specified in Table 7-1. Thus cc is zero for the Y component, one for the Cb component and two for the Cr component.



Table 7-1. Definition of cc, colour component index




cc







Block Number

4:2:0

4:2:2

4:4:4

0

0

0

0

1

0

0

0

5


2

2

2

6




1

1

7




2

2

8







1

9







2

11








2


7.2.1 DC coefficients in intra blocks


DC coefficients in blocks in intra macroblocks are encoded as a variable length code denoting dct_dc_size as defined in Table B-12 and B-13. If dct_dc_size is not equal to zero then this shall be followed by a fixed length code, dc_dct_differential, of dct_dc_size bits. A differential value is first recovered from the coded data which is added to a predictor in order to recover the final decoded coefficient.

If cc is zero then Table B-12 shall be used for dct_dc_size. If cc is non-zero then Table B-13 shall be used for dct_dc_size.

Three predictors are maintained, one for each of the colour components, cc. Each time a DC coefficient in a block in an intra macroblock is decoded the predictor is added to the differential to recover the actual coefficient. Then the predictor shall be set to the value of the coefficient just decoded. At various times, as described below, the predictors shall be reset. The reset value is derived from the parameter intra_dc_precision as specified in Table 7-2.

Table 7-2. Relation between intra_dc_precision and the predictor reset value

intra_dc_precision

Bits of precision

reset value

0

8

128

1

9

256

3


11

1024

The predictors shall be reset to the reset value at the following times:

• At the start of a slice.

• Whenever a non-intra macroblock is decoded.

• Whenever a macroblock is skipped. i.e. when macroblock_address_increment > 1.

The predictors are denoted dc_dct_pred[cc].

QFS[0] shall be calculated from dc_dct_size and dc_dct_differential by any process equivalent to:

if ( dc_dct_size == 0 ) {

dct_diff = 0;

} else {


half_range = 2 ^ ( dc_dct_size - 1 ); Note ^ denotes power (not XOR)

if ( dc_dct_differential >= half_range )

dct_diff = dc_dct_differential;

else


dct_diff = (dc_dct_differential + 1) - (2 * half_range);

}

QFS[0] = dc_dct_pred[cc] + dct_diff;



dc_dct_pred[cc] = QFS[0]

NOTE - dct_diff and half_range are temporary variables which are not used elsewhere in this specification.

It is a requirement of the bitstream that QFS[0] shall lie in the range:

0 to ((2^(8 + intra_dc_precision))-1)


7.2.2 Other coefficients


All coefficients with the exception of the DC intra coefficients shall be encoded using Tables B-14, B-15 and B-16.

In all cases a variable length code shall first be decoded using either Table B-14 or Table B-15. The decoded value of this code denotes one of three courses of action:

1 End of Block. In this case there are no more coefficients in the block in which case the remainder of the coefficients in the block (those for which no value has yet been decoded) shall be set to zero. This is denoted by “End of block” in the syntax specification of 6.2.6.

2 A “normal” coefficient in which a value of run and level is decoded followed by a single bit, s, giving the sign of the coefficient signed_level is computed from level and s as shown below. run coefficients shall be set to zero and the subsequent coefficient shall have the value signed_level.

if (s ==0)

signed_level = level;

else

signed_level = (-level);



3 An “Escape” coded coefficient. In which the values of run and signed_level are fixed length coded as described in 7.2.2.3.

7.2.2.1 Table selection


Table 7-3 indicates which Table shall be used for decoding the DCT coefficients.

Table 7-3. Selection of DCT coefficient VLC tables

intra_vlc_format

0

1

intra blocks

(macroblock_intra = 1)

B-14

B-15

non-intra blocks

(macroblock_intra = 0)

B-14

B-14


7.2.2.2 First coefficient of a non-intra block


In the case of the first coefficient of a non-intra block (a block in a non-intra macroblock) Table B-14 is modified as indicated by “NOTE 2” and “NOTE 3” at the foot of that Table.

This modification only affects the entry that represents run = 0, level = ±1. Since it is not possible to encode an End of block as the first coefficient of a block (the block would be “not coded” in this case) no possibility for ambiguity exists.

The positions in the syntax that use this modified Table are denoted by “First DCT coefficient” in the syntax specification of 6.2.6. The remainder of the coefficients are denoted by “Subsequent DCT coefficients”.

NOTE - In the case that Table B-14 is used for an intra block, the first coefficient shall be coded as specified in 7.2.1. Table B-14 shall therefore not be modified as the first coefficient that uses Table B-14 is the second coefficient in the block.


7.2.2.3 Escape coding


Many possible combinations of run and level have no variable length code to represent them. In order to encode these statistically rare combinations an Escape coding method is used.

Table B-16 defines the escape coding method. The Escape VLC is followed by a 6-bit fixed length code giving “run”. This is followed by a 12-bit fixed length code giving the values of “signed_level”.

NOTE - Attention is drawn to the fact that the escape coding method used in this specification is different to that used in ISO/IEC 11172-2.

7.2.2.4 Summary


To summarise 7.2.2. The variable length decoding process shall be equivalent to the following. At the start of this process n shall take the value zero for non-intra blocks and one for intra blocks.

eob_not_read = 1;

while ( eob_not_read )

{



if ( ) {

eob_not_read = 0;

while ( n< 64) {

QFS[n] = 0;

n = n + 1;

}

} else {



for ( m = 0; m < run; m++ ) {

QFS[n] = 0;

n = n + 1;

}

QFS[n] = signed_level



n = n + 1;

}

}



NOTE - eob_not_read and m are temporary variables that are not used elsewhere in this specification.

1   ...   5   6   7   8   9   10   11   12   ...   35


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©atelim.com 2016
rəhbərliyinə müraciət