Commit 40008d54 authored by PLAINSI's avatar PLAINSI
Browse files

Decorrelation JBM split up

parent 8295a205
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3884,7 +3884,8 @@ void ivas_mc_paramupmix_dec_read_BS(
#ifdef JBM_PARAMUPMIX
void ivas_mc_paramupmix_dec_digest_tc(
    Decoder_Struct *st_ivas,                                        /* i/o: IVAS decoder handle                            */
    const uint8_t nCldfbSlots                                       /* i : number of CLFBS slots in the transport channels */
    const uint8_t nCldfbSlots,                                      /* i : number of CLFBS slots in the transport channels */
    const int16_t nSamplesForRendering                              /* i  : number of samples provided   */
);

void ivas_mc_paramupmix_dec_render(
+1 −1
Original line number Diff line number Diff line
@@ -625,7 +625,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer(
#ifdef JBM_PARAMUPMIX
        else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
        {
            ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots );
            ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
        }
#endif
        else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
+29 −19
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_

static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] );

static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas );
static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering );
#endif

static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float pcm_in[][L_FRAME48k], float **pp_out_pcm, const int16_t output_frame );
@@ -303,7 +303,8 @@ void ivas_mc_paramupmix_dec(
#ifdef JBM_PARAMUPMIX
void ivas_mc_paramupmix_dec_digest_tc(
    Decoder_Struct *st_ivas,           /* i/o: IVAS decoder handle                            */
    const uint8_t nCldfbSlots /* i : number of CLFBS slots in the transport channels */
    const uint8_t nCldfbSlots,         /* i : number of CLFBS slots in the transport channels */
    const int16_t nSamplesForRendering /* i  : number of samples provided   */
)
{
    MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix;
@@ -312,7 +313,7 @@ void ivas_mc_paramupmix_dec_digest_tc(

    push_wmops( "ivas_mc_paramupmix_dec_digest_tc" );

    ivas_param_upmix_dec_decorr_subframes( st_ivas );
    ivas_param_upmix_dec_decorr_subframes( st_ivas, nSamplesForRendering );

    /* adapt subframes */
    ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
@@ -607,35 +608,44 @@ static void paramupmix_td_decorr_process_jbm(
}

static void ivas_param_upmix_dec_decorr_subframes(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder handle                                          */
)
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle                                          */
    const int16_t nSamplesForRendering )
{
    MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix;
    int16_t i, ch;
    int32_t output_Fs;
    int16_t output_frame;
    float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/
    float *p_tc[MC_PARAMUPMIX_MAX_INPUT_CHANS];
    float *pPcm_tmp[MC_PARAMUPMIX_COMBINATIONS];
    float *p_tc[MC_PARAMUPMIX_COMBINATIONS];
    int16_t nchan_internal, ch;
    int16_t nSamplesLeftForTD, default_frame;

    hMCParamUpmix = st_ivas->hMCParamUpmix;
    assert( hMCParamUpmix );

    push_wmops( "ivas_param_upmix_dec_decorr_subframes" );

    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );
    /* TD decorrelator */
    default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
    nSamplesLeftForTD = nSamplesForRendering;
    nchan_internal = MC_PARAMUPMIX_COMBINATIONS;

    for ( ch = 0; ch < MC_PARAMUPMIX_MAX_INPUT_CHANS; ch++ )
    for ( ch = 0; ch < nchan_internal; ch++ )
    {
        p_tc[ch] = st_ivas->hTcBuffer->tc[ch];
        pPcm_tmp[ch] = st_ivas->hTcBuffer->tc[ch + 8];
        p_tc[ch] = st_ivas->hTcBuffer->tc[ch + 4];
    }

    for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ )
    while ( nSamplesLeftForTD )
    {
        int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame );

        paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr );

        for ( ch = 0; ch < nchan_internal; ch++ )
        {
        pPcm_temp[i] = p_tc[8 + i]; /* decorrelated */
            p_tc[ch] += nSamplesToDecorr;
        }

    paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, &( p_tc[4] ), pPcm_temp, output_frame );
        nSamplesLeftForTD -= nSamplesToDecorr;
    }

    pop_wmops();