Commit 62a69000 authored by vaclav's avatar vaclav
Browse files

remove dead code in ivas_sba_prototype_renderer_sf()

parent efe63d59
Loading
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -4351,14 +4351,6 @@ void ivas_sba_mix_matrix_determiner(
    const int16_t output_frame                                  /* i  : output frame length                     */
);

#ifdef JBM_TSM_ON_TCS
void ivas_sba_prototype_renderer_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder struct                     */
    float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Input audio in CLDFB domain, real */
    float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]  /* i  : Input audio in CLDFB domain, imag */
);
#endif

/* AGC */
/*! r: AGC enable flag */
int16_t ivas_agc_enc_get_flag(
+0 −161
Original line number Diff line number Diff line
@@ -44,167 +44,6 @@
#include "wmc_auto.h"


#ifdef JBM_TSM_ON_TCS
/*-------------------------------------------------------------------*
 * ivas_sba_prototype_renderer_sf()
 *
 * Render prototype audio signals using SBA mixing matrices
 *-------------------------------------------------------------------*/

void ivas_sba_prototype_renderer_sf(
    Decoder_Struct *st_ivas,                                          /* i/o: IVAS decoder struct               */
    float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Input audio in CLDFB domain, real */
    float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]  /* i  : Input audio in CLDFB domain, imag */
)
{
    float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS];
    SPAR_DEC_HANDLE hSpar;
    DECODER_CONFIG_HANDLE hDecoderConfig;
    int16_t num_spar_bands, spar_band;
    int16_t b, ts;
    int16_t num_cldfb_bands, numch_in, numch_out;
    int16_t cldfb_band;
    int16_t out_ch, in_ch;
    int16_t firstInCh, inChEnd, firstOutCh, outChEnd;
    int16_t slot_idx_start;

    push_wmops( "ivas_sba_prototype_renderer" );

    hSpar = st_ivas->hSpar;
    hDecoderConfig = st_ivas->hDecoderConfig;
    num_spar_bands = hSpar->hFbMixer->pFb->filterbank_num_bands;

    num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands;
    numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans;
    numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans;

    if ( st_ivas->nchan_transport == 1 )
    {
        firstInCh = 0;
        inChEnd = 1;
        firstOutCh = 0;
        outChEnd = 1;
    }
    else /* 2 TC */
    {
        firstInCh = 0;
        inChEnd = 2;
        firstOutCh = 1;
        outChEnd = 2;
    }
    slot_idx_start = hSpar->slots_rendered;

    /* Apply mixing matrix */
    for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ )
    {
        int16_t md_idx = hSpar->render_to_md_map[ts + slot_idx_start];

        /* determine SPAR parameters for this time slot */
        ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat );

        for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ )
        {
            float out_re[IVAS_SPAR_MAX_CH];
            float out_im[IVAS_SPAR_MAX_CH];
            float cldfb_par;
            ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band;

            for ( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ )
            {
                out_re[out_ch] = 0.0f;
                out_im[out_ch] = 0.0f;

                for ( in_ch = firstInCh; in_ch < inChEnd; in_ch++ )
                {
                    if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */
                    {
                        spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band];
                        cldfb_par = mixer_mat[out_ch][in_ch][spar_band];
                    }
                    else
                    {
                        cldfb_par = 0.0f;
                        for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ )
                        {
                            /* accumulate contributions from all SPAR bands */
                            cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band];
                        }
                    }

                    out_re[out_ch] += inRe[in_ch][ts][cldfb_band] * cldfb_par;
                    out_im[out_ch] += inIm[in_ch][ts][cldfb_band] * cldfb_par;
                }
            }

            /*update CLDFB data with the parameter-modified data*/
            for ( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ )
            {
                inRe[out_ch][ts][cldfb_band] = out_re[out_ch];
                inIm[out_ch][ts][cldfb_band] = out_im[out_ch];
            }
        }

        /* Update mixing matrices */
        if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) )
        {
            /* we have crossed an unadapted parameter sf border, update previous mixing matrices */
            int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME;
            hSpar->i_subframe++;
            hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES );
            mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS );
            mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS );
            mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS );
            mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS );

            for ( out_ch = 0; out_ch < numch_out; out_ch++ )
            {
                for ( in_ch = 0; in_ch < numch_in; in_ch++ )
                {
                    for ( b = 0; b < num_spar_bands; b++ )
                    {
                        hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS];
                    }
                }
            }
        }
    }

    /* Create prototypes */
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
    {
        for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ )
        {
            if ( st_ivas->nchan_transport == 1 ) /* Dual mono */
            {
                mvr2r( inRe[0][ts], inRe[1][ts], CLDFB_NO_CHANNELS_MAX );
                mvr2r( inIm[0][ts], inIm[1][ts], CLDFB_NO_CHANNELS_MAX );
            }
            else if ( st_ivas->nchan_transport == 2 ) /* Opposing cardioids */
            {
                float temp_signal[CLDFB_NO_CHANNELS_MAX];

                v_add( inRe[0][ts], inRe[1][ts], temp_signal, CLDFB_NO_CHANNELS_MAX );
                v_sub( inRe[0][ts], inRe[1][ts], inRe[1][ts], CLDFB_NO_CHANNELS_MAX );
                mvr2r( temp_signal, inRe[0][ts], CLDFB_NO_CHANNELS_MAX );
                v_multc( inRe[0][ts], 0.5f, inRe[0][ts], CLDFB_NO_CHANNELS_MAX );
                v_multc( inRe[1][ts], 0.5f, inRe[1][ts], CLDFB_NO_CHANNELS_MAX );

                v_add( inIm[0][ts], inIm[1][ts], temp_signal, CLDFB_NO_CHANNELS_MAX );
                v_sub( inIm[0][ts], inIm[1][ts], inIm[1][ts], CLDFB_NO_CHANNELS_MAX );
                mvr2r( temp_signal, inIm[0][ts], CLDFB_NO_CHANNELS_MAX );
                v_multc( inIm[0][ts], 0.5f, inIm[0][ts], CLDFB_NO_CHANNELS_MAX );
                v_multc( inIm[1][ts], 0.5f, inIm[1][ts], CLDFB_NO_CHANNELS_MAX );
            }
        }
    }

    pop_wmops();

    return;
}
#endif


/*-------------------------------------------------------------------*
 * ivas_sba_prototype_renderer()
 *