Commit 356bda5f authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Fabian Bauer
Browse files

OMASA LTV crash fixes for original and +10dB, high mld fix for OMASA

[x] Crash fix for +10db case : [ltv_basop_encoder-OMASA 2TC 1ISM at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out]
[x] Fix for +10db omasa stv high mld case
[x] Fix for LTV Crash - OMASA 1TC 4ISM at 48 kbps, 48kHz in, 48kHz out, BINAURAL out
parent 6d59f30a
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1671,6 +1671,12 @@ void QuantizeSpectrum_ivas_fx(

    QuantizeTCXSpectrum_fx( st, frame_cnt, hTcxEnc->spectrum_fx[frame_cnt], hTcxEnc->spectrum_e[frame_cnt], gainlpc_fx, gainlpc_e, Aqind, tnsSize, nb_bits, vad_hover_flag,
                            &L_frameTCX, &L_frame, &L_spec, &tcx_offset, &noiseFillingBorder, quantized_spectrum_fx, &quantized_spectrum_e, hm_cfg, &hm_active, lf_deemph_fact_fx, &nf_seed, &ener_fx, &ener_e, &gain_tcx_fx, &gain_tcx_e, prm );
    if ( hTcxEnc->spectrum_e[frame_cnt] < 0 )
    {
        /*buffer is already scaled inside QuantizeTCXSpectrum_fx*/
        hTcxEnc->spectrum_e[frame_cnt] = 0;
        move16();
    }

    Word16 s1 = sub( getScaleFactor32( st->hTcxEnc->spectrum_fx[frame_cnt], L_frame ), 6 );
    Word16 s2 = getScaleFactor32( quantized_spectrum_fx, s_max( L_frame, L_spec ) );
@@ -3553,7 +3559,7 @@ void QuantizeTCXSpectrum_fx(
    Encoder_State *st,           /* i  : state handle                            */
    const Word16 frame_cnt,      /* i  : frame counter in the super_frame        Q0 */
    Word32 *x_orig_fx,           /* i  : shaped MDCT spectrum                    */
    const Word16 x_orig_e,       /* i  : exp of shaped MDCT spectrum                    */
    Word16 x_orig_e,             /* i  : exp of shaped MDCT spectrum                    */
    Word16 *gainlpc_fx,          /* i  : FDNS gains                              */
    Word16 *gainlpc_e,           /* i  : exp of FDNS gains                              */
    const Word16 *Aqind,         /* i  : frame-independent quantized coefficients (M+1) Q0 */
@@ -3708,6 +3714,15 @@ void QuantizeTCXSpectrum_fx(
    }

    /* Start with the pre-shaped spectrum*/

    /*scaling buffer to Q31 if exp < 0 to avoid overflow while scaling constants*/
    IF( x_orig_e < 0 )
    {
        scale_sig32( x_orig_fx, L_spec, x_orig_e );
        x_orig_e = 0;
        move16();
    }

    Copy32( x_orig_fx, spectrum_fx, L_spec );
    *spectrum_e = x_orig_e;
    move16();
+5 −3
Original line number Diff line number Diff line
@@ -402,10 +402,12 @@ ivas_error ivas_cpe_enc_fx(

    stereo_tca_enc_fx( hCPE, input_frame );

    Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, 0 ), sts[0]->q_inp32 ) );
    Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, 0 ), sts[1]->q_inp32 ) );
    shift = s_min( 0, sub( add( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 ) );
    shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 ) );
    Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, shift ), sts[0]->q_inp32 ) );
    Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, shift ), sts[1]->q_inp32 ) );

    sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = 0;
    sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = shift;
    move16();
    move16();
    move16();
+1 −1
Original line number Diff line number Diff line
@@ -2525,7 +2525,7 @@ void QuantizeTCXSpectrum_fx(
    Encoder_State *st,           /* i  : state handle                            */
    const Word16 frame_cnt,      /* i  : frame counter in the super_frame        Q0 */
    Word32 *x_orig_fx,           /* i  : shaped MDCT spectrum                    */
    const Word16 x_orig_e,       /* i  : exp of shaped MDCT spectrum                    */
    Word16 x_orig_e,             /* i  : exp of shaped MDCT spectrum                    */
    Word16 *gainlpc_fx,          /* i  : FDNS gains                              */
    Word16 *gainlpc_e,           /* i  : exp of FDNS gains                              */
    const Word16 *Aqind,         /* i  : frame-independent quantized coefficients (M+1) Q0 */
+7 −0
Original line number Diff line number Diff line
@@ -369,6 +369,13 @@ void AnalyzePowerSpectrum_ivas_fx(
        tmp32 = L_shl( mdctSpectrum[i], shift );
        powerSpec[i] = BASOP_Util_Add_Mant32Exp( powerSpec[i], shl( powerSpec_e[i], 1 ), Mpy_32_32( tmp32, tmp32 ), shl( sub( mdctSpectrum_e, shift ), 1 ), &powerSpec_e[i] );
        move32();
        IF( LT_16( powerSpec_e[i], -31 ) )
        {
            powerSpec[i] = L_shl( powerSpec[i], sub( powerSpec_e[i], -31 ) );
            move32();
            powerSpec_e[i] = -31;
            move16();
        }
        temp_powerSpec_e = s_max( temp_powerSpec_e, powerSpec_e[i] );
    }