Commit 5ed0ee68 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Normalize find_targets_ivas_fx() inputs locally to improve precision

parent 6467c04c
Loading
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -247,8 +247,39 @@ void encod_gen_voic_fx(
        }
        ELSE
        {
#ifdef FIX_BASOP_2517_CLICK_IN_OMASA_LTV
            Word16 min_scf = norm_arr( (Word16 *) ( speech_fx + i_subfr_fx - M ), M );
            min_scf = s_min( min_scf, norm_arr( hLPDmem->mem_syn, M ) );
            min_scf = s_min( min_scf, norm_arr( (Word16 *) ( res_fx + i_subfr_fx ), L_SUBFR ) );
            IF( hLPDmem->mem_w0 != 0 )
            {
                min_scf = s_min( min_scf, norm_s( hLPDmem->mem_w0 ) );
            }

            IF( GT_16( min_scf, 0 ) )
            {
                Word16 speech_local[L_FRAME16k];
                Word16 mem_syn_local[M];
                Word16 res_local[L_FRAME16k];
                Word16 mem_w0_local = shl( hLPDmem->mem_w0, min_scf );
                Copy_Scale_sig( speech_fx, speech_local, L_frame, min_scf );
                Copy_Scale_sig( hLPDmem->mem_syn, mem_syn_local, M, min_scf );
                Copy_Scale_sig( res_fx, res_local, L_frame, min_scf );
                find_targets_ivas_fx( speech_local, mem_syn_local, i_subfr_fx, &mem_w0_local, p_Aq_fx,
                                      res_local, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );
                scale_sig( xn_fx, L_SUBFR, negate( min_scf ) );
                scale_sig( cn_fx, L_SUBFR, negate( min_scf ) );
                hLPDmem->mem_w0 = shr( mem_w0_local, min_scf );
            }
            ELSE
            {
                find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx,
                                      res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );
            }
#else
            find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx,
                                  res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );
#endif

            q_h1 = sub( 14, norm_s( h1_fx[0] ) );
            Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/