Commit 21818bb0 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'cldfb_dec_reconfig_integration_float_buff_cleanup_in_renderer_jbm_files' into 'main'

ivas_cldfb_dec_reconfig fxd pt integration, float buffers cleanup

See merge request !346
parents bd11b3ef 196572cf
Loading
Loading
Loading
Loading
+43 −1
Original line number Diff line number Diff line
@@ -2438,6 +2438,48 @@ void mdct_switching_dec(
 * Simulate packet losses by reading FEC pattern from external file
 *-------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
Decoder_State **reset_elements(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
)
{
    Word16 k, n;
    Decoder_State **sts = NULL; /* to avoid compilation warning */

    FOR ( k = 0; k < st_ivas->nSCE; k++ )
    {
        sts = st_ivas->hSCE[k]->hCoreCoder;

        sts[0]->bfi = 0;
        sts[0]->BER_detect = 0;
        sts[0]->mdct_sw_enable = 0;
        sts[0]->mdct_sw = 0;

        move16(); move16(); move16(); move16();

        reset_indices_dec( sts[0] );
    }

    FOR ( k = 0; k < st_ivas->nCPE; k++ )
    {
        sts = st_ivas->hCPE[k]->hCoreCoder;

        FOR ( n = 0; n < CPE_CHANNELS; n++ )
        {
            sts[n]->bfi = 0;
            sts[n]->BER_detect = 0;
            sts[n]->mdct_sw_enable = 0;
            sts[n]->mdct_sw = 0;

            move16(); move16(); move16(); move16();

            reset_indices_dec( sts[n] );
        }
    }

    return sts; /* return last decoder state */
}
#else
Decoder_State **reset_elements(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
)
@@ -2474,7 +2516,7 @@ Decoder_State **reset_elements(

    return sts; /* return last decoder state */
}

#endif

/*-------------------------------------------------------------------*
 * ivas_set_bitstream_pointers()
+1 −0
Original line number Diff line number Diff line
@@ -1024,6 +1024,7 @@ void ivas_param_ism_config_fx(
    }

    hParamIsm->last_dmx_gain_fx = (Word16) 16384;
    hParamIsm->last_dmx_gain_e = 1;
    move16();
    set16_fx( hParamIsm->last_cardioid_left_fx, (Word16) 16384, MAX_NUM_OBJECTS );

+26 −2
Original line number Diff line number Diff line
@@ -353,11 +353,19 @@ ivas_error ivas_dec(
    int16_t *data                                               /* o  : output synthesis signal                 */
);

#ifndef IVAS_FLOAT_FIXED
ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed from the previous frame (JBM) */
    int16_t *data                                               /* o  : output synthesis signal                 */
);
#else
ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder structure                                  */
    UWord16 *nSamplesRendered, /* o  : number of samples flushed from the previous frame (JBM) */
    Word16 *data /* o  : output synthesis signal                 */
);
#endif

#ifndef IVAS_FLOAT_FIXED
ivas_error create_sce_dec(
@@ -464,9 +472,15 @@ ivas_error ivas_mct_dec(
);

/*! r: number of channels to be synthesised */
#ifdef IVAS_FLOAT_FIXED
Word16 getNumChanSynthesis(
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder structure                  */
);
#else
int16_t getNumChanSynthesis(
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder structure                  */
);
#endif

void copy_decoder_config(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                  */
@@ -1318,11 +1332,19 @@ void ivas_ism_dec_digest_tc(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                      */
);

#ifdef IVAS_FLOAT_FIXED
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const UWord16 nCldfbSlots,                                 /* i  : number of CLFBS slots in the transport channels         */
    Word32 *transport_channels_f[]                               /* i  : synthesized core-coder transport channels/DirAC output  */
);
#else
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const uint16_t nCldfbSlots,                                 /* i  : number of CLFBS slots in the transport channels         */
    float *transport_channels_f[]                               /* i  : synthesized core-coder transport channels/DirAC output  */
);
#endif // IVAS_FLOAT_FIXED

void ivas_ism_param_dec_tc_gain_ajust(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
@@ -4163,14 +4185,14 @@ ivas_error ivas_cldfb_dec_reconfig_fx(
    Word16 numCldfbAnalyses_old,                               /* i  : number of CLDFB analysis instances in previous frame  */
    const Word16 numCldfbSyntheses_old                         /* i  : number of CLDFB synthesis instances in previous frame */
);
#endif // IVAS_FLOAT_FIXED

#else
ivas_error ivas_cldfb_dec_reconfig(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                */
    const int16_t nchan_transport_old,                          /* i  : number of TCs in previous frame                       */
    int16_t numCldfbAnalyses_old,                               /* i  : number of CLDFB analysis instances in previous frame  */
    const int16_t numCldfbSyntheses_old                         /* i  : number of CLDFB synthesis instances in previous frame */
);
#endif

/*! r: Ambisonic (SBA) order */
int16_t ivas_sba_get_order(
@@ -6801,6 +6823,7 @@ ivas_error ivas_ls_custom_open(
    LSSETUP_CUSTOM_HANDLE *hLsSetupCustom                       /* o  : Custom loudspeaker setup handle                 */
);

#ifndef IVAS_FLOAT_FIXED
ivas_error ivas_ls_custom_output_init(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder handle                             */
);
@@ -6809,6 +6832,7 @@ void ivas_ls_custom_setup(
    IVAS_OUTPUT_SETUP_HANDLE hOutSetup,                         /* o  : IVAS output setup handle                        */
    LSSETUP_CUSTOM_STRUCT *hLsSetupCustom                 /* i  : Custom loudspeaker setup handle                 */
);
#endif


/*----------------------------------------------------------------------------------*
+2 −2
Original line number Diff line number Diff line
@@ -1011,8 +1011,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx(
    }
    return IVAS_ERR_OK;
}
#endif // IVAS_FLOAT_FIXED

#else
ivas_error ivas_cldfb_dec_reconfig(
    Decoder_Struct *st_ivas,            /* i/o: IVAS decoder structure                                */
    const int16_t nchan_transport_old,  /* i  : number of TCs in previous frame                       */
@@ -1095,3 +1094,4 @@ ivas_error ivas_cldfb_dec_reconfig(

    return IVAS_ERR_OK;
}
#endif // IVAS_FLOAT_FIXED
+3 −35
Original line number Diff line number Diff line
@@ -3588,8 +3588,6 @@ void ivas_dirac_dec_render_sf_fx(
    {
        h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands );
        floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands );

        floatToFixed_arrL( hDirACRend->stack_mem.onset_filter, hDirACRend->stack_mem.onset_filter_fx, Q30, ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ? hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands : 2 * hSpatParamRendCom->num_freq_bands );
    }

    if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD )
@@ -3699,8 +3697,6 @@ void ivas_dirac_dec_render_sf_fx(
            hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth );
            hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y );
        }
        hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = L_get_q_buf( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hSpatParamRendCom->num_freq_bands );
        floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, hSpatParamRendCom->num_freq_bands );

        hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho );
        floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho );
@@ -4208,13 +4204,9 @@ void ivas_dirac_dec_render_sf_fx(
                                                  hDirACRend->h_freq_domain_decorr_ap_params,
                                                  hDirACRend->h_freq_domain_decorr_ap_state );

                DirAC_mem.q_onset_filter = Q31;
                move16();

                v_multc_fixed( onset_filter_fx, 268435456, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); // 268435456 = 0.25 in Q30
                DirAC_mem.q_onset_filter = sub( add( DirAC_mem.q_onset_filter, Q30 ), Q31 );
                v_multc_fixed( onset_filter_fx, 536870912 /* 0.25f in Q31 */, onset_filter_fx, hSpatParamRendCom->num_freq_bands );

                v_add_fixed( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands, 0 ); // Q30
                v_add_fixed( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands, 0 ); /* Q31 */
                p_onset_filter_fx = onset_filter_subframe_fx;
            }
            ELSE
@@ -4243,19 +4235,13 @@ void ivas_dirac_dec_render_sf_fx(
                hDirACRend->proto_frame_dec_f_len = DirAC_mem.frame_dec_f_len;
                move16();
                p_onset_filter_fx = onset_filter_fx;

                scale_sig32( onset_filter_fx, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ), -1 );
                DirAC_mem.q_onset_filter = Q30;
                move16();
            }
        }
        ELSE
        {
            IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
            {
                set_l( onset_filter_subframe_fx, ONE_IN_Q30, hSpatParamRendCom->num_freq_bands );
                DirAC_mem.q_onset_filter = Q30;
                move16();
                set32_fx( onset_filter_subframe_fx, ONE_IN_Q31, hSpatParamRendCom->num_freq_bands );
                p_onset_filter_fx = onset_filter_subframe_fx;
            }
            ELSE
@@ -4308,10 +4294,6 @@ void ivas_dirac_dec_render_sf_fx(
            h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31;
            move16();

            scale_sig32( h_dirac_output_synthesis_state->diffuse_responses_square_fx, num_channels_dir, sub( Q31, h_dirac_output_synthesis_state->diffuse_responses_square_q ) );
            h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31;
            move16();

            exp = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ) );
            scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), exp );
            h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, exp );
@@ -4335,10 +4317,6 @@ void ivas_dirac_dec_render_sf_fx(
            h_dirac_output_synthesis_state->direct_responses_square_q = Q31;
            move16();

            scale_sig32( h_dirac_output_synthesis_state->diffuse_responses_square_fx, num_channels_dir, sub( Q31, h_dirac_output_synthesis_state->diffuse_responses_square_q ) );
            h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31;
            move16();

            exp = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ) );
            scale_sig32( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), exp );
            h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, exp );
@@ -4618,10 +4596,6 @@ void ivas_dirac_dec_render_sf_fx(
        {
            Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, i_mult( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ), sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q ) );
        }
        IF( NE_16( hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q, Q31 ) )
        {
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_fx, hDirACRend->num_outputs_dir, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q ) );
        }

        exp = L_norm_arr( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands );
        scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, exp );
@@ -5183,12 +5157,9 @@ void ivas_dirac_dec_render_sf_fx(
    {
        IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
        {
            fixedToFloat_arrL( onset_filter_fx, DirAC_mem.onset_filter, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands );
            fixedToFloat_arrL( onset_filter_subframe_fx, DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands );
        }
        ELSE
        {
            fixedToFloat_arrL( onset_filter_fx, DirAC_mem.onset_filter, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff );
            me2f_buf( DirAC_mem.frame_dec_f_fx, 31 - DirAC_mem.frame_dec_f_q, DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_len );

            hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f;
@@ -5198,7 +5169,6 @@ void ivas_dirac_dec_render_sf_fx(
    {
        IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
        {
            fixedToFloat_arrL( onset_filter_fx, DirAC_mem.onset_filter, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands );
        }
        ELSE
        {
@@ -5284,8 +5254,6 @@ void ivas_dirac_dec_render_sf_fx(
    }
    ELSE
    {
        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands );

        IF( hDirACRend->masa_stereo_type_detect != NULL )
        {
            hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth );
Loading