Commit 3209f346 authored by vaclav's avatar vaclav
Browse files

polishing

parent e1956b01
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 ParamISM TCs */
#else
#define MAX_CLDFB_DIGEST_CHANNELS               (FOA_CHANNELS + MAX_NUM_OBJECTS)
#endif

typedef enum
{
+10 −15
Original line number Diff line number Diff line
@@ -314,8 +314,12 @@ void stereo_dmx_evs_close_encoder(
);

ivas_error ivas_dec(
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
#else
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                      */
    int16_t *data                                               /* o  : output synthesis signals                */
    float *data                                                 /* o  : output synthesis signals                                    */
#endif
);

ivas_error ivas_dec_render(
@@ -782,16 +786,7 @@ void ivas_apply_non_diegetic_panning(
 * decoder->rendering TC buffer prototypes
 *----------------------------------------------------------------------------------*/

ivas_error ivas_dec_tc(
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
#else
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                      */
    float *data                                                 /* o  : output synthesis signals                                    */
#endif
);

ivas_error ivas_jbm_dec_flush_renderer(
ivas_error ivas_dec_flush_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                      */
    const int16_t tc_granularity_new,                           /* i  : new renderer granularity                                    */
    const RENDERER_TYPE renderer_type_old,                      /* i  : old renderer type                                           */
@@ -815,7 +810,7 @@ void ivas_dec_prepare_renderer(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
);

ivas_error ivas_jbm_dec_set_discard_samples(
ivas_error ivas_dec_set_discard_samples(
    Decoder_Struct *st_ivas                                     /* i/o: main IVAS decoder structre                                  */
);

@@ -1094,7 +1089,7 @@ void ivas_ism_dec_digest_tc(
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const uint16_t nCldfbSlots,                                 /* i  : number of CLDFB slots in transport channels */
    float *transport_channels_f[]                               /* i  : synthesized core-coder transport channels/DirAC output  */
    float *p_data_f[]                                           /* i  : synthesized core-coder transport channels/DirAC output  */
);

void ivas_param_ism_dec_dequant_md(
@@ -3855,7 +3850,7 @@ void ivas_param_mc_dec_read_BS(
void ivas_param_mc_dec_digest_tc(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                 */
    const uint8_t nCldfbSlots,                                  /* i  : number of CLDFB slots in transport channels         */
    float *transport_channels_f[]                               /* i/o: synthesized core-coder transport channels/DirAC output*/
    float *p_data_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output*/
);

void ivas_param_mc_dec_prepare_renderer(
+2 −2
Original line number Diff line number Diff line
@@ -51,12 +51,12 @@
 * Principal IVAS decoder routine
 *--------------------------------------------------------------------------*/

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

+4 −4
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
            mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }

        /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
        /* when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
           render what still fits in the new granularity */
        tc_granularity_new = ivas_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );

@@ -130,10 +130,10 @@ static ivas_error ivas_ism_bitrate_switching_dec(
        {
            /* flush already done in IVAS_DEC_ReadFormat() */
        }
        /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
        /* when granularity goes up set samples to discard at the beginning of the frame */
        else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity )
        {
            if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
+21 −19
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@
 * 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 *transport_channels_f[] );
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

@@ -571,19 +571,16 @@ ivas_error ivas_param_ism_dec_open(
            {
                n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES;
            }
            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )

            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) );
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM Rendering handle\n" ) );
            }
            set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands );

            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )
            {
                if ( ( error = ivas_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM Rendering handle\n" ) );
            }
            set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands );
        }
@@ -591,15 +588,11 @@ ivas_error ivas_param_ism_dec_open(
        if ( st_ivas->hTcBuffer == NULL )
        {
            if ( ( error = ivas_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK )
            {
                int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out;
                if ( ( error = ivas_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
    }
    else
    {
        hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL;
@@ -803,13 +796,13 @@ void ivas_ism_dec_digest_tc(
 *
 *-------------------------------------------------------------------------*/

#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder handle                                       */
    const uint16_t nCldfbSlots, /* i  : number of CLDFB slots in transport channels               */
    float *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output    */
    float *p_data_f[]           /* i/o: synthesized core-coder transport channels/DirAC output    */
)
{
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    int16_t ch, num_freq_bands, slot_idx, cldfb_ch, n_ch_cldfb;
    int16_t output_frame;
    float *cldfb_real_buffer;
@@ -824,20 +817,29 @@ void ivas_param_ism_dec_digest_tc(
    cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc;

    /* Adjust TCs energy */
    ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, transport_channels_f );
    ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, p_data_f );

    /* 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] ),
            cldfbAnalysis_ts( &( p_data_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] );
        }
    }

    return;
}
#else
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder handle                                       */
    const uint16_t nCldfbSlots,   /* i  : number of CLDFB slots in transport channels               */
    float *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output    */
)
{

    int16_t ch, nchan_transport;
    int16_t slot_idx;
@@ -882,10 +884,10 @@ void ivas_param_ism_dec_digest_tc(
    }

    pop_wmops();
#endif

    return;
}
#endif


/*-------------------------------------------------------------------------*
Loading