Commit d6f899bc authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

commit 1

parent d8a67817
Loading
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -3285,6 +3285,7 @@ void ivas_get_spar_md_from_dirac_fx(
            {
                // ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][i_ts], (int16_t) ele_dirac[band][i_ts], response_avg, order );
                ivas_dirac_dec_get_response_fx( (int16_t) L_shr( azi_dirac_fx[band][i_ts], Q22 ), (int16_t) L_shr( ele_dirac_fx[band][i_ts], Q22 ), response_avg_fx, order );
                scale_sig32(response_avg_fx, MAX_OUTPUT_CHANNELS, -1); //Q30
                /*for ( int l = 0; l < MAX_OUTPUT_CHANNELS; l++ )
                {
                    response_avg[l] = (float) response_avg_fx[l] / ( 1 << 30 );
@@ -3294,6 +3295,7 @@ void ivas_get_spar_md_from_dirac_fx(
            {
                // ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][0], (int16_t) ele_dirac[band][0], response_avg, order );
                ivas_dirac_dec_get_response_fx( (int16_t) L_shr( azi_dirac_fx[band][0], Q22 ), (int16_t) L_shr( ele_dirac_fx[band][0], Q22 ), response_avg_fx, order );
                scale_sig32(response_avg_fx, MAX_OUTPUT_CHANNELS, -1); //Q30
                /*for ( int l = 0; l < MAX_OUTPUT_CHANNELS; l++ )
                {
                    response_avg[l] = (float) response_avg_fx[l] / ( 1 << 30 );
@@ -3305,6 +3307,7 @@ void ivas_get_spar_md_from_dirac_fx(
                {
                    // ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][block], (int16_t) ele_dirac[band][block], &( response[block][0] ), order );
                    ivas_dirac_dec_get_response_fx( (int16_t) L_shr( azi_dirac_fx[band][block], Q22 ), (int16_t) L_shr( ele_dirac_fx[band][block], Q22 ), &( response_fx[block][0] ), order );
                    scale_sig32(response_avg_fx, MAX_OUTPUT_CHANNELS, -1); //Q30
                    /*for ( int l = 0; l < MAX_OUTPUT_CHANNELS; l++ )
                    {
                        response[block][l] = (float) response_fx[block][l] / ( 1 << 30 );
@@ -3323,14 +3326,12 @@ void ivas_get_spar_md_from_dirac_fx(

                    for ( ch = 0; ch < num_ch_order; ch++ )
                    {
                        Word64 temp = 0;
                        for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ )
                        {
                            // response_avg[ch] += response[block][ch];
                            temp = temp + response_fx[block][ch];
                            response_avg_fx[ch] = L_add( response_avg_fx[ch], L_shr_r( response_fx[block][ch], 2 ) ); // divide by MAX_PARAM_SPATIAL_SUBFRAMES
                        }
                        // response_avg[ch] /= MAX_PARAM_SPATIAL_SUBFRAMES;
                        response_avg_fx[ch] = W_extract_l( W_shr( temp, 2 ) );
                    }

                    /*normalize 1st order*/
@@ -6203,7 +6204,7 @@ void ivas_dirac_dec_get_response_fx(
    // float sin_az[3];
    Word32 sin_az_fx[3];
    // float f, c;
    Word32 f_fx, c_fx;
    Word32 f_fx;
    Word32 c_fx_better;
    int16_t l, m;
    int16_t b, b1, b_2, b1_2, a;
@@ -6239,7 +6240,7 @@ void ivas_dirac_dec_get_response_fx(
    sin_az_fx[2] = L_shl_sat( Mpy_32_32( sin_1_fx, ( cos_2_fx - ONE_IN_Q29 ) ), 2 );

    // response[0] = 1.0f;
    response_fx[0] = ONE_IN_Q30;
    response_fx[0] = MAX_32;
    /* Un-optimized code - for reference */
    /*     for( l = 1; l<= ambisonics_order; l++ ) */
    /*     { */
@@ -6283,16 +6284,16 @@ void ivas_dirac_dec_get_response_fx(
            b = b_2 + m;
            a = dirac_gains_P_idx[b];
            // c = SQRT2 * dirac_gains_norm_term[a] * dirac_gains_Pnm[el][a];
            c_fx = Mpy_32_32( SQRT2_FIXED, Mpy_32_32( dirac_gains_norm_term_fx[a], dirac_gains_Pnm_int[el][a] ) );
            //c_fx = Mpy_32_32( SQRT2_FIXED, Mpy_32_32( dirac_gains_norm_term_fx[a], dirac_gains_Pnm_int[el][a] ) );
            c_fx_better = local_result_table[el][a];
            // response[b] = c * sin_az[l - m - 1];
            response_fx[b] = Mpy_32_32( L_shl( c_fx, 3 ), sin_az_fx[l - m - 1] );
            response_fx[b] = Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] );
            //response_fx[b] = Mpy_32_32( L_shl( c_fx, 3 ), sin_az_fx[l - m - 1] );
            response_fx[b] = L_shl_sat(Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] ),1); //Q30+Q1=Q31

            b1 = b1_2 - m;
            // response[b1] = c * cos_az[l - m - 1];
            response_fx[b1] = Mpy_32_32( L_shl( c_fx, 3 ), cos_az_fx[l - m - 1] );
            response_fx[b1] = Mpy_32_32( c_fx_better, cos_az_fx[l - m - 1] );
            //response_fx[b1] = Mpy_32_32( L_shl( c_fx, 3 ), cos_az_fx[l - m - 1] );
            response_fx[b1] = L_shl_sat(Mpy_32_32( c_fx_better, cos_az_fx[l - m - 1] ),1); //Q30+Q1=Q31
        }

        for ( m = 1; m < l; m += 2 )
@@ -6300,42 +6301,42 @@ void ivas_dirac_dec_get_response_fx(
            b = b_2 + m;
            a = dirac_gains_P_idx[b];
            // c = SQRT2 * dirac_gains_norm_term[a] * dirac_gains_Pnm[el][a];
            c_fx = Mpy_32_32( SQRT2_FIXED, Mpy_32_32( dirac_gains_norm_term_fx[a], dirac_gains_Pnm_int[el][a] ) );
            //c_fx = Mpy_32_32( SQRT2_FIXED, Mpy_32_32( dirac_gains_norm_term_fx[a], dirac_gains_Pnm_int[el][a] ) );
            c_fx_better = local_result_table[el][a];
            if ( e == -1 )
            {
                c_fx = L_negate( c_fx );
                //c_fx = L_negate( c_fx );
                c_fx_better = L_negate( c_fx_better );
            }
            // c = c * e;

            // response[b] = c * sin_az[l - m - 1];
            response_fx[b] = Mpy_32_32( L_shl( c_fx, 3 ), sin_az_fx[l - m - 1] );
            response_fx[b] = Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] );
            //response_fx[b] = Mpy_32_32( L_shl( c_fx, 3 ), sin_az_fx[l - m - 1] );
            response_fx[b] = L_shl_sat(Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] ),1); //Q30+Q1=Q31
            b1 = b1_2 - m;
            // response[b1] = c * cos_az[l - m - 1];
            response_fx[b1] = Mpy_32_32( L_shl( c_fx, 3 ), cos_az_fx[l - m - 1] );
            response_fx[b1] = Mpy_32_32( c_fx_better, cos_az_fx[l - m - 1] );
            //response_fx[b1] = Mpy_32_32( L_shl( c_fx, 3 ), cos_az_fx[l - m - 1] );
            response_fx[b1] = L_shl_sat(Mpy_32_32( c_fx_better, cos_az_fx[l - m - 1] ),1); //Q30+Q1=Q31
        }

        b = b_2 + l;
        a = dirac_gains_P_idx[b];
        // c = dirac_gains_norm_term[a] * dirac_gains_Pnm[el][a];
        c_fx = Mpy_32_32( dirac_gains_norm_term_fx[a], dirac_gains_Pnm_int[el][a] );
        //c_fx = Mpy_32_32( dirac_gains_norm_term_fx[a], dirac_gains_Pnm_int[el][a] );
        c_fx_better = local_result_table_2[el][a];
        if ( l % 2 == 1 )
        {
            // c = c * e;
            if ( e == -1 )
            {
                c_fx = L_negate( c_fx );
                //c_fx = L_negate( c_fx );
                c_fx_better = L_negate( c_fx_better );
            }
        }

        // response[b] = c;
        response_fx[b] = L_shl( c_fx, 2 );
        response_fx[b] = c_fx_better;
        //response_fx[b] = L_shl( c_fx, 2 );
        response_fx[b] = L_shl_sat(c_fx_better,1); //Q30+Q1=Q31
    }

    return;
+0 −1
Original line number Diff line number Diff line
@@ -779,7 +779,6 @@ static void filt_mu_fx(
            Overflow = 0;
        }
#endif

#else
        sig_out[n] = shl( mult_r( ga, temp ), 1 );
#endif
+76 −74
Original line number Diff line number Diff line
@@ -109,8 +109,10 @@ static Word16 IGF_replaceTCXNoise_1( /**< ou
    nE = 0;
    move32();

    FOR( sb = start; sb < stop; sb++ ){
        IF( TCXNoise[sb] ){
    FOR( sb = start; sb < stop; sb++ )
    {
        IF ( TCXNoise[sb] )
        {
            tmp16 = extract_h( L_shl( in[sb], s_l ) );
        }
        IF ( TCXNoise[sb] )
+7 −7
Original line number Diff line number Diff line
@@ -1735,7 +1735,7 @@ static void ivas_binaural_obtain_DMX_fx(
            FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
            {
                // float foa_const = hBinRenderer->hReverb->foa_enc[chIdx][1];
                Word32 foa_const_fx = L_shl( hBinRenderer->hReverb->foa_enc_fx[chIdx][1], 1 ); // Q30
                Word32 foa_const_fx = hBinRenderer->hReverb->foa_enc_fx[chIdx][1]; // Q31

                inRealPtr_fx = (Word32 *) &( RealBuffer[chIdx][k][0] );
                inImagPtr_fx = (Word32 *) &( ImagBuffer[chIdx][k][0] );
@@ -1744,13 +1744,13 @@ static void ivas_binaural_obtain_DMX_fx(
                {
                    // outRealLeftPtr[bandIdx] += inRealPtr[bandIdx] * ( 1.f + foa_const );
                    // outImagLeftPtr[bandIdx] += inImagPtr[bandIdx] * ( 1.f + foa_const );
                    outRealLeftPtr_fx[bandIdx] = L_add( outRealLeftPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], L_add( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1
                    outImagLeftPtr_fx[bandIdx] = L_add( outImagLeftPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], L_add( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1
                    outRealLeftPtr_fx[bandIdx] = L_add( outRealLeftPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], L_add( ONE_IN_Q30, L_shr(foa_const_fx,1) ) ) ); // Q_in - 1
                    outImagLeftPtr_fx[bandIdx] = L_add( outImagLeftPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], L_add( ONE_IN_Q30, L_shr(foa_const_fx,1) ) ) ); // Q_in - 1

                    // outRealRightPtr[bandIdx] += inRealPtr[bandIdx] * ( 1.f - foa_const );
                    // outImagRightPtr[bandIdx] += inImagPtr[bandIdx] * ( 1.f - foa_const );
                    outRealRightPtr_fx[bandIdx] = L_add( outRealRightPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], L_sub( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1
                    outImagRightPtr_fx[bandIdx] = L_add( outImagRightPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], L_sub( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1
                    outRealRightPtr_fx[bandIdx] = L_add( outRealRightPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], L_sub( ONE_IN_Q30, L_shr(foa_const_fx,1) ) ) ); // Q_in - 1
                    outImagRightPtr_fx[bandIdx] = L_add( outImagRightPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], L_sub( ONE_IN_Q30, L_shr(foa_const_fx,1) ) ) ); // Q_in - 1
                }
            }
        }
@@ -1927,8 +1927,8 @@ ivas_error ivas_binRenderer_open_fx(
        {
            FOR( k = 0; k < 11; k++ )
            {
                ivas_dirac_dec_get_response_fixed( (Word16) L_shr_r( ls_azimuth_CICP19_fx[k], 22 ), (Word16) L_shr_r( ls_elevation_CICP19_fx[k], 22 ), hBinRenderer->hReverb->foa_enc_fx[k], 1 );
                // Q29: hBinRenderer->hReverb->foa_enc_fx[k]
                ivas_dirac_dec_get_response_fx( (Word16) L_shr_r( ls_azimuth_CICP19_fx[k], 22 ), (Word16) L_shr_r( ls_elevation_CICP19_fx[k], 22 ), hBinRenderer->hReverb->foa_enc_fx[k], 1 );
                // Q31: hBinRenderer->hReverb->foa_enc_fx[k]
            }
        }
        ELSE IF( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
+1 −1
Original line number Diff line number Diff line
@@ -4704,7 +4704,7 @@ void ivas_dirac_dec_render_sf_fx(
                            {
                                Word32 g_fx;
                                w2_fx = sub( MAX16B, *w1_fx );
                                g_fx = L_add( Mpy_32_16_1( gain_fx, *w1_fx ), Mpy_32_16_1( prev_gain_fx, w2_fx ) );
                                g_fx = L_add( L_shr(Mpy_32_16_1( gain_fx, *w1_fx ),1), L_shr(Mpy_32_16_1( prev_gain_fx, w2_fx ),1) );
                                FOR( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
                                {
                                    Word32 tmp;
Loading