5.5 Writing to bitstream

26.4053GPPEncoder specification parametric stereo partEnhanced aacPlus general audio codecGeneral audio codec audio processing functionsRelease 17TS

The parametric stereo bitstream should be placed in the SBR extension field according to syntax in Table 5. The EXTENSION_ID_PS should be used as extension identifier. Note that due to SBR extension is design, the total size, in bytes, of the ps_data element has to be added to the SBR extension element before writing the actual ps_data.

Table 5: Syntax of sbr_extension()

Syntax

No. of bits

Mnemonic

sbr_extension(bs_extension_id, num_bits_left)

{

switch (bs_extension_id) {

case EXTENSION_ID_PS:

num_bits_left -= ps_data();

Note 1

break;

default:

bs_fill_bits;

num_bits_left

bslbf

num_bits_left = 0;

break;

}

}

Note 1: ps_data() returns the number of bits read.

Table 6: Values of the bs_extension_id field

Symbol

Value

Purpose

EXTENSION_ID_PS

2

Parametric Stereo Coding

all other values

reserved

The syntax of the ps_data is defined in [4] Table 8.1. The bitstream elements in ps_data should be assigned values according to the following list.

enable_ps_header – Is set to 1 for all frames containing an SBR header. Is set to 0 for all other cases.

enable_iid – Is set to 0 if all values in the iid vector after quantization are zero. Is set to 1 for all other cases.

enable_icc – Is set to 0 if all values in the icc vector after quantization are zero. Is set to 1 for all other cases.

iid_mode – Is set to 0 if 10 stereo bands resolution is chosen. Is set to 1 for all other cases.

icc_mode – Is set to 0 if 10 stereo bands resolution is chosen. Is set to 1 for all other cases.

enable_ext – Is set to 0.

frame_class – Is set to 0.

num_env_idx – Is set to 0 if all values in the iid and icc vectors after quantization are unchanged since previous frame. Is set to 1 for all other cases.

iid_dt – Is set to 1 if differential coding of iid parameters over time gives a lower total Huffman code length than differential coding of iid parameters with respect to the previous parameter position. Is set to 0 for all other cases.

icc_dt – Is set to 1 if differential coding of icc parameters over time gives a lower total Huffman code length than differential coding of iid parameters with respect to the previous parameter position. Is set to 0 for all other cases.

iid_par_dt[n] – In case of differential coding of IID parameters over time (iid_dt==1), iid_par_dt[n] describes the IID difference with respect to the previous parameter position. If no previous parameter position is available, iid_par_dt[n] represents the IID difference with respect to the decoded value 0 (i.e. index=0).

iid_par_df[n] – In case of differential coding of IID parameters over frequency (iid_dt==0), iid_par_df[n] describes the Huffman encoded IID difference with respect to the parameter (n-1).

iid_par_df[0] – represents the IID difference with respect to the decoded value 0 (i.e. index=0).

icc_par_dt[n] – In case of differential coding of ICC parameters over time (icc_dt==1), icc_par_dt[n] describes the difference with respect to the previous parameter position. If no previous parameter position is available, icc_par_dt[n] represents the ICC difference with respect to the decoded value 1 (i.e. index=0).

icc_par_df[n] – In case of differential coding of ICC parameters over frequency (icc_dt==0), icc_par_df[n] describes the ICC difference with respect to the parameter (n-1). icc_par_df[0] represents the ICC difference with respect to the decoded value 1 (i.e. index=0).