Commit 5eced01d authored by vaclav's avatar vaclav
Browse files

accept NONBE_FIX_839_MC_RS_CHANNEL_ALLOC

parent 6e46dec1
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -294,13 +294,11 @@ ivas_error ivas_init_decoder(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
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*/
    const int16_t nchan_out_buff                                /* i  : number of output channels               */
);
#endif

ivas_error stereo_dmx_evs_init_encoder(
    STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS,                   /* o  : Stereo downmix for EVS encoder handle   */
+0 −1
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */

#define NONBE_FIX_839_MC_RS_CHANNEL_ALLOC                     /* FhG: Issues #839: problems with reallocation of the channels on the heap in case of MC RS */
#define BE_FIX_832_ASAN_ERROR_EFAP_OSBA                       /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/
#define NONBE_FIX_819_DOUBLE_PREC_COMB_FORMATS                /* VA: issue 820: Double precision arithmetic in combined formats */
#define NONBE_FIX_849_OMASA_BFI_CRASH                         /* VA: issue 849: fix OMASA 2TC and FEC crashes */
+1 −35
Original line number Diff line number Diff line
@@ -67,11 +67,7 @@ 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 NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
    int16_t nchan_out_buff, nchan_out_buff_old;
#else
    int16_t ch, nchan_out_buff, nchan_out_buff_old;
#endif
    AUDIO_CONFIG intern_config_old;
    IVAS_OUTPUT_SETUP hIntSetupOld;
    RENDERER_TYPE renderer_type_old;
@@ -80,17 +76,12 @@ static ivas_error ivas_ism_bitrate_switching_dec(
    nCPE_old = st_ivas->nCPE;
    nSCE_old = st_ivas->nSCE;

    /* we have to temporarily set the ism mode back to the old one, otherwise this can give wrong results*/
    /* temporarily set the ism mode back to the old one, otherwise this can give wrong results*/
    ism_mode = st_ivas->ism_mode;
    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;
#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#else
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
#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 )
    {
@@ -337,37 +328,12 @@ static ivas_error ivas_ism_bitrate_switching_dec(
    if ( !st_ivas->hDecoderConfig->Opt_5ms )
#endif
    {
#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
        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 ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );


        if ( nchan_out_buff > nchan_out_buff_old )
        {
            for ( ch = nchan_out_buff_old; ch < nchan_out_buff; ch++ )
            {
                /* note: these are intra-frame heap memories */
                if ( ( st_ivas->p_output_f[ch] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */
                {
                    return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) );
                }
            }
        }
        else
        {
            for ( ch = nchan_out_buff; ch < nchan_out_buff_old; ch++ )
            {
                free( st_ivas->p_output_f[ch] );
                st_ivas->p_output_f[ch] = NULL;
            }
        }
#endif
    }

    /*-----------------------------------------------------------------*
+0 −4
Original line number Diff line number Diff line
@@ -450,11 +450,7 @@ void ivas_mc_paramupmix_dec(
        }
    }

#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
    for ( ch = first_empty_channel; ch < ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); ch++ )
#else
    for ( ch = first_empty_channel; ch < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); ch++ )
#endif
    {
        set_f( output_f[ch], 0.0f, output_frame );
    }
+1 −30
Original line number Diff line number Diff line
@@ -731,19 +731,15 @@ static ivas_error ivas_mc_dec_reconfig(
    int16_t tc_granularity_new;
    AUDIO_CONFIG intern_config_old;
    IVAS_OUTPUT_SETUP hIntSetupOld;
#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
    int16_t nchan_out_buff_old, nchan_out_buff;
#endif

    error = IVAS_ERR_OK;
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    nchan_transport_old = st_ivas->nchan_transport;
#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
    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 */

    /* we have to temporally set the current mc_mode back to the previous one to make sure the following call to
    /* temporally set the current mc_mode back to the previous one to make sure the following call to
       ivas_init_dec_get_num_cldfb_instances() returns the correct counts */
    mc_mode = st_ivas->mc_mode;
    st_ivas->mc_mode = last_mc_mode;
@@ -1403,37 +1399,12 @@ static ivas_error ivas_mc_dec_reconfig(
    if ( !st_ivas->hDecoderConfig->Opt_5ms )
    {
#endif
#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
        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 ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
    int16_t nchan_out_buff, ch;
    nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );

    if ( nchan_out_buff > nchan_out_buf_old )
    {
        for ( ch = nchan_out_buf_old; ch < nchan_out_buff; ch++ )
        {
            /* note: these are intra-frame heap memories */
            if ( ( st_ivas->p_output_f[ch] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) );
            }
        }
    }
    else
    {
        for ( ch = nchan_out_buff; ch < nchan_out_buf_old; ch++ )
        {
            free( st_ivas->p_output_f[ch] );
            st_ivas->p_output_f[ch] = NULL;
        }
    }
#endif
#ifndef NONBE_UNIFIED_DECODING_PATHS
    }
#endif
Loading