Commit 86f23594 authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

re-review

parent 4627fb90
Loading
Loading
Loading
Loading
Loading
+233 −193

File changed.

Preview size limit exceeded, changes collapsed.

+98 −95
Original line number Diff line number Diff line
@@ -112,6 +112,8 @@ void ivas_mc_paramupmix_dec_read_BS(
            {
                hMCParamUpmix->alphas_fx[i][k] = hMCParamUpmix->alpha_prev_fx[i][k];
                hMCParamUpmix->betas_fx[i][k] = hMCParamUpmix->beta_prev_fx[i][k];
                move32();
                move32();
            }
        }
        hMCParamUpmix->first_frame = 1;
@@ -408,7 +410,7 @@ ivas_error ivas_mc_paramupmix_dec_open(
            move16();
        }

        IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK )
        IF( EQ_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
@@ -561,7 +563,7 @@ static void ivas_param_upmix_dec_decorr_subframes(

    WHILE( nSamplesLeftForTD )
    {
        int16_t nSamplesToDecorr = s_min( nSamplesLeftForTD, default_frame );
        Word16 nSamplesToDecorr = s_min( nSamplesLeftForTD, default_frame );

        {
            Word16 i, q_format[MC_PARAMUPMIX_COMBINATIONS];
@@ -721,24 +723,25 @@ static void ivas_mc_paramupmix_dec_sf(
    assert( hMCParamUpmix );
    push_wmops( "ivas_mc_paramupmix_dec_sf" );

    for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ )
    FOR( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ )
    {
        pPcm_temp_fx[2 * i] = output_fx[i + 4];     /* un-decorrelated */
        pPcm_temp_fx[2 * i + 1] = output_fx[i + 8]; /* decorrelated */
    }

    /* CLDFB Analysis*/
    for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ )
    FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ )
    {
        /* slot loop for gathering the input data */
        for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
        FOR( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
        {
            Word16 q_cldfb = 11;
            move16();
            cldfbAnalysis_ts_fx_fixed_q( &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_cldfb );
        }
    }

    for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
    FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
    {
        ps_pred_process_sf( hMCParamUpmix,
                            st_ivas->hTcBuffer,
@@ -751,9 +754,9 @@ static void ivas_mc_paramupmix_dec_sf(
                            st_ivas->hTcBuffer->slots_rendered );

        /*-- m, s -> l, r ----------------------------*/
        for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
        FOR( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
        {
            for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ )
            FOR( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ )
            {
                Word32 qlre_fx = Cldfb_RealBuffer_fx[2 * ch][slot_idx][k];
                Word32 qlim_fx = Cldfb_ImagBuffer_fx[2 * ch][slot_idx][k];
@@ -768,7 +771,7 @@ static void ivas_mc_paramupmix_dec_sf(
        }
    }

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
    IF( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
    {
        Word16 temp_e;
        maxBand = BASOP_Util_Divide3232_Scale( (Word32) W_mult0_32_32( CLDFB_NO_CHANNELS_MAX, st_ivas->hDecoderConfig->output_Fs ), 48000, &temp_e );
@@ -779,13 +782,13 @@ static void ivas_mc_paramupmix_dec_sf(
        /* cldfb analysis of non-coupled, non-LFE channels */
        idx_in = 0;
        move16();
        for ( ch = 0; ch < MC_PARAMUPMIX_MAX_INPUT_CHANS - 2 * MC_PARAMUPMIX_COMBINATIONS; ch++ )
        FOR( ch = 0; ch < MC_PARAMUPMIX_MAX_INPUT_CHANS - 2 * MC_PARAMUPMIX_COMBINATIONS; ch++ )
        {
            if ( st_ivas->hIntSetup.index_lfe[0] != ch )
            IF( st_ivas->hIntSetup.index_lfe[0] != ch )
            {
                pPcm_temp_fx[ch] = output_fx[ch];
                /* slot loop for gathering the input data */
                for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
                FOR( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
                {
                    Word16 q_cldfb = 11;
                    move16();
@@ -801,9 +804,9 @@ static void ivas_mc_paramupmix_dec_sf(


        /* copy and reorder cldfb analysis of coupled channels */
        for ( ch = 0; ch < MAX_PARAM_SPATIAL_SUBFRAMES; ch++ )
        FOR( ch = 0; ch < MAX_PARAM_SPATIAL_SUBFRAMES; ch++ )
        {
            for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
            FOR( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
            {
                Copy32( Cldfb_RealBuffer_fx[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_RealBuffer_subfr_fx[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX );
                Copy32( Cldfb_ImagBuffer_fx[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_ImagBuffer_subfr_fx[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX );
@@ -813,9 +816,9 @@ static void ivas_mc_paramupmix_dec_sf(
            idx_in = add( idx_in, 2 );
        }

        if ( st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
        IF( st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
        {
            for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
            FOR( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
            {
                ivas_param_mc_mc2sba_cldfb_fx( st_ivas->hTransSetup, hMCParamUpmix->hoa_encoder_fx, slot_idx, Cldfb_RealBuffer_subfr_fx, Cldfb_ImagBuffer_subfr_fx, maxBand, GAIN_LFE_FX );
            }
@@ -833,21 +836,21 @@ static void ivas_mc_paramupmix_dec_sf(
                             Cldfb_RealBuffer_subfr_fx,
                             Cldfb_ImagBuffer_subfr_fx, &input_q );

        for ( int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ )
        FOR( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ )
        {
            for ( int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ )
            FOR( Word16 idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ )
            {
                Scale_sig32( Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, sub( 6, input_q ) );
                Scale_sig32( Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, sub( 6, input_q ) );
            }
        }
        /* Implement CLDFB synthesis */
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES];
            Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES];

            for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ )
            FOR( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ )
            {
                RealBuffer_fx[slot_idx] = Cldfb_RealBuffer_Binaural_fx[ch][slot_idx];
                ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[ch][slot_idx];
@@ -860,12 +863,12 @@ static void ivas_mc_paramupmix_dec_sf(
            st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11;
            move16();
        }
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            Scale_sig32( output_fx[ch], imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), 6 );
        }
    }
    else
    ELSE
    {
        /*  boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */
        pPcm_temp_fx[0] = output_fx[4];
@@ -878,12 +881,12 @@ static void ivas_mc_paramupmix_dec_sf(
        pPcm_temp_fx[7] = output_fx[11];

        /* CLDFB synthesis */
        for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ )
        FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ )
        {
            scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, sub( Q5, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) );
            st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q5;
            move16();
            for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
            FOR( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
            {
                Word32 *ptr_im_fx[1], *ptr_re_fx[1];

@@ -898,16 +901,16 @@ static void ivas_mc_paramupmix_dec_sf(
            move16();
        }
        // Done to keep entire buffer in q11
        for ( ch = 4; ch < 12; ch++ )
        FOR( ch = 4; ch < 12; ch++ )
        {
            Scale_sig32( output_fx[ch], imult1616( hMCParamUpmix->num_freq_bands, st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] ), 6 );
        }
        /* adjust delay of other channels */
        noparamupmix_delay = NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS );
        n_samples_rendered = imult1616( st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered], hMCParamUpmix->num_freq_bands );
        if ( n_samples_rendered > noparamupmix_delay )
        IF( n_samples_rendered > noparamupmix_delay )
        {
            for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
            FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
            {
                Word32 tmp_buf_fx[L_SUBFRAME5MS_48k];
                Copy32( &output_fx[ch][sub( n_samples_rendered, noparamupmix_delay )], tmp_buf_fx, noparamupmix_delay );
@@ -916,9 +919,9 @@ static void ivas_mc_paramupmix_dec_sf(
                Copy32( tmp_buf_fx, hMCParamUpmix->pcm_delay_fx[ch], noparamupmix_delay );
            }
        }
        else
        ELSE
        {
            for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
            FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
            {
                Word32 tmp_buf_fx[L_SUBFRAME5MS_48k];
                Copy32( &output_fx[ch][0], tmp_buf_fx, n_samples_rendered );
+84 −77

File changed.

Preview size limit exceeded, changes collapsed.

+16 −14
Original line number Diff line number Diff line
@@ -181,11 +181,13 @@ static void applyGlobalILD_fx(

    FOR( ch = 0; ch < ( hMCT->nchan_out_woLFE ); ch++ )
    {
        IF(EQ_16(sts[ch]->core, TCX_20_CORE)) {
        IF( EQ_16( sts[ch]->core, TCX_20_CORE ) )
        {
            nSubframes = 1;
            move16();
        }
        ELSE{
        ELSE
        {
            nSubframes = NB_DIV;
            move16();
        }
@@ -305,8 +307,8 @@ void mctStereoIGF_dec_fx(
        move16();

        // Using input Q-factor as 12
        set16_fx( p_x_e[0], sub( 31, Q12 ), CPE_CHANNELS );
        set16_fx( p_x_e[1], sub( 31, Q12 ), CPE_CHANNELS );
        set16_fx( p_x_e[0], 31 - Q12, CPE_CHANNELS );
        set16_fx( p_x_e[1], 31 - Q12, CPE_CHANNELS );

        FOR( k = 0; k < nSubframes; k++ )
        {
@@ -336,12 +338,12 @@ void mctStereoIGF_dec_fx(
                // Shifting output with variable exponent back to Q12
                FOR( Word16 i = 0; i < p_x_len[0][k]; i++ )
                {
                    p_x[0][k][i] = L_shr( p_x[0][k][i], sub(sub(31, Q12), p_x_e[0][k]) );
                    p_x[0][k][i] = L_shr( p_x[0][k][i], sub( 31 - Q12, p_x_e[0][k] ) );
                    move32();
                }
                FOR( Word16 i = 0; i < p_x_len[1][k]; i++ )
                {
                    p_x[1][k][i] = L_shr( p_x[1][k][i], sub(sub(31, Q12), p_x_e[1][k]) );
                    p_x[1][k][i] = L_shr( p_x[1][k][i], sub( 31 - Q12, p_x_e[1][k] ) );
                    move32();
                }
            }
@@ -353,7 +355,7 @@ void mctStereoIGF_dec_fx(

                    st = sts[ch];
                    test();
                    IF( bfi && EQ_16( st->core, ACELP_CORE ) ) /*no igf processing needed*/
                    IF( bfi && ( st->core == ACELP_CORE ) ) /*no igf processing needed*/
                    {
                        CONTINUE;
                    }
@@ -370,7 +372,7 @@ void mctStereoIGF_dec_fx(

                    /* mono or dual mono IGF decoding */

                    x_e = sub(31, Q12); // input q-factor of x[p_ch[ch]][k] is Q12
                    x_e = 31 - Q12; // input q-factor of x[p_ch[ch]][k] is Q12
                    move16();

                    decoder_tcx_IGF_mono_fx( st, x[p_ch[ch]][k], &x_e, &x_len, L_frame[ch], left_rect[ch], bfi, k );
@@ -378,7 +380,7 @@ void mctStereoIGF_dec_fx(
                    FOR( Word16 i = 0; i < x_len; i++ )
                    {
                        // Converting from variable exponent to Fixed q-factor (Q12)
                        x[p_ch[ch]][k][i] = L_shr( x[p_ch[ch]][k][i], sub(sub(31, Q12), x_e ) );
                        x[p_ch[ch]][k][i] = L_shr( x[p_ch[ch]][k][i], sub( 31 - Q12, x_e ) );
                        move32();
                    }
                }
@@ -386,7 +388,7 @@ void mctStereoIGF_dec_fx(
        }
    }

    IF( NE_16( sum16_fx( singleChEle, ( hMCT->nchan_out_woLFE ) ), 0 ) )
    IF( sum16_fx( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 )
    {
        FOR( ch = 0; ch < ( hMCT->nchan_out_woLFE ); ch++ )
        {
@@ -394,7 +396,7 @@ void mctStereoIGF_dec_fx(
            {
                st = stm[ch];
                test();
                IF( bfi && EQ_16( st->core, ACELP_CORE ) ) /*no igf processing needed*/
                IF( bfi && ( st->core == ACELP_CORE ) ) /*no igf processing needed*/
                {
                    CONTINUE;
                }
@@ -421,7 +423,7 @@ void mctStereoIGF_dec_fx(
                    init_tcx_info_fx( st, L_frame_nSubframe, L_frameTCX_nSubframe, k, bfi, &tcx_offset[0], &tcx_offsetFB[0], &L_frame[0], &L_frameTCX[0], &left_rect[0], &L_spec[0] );

                    /* mono or dual mono IGF decoding */
                    x_e = sub( 31, Q12 ); // Input Q-factor is Q12.
                    x_e = 31 - Q12; // Input Q-factor is Q12.
                    move16();

                    decoder_tcx_IGF_mono_fx( st, x[ch][k], &x_e, &x_len, L_frame[0], left_rect[0], bfi, k );
@@ -429,7 +431,7 @@ void mctStereoIGF_dec_fx(
                    FOR( Word16 i = 0; i < x_len; i++ )
                    {
                        // Converting from variable exponent to Fixed q-factor (Q12)
                        x[ch][k][i] = L_shr( x[ch][k][i], sub( sub( 31, Q12 ), x_e ) );
                        x[ch][k][i] = L_shr( x[ch][k][i], sub( 31 - Q12, x_e ) );
                    }
                }
            }