Commit 0f6d8180 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'optimizations_renderer_sba_enc' into 'main'

Optimizations in renderer and SBA encoder

See merge request !1672
parents 64b7cd49 a50df063
Loading
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -759,6 +759,13 @@ void ivas_fb_mixer_process_fx(
    pMdft_out_fx[0] = Mdft_out_0_fx;
    pMdft_out_fx[1] = Mdft_out_1_fx;

#ifdef OPT_SBA_ENC_V1_BE
    Word16 total_guard = find_guarded_bits_fx( num_bands );
    Word16 total_guard_2 = find_guarded_bits_fx( shl( frame_len, 1 ) );
    Word16 tmp_q = sub( sub( *q_mixer_mat_fx, total_guard ), 32 ); // Q30 + hFbMixer->q_prior_mixer_fx - 31 - total_guard - 31
    Word16 len = shl( frame_len, 1 );
    Word16 res_q, q_check;
#endif
    FOR( ch = ( hFbMixer->fb_cfg->active_w_mixing == 0 ); ch < hFbMixer->fb_cfg->num_out_chans; ch++ )
    {
        /* Run a loop of 2 to calculate current frame's filterbank output and prev frame's output */
@@ -773,6 +780,12 @@ void ivas_fb_mixer_process_fx(
                IF( in_out_mixer_map[ch][j] != 0 )
                {

#ifdef OPT_SBA_ENC_V1_BE
                    res_q = add( tmp_q, hFbMixer->q_ppFilterbank_inFR[j] );
                    q_check = s_min( q_pOut_fr_fx, res_q );
                    scale_sig32( pOut_fr_re_fx, frame_len, sub( q_check, q_pOut_fr_fx ) );
                    scale_sig32( pOut_fr_im_fx, frame_len, sub( q_check, q_pOut_fr_fx ) );
#endif
                    Word32 filterbank_mixer_bins_re_fx[L_FRAME48k];
                    Word32 filterbank_mixer_bins_im_fx[L_FRAME48k];
                    Word32 *pFb_inFR_re_fx = hFbMixer->ppFilterbank_inFR_re_fx[j]; // Q(hFbMixer->q_ppFilterbank_inFR_re_fx)
@@ -781,8 +794,10 @@ void ivas_fb_mixer_process_fx(
                    set_zero_fx( filterbank_mixer_bins_re_fx, frame_len );
                    set_zero_fx( filterbank_mixer_bins_im_fx, frame_len );

#ifndef OPT_SBA_ENC_V1_BE
                    Word16 total_guard = find_guarded_bits_fx( num_bands );
                    move16();
#endif
                    FOR( i = 0; i < num_bands; i++ )
                    {
                        Word16 start_offset = pFb->fb_consts.pFilterbank_bins_start_offset[i];
@@ -808,15 +823,19 @@ void ivas_fb_mixer_process_fx(
                        hFbMixer->prior_mixer_fx[ch][j][i] = mixer_mat_fx[ch][j][i]; // Q(q_mixer_mat_fx)
                        move32();
                    }
#ifndef OPT_SBA_ENC_V1_BE
                    Word16 res_q = 0;
                    move16();
#endif
                    FOR( k = 0; k < frame_len; k++ )
                    {
                        Word32 temp_out_re_fx, temp_out_im_fx;

                        ivas_cmult_fix( filterbank_mixer_bins_re_fx[k], filterbank_mixer_bins_im_fx[k], pFb_inFR_re_fx[k],
                                        pFb_inFR_im_fx[k], &temp_out_re_fx, &temp_out_im_fx );
#ifndef OPT_SBA_ENC_V1_BE
                        res_q = sub( add( sub( sub( add( 30, *q_mixer_mat_fx ), 31 ), total_guard ), hFbMixer->q_ppFilterbank_inFR[j] ), 31 );

                        Word16 q_check = s_min( q_pOut_fr_fx, res_q );
                        IF( NE_16( q_check, q_pOut_fr_fx ) )
                        {
@@ -825,31 +844,48 @@ void ivas_fb_mixer_process_fx(
                            pOut_fr_im_fx[k] = L_shr( pOut_fr_im_fx[k], sub( q_pOut_fr_fx, q_check ) ); // q_pOut_fr_fx -> q_check
                            move32();
                        }
#endif
                        IF( NE_16( q_check, res_q ) )
                        {
                            temp_out_re_fx = L_shr( temp_out_re_fx, sub( res_q, q_check ) ); // res_q -> q_check
                            temp_out_im_fx = L_shr( temp_out_im_fx, sub( res_q, q_check ) ); // res_q -> q_check
                        }
#ifndef OPT_SBA_ENC_V1_BE
                        res_q = q_check;
                        move16();
#endif

                        pOut_fr_re_fx[k] = L_add_sat( pOut_fr_re_fx[k], temp_out_re_fx ); // res_q
                        move32();
                        pOut_fr_im_fx[k] = L_add_sat( pOut_fr_im_fx[k], temp_out_im_fx ); // res_q
                        move32();
                    }
#ifdef OPT_SBA_ENC_V1_BE
                    q_pOut_fr_fx = q_check;
#else
                    q_pOut_fr_fx = res_q;
                    move16();
#endif
                }
            }
#ifndef OPT_SBA_ENC_V1_BE
            Word16 scale = sub( s_min( L_norm_arr( pOut_fr_re_fx, frame_len ), L_norm_arr( pOut_fr_im_fx, frame_len ) ), find_guarded_bits_fx( shl( frame_len, 1 ) ) );
#else
            Word16 scale = sub( s_min( L_norm_arr( pOut_fr_re_fx, frame_len ), L_norm_arr( pOut_fr_im_fx, frame_len ) ), total_guard_2 );
#endif
            scale_sig32( pOut_fr_re_fx, frame_len, scale );
            scale_sig32( pOut_fr_im_fx, frame_len, scale );
            ivas_imdft_fx( pOut_fr_re_fx, pOut_fr_im_fx, pMdft_out_fx[hist], frame_len );
            q_pMdft_out_fx[hist] = add( q_pOut_fr_fx, scale );
            move16();
        }
#ifdef OPT_SBA_ENC_V1_BE
        scale_sig32( pMdft_out_fx[0], len, sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[0] ) );
        scale_sig32( pMdft_out_fx[1], len, sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[1] ) );
#else
        scale_sig32( pMdft_out_fx[0], shl( frame_len, 1 ), sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[0] ) );
        scale_sig32( pMdft_out_fx[1], shl( frame_len, 1 ), sub( s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] ), q_pMdft_out_fx[1] ) );
#endif
        ivas_fb_mixer_cross_fading_fx( hFbMixer, ppOut_pcm_fx, pMdft_out_fx[0], pMdft_out_fx[1], ch, frame_len, frame_len );
        q_ppOut_pcm_fx[ch] = s_min( q_pMdft_out_fx[0], q_pMdft_out_fx[1] );
        move16();
+75 −3
Original line number Diff line number Diff line
@@ -1995,15 +1995,23 @@ static void ivas_calc_post_pred_per_band_enc_fx(
    Word16 *q_postpred_cov_re )
{
    Word16 i, j, k;
#ifndef OPT_SBA_ENC_V1_BE
    Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word16 min_val;
#else
    Word16 max_val;
    Word16 temp;
    Word32 temp_add;
    Word16 e_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
#endif
    Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    Word32 tmp_re;
    Word16 tmp_q;
    Word16 tmp_e;

#ifndef OPT_SBA_ENC_V1_BE
    FOR( i = 0; i < num_ch; i++ )
    {
        FOR( j = 0; j < num_ch; j++ )
@@ -2013,25 +2021,40 @@ static void ivas_calc_post_pred_per_band_enc_fx(
        }
    }


    FOR( i = 0; i < num_ch; i++ )
    {
        set32_fx( temp_mat[i], 0, num_ch );
        set32_fx( postpred_cov_re[i], 0, num_ch );
    }
#endif

#ifdef OPT_SBA_ENC_V1_BE
    max_val = MIN16B;
    move16();
    temp = sub( 62, q_mixer_mat );
#else
    min_val = MAX16B;
    move16();
#endif

    /* num_ch x num_ch mult */
    FOR( i = 0; i < num_ch; i++ )
    {
        FOR( j = 0; j < num_ch; j++ )
        {
#ifndef OPT_SBA_ENC_V1_BE
            temp_mat[i][j] = 0;
#else
            temp_add = 0;
#endif
            move32();
            temp_mat_e[i][j] = 0;
            move16();

            FOR( k = 0; k < num_ch; k++ )
            {
#ifndef OPT_SBA_ENC_V1_BE
                tmp_re = Mpy_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] );
                tmp_e = sub( 62, add( q_cov_real[i][k][band_idx], q_mixer_mat ) );
                IF( tmp_re )
@@ -2039,34 +2062,71 @@ static void ivas_calc_post_pred_per_band_enc_fx(
                    temp_mat[i][j] = BASOP_Util_Add_Mant32Exp( temp_mat[i][j], temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] );
                    move32();
                }
#else
                tmp_re = Mpy_32_32( cov_real[i][k][band_idx], mixer_mat[j][k][band_idx] );
                tmp_e = sub( temp, q_cov_real[i][k][band_idx] );
                IF( tmp_re )
                {
                    temp_add = BASOP_Util_Add_Mant32Exp( temp_add, temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] );
                }
#endif
            }
#ifdef OPT_SBA_ENC_V1_BE
            temp_mat[i][j] = temp_add;
            move32();
#endif
        }
    }

    tmp_e = sub( Q31, q_mixer_mat );
    /* num_ch x num_ch mult */
    FOR( i = 0; i < num_ch; i++ )
    {
        FOR( j = i; j < num_ch; j++ )
        {
#ifdef OPT_SBA_ENC_V1_BE
            temp_add = 0;
            move32();
            e_postpred_cov_re_buf[i][j] = sub( 31, *q_postpred_cov_re );
#else
            q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re;
#endif
            move16();
            FOR( k = 0; k < num_ch; k++ )
            {
                tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] );
#ifdef OPT_SBA_ENC_V1_BE
                tmp_q = add( tmp_e, temp_mat_e[k][j] );
#else
                tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] );
#endif
                IF( tmp_re )
                {
#ifndef OPT_SBA_ENC_V1_BE
                    tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] );
                    postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e );
                    move32();
                    q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e );
                    move16();
#else
                    temp_add = BASOP_Util_Add_Mant32Exp( temp_add, e_postpred_cov_re_buf[i][j], tmp_re, tmp_q, &e_postpred_cov_re_buf[i][j] );
#endif
                }
            }
#ifndef OPT_SBA_ENC_V1_BE
            IF( postpred_cov_re[i][j] )
            {
                min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] );
#else
            if ( temp_add )
            {
                max_val = s_max( max_val, e_postpred_cov_re_buf[i][j] );
#endif
            }
#ifdef OPT_SBA_ENC_V1_BE
            postpred_cov_re[i][j] = temp_add;
            move32();
#endif
        }
    }

@@ -2077,7 +2137,11 @@ static void ivas_calc_post_pred_per_band_enc_fx(
        {
            IF( postpred_cov_re[i][j] )
            {
#ifdef OPT_SBA_ENC_V1_BE
                postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( max_val, e_postpred_cov_re_buf[i][j] ) );
#else
                postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) );
#endif
                move32();
            }
        }
@@ -2092,13 +2156,21 @@ static void ivas_calc_post_pred_per_band_enc_fx(
            move32();
        }
    }

#ifdef OPT_SBA_ENC_V1_BE
    if ( EQ_16( max_val, MIN16B ) )
    {
        max_val = 0;
        move16();
    }
    *q_postpred_cov_re = sub( Q31, max_val );
#else
    if ( EQ_16( min_val, MAX16B ) )
    {
        min_val = Q31;
        move16();
    }
    *q_postpred_cov_re = min_val;
#endif
    move16();

    return;
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@
#define FIX_1379_MASA_ANGLE_ROUND

/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_SBA_ENC_V1_BE
#define OPT_BIN_RENDERER_V1
#define OPT_BIN_RENDERER_V2
#define OPT_STEREO_32KBPS_V1                    /* Optimization made in stereo decoding path for 32kbps decoding */
#define OPT_AVOID_STATE_BUF_RESCALE             /* Optimization made to avoid rescale of synth state buffer */
#define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx                 /*FhG: WMOPS tuning, nonbe*/
+139 −0
Original line number Diff line number Diff line
@@ -54,7 +54,137 @@
 *
 *
 *-------------------------------------------------------------------------*/
#ifdef OPT_BIN_RENDERER_V2
static void ivas_binRenderer_filterModule_fx(
    Word32 out_Conv_CLDFB_real[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : real part of Binaural signals    Q6 */
    Word32 out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : imag part of Binaural signals    Q6 */
    Word32 CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],                           /* i  : real part of LS signals           Q_curr*/
    Word32 CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],                           /* i  : imag part of LS signals           Q_curr*/
    const Word16 numTimeSlots,                                                                         /* i  : number of time slots to process   */
    BINAURAL_RENDERER_HANDLE hBinRenderer,                                                             /* i/o: fastconv binaural renderer handle */
    Word16 Q_curr )
{
    Word16 bandIdx, k, chIdx, tapIdx;
    Word32 *filterStatesLeftRealPtr_fx, *filterStatesLeftImagPtr_fx;
    Word16 Q_filterStates;
    const Word32 *filterTapsLeftRealPtr_fx, *filterTapsLeftImagPtr_fx, *filterTapsRightRealPtr_fx, *filterTapsRightImagPtr_fx;
    Word16 shift_q;
    Word16 shift_q6 = sub( -29 + 6, Q_curr );
    Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStatesLeft;
    move16();

    // to be checked: feasibility with 32 bit buffers
    Word64 Cldfb_RealBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES];
    Word64 Cldfb_ImagBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES];

    FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
    {
        set64_fx( &Cldfb_RealBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES );
        set64_fx( &Cldfb_ImagBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES );

        FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
        {
            filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] );
            filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] );

            filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx];   // Q29
            filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx];   // Q29
            filterTapsRightRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx]; // Q29
            filterTapsRightImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx]; // Q29

            FOR( k = 0; k < numTimeSlots; k++ )
            {
                Word64 outRealLeft_fx = 0, outRealRight_fx = 0, outImagLeft_fx = 0, outImagRight_fx = 0;
                move64();
                move64();
                move64();
                move64();

                FOR( tapIdx = hBinRenderer->hBinRenConvModule->numTapsArray[bandIdx] - 1; tapIdx > 0; tapIdx-- )
                {
                    filterStatesLeftRealPtr_fx[tapIdx] = filterStatesLeftRealPtr_fx[tapIdx - 1];
                    move32();
                    filterStatesLeftImagPtr_fx[tapIdx] = filterStatesLeftImagPtr_fx[tapIdx - 1];
                    move32();
                    Word32 neg_filterStatesLeftImagPtr_fx = L_negate( filterStatesLeftImagPtr_fx[tapIdx] );


                    outRealLeft_fx = W_mac_32_32( outRealLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
                    outRealLeft_fx = W_mac_32_32( outRealLeft_fx, neg_filterStatesLeftImagPtr_fx, filterTapsLeftImagPtr_fx[tapIdx] );     // Q30 + Q_filterStates

                    outImagLeft_fx = W_mac_32_32( outImagLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
                    outImagLeft_fx = W_mac_32_32( outImagLeft_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates

                    outRealRight_fx = W_mac_32_32( outRealRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
                    outRealRight_fx = W_mac_32_32( outRealRight_fx, neg_filterStatesLeftImagPtr_fx, filterTapsRightImagPtr_fx[tapIdx] );     // Q30 + Q_filterStates

                    outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
                    outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
                }

                shift_q = add( sub( Q_filterStates, Q_curr ), 1 );

                IF( shift_q != 0 )
                {
                    outRealLeft_fx = W_shr( outRealLeft_fx, shift_q );   // Q_curr + Q29
                    outImagLeft_fx = W_shr( outImagLeft_fx, shift_q );   // Q_curr + Q29
                    outRealRight_fx = W_shr( outRealRight_fx, shift_q ); // Q_curr + Q29
                    outImagRight_fx = W_shr( outImagRight_fx, shift_q ); // Q_curr + Q29
                    hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr;
                    move16();
                }

                filterStatesLeftRealPtr_fx[0] = CLDFB_real[chIdx][k][bandIdx];
                move32();
                filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx];
                move32();


                /* Left Real and Imag */

                Word32 temp1 = L_shr( filterStatesLeftRealPtr_fx[0], 1 ); // Q_curr -1
                Word32 temp2 = L_shr( filterStatesLeftImagPtr_fx[0], 1 ); // Q_curr -1
                Word32 neg_temp2 = L_negate( temp2 );                     // Q_curr -1


                outRealLeft_fx = W_mac_32_32( outRealLeft_fx, temp1, filterTapsLeftRealPtr_fx[0] );
                outRealLeft_fx = W_mac_32_32( outRealLeft_fx, neg_temp2, filterTapsLeftImagPtr_fx[0] );
                Cldfb_RealBuffer_64fx[0][k] = W_add( Cldfb_RealBuffer_64fx[0][k], outRealLeft_fx ); // Q29 + Q_curr
                move64();

                outImagLeft_fx = W_mac_32_32( outImagLeft_fx, temp1, filterTapsLeftImagPtr_fx[0] );
                outImagLeft_fx = W_mac_32_32( outImagLeft_fx, temp2, filterTapsLeftRealPtr_fx[0] );
                Cldfb_ImagBuffer_64fx[0][k] = W_add( Cldfb_ImagBuffer_64fx[0][k], outImagLeft_fx ); // Q29 + Q_curr
                move64();

                /* Right Real and Imag */
                outRealRight_fx = W_mac_32_32( outRealRight_fx, temp1, filterTapsRightRealPtr_fx[0] );
                outRealRight_fx = W_mac_32_32( outRealRight_fx, neg_temp2, filterTapsRightImagPtr_fx[0] );
                Cldfb_RealBuffer_64fx[1][k] = W_add( Cldfb_RealBuffer_64fx[1][k], outRealRight_fx ); // Q29 + Q_curr
                move64();

                outImagRight_fx = W_mac_32_32( outImagRight_fx, temp1, filterTapsRightImagPtr_fx[0] );
                outImagRight_fx = W_mac_32_32( outImagRight_fx, temp2, filterTapsRightRealPtr_fx[0] );
                Cldfb_ImagBuffer_64fx[1][k] = W_add( Cldfb_ImagBuffer_64fx[1][k], outImagRight_fx ); // Q29 + Q_curr
                move64();
            }
        }
        FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
        {
            FOR( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ )
            {
                out_Conv_CLDFB_real[chIdx][k][bandIdx] = W_shl_sat_l( Cldfb_RealBuffer_64fx[chIdx][k], shift_q6 ); // Q6
                move32();
                out_Conv_CLDFB_imag[chIdx][k][bandIdx] = W_shl_sat_l( Cldfb_ImagBuffer_64fx[chIdx][k], shift_q6 ); // Q6
                move32();
            }
        }
    }


    return;
}
#else  /* OPT_BIN_RENDERER_V2 */
static void ivas_binRenderer_filterModule_fx(
    Word64 out_Conv_CLDFB_real[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : real part of Binaural signals    Q29 */
    Word64 out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : imag part of Binaural signals    Q29 */
@@ -164,6 +294,7 @@ static void ivas_binRenderer_filterModule_fx(

    return;
}
#endif /* OPT_BIN_RENDERER_V2 */

/*-------------------------------------------------------------------------
 * ivas_binRenderer_convModuleOpen()
@@ -1482,9 +1613,11 @@ void ivas_binRenderer_fx(
)
{
    Word16 chIdx, i, j, k;
#ifndef OPT_BIN_RENDERER_V2
    // to be checked: feasibility with 32 bit buffers
    Word64 Cldfb_RealBuffer_Binaural_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word64 Cldfb_ImagBuffer_Binaural_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
#endif /* OPT_BIN_RENDERER_V2 */
    push_wmops( "fastconv_binaural_rendering" );

    /* Compute Convolution */
@@ -1495,8 +1628,10 @@ void ivas_binRenderer_fx(
        {
            set32_fx( Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX );
            set32_fx( Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX );
#ifndef OPT_BIN_RENDERER_V2
            set64_fx( Cldfb_RealBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX );
            set64_fx( Cldfb_ImagBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX );
#endif /* OPT_BIN_RENDERER_V2 */
        }
    }

@@ -1536,6 +1671,9 @@ void ivas_binRenderer_fx(
        ivas_sba2mc_cldfb_fixed( *( hBinRenderer->hInputSetup ), RealBuffer_fx, ImagBuffer_fx,
                                 hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx );
    }
#ifdef OPT_BIN_RENDERER_V2
    ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in );
#else  /* OPT_BIN_RENDERER_V2 */
    ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in );

    FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
@@ -1551,6 +1689,7 @@ void ivas_binRenderer_fx(
            }
        }
    }
#endif /* OPT_BIN_RENDERER_V2 */
    /* Obtain the binaural dmx and compute the reverb */
    IF( hBinRenderer->hReverb != NULL )
    {
+17 −2
Original line number Diff line number Diff line
@@ -2227,6 +2227,7 @@ void ivas_dirac_dec_render_sf_fx(
        }
    }

#ifndef OPT_BIN_RENDERER_V2
    FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
    {
        FOR( Word16 j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ )
@@ -2235,6 +2236,7 @@ void ivas_dirac_dec_render_sf_fx(
            set32_fx( Cldfb_RealBuffer_Binaural_fx[i][j], 0, CLDFB_NO_CHANNELS_MAX );
        }
    }
#endif /* OPT_BIN_RENDERER_V2 */

    /* local copies of azi, ele, diffuseness */
    Word16 azimuth[CLDFB_NO_CHANNELS_MAX];
@@ -3973,9 +3975,19 @@ void ivas_dirac_dec_render_sf_fx(
                            {
                                Word32 g_fx;
                                w2_fx = sub( MAX16B, *w1_fx );
#ifdef OPT_BIN_RENDERER_V2
                                g_fx = Madd_32_16( Mpy_32_16_1( gain_fx, *w1_fx ), prev_gain_fx, w2_fx ); // Q15
#else                                                                                                     /* OPT_BIN_RENDERER_V2 */
                                g_fx = L_add( Mpy_32_16_1( gain_fx, *w1_fx ), Mpy_32_16_1( prev_gain_fx, w2_fx ) ); // Q15
#endif                                                                                                    /* OPT_BIN_RENDERER_V2 */
                                FOR( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
                                {
#ifdef OPT_BIN_RENDERER_V2
                                    Cldfb_RealBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l] = Madd_32_32( Cldfb_RealBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l], g_fx, *tc_re_fx );
                                    move32();
                                    tc_re_fx++;
                                    Cldfb_ImagBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l] = Madd_32_32( Cldfb_ImagBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l], g_fx, *tc_im_fx );
#else  /* OPT_BIN_RENDERER_V2 */
                                    Word32 tmp;
                                    tmp = Mpy_32_32( g_fx, *tc_re_fx );
                                    Cldfb_RealBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l] = L_add( Cldfb_RealBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l], tmp );
@@ -3983,6 +3995,7 @@ void ivas_dirac_dec_render_sf_fx(
                                    tc_re_fx++;
                                    tmp = Mpy_32_32( g_fx, *tc_im_fx );
                                    Cldfb_ImagBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l] = L_add( Cldfb_ImagBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l], tmp );
#endif /* OPT_BIN_RENDERER_V2 */
                                    move32();
                                    tc_re_fx++;
                                }
@@ -4012,8 +4025,10 @@ void ivas_dirac_dec_render_sf_fx(
                             Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx,
                             Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q );

#ifndef OPT_BIN_RENDERER_V2
        Scale_sig32( Cldfb_RealBuffer_Binaural_fx[0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); // Q6
        Scale_sig32( Cldfb_ImagBuffer_Binaural_fx[0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); // Q6
#endif                                                                                                                                                                    /* OPT_BIN_RENDERER_V2 */

        /* Inverse CLDFB*/
        FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
Loading