Commit d971738a authored by vaclav's avatar vaclav
Browse files

fix crash + simplification

parent cc809c9f
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -308,12 +308,12 @@ ivas_error ivas_init_decoder(

ivas_error ivas_output_buff_dec(
    float *p_output_f[],                                        /* i/o: output audio buffers                    */
    const int16_t nchan_out_buff_old,                           /* i  : previous frame number of output channels*/
#ifdef FIX_1330_JBM_MEMORY
    const int16_t nchan_out_buff,                               /* i  : number of output channels               */
    const int16_t Opt_tsm,                                      /* i  : TSM option flag                         */
    DECODER_TC_BUFFER_HANDLE hTcBuffer                          /* i  : TSM buffer handle                       */
#else
    const int16_t nchan_out_buff_old,                           /* i  : previous frame number of output channels*/
    const int16_t nchan_out_buff                                /* i  : number of output channels               */
#endif
);
+6 −2
Original line number Diff line number Diff line
@@ -1252,6 +1252,9 @@ ivas_error ivas_init_decoder(
    int16_t sce_id, cpe_id;
    int16_t numCldfbAnalyses, numCldfbSyntheses;
    int16_t granularity, n_channels_transport_jbm;
#ifdef FIX_1330_JBM_MEMORY
    int16_t nchan_out_buff;
#endif
    int32_t output_Fs, ivas_total_brate;
    int32_t delay_ns;
    AUDIO_CONFIG output_config;
@@ -2378,13 +2381,14 @@ ivas_error ivas_init_decoder(
     * Allocate floating-point output audio buffers
     *-----------------------------------------------------------------*/

    k = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, ivas_total_brate );
#ifdef FIX_1330_JBM_MEMORY
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, 0, k, hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
    nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, ivas_total_brate );
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    k = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, ivas_total_brate );
    for ( n = 0; n < k; n++ )
    {
        /* note: these are intra-frame heap memories */
+7 −1
Original line number Diff line number Diff line
@@ -60,7 +60,11 @@ static ivas_error ivas_ism_bitrate_switching_dec(
    int16_t tc_nchan_tc_new;
    int16_t tc_nchan_allocate_new;
    int16_t tc_granularity_new;
#ifdef FIX_1330_JBM_MEMORY
    int16_t nchan_out_buff;
#else
    int16_t nchan_out_buff, nchan_out_buff_old;
#endif

    nCPE_old = st_ivas->nCPE;
    nSCE_old = st_ivas->nSCE;
@@ -70,7 +74,9 @@ static ivas_error ivas_ism_bitrate_switching_dec(
    st_ivas->ism_mode = last_ism_mode;
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    st_ivas->ism_mode = ism_mode;
#ifndef FIX_1330_JBM_MEMORY
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#endif

    if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK )
    {
@@ -323,7 +329,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
     *-----------------------------------------------------------------*/

    nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
    {
        return error;
    }
+7 −1
Original line number Diff line number Diff line
@@ -1320,7 +1320,11 @@ ivas_error ivas_masa_dec_reconfigure(
    Decoder_State **sts;
    int32_t ivas_total_brate, last_ivas_total_brate;
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old;
#ifdef FIX_1330_JBM_MEMORY
    int16_t nchan_out_buff;
#else
    int16_t nchan_out_buff_old, nchan_out_buff;
#endif
    ivas_error error;
    int16_t pos_idx;
    int32_t ism_total_brate;
@@ -1328,8 +1332,10 @@ ivas_error ivas_masa_dec_reconfigure(
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;

#ifndef FIX_1330_JBM_MEMORY
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );

#endif
    /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */
    if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
    {
@@ -1549,7 +1555,7 @@ ivas_error ivas_masa_dec_reconfigure(
    {
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#ifdef FIX_1330_JBM_MEMORY
        if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
#endif
+7 −1
Original line number Diff line number Diff line
@@ -732,11 +732,17 @@ static ivas_error ivas_mc_dec_reconfig(
    int16_t tc_nchan_tc_new;
    int16_t tc_nchan_allocate_new;
    int16_t tc_granularity_new;
#ifdef FIX_1330_JBM_MEMORY
    int16_t nchan_out_buff;
#else
    int16_t nchan_out_buff_old, nchan_out_buff;
#endif

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    nchan_transport_old = st_ivas->nchan_transport;
#ifndef FIX_1330_JBM_MEMORY
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#endif
    last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */

    /* temporally set the current mc_mode back to the previous one to make sure the following call to
@@ -1346,7 +1352,7 @@ static ivas_error ivas_mc_dec_reconfig(

    nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#ifdef FIX_1330_JBM_MEMORY
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
#else
    if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
#endif
Loading