7. Parsing Process
Dieser Abschnitt bewahrt den RFC-Text zu APV, einschliesslich bitstream syntax, syntax element processing, decoding and parsing processes, metadata, profiles, levels, bands, raw bitstream format und implementation references.
Originaler RFC-Text
7. Parsing Process
7.1. Process for Syntax Element Type h(v)
This process is invoked for the parsing of syntax elements with
descriptor h(v) in Section 5.3.15 and Section 5.3.16.
7.1.1. Process for abs_dc_coeff_diff
Inputs to this process are bits for the abs_dc_coeff_diff syntax
element. Output of this process is a value of the abs_dc_coeff_diff
syntax element. The variable kParam is derived as follows:
kParam = clip(0, 5, PrevDcDiff >> 1)
The value of syntax element abs_dc_coeff_diff is obtained by invoking
the parsing process for variable-length codes as specified in
Section 7.1.4 with kParam.
7.1.2. Process for coeff_zero_run
Inputs to this process are bits for the coeff_zero_run syntax
element.
Output of this process is a value of the coeff_zero_run syntax
element.
The variable kParam is derived as follows:
kParam = clip(0, 2, PrevRun >> 2)
The value of syntax element coeff_zero_run is obtained by invoking
the parsing process for variable-length codes as specified in
Section 7.1.4 with kParam.
7.1.3. Process for abs_ac_coeff_minus1
Inputs to this process are bits for the abs_ac_coeff_minus1 syntax
element.
Output of this process is a value of the abs_ac_coeff_minus1 syntax
element.
The variable kParam is derived as follows:
kParam = clip(0, 4, PrevLevel >> 2)
The value of syntax element abs_ac_coeff_minus1 is obtained by
invoking the parsing process for variable-length codes as specified
in Section 7.1.4 with kParam.
7.1.4. Process for Variable-Length Codes
Input to this process is kParam.
Output of this process is a value, symbolValue, of a syntax element.
The symbolValue is derived as follows:
symbolValue = 0
parseExpGolomb = 1
k = kParam
stopLoop = 0
if(read_bits(1) == 1){
parseExpGolomb = 0
}
else{
if(read_bits (1) == 0){
symbolValue += (1 << k)
parseExpGolomb = 0
}
else{
symbolValue += (2 << k)
parseExpGolomb = 1
}
}
if(parseExpGolomb){
do{
if(read_bits(1) == 1){
stopLoop = 1
}
else{
symbolValue += (1 << k)
k++
}
} while(!stopLoop)
}
if(k > 0)
symbolValue += read_bits(k)
Figure 26: Parsing process of symbolValue
where the value returned from read_bits(n) is interpreted as a binary
representation of an n-bit unsigned integer with the most significant
bit written first.
7.2. Codeword Generation Process for h(v) (Informative)
This process specifies the code generation process for syntax
elements with descriptor h(v).
7.2.1. Process for abs_dc_coeff_diff
Input to this process is a symbol value of the abs_dc_coeff_diff
syntax element.
Output of this process is a codeword of the abs_dc_coeff_diff syntax
element.
The variable kParam is derived as follows:
kParam = clip(0, 5, PrevDcDiff >> 1)
The codeword of syntax element abs_dc_coeff_diff is obtained by
invoking the generation process for variable-length codes as
specified in Section 7.2.4 with the symbol value symbolValue and
kParam.
7.2.2. Process for coeff_zero_run
Input to this process is a symbol value of the coeff_zero_run syntax
element.
Output of this process is a codeword of the coeff_zero_run syntax
element.
The variable kParam is derived as follows:
kParam = clip(0, 2, PrevRun >> 2)
The codeword of syntax element coeff_zero_run is obtained by invoking
the generation process for variable-length codes as specified in
Section 7.2.4 with the symbol value symbolValue and kParam.
7.2.3. Process for abs_ac_coeff_minus1
Input to this process is a symbol value of the abs_ac_coeff_minus1
syntax element.
Output of this process is a codeword of the abs_ac_coeff_minus1
syntax element.
The variable kParam is derived as follows:
kParam = clip(0, 4, PrevLevel >> 2)
The codeword of syntax element abs_ac_coeff_minus1 is obtained by
invoking the generation for variable-length codes as specified in
Section 7.2.4 with the symbol value symbolValue and kParam.
7.2.4. Process for Variable-Length Codes
Inputs to this process are symbolVal and kParam
Output of this process is a codeword of a syntax element.
The codeword is derived as follows:
PrefixVLCTable[3][2] = {{1, 0}, {0, 0}, {0, 1}}
symbolValue = symbolVal
valPrefixVLC = clip(0, 2, symbolVal >> kParam)
bitCount = 0
k = kParam
while(symbolValue >= (1 << k)){
symbolValue -= (1 << k)
if(bitCount < 2)
put_bits(PrefixVLCTable[valPrefixVLC][bitCount], 1)
else
put_bits(0, 1)
if(bitCount >= 2)
k++
bitCount++
}
if(bitCount < 2)
put_bits(PrefixVLCTable[valPrefixVLC][bitCount], 1)
else
put_bits(1, 1)
if(k > 0)
put_bits(symbolValue, k)
Figure 27: Generating bits from symbolValue
where a codeword generated from put_bits(v, n) is interpreted as a
binary representation of an n-bit unsigned integer value v with the
most significant bit written first.