Commit 9a529ee2 authored by vaclav's avatar vaclav
Browse files

issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS; under...

issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS; under UNIFIED_DECODING_PATHS_LEFTOVERS
parent db3a2561
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -175,7 +175,11 @@ typedef enum
#define MAX_JBM_L_FRAME48k                      1920
#define MAX_JBM_L_FRAME_NS                      40000000L
#define MAX_SPAR_INTERNAL_CHANNELS              IVAS_SPAR_MAX_CH
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
#define MAX_CLDFB_DIGEST_CHANNELS               3                           /* == maximum of ParamISM TCs and ParamMC TCs */
#else
#define MAX_CLDFB_DIGEST_CHANNELS               (FOA_CHANNELS + MAX_NUM_OBJECTS)
#endif

typedef enum
{
+4 −2
Original line number Diff line number Diff line
@@ -875,13 +875,14 @@ void ivas_jbm_dec_get_md_map(
int16_t ivas_jbm_dec_get_num_tc_channels( 
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder handle                                         */
);

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
void ivas_jbm_dec_copy_tc_no_tsm( 
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                         */
    float *tc[],                                                /* i  : transport channels                                          */
    const int16_t output_frame                                  /* i  : output frame size                                           */
);

#endif
void ivas_jbm_dec_get_md_map_even_spacing(
    const int16_t len,                                          /* i  : length of the modfied frames in metadata slots              */
    const int16_t subframe_len,                                 /* i  : default length of a subframe                                */
@@ -1142,13 +1143,14 @@ void ivas_param_ism_dec_prepare_renderer(
    const uint16_t nCldfbSlots                                  /* i  : number of CLDFB slots in transport channels */
);

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
void ivas_ism_param_dec_tc_gain_ajust(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const uint16_t nSamples,                                    /* i  : number of samples to be compensate          */
    const uint16_t nFadeLength,                                 /* i  : length of the crossfade in samples          */
    float *transport_channels_f[]                               /* i  : synthesized core-coder transport channels/DirAC output  */
);

#endif
void ivas_param_ism_dec_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const uint16_t nSamplesAsked,                               /* i  : number of CLDFB slots requested             */
+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define LIB_DEC_REVISION                                /* VA: cleaning and simplification of lib_dec.c */
#define UNIFIED_DECODING_PATHS_LEFTOVERS                /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */


/* #################### End BE switches ################################## */
+55 −14
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@
#include "wmc_auto.h"


#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
/*-----------------------------------------------------------------------*
 * Local function declarations
 *-----------------------------------------------------------------------*/

static void ivas_ism_param_dec_tc_gain_adjust( Decoder_Struct *st_ivas, const int16_t nSamples, const int16_t nFadeLength, float *p_data_f[] );

#endif
/*-----------------------------------------------------------------------*
 * Local function definitions
 *-----------------------------------------------------------------------*/
@@ -809,14 +817,28 @@ void ivas_param_ism_dec_digest_tc(
    float *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output    */
)
{
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    int16_t ch, slot_idx, output_frame;
    int16_t num_freq_bands, cldfb_ch, n_ch_cldfb;
    float *cldfb_real_buffer, *cldfb_imag_buffer;
#else
    int16_t ch, nchan_transport;
    int16_t slot_idx;
    int16_t output_frame;
    PARAM_ISM_DEC_HANDLE hParamIsmDec;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
    int16_t fade_len;
#endif

    /* Initialization */
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands;
    output_frame = nCldfbSlots * num_freq_bands;
    n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_jbm - st_ivas->hTcBuffer->nchan_buffer_full;

    cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc;
    cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc;
#else
    hParamIsmDec = st_ivas->hParamIsmDec;
    assert( hParamIsmDec );
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
@@ -825,15 +847,31 @@ void ivas_param_ism_dec_digest_tc(
    fade_len = output_frame / 2;

    nchan_transport = st_ivas->nchan_transport;
#endif

    push_wmops( "ivas_param_ism_dec_digest_tc" );

#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, transport_channels_f );
#else
    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
        /*TODO : FhG to check*/
        ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, transport_channels_f );
    }
#endif

#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    /* CLDFB Analysis */
    for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ )
    {
        for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
        {
            cldfbAnalysis_ts( &( transport_channels_f[ch][num_freq_bands * slot_idx] ),
                              &cldfb_real_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands],
                              &cldfb_imag_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands],
                              num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] );
        }
    }
#else
    for ( ch = 0; ch < nchan_transport; ch++ )
    {
        /* CLDFB Analysis */
@@ -850,9 +888,7 @@ void ivas_param_ism_dec_digest_tc(
            }
        }
    }


    pop_wmops();
#endif

    return;
}
@@ -924,8 +960,6 @@ void ivas_param_ism_dec_prepare_renderer(
        nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
    }

    push_wmops( "ivas_param_ism_dec_digest_tc" );

    /* general setup */
    ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hParamIsmDec->hParamIsmRendering->interpolator );

@@ -1006,22 +1040,29 @@ void ivas_param_ism_dec_prepare_renderer(
    /* Compute mixing matrix */
    ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, hParamIsmDec->hParamIsmRendering->mixing_matrix_lin );

    pop_wmops();

    return;
}


/*-------------------------------------------------------------------------*
 * ivas_ism_param_dec_tc_gain_ajust()
 * ivas_ism_param_dec_tc_gain_adjust()
 *
 *
 *-------------------------------------------------------------------------*/

#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
static void ivas_ism_param_dec_tc_gain_adjust(
#else
void ivas_ism_param_dec_tc_gain_ajust(
#endif
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle                                   */
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    const int16_t nSamples,    /* i  : number of samples to be compensate                    */
    const int16_t nFadeLength, /* i  : length of the crossfade in samples                    */
#else
    const uint16_t nSamples,    /* i  : number of samples to be compensate                    */
    const uint16_t nFadeLength, /* i  : length of the crossfade in samples                    */
#endif
    float *transport_channels_f[] /* i  : synthesized core-coder transport channels/DirAC output*/
)

+123 −7
Original line number Diff line number Diff line
@@ -50,8 +50,9 @@
 * Local function prototypes
 *-----------------------------------------------------------------------*/

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] );

#endif
static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] );

static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas );
@@ -98,6 +99,7 @@ ivas_error ivas_jbm_dec_tc(

    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );

    /* set pointers to transport channels audio */
    for ( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ )
    {
        p_output[n] = st_ivas->p_output_f[n];
@@ -213,11 +215,12 @@ ivas_error ivas_jbm_dec_tc(
            {
                return error;
            }

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hDecoderConfig->Opt_tsm )
            {
                ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
            }
#endif
        }
        else if ( st_ivas->ivas_format == SBA_FORMAT )
        {
@@ -412,11 +415,12 @@ ivas_error ivas_jbm_dec_tc(
                /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */
                ivas_omasa_render_objects_from_mix( st_ivas, p_output, st_ivas->nchan_ism, output_frame );
            }

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
            if ( st_ivas->hDecoderConfig->Opt_tsm )
            {
                ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
            }
#endif
        }
    }
    else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
@@ -727,6 +731,7 @@ ivas_error ivas_jbm_dec_tc(
        }
    }

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
    /*----------------------------------------------------------------*
     * Write IVAS transport channels
     *----------------------------------------------------------------*/
@@ -746,6 +751,7 @@ ivas_error ivas_jbm_dec_tc(
        ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame );
    }

#endif
    /*----------------------------------------------------------------*
     * Common updates
     *----------------------------------------------------------------*/
@@ -781,6 +787,111 @@ ivas_error ivas_jbm_dec_tc(
    return IVAS_ERR_OK;
}

#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS

/*--------------------------------------------------------------------------*
 * ivas_dec_feed_tc_to_renderer()
 *
 * Feed decoded transport channels to the IVAS renderer routine
 * + digest TC channels in ParamISM and ParamMC
 *--------------------------------------------------------------------------*/

void ivas_jbm_dec_feed_tc_to_renderer(
    Decoder_Struct *st_ivas,            /* i/o: IVAS decoder structure                          */
    const int16_t nSamplesForRendering, /* i  : number of TC samples available for rendering    */
    int16_t *nSamplesResidual,          /* o  : number of samples not fitting into the renderer grid and buffer for the next call*/
    float *data                         /* i  : transport channels                              */
)
{
    float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */
    float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS];
    int16_t n, n_render_timeslots, n_ch_cldfb;
    int16_t ch;
    DECODER_TC_BUFFER_HANDLE hTcBuffer;

    hTcBuffer = st_ivas->hTcBuffer;
    n_ch_cldfb = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full;

    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
        int16_t n_samples_still_available, m;
        int16_t n_ch_full_copy;
        int16_t n_ch_res_copy;

        for ( n = 0; n < n_ch_cldfb; n++ )
        {
            p_data_f[n] = &data_f[n][0];
        }

        n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered;
        hTcBuffer->n_samples_buffered = n_samples_still_available + nSamplesForRendering + hTcBuffer->n_samples_discard;
        hTcBuffer->n_samples_available = hTcBuffer->n_samples_granularity * ( hTcBuffer->n_samples_buffered / hTcBuffer->n_samples_granularity );
        *nSamplesResidual = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_available;
        n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full );
        n_ch_res_copy = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full;

        for ( ch = 0; ch < n_ch_full_copy; ch++ )
        {
            set_zero( hTcBuffer->tc[ch], hTcBuffer->n_samples_discard );
            mvr2r( hTcBuffer->tc[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch] + hTcBuffer->n_samples_discard, n_samples_still_available );
            for ( m = 0; m < nSamplesForRendering; m++ )
            {
                hTcBuffer->tc[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * hTcBuffer->nchan_transport_jbm + ch];
            }
        }

        if ( n_ch_res_copy > 0 )
        {
            for ( ; ch < hTcBuffer->nchan_transport_jbm; ch++ )
            {
                mvr2r( hTcBuffer->tc[ch], p_data_f[ch], n_samples_still_available );

                for ( m = 0; m < nSamplesForRendering; m++ )
                {
                    p_data_f[ch][n_samples_still_available + m] = data[m * hTcBuffer->nchan_transport_jbm + ch];
                }
                mvr2r( p_data_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc[ch], *nSamplesResidual );
            }
        }

        n_render_timeslots = hTcBuffer->n_samples_available / hTcBuffer->n_samples_granularity;
    }
    else
    {
        for ( n = 0; n < n_ch_cldfb; n++ )
        {
            p_data_f[n] = &st_ivas->p_output_f[n][0];
        }

        for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
        {
            hTcBuffer->tc[n] = st_ivas->p_output_f[n]; /* note: buffers needed in the TD decorellator */
        }

        hTcBuffer->n_samples_buffered = nSamplesForRendering;
        hTcBuffer->n_samples_available = hTcBuffer->n_samples_buffered;
        *nSamplesResidual = 0;

        n_render_timeslots = DEFAULT_JBM_CLDFB_TIMESLOTS;
    }

    /* CLDFB analysis for ParamMC/ParamISM */
    if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) )
    {
        ivas_param_ism_dec_digest_tc( st_ivas, n_render_timeslots, p_data_f );
    }
    else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC && hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_RENDERER )
    {
        ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f );
    }

    hTcBuffer->n_samples_rendered = 0;
    hTcBuffer->subframes_rendered = 0;

    return;
}

#else

/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_feed_tc_to_renderer()
@@ -846,6 +957,7 @@ void ivas_jbm_dec_feed_tc_to_renderer(
    return;
}

#endif

/*--------------------------------------------------------------------------*
 * ivas_dec_render()
@@ -2020,7 +2132,7 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
    return num_tc;
}


#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_copy_tc()
 *
@@ -2078,7 +2190,7 @@ static void ivas_jbm_dec_copy_tc(

    return;
}

#endif

/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_get_render_granularity()
@@ -2605,7 +2717,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode(
    return buffer_mode;
}


#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_copy_tc_no_tsm()
 *
@@ -2678,7 +2790,7 @@ void ivas_jbm_dec_copy_tc_no_tsm(

    return;
}

#endif

/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_metadata_open()
@@ -2768,6 +2880,10 @@ static void ivas_jbm_masa_sf_to_slot_map(
    int16_t slot_idx;
    int16_t write_idx, sf_index;

#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );

#endif
    /* Set values */
    hJbmMetadata = st_ivas->hJbmMetadata;
    num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES;
Loading