Commit 30d73602 authored by Manuel Jander's avatar Manuel Jander
Browse files

Remove fixed Q0 scale for IVAS_CPE_TD mode.

parent 2023466e
Loading
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -758,13 +758,23 @@ ivas_error ivas_cpe_enc_fx(
    }
    ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) )
    {
#ifdef NONBE_FIX_ISSUE_2206
        /* Make scale of L/R equal, required inside stereo_tdm_ener_analysis_fx()->Get_dt_lt_ener_fx() */
        tmp = s_min( sts[0]->q_inp, sts[1]->q_inp );
        scale_sig( sts[0]->input_fx, input_frame, sub( tmp, sts[0]->q_inp ) ); /* min Q of both channels */
        sts[0]->q_inp = tmp;
        move16();
        scale_sig( sts[1]->input_fx, input_frame, sub( tmp, sts[1]->q_inp ) ); /* min Q of both channels */
        sts[1]->q_inp = tmp;
        move16();
#else
        Scale_sig( sts[0]->input_fx, input_frame, negate( sts[0]->q_inp ) ); /* Q0 */
        sts[0]->q_inp = 0;
        move16();
        Scale_sig( sts[1]->input_fx, input_frame, negate( sts[1]->q_inp ) ); /* Q0 */
        sts[1]->q_inp = 0;
        move16();

#endif
        /* Determine the energy ratio between the 2 channels */
        tdm_ratio_idx = stereo_tdm_ener_analysis_fx( ivas_format, hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); /* Q0 */

+1 −1
Original line number Diff line number Diff line
@@ -1164,7 +1164,7 @@ void stereo_dft_enc_analyze_fx(
            Word16 tmp;

            tmp = norm_arr( input[n] + input_frame - dft_ovl, dft_ovl );
            Copy_Scale_sig( input[n] + input_frame - dft_ovl, input_mem[n], dft_ovl, tmp );
            Copy_Scale_sig_nosat( input[n] + input_frame - dft_ovl, input_mem[n], dft_ovl, tmp );
            q_input_mem[n] = add( sts[n]->q_inp, tmp );
            move16();
        }
+10 −2
Original line number Diff line number Diff line
@@ -170,10 +170,12 @@ Word16 stereo_tdm_ener_analysis_fx(
    /*----------------------------------------------------------------*
     * Compute L and R energy and Long term RMS of each channel
     *----------------------------------------------------------------*/
    Get_LR_rms_fx( sts[0]->input_fx, sts[1]->input_fx, input_frame, &rms_L_fx, &q_rms_L, &rms_R_fx, &q_rms_R );

#ifdef NONBE_FIX_ISSUE_2206
    assert( sts[0]->q_inp == sts[1]->q_inp );
    q_rms_L = add( q_rms_L, sts[0]->q_inp );
    q_rms_R = add( q_rms_R, sts[1]->q_inp );
#endif
    Get_LR_rms_fx( sts[0]->input_fx, sts[1]->input_fx, input_frame, &rms_L_fx, &q_rms_L, &rms_R_fx, &q_rms_R );

    /*----------------------------------------------------------------*
     * Compute the 1st order energy difference difference
@@ -837,13 +839,18 @@ static Word16 Get_dt_lt_ener_fx(
    Word32 es_em_fx;
    Word16 tmp_SM_flag, tdm_SM_flag_loc;
    Word32 L_tmp, L_tmp1;
#ifdef NONBE_FIX_ISSUE_2206
    Word16 exp_diff;
#else
    Word16 exp_diff, tmp;
#endif

    sts = hCPE->hCoreCoder;

    Left_in_fx = sts[0]->input_fx;  /* Left channel  sts[0]->q_inp*/
    Right_in_fx = sts[1]->input_fx; /* Right channel sts[1]->q_inp*/

#ifndef NONBE_FIX_ISSUE_2206
    tmp = sub( getScaleFactor16( sts[0]->input_fx, input_frame ), 1 );
    Scale_sig( sts[0]->input_fx, input_frame, tmp ); /* sts[0]->q_inp + tmp */
    sts[0]->q_inp = add( tmp, sts[0]->q_inp );
@@ -860,6 +867,7 @@ static Word16 Get_dt_lt_ener_fx(
    move16();
    sts[0]->q_inp = sts[1]->q_inp;
    move16();
#endif

    tdm_SM_flag_loc = tdm_last_SM_flag; /* Q0 */
    move16();