Commit 93293c3e authored by multrus's avatar multrus
Browse files

Merge branch 'main' into...

Merge branch 'main' into 1379-increase-accuracy-of-azimuth-and-elevation-angles-in-masa-metadata-with-dirac-rendering
parents 7e88d30a 7f29e919
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2636,10 +2636,10 @@ void IMDCT_ivas_fx(
    {
        Word32 fac;
        // fac = shl_sat( mult_r( extract_h( L_shr_sat( hTcxDec->conceal_eof_gain32, sub( 1, hTcxDec->conceal_eof_gain_e ) ) ), st->last_concealed_gain_syn_deemph ), 1 );
        fac = Mpy_32_16_1( hTcxDec->conceal_eof_gain32, st->last_concealed_gain_syn_deemph ); // q = 31 - hTcxDec->conceal_eof_gain_e
        fac = Mpy_32_16_1( hTcxDec->conceal_eof_gain32, st->last_concealed_gain_syn_deemph ); // q = 31 - hTcxDec->conceal_eof_gain_e - last_concealed_gain_syn_deemph_e
        FOR( Word16 ind = 0; ind < overlap; ind++ )
        {
            old_syn_overl_fx[ind] = extract_l( L_shl_sat( Mpy_32_32( old_syn_overl_fx[ind], fac ), hTcxDec->conceal_eof_gain_e ) ); // Q(-2)
            old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e ) ) ); // Q(-2)
            move16();
        }
    }
+3 −1
Original line number Diff line number Diff line
@@ -1623,6 +1623,8 @@ void ivas_mdct_core_tns_ns_fx(
            }
            q_2 = q_x;
            move16();
            Word16 length2 = length;
            move16();
            sns_shape_spectrum_fx( x_fx[ch][k], &q_x, st->hTcxCfg->psychParamsCurrent, sns_int_scf_fx, q_sns_int_scf, st->hTcxCfg->psychParamsCurrent->nBins, &length );
            IF( LT_16( q_2, add( q_x, 1 ) ) ) /*scaling to q_2*/
            {
@@ -1632,7 +1634,7 @@ void ivas_mdct_core_tns_ns_fx(
            }
            ELSE /*scaling to q_x+1*/
            {
                Scale_sig32( &x_fx[ch][k][0] + length, sub( L_spec[ch], length ), sub( add( q_x, 1 ), q_2 ) );
                Scale_sig32( &x_fx[ch][k][0] + length, sub( length2, length ), sub( add( q_x, 1 ), q_2 ) );
                q_x = add( q_x, 1 );
            }
            x_e[ch][k] = sub( 31, q_x );
+10 −11
Original line number Diff line number Diff line
@@ -1855,7 +1855,7 @@ static void calculate_energy_buffer_ivas_fx(
    const Word32 input_Fs,      /* i  : input sampling rate         Q0*/
    Word16 *enerBuffer_dft_e )
{
    Word16 i, j;
    Word16 i, j, guard_bits;
    Word64 nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX];
    Word64 *p_nrg_DMX_fx;
    Word32 *pDFT_DMX_fx; /*q_DFT_DMX_fx*/
@@ -1863,8 +1863,6 @@ static void calculate_energy_buffer_ivas_fx(
    Word16 band_res_dft_fx, chan_width_f_fx, start, stop;
    Word16 norm_nrg_DMX_fx;
    Word64 max_abs_nrg_DMX_fx;
    Flag overflow = 0;
    move32();

    max_abs_nrg_DMX_fx = 0;
    move64();
@@ -1881,22 +1879,23 @@ static void calculate_energy_buffer_ivas_fx(
    start = 1;
    move16();

    guard_bits = add( find_guarded_bits_fx( extract_h( chan_width_bins_fx ) ), 1 ); /* Q0 */

    pDFT_DMX_fx = hCPE->hStereoDft->DFT_fx[0]; /* q_DFT_DMX_fx = 31 - hCPE->hStereoDft->DFT_fx_e[0] */
    p_nrg_DMX_fx = nrg_DMX_fx;

    *p_nrg_DMX_fx = Mpy_32_32( pDFT_DMX_fx[0], pDFT_DMX_fx[0] ); /*2 * q_DFT_DMX_fx -31 */
    *p_nrg_DMX_fx = W_shr( W_mult_32_32( pDFT_DMX_fx[0], pDFT_DMX_fx[0] ), guard_bits ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */
    move64();

    FOR( i = 0; i < no_channels; i++ )
    {
        stop = extract_l( L_shr( L_add( Mpy_32_16_1( chan_width_bins_fx, add( i, 1 ) ), 1 ), 1 ) );
        stop = extract_l( L_shr( L_add( Mpy_32_16_1( chan_width_bins_fx, add( i, 1 ) ), 1 ), 1 ) ); /* Q0 */
        FOR( j = start; j < stop; j++ )
        {
            *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j], pDFT_DMX_fx[2 * j] ) ); /*2 * q_DFT_DMX_fx -31 */
            *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j], pDFT_DMX_fx[2 * j] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */
            move64();
            *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ) );
            *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */
            move64();
            // 2 * DFT_fx_e
        }
        IF( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) )
        {
@@ -1910,11 +1909,11 @@ static void calculate_energy_buffer_ivas_fx(
    norm_nrg_DMX_fx = W_norm( max_abs_nrg_DMX_fx );
    FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */
    {
        enerBuffer_dft_fx[i] = W_extract_h( W_shl_o( nrg_DMX_fx[i], norm_nrg_DMX_fx, &overflow ) ) / 3; /*q_enerBuffer_dft_fx=2 * q_DFT_DMX_fx -31+ norm_nrg_DMX_fx -32*/
        enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx - 32 */
        move32();
    }

    *enerBuffer_dft_e = sub( add( 32, shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ) ), norm_nrg_DMX_fx ); /*31-q_enerBuffer_dft_fx*/
    *enerBuffer_dft_e = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx );
    move16();

    /* Set remaining entries of enerBuffer to zero */