core_brate<=STEREO_GSC_BIT_RATE_ALLOC&&brate_intermed_tbl[i]==ACELP_9k60)/* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */
/* Probably classification error -> concentrate bits on LF */
if(L_frame==L_FRAME16k&&core_brate>=ACELP_24k40)
{
nb_bands_max=nb_tot_bands-2;
}
elseif(core_brate>=ACELP_16k40)
{
nb_bands_max=nb_bands+2;
}
elseif(core_brate>=ACELP_8k00)
{
nb_bands_max=nb_bands+1;
}
else
{
nb_bands_max=nb_bands;
}
}
elseif(noise_lev>=NOISE_LEVEL_SP2||(core_brate<=ACELP_13k20&&core_brate>=ACELP_9k60&&cor_strong_limit==0))/* Very low dynamic, tend to speech, do not try to code HF at all */
{
nb_bands_max-=2;
}
elseif(noise_lev>=NOISE_LEVEL_SP1)/* Very low dynamic, tend to speech, code less HF */
Ltmp=Mpy_32_16_1(L_sub(L_shl(SWB_bit_budget,18),bit_fracf),d_tmp);/* Perform mult by 1/den */
nb_tot_bands_loc=extract_h(L_shl(Ltmp,sub(1,e_div)));/* adjust exponent: 1 is to take into account the / 2.0f, and e_div for the num and den of the division*/
constint16_tenc_dec,/* i : encoder/decoder flag */
constint16_tcoder_type,/* i : Coder type */
constint16_tMbands_gn,/* i : Number of band */
constint32_tcore_brate,/* i : Core bitrate */
constfloatmean_g,/* i : Average gain */
constfloat*Gain_in,/* i : Unquantized gain vector */
float*Gain_out/* o : Level adjusted unquantized gain vector */
)
{
floatGain_off;
int16_ti;
/* Gain adjustment to fit ACELP generic inactive coding gain at low rate */
Gain_off=0.0f;
if(coder_type==INACTIVE||coder_type==UNVOICED)
{
if(core_brate<=ACELP_5k00&&coder_type==UNVOICED)
{
Gain_off=9.f;
}
elseif(core_brate<=ACELP_7k20)
{
Gain_off=8.f;/* 0 dB */
}
elseif(core_brate<=ACELP_8k00)
{
Gain_off=6.6f;/* ~-3.3 dB */
}
elseif(core_brate<=ACELP_9k60)
{
Gain_off=4.8f;/* ~-2.4 dB */
}
elseif(core_brate<=ACELP_11k60)
{
Gain_off=3.5f;/* ~-2.4 dB */
}
elseif(core_brate<=ACELP_13k20)
{
Gain_off=3.0f;/* ~-2.4 dB */
}
}
if(coder_type!=INACTIVE&&coder_type!=UNVOICED)
{
for(i=0;i<Mbands_gn;i++)
{
Gain_out[i]=Gain_in[i]+mean_g;
}
}
else
{
/*mimic ACELP decay of energy for low rates*/
if(element_mode==EVS_MONO&&enc_dec==DEC)
{
/* This is to keep EVS mono bit-exact with the standard (there might be a small desynchronization between encoder and decoder but there is no real quality or interop. issue) */