the signal of the secondary channel doesn't contain signal activity and has its long term energy is low
or secondary channel doesn't contain signal activity or its last energy was low and the difference between the long term energy of primary and secondary channel is above 26dB
then :
- the secondary channel coder type is set to INACTIVE.
if the lp reusing flag is 0 and the content of the primary channel contains active signal
then :
- the flag indicating the use of an average lp filter is set to one
- the lp reusing flag is set to 1
*/
if(hCPE->hStereoClassif->lrtd_mode==0&&
((sts[1]->hSpMusClas->tdm_lt_Etot<0&&hCPE->hCoreCoder[1]->vad_flag==0)/* very clean signal */
elseif(((hCPE->hCoreCoder[1]->vad_flag==0)||(hCPE->hCoreCoder[0]->vad_flag==0&&Etot_last[1]<30.0f&&(sts[0]->hSpMusClas->tdm_lt_Etot-sts[1]->hSpMusClas->tdm_lt_Etot)>26.0f))&&(hCPE->hStereoClassif->lrtd_mode==1)/* && NO_DTX */)/* boths channels are inactive but not DTX used*/
/*
Else, in case of over-talk or uncorrelated content (LRTD) and
the signal of the secondary channel doesn't contain voice activity or the signal of the primary channel doesn't contain voice activity
and its last energy was below 30 dB and the long term energy of the secondary channel is 26dB below the long term energy of the primary channel
then :
- the secondary channel coder type is set to INACTIVE.
if tdm_ratio_idx is between 1 and 29
if the lp reusing flag is 0 and the content of the primary channel contains active signal
then :
- the flag indicating the use of an average lp filter is set to one
Else, if the sp_aud_decision0 of the secondary channel is 0 and transition counter is less or equal to 0 and
the unmodified coder_type of the secondary channel is unvoiced or
the tdm_LRTD_flag is 1 and the lp reuse flag is 0 and the signal activity flag on the secondary channel is 0 or the last energy of the secondary channel was below 30 db and the long term energy of secondary channel is 26 dB below the primary channel
then :
- the coding mode of the secondary channel is force to UNVOICED
if tdm_LRTD_flag is set to 1
- then the
if the lp reusing flag is 0 and the content of the primary channel contains active signal
Setting a temporary coder type that will be used inside the bit allocation routine. it is needed to know weather the coder type of the primary channel is TRANSITION or not
the temporary coder type is set to AUDIO
if the bit rate is below 24k4
then :
- the temporary coding mode is set to the actual primary channel coding mode
if
last frame >= L_FRAME16k and the primary channel flag ACELP16k is 0
or
last frame == L_FRAME and the primary channel flag ACELP16k is 1
and the last core bit rate is not 0 and is not 2k4 and the primary channel unmodified coder type is not VOICED
then :
- temporary coding mode is set to TRANSITION
else if the primary channel sp_aud_decision1 or the sp_aud_decision2 flags is set to 1 or the primary coder type is different of TRANSITION
then :
- temporary coding mode is set AUDIO
*/
mod_ct=AUDIO;
if(hCPE->element_brate<IVAS_24k4)
{
mod_ct=sts[0]->coder_type;
/* Only sure TRANSITION coding modes are important for bit allocation, otherwise mod_ct is set to AUDIO only to easy debugging if needed */
if(((sts[0]->last_L_frame>=L_FRAME16k&&sts[0]->flag_ACELP16k==0)||(sts[0]->last_L_frame==L_FRAME&&sts[0]->flag_ACELP16k==1))&&sts[0]->last_core_brate!=FRAME_NO_DATA&&sts[0]->last_core_brate!=SID_2k40&&sts[0]->coder_type_raw!=VOICED/*in case of CNG, this code is not reached sts[0]->core_brate != FRAME_NO_DATA && sts[0]->core_brate != SID_2k40 &&*/)