Word32xL_fx[],/* i : L vector to quantize Q31-e_xL*/
Word16e_xL,
Word32xR_fx[],/* i : R vector to quantize Q31-e_xR*/
Word16e_xR,
constWord32xL_fx[],/* i : L vector to quantize Q31-e_xL*/
constWord16e_xL,
constWord32xR_fx[],/* i : R vector to quantize Q31-e_xR*/
constWord16e_xR,
constWord16nbitsSQ,/* i : number of bits targeted Q0*/
constWord16lg,/* i : vector size (2048 max) Q0*/
Word16*e_res)
{
Word16i,q,iter,e_ener,e_tmp;
Word16i,q,iter,e_ener,e_xL_2,e_xR_2,s;
Word32ener_fx,tmp_32,target_fx,fac_fx,offset_fx;
Word32en_fx[N_MAX/2];// Q(26)
Word32en_fx[N_MAX/2];// Q25
Word16lg2,lg_4,lg2_4;
Word64W_tmp,_0_01;
lg_4=shr(lg,2);/* Q0 */
lg2_4=shl(lg_4,1);/* Q0 */
lg2=shl(lg2_4,2);/* Q0 */
i=0;
move16();
e_xL_2=shl(e_xL,1);
e_xR_2=shl(e_xR,1);
_0_01=W_shr(21474836/* 0.01 in Q31 */,sub(e_xL_2,32));// 0.01 in 2*(Q of specL/R) + 1
set32_fx(en_fx,21474836/* 0.01 in Q31 */,idiv1616(N_MAX,2));
set32_fx(en_fx,335544/* 0.01 in Q25 */,(N_MAX/2));
/* energy of quadruples with 9dB offset */
/* ignore that we may take no all lines into account, max. 3 lines at the upper end of the spectrum can be missed (if lg is not a multiple of 4, happens also in SQGain()*/
FOR(q=0;q<lg_4;q++)
{
ener_fx=BASOP_Util_Add_Mant32Exp(21474836/*0.01 in Q15*/,0,Mpy_32_32(xL_fx[i],xL_fx[i]),e_xL*2,&e_ener);/* Q31-e_ener */