Commit c0d03a51 authored by vaclav's avatar vaclav
Browse files

Merge branch '876-nonbe_unified_decoding_paths-increased-memory-consumption_ver2' into 'main'

Resolve "NONBE_UNIFIED_DECODING_PATHS increased memory consumption"

See merge request !1187
parents df1b90d0 b71041a8
Loading
Loading
Loading
Loading
Loading
+33 −7
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ void stereo_dmx_evs_close_encoder(

ivas_error ivas_dec(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                  */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#if( defined SPLIT_REND_WITH_HEAD_ROT && !defined NONBE_UNIFIED_DECODING_PATHS_FIX )
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution     */
    void *data                                                  /* o  : output synthesis signal                 */
#else
@@ -3726,13 +3726,14 @@ void ivas_dirac_dec_set_md_map(
    const int16_t nCldfbTs                                      /* i  : number of CLDFB time slots              */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
void ivas_dirac_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                  */
    float *output_f[],                                          /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t nchan_transport,                              /* i  : number of transport channels                            */
    const int16_t num_subframes                                 /* i  : number of subframes to render           */
);

#endif
void ivas_dirac_dec_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    const int16_t nchan_transport,                              /* i  : number of transport channels            */
@@ -3814,11 +3815,12 @@ void ivas_mc_paramupmix_enc_close(
    const int32_t input_Fs                                      /* i  : input sampling rate                             */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
void ivas_mc_paramupmix_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                     */
    float *output_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output  */
);

#endif
ivas_error ivas_mc_paramupmix_dec_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                          */
);
@@ -4178,12 +4180,13 @@ void ivas_spar_config(
    const int16_t sid_format                                    /* i  : IVAS format indicator from SID frame    */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
ivas_error ivas_sba_upmixer_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder struct                     */
    float *output[],                                            /* i/o: transport/output audio channels         */
    const int16_t output_frame                                  /* i  : output frame length                     */
);

#endif
ivas_error ivas_sba_linear_renderer(
    float *output_f[],                                          /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t output_frame,                                 /* i  : output frame length per channel                         */
@@ -5296,12 +5299,13 @@ void ivas_ism_renderer_close(
    ISM_RENDERER_HANDLE *hIsmRendererData                       /* i/o: ISM renderer handle                             */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS
void ivas_ism_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                          */
    float *output_f[],                                          /* i/o: core-coder transport channels/object output     */
    const int16_t output_frame                                  /* i  : output frame length per channel                 */
);

#endif
void ivas_ism_render_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                          */
    float *output_f[],                                          /* i/o: core-coder transport channels/object output     */
@@ -5334,6 +5338,7 @@ void ivas_param_mc_mc2sba_cldfb(
    const float gain_lfe                                                          /* i  : gain applied to LFE                                        */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
void ivas_ism2sba(
    float *buffer_td[],                                         /* i/o: TD signal buffers                               */
    ISM_RENDERER_HANDLE hIsmRendererData,                       /* i/o: renderer data                                   */
@@ -5343,6 +5348,7 @@ void ivas_ism2sba(
    const int16_t sba_order                                     /* i  : SBA order                                       */
);

#endif
void ivas_ism2sba_sf(
    float *buffer_in[],                                         /* i  : TC buffer                                       */
    float *buffer_out[],                                        /* o  : TD signal buffers                               */
@@ -5691,11 +5697,13 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
    float *output_f[]                                           /* o  : rendered time signal                    */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
ivas_error ivas_osba_dirac_td_binaural(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output[],                                            /* o  : output synthesis signal                 */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
);
#endif

ivas_error ivas_osba_ism_metadata_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
@@ -5704,11 +5712,21 @@ ivas_error ivas_osba_ism_metadata_dec(
    int16_t nb_bits_metadata[]                                  /* o  : number of ISM metadata bits             */
);

#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
ivas_error ivas_osba_render_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    const uint16_t nSamplesAsked,                               /* i  : number of CLDFB slots requested         */
    uint16_t *nSamplesRendered,                                 /* o  : number of CLDFB slots rendered          */
    uint16_t *nSamplesAvailableNext,                            /* o  : number of CLDFB slots still to render   */
    float *output_f[]                                           /* o  : rendered time signal                    */
);
#else
ivas_error ivas_osba_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                      */
    float *output_f[],                                          /* i/o: core-coder transport channels/object output */
    const int16_t output_frame                                  /* i  : output frame length per channel             */
);
#endif

void ivas_osba_data_close(
    SBA_ISM_DATA_HANDLE *hSbaIsmData                            /* i/o: OSBA rendering handle                   */
@@ -5847,12 +5865,13 @@ ivas_error ivas_omasa_ism_metadata_dec(
    int16_t nb_bits_metadata[]                                  /* o  : number of ISM metadata bits             */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS
ivas_error ivas_omasa_dirac_td_binaural(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output[],                                            /* o  : output synthesis signal                 */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
);

#endif
ivas_error ivas_omasa_dirac_td_binaural_jbm(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    const uint16_t nSamplesAsked,                               /* i  : number of samples requested             */
@@ -5862,12 +5881,14 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
    float *output_f[]                                           /* o  : rendered time signal                    */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
void ivas_omasa_dirac_rend(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output[],                                            /* o  : output synthesis signal                 */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
);

#endif
void ivas_omasa_rearrange_channels(
    float *output[],                                            /* o  : output synthesis signal                 */
    const int16_t nchan_transport_ism,                          /* i  : number of ISM TCs                       */
@@ -5899,6 +5920,7 @@ void ivas_omasa_separate_object_renderer_close(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
void ivas_omasa_separate_object_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float input_f[][L_FRAME48k],                                /* i  : separated object signal                 */
@@ -5906,9 +5928,13 @@ void ivas_omasa_separate_object_render(
    const int16_t output_frame                                  /* i  : output frame length per channel         */
);

#endif
void ivas_omasa_separate_object_render_jbm(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const uint16_t nSamplesRendered,                            /* i  : number of samples rendered              */
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    float input_f[][L_FRAME48k],                                /* i  : separated object signal                 */
#endif
    float *output_f[],                                          /* o  : rendered time signal                    */
    const int16_t subframes_rendered,                           /* i  : number of subframes rendered            */
    const int16_t slots_rendered                                /* i  : number of CLDFB slots rendered          */

lib_com/options.h

100755 → 100644
+4 −0
Original line number Diff line number Diff line
@@ -163,6 +163,10 @@

#define NONBE_FIX_856_TCX_LTP_SYNTH_FILTER                    /* FhG: issue 856: correct filtering length for tcx-ltp synth filtering*/
#define NONBE_UNIFIED_DECODING_PATHS                          /* FhG: unify decoding paths   */
#ifdef NONBE_UNIFIED_DECODING_PATHS
#define NONBE_UNIFIED_DECODING_PATHS_FIX                      /* VA: issue 876: fixes within NONBE_UNIFIED_DECODING_PATHS */
#endif
#define NONBE_FIX_874_OMASA_BRSW_2TD                          /* Nokia: issue 874: Fixes the crashes with the long test vectors that prompted switching to TD*/
#define NONBE_FIX_871_ACELP_CRASH_IN_OSBA                     /* FhG: isse 871: crash in ACELP core encoder with OSBA */

/* ##################### End NON-BE switches ########################### */
+14 −0
Original line number Diff line number Diff line
@@ -51,6 +51,19 @@
 * Principal IVAS decoder routine
 *--------------------------------------------------------------------------*/

#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
ivas_error ivas_dec(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure      */
    int16_t *data            /* o  : output synthesis signal     */
)
{
    // TODO: move here function ivas_jbm_dec_tc() and rename it to ivas_dec()
    st_ivas->ivas_format = UNDEFINED_FORMAT; // temp. to avoid compilation warnings
    data[0] = 0;                             // temp. to avoid compilation warnings

    return IVAS_ERR_OK;
}
#else
ivas_error ivas_dec(
    Decoder_Struct *st_ivas,             /* i/o: IVAS decoder structure      */
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -1163,3 +1176,4 @@ ivas_error ivas_dec(
    pop_wmops();
    return IVAS_ERR_OK;
}
#endif
+22 −4
Original line number Diff line number Diff line
@@ -1590,7 +1590,7 @@ void ivas_dirac_dec_set_md_map(
    return;
}


#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
/*-------------------------------------------------------------------------
 * ivas_dirac_dec()
 *
@@ -1669,7 +1669,7 @@ void ivas_dirac_dec(

    return;
}

#endif

/*-------------------------------------------------------------------------
 * ivas_dirac_dec_render()
@@ -1690,6 +1690,9 @@ void ivas_dirac_dec_render(
    uint16_t slot_size, n_samples_sf, ch, nchan_intern;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
    float *output_f_local[MAX_OUTPUT_CHANNELS];
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV
#endif

    hSpatParamRendCom = st_ivas->hSpatParamRendCom;

@@ -1699,7 +1702,12 @@ void ivas_dirac_dec_render(
#endif
    for ( ch = 0; ch < nchan_intern; ch++ )
    {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
        output_f_local[ch] = output_f_local_buff[ch];
        set_zero( output_f_local_buff[ch], nSamplesAsked );
#else
        output_f_local[ch] = output_f[ch];
#endif
    }
    slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );

@@ -1733,6 +1741,16 @@ void ivas_dirac_dec_render(
#endif
    }

#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    for ( ch = 0; ch < nchan_intern; ch++ )
    {
        if ( !( ( st_ivas->hDirACRend->hOutSetup.separateChannelEnabled ) && ( st_ivas->hDirACRend->hOutSetup.separateChannelIndex == ch || st_ivas->hDirACRend->hOutSetup.separateChannelIndex + 1 == ch ) ) )
        {
            mvr2r( output_f_local_buff[ch], output_f[ch], *nSamplesRendered );
        }
    }

#endif
    if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots )
    {
        if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 )
@@ -1752,9 +1770,9 @@ void ivas_dirac_dec_render(


/*-------------------------------------------------------------------------
 * ivas_dirac_dec()
 * ivas_dirac_dec_render_sf()
 *
 * DirAC decoding process
 * DirAC decoding renderer process
 *------------------------------------------------------------------------*/

void ivas_dirac_dec_render_sf(
+52 −8
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ void ivas_ism_renderer_close(
    return;
}


#ifndef NONBE_UNIFIED_DECODING_PATHS
/*-------------------------------------------------------------------------*
 * ivas_ism_render()
 *
@@ -233,7 +233,7 @@ void ivas_ism_render(

    return;
}

#endif

/*-------------------------------------------------------------------------*
 * ivas_ism_render_sf()
@@ -254,6 +254,10 @@ void ivas_ism_render_sf(
    int16_t tc_offset;
    int16_t interp_offset;
    float gain, prev_gain;
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    float tc_local[MAX_NUM_OBJECTS][L_FRAME48k];
    float *p_tc[MAX_NUM_OBJECTS];
#endif

    num_objects = st_ivas->nchan_transport;
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
@@ -266,6 +270,23 @@ void ivas_ism_render_sf(
    tc_offset = st_ivas->hTcBuffer->n_samples_rendered;
    interp_offset = st_ivas->hTcBuffer->n_samples_rendered;

#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
        for ( i = 0; i < num_objects; i++ )
        {
            p_tc[i] = &st_ivas->hTcBuffer->tc[i][tc_offset];
        }
    }
    else
    {
        for ( i = 0; i < num_objects; i++ )
        {
            mvr2r( &output_f[i][tc_offset], tc_local[i], n_samples_to_render );
            p_tc[i] = tc_local[i];
        }
    }
#endif

    for ( i = 0; i < nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ )
    {
@@ -312,7 +333,11 @@ void ivas_ism_render_sf(
            if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f )
            {
                g1 = &st_ivas->hIsmRendererData->interpolator[interp_offset];
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
                tc = p_tc[i];
#else
                tc = &st_ivas->hTcBuffer->tc[i][tc_offset];
#endif
                for ( k = 0; k < n_samples_to_render; k++ )
                {
                    g2 = 1.0f - *g1;
@@ -487,7 +512,7 @@ void ivas_omasa_separate_object_renderer_close(
    return;
}


#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
/*-------------------------------------------------------------------------*
 * ivas_omasa_separate_object_render()
 *
@@ -598,7 +623,7 @@ void ivas_omasa_separate_object_render(

    return;
}

#endif

/*-------------------------------------------------------------------------*
 * ivas_omasa_separate_object_render_jbm()
@@ -609,6 +634,9 @@ void ivas_omasa_separate_object_render(
void ivas_omasa_separate_object_render_jbm(
    Decoder_Struct *st_ivas,         /* i/o: IVAS decoder structure                      */
    const uint16_t nSamplesRendered, /* i  : number of samples rendered                  */
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    float input_f_in[][L_FRAME48k], /* i  : separated object signal                     */
#endif
    float *output_f[],                /* o  : rendered time signal                        */
    const int16_t subframes_rendered, /* i  : number of subframes rendered                */
    const int16_t slots_rendered      /* i  : number of CLDFB slots rendered              */
@@ -658,10 +686,26 @@ void ivas_omasa_separate_object_render_jbm(
    {
        output_f_local[j] = output_f[j];
    }

#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
#endif
        for ( obj = 0; obj < num_objects; obj++ )
        {
            input_f[obj] = &st_ivas->hTcBuffer->tc[obj + 2][offsetSamples];
        }
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
    }
    else
    {
        for ( obj = 0; obj < num_objects; obj++ )
        {
            input_f[obj] = input_f_in[obj];
        }
    }
#endif

    slots_to_render = nSamplesRendered / hSpatParamRendCom->slot_size;
    first_sf = subframes_rendered;
    last_sf = first_sf;
Loading