Commit 371e411f authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main-pc-update-step1-merge-version' into 'main-pc'

[skip-name-check] [non-BE][split-non-BE][rend-non-BE][allow-regression]Main pc update step1

See merge request !1909
parents 3f503ab0 c33259e2
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*/
+175 −6

File changed.

Preview size limit exceeded, changes collapsed.

+25 −5
Original line number Diff line number Diff line
@@ -2256,7 +2256,10 @@ void ivas_dirac_dec_render_sf_fx(
        }
    }

#ifndef OPT_BIN_RENDERER_V2
    FOR( Word16 p = 0; p < MAX_HEAD_ROT_POSES; p++ )
    {
        FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
        {
            FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
            {
@@ -2267,6 +2270,8 @@ void ivas_dirac_dec_render_sf_fx(
                }
            }
        }
    }
#endif /* OPT_BIN_RENDERER_V2 */

    /* local copies of azi, ele, diffuseness */
    Word16 azimuth[CLDFB_NO_CHANNELS_MAX];
@@ -3956,9 +3961,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 );
@@ -3966,6 +3981,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++;
                                }
@@ -4006,18 +4022,22 @@ void ivas_dirac_dec_render_sf_fx(
            }
        }

        /*Binaural output in Q6 format*/
        ivas_binRenderer_fx( st_ivas->hBinRenderer,
                             ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
                             st_ivas->hCombinedOrientationData,
                             hSpatParamRendCom->subframe_nbslots[subframe_idx],
                             Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx,
                             Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q );

        Word16 pos_idx;
#ifndef OPT_BIN_RENDERER_V2
        FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
        {
            Scale_sig32( &Cldfb_RealBuffer_Binaural_fx[pos_idx][0][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[pos_idx][0][0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); // Q6
        }
#endif
        IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
            FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
Loading