Commit ebd34cb2 authored by Manuel Jander's avatar Manuel Jander
Browse files

Add missing scale adaption of ACELP high rate memories mem_deemp_preQ_fx and...

Add missing scale adaption of ACELP high rate memories mem_deemp_preQ_fx and mem_preemp_preQ_fx. Correct another scaling issue of hLPDmem->mem_w0.
parent abfc200a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ ivas_error acelp_core_enc_fx(
            move16();
            hLPDmem->q_mem_syn = sub( Q_new, 1 );
            move16();
#ifdef NONBE_FIX_ISSUE_2518
            st->mem_deemp_preQ_fx = shl_sat( st->mem_deemp_preQ_fx, sub( Q_new, st->prev_Q_new ) );
            st->mem_preemp_preQ_fx = shl_sat( st->mem_preemp_preQ_fx, sub( Q_new, st->prev_Q_new ) );
#endif
        }

        Scale_sig32( st->Bin_E_old_fx, L_FFT / 2, sub( add( Q_new, Q_SCALE - 2 ), st->q_Bin_E_old ) ); // Q_new + Q_scale - 2
+2 −1
Original line number Diff line number Diff line
@@ -1732,10 +1732,11 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
                    move16();
                    Copy( hLPDmem->mem_syn2, tmp_buf + 1, M );
                    deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp );
                    Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 );
#ifdef NONBE_FIX_ISSUE_2518
                    Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 );
                    hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp );
#else
                    Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 );
                    hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp );
#endif
                    move16();
+5 −7
Original line number Diff line number Diff line
@@ -753,17 +753,15 @@ void pre_proc_front_ivas_fx(
    shift = s_min( shift, norm_arr( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ) ) );
    shift = add( shift, st->q_inp );

    IF( flag_16k_smc )
    {
    /* Avoid saturation of resampling/delay decimation buffer. */
    shift = s_min( shift, add( st->q_mem_decim16k_fx, 1 ) );
    }

    /* Limit Q_new here to st->q_inp because inside ivas_compute_core_buffers_fx() st->input is rescaled to Q_new */
    shift = s_min( shift, st->q_inp );
    IF( st->hLPDmem != NULL )
    {
        shift = s_min( shift, add( st->hLPDmem->q_lpd_old_exc, 0 ) );
        shift = s_min( shift, add( st->hLPDmem->q_lpd_syn, 0 ) );
        shift = s_min( shift, st->hLPDmem->q_lpd_old_exc );
        shift = s_min( shift, st->hLPDmem->q_lpd_syn );
        shift = s_min( shift, add( st->hLPDmem->q_mem_syn, 1 ) );
    }

+2 −3
Original line number Diff line number Diff line
@@ -943,7 +943,6 @@ void ivas_compute_core_buffers_fx(
#ifdef NONBE_FIX_ISSUE_2206
            scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */

            // Scale_sig( st->mem_decim16k_fx, 2 * L_FILT_MAX, sub( -1, Q_old_inp_16k ) ); /* Q(-1) */
            Q_tmp = norm_arr( st->mem_decim16k_fx, mem_decim16k_size );
            scale_sig( st->mem_decim16k_fx, mem_decim16k_size, Q_tmp );
            st->q_mem_decim16k_fx = add( Q_tmp, Q_old_inp_16k );
@@ -1306,8 +1305,8 @@ void ivas_compute_core_buffers_fx(

        IF( st->hLPDmem != NULL )
        {
            shift = s_min( shift, add( st->hLPDmem->q_lpd_old_exc, 0 ) );
            shift = s_min( shift, add( st->hLPDmem->q_lpd_syn, 0 ) );
            shift = s_min( shift, st->hLPDmem->q_lpd_old_exc );
            shift = s_min( shift, st->hLPDmem->q_lpd_syn );
            shift = s_min( shift, add( st->hLPDmem->q_mem_syn, 1 ) );
        }
        *Q_new = s_min( shift, Q_MAX );