Commit 881dfae9 authored by eichenseer's avatar eichenseer
Browse files

Merge branch '768-refactoring-of-paramism' into 'main'

Resolve "Refactoring of ParamISM"

See merge request !1054
parents e5f1900f bb75db6b
Loading
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1043,10 +1043,17 @@ void ivas_param_ism_enc(
    const int16_t input_frame                                   /* i  : input frame length per channel              */
);

#ifndef PARAM_ISM_REFACTOR
void ivas_param_ism_enc_close(
    DIRAC_ENC_HANDLE *hDirAC,                                   /* i/o: encoder DirAC handle                        */
    const int32_t input_Fs                                      /* i  : input sampling_rate                         */
);
#else
void ivas_param_ism_enc_close(
    PARAM_ISM_CONFIG_HANDLE *hParamIsm,                         /* i/o: ParamISM handle                             */
    const int32_t input_Fs                                      /* i  : input sampling_rate                         */
);
#endif

void ivas_ism_metadata_close(
    ISM_METADATA_HANDLE hIsmMetaData[],                         /* i/o  : object metadata handles                   */
@@ -1085,7 +1092,11 @@ ivas_error ivas_param_ism_dec_open(
);

void ivas_param_ism_dec_close(
#ifndef PARAM_ISM_REFACTOR
    DIRAC_DEC_HANDLE *hDirAC,                                   /* i/o: decoder DirAC handle                        */
#else
    PARAM_ISM_DEC_HANDLE *hParamIsmDec,                         /* i/o: decoder ParamISM handle                     */
#endif
    SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out,  /* i/o: common spatial renderer data                */
    const AUDIO_CONFIG output_config                            /* i  : output audio configuration                  */
);
+35 −30
Original line number Diff line number Diff line
@@ -150,36 +150,6 @@ typedef struct

} ECSQ_instance;

/*----------------------------------------------------------------------------------*
 * PARAMETRIC ISM encoder/decoder (common) structure
 *----------------------------------------------------------------------------------*/

typedef struct ivas_param_ism_data_structure
{
    int16_t nbands;
    int16_t nblocks[MAX_PARAM_ISM_NBANDS];
    int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1];

    int16_t azi_index[MAX_NUM_OBJECTS];
    int16_t ele_index[MAX_NUM_OBJECTS];

    int16_t obj_indices[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE];
    int16_t power_ratios_idx[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS];

    int16_t last_az_sgn[MAX_NUM_OBJECTS];
    int16_t last_az_diff[MAX_NUM_OBJECTS];
    int16_t last_el_sgn[MAX_NUM_OBJECTS];
    int16_t last_el_diff[MAX_NUM_OBJECTS];

    int16_t flag_noisy_speech;
    int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE];
    int16_t flag_equal_energy;

    float last_dmx_gain;
    float last_cardioid_left[MAX_NUM_OBJECTS];

} PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE;


/*----------------------------------------------------------------------------------*
 * Declaration of DirAC common (encoder & decoder) structure
@@ -813,4 +783,39 @@ typedef struct ivas_fb_mixer_state_structure
} IVAS_FB_MIXER_DATA, *IVAS_FB_MIXER_HANDLE;


/*----------------------------------------------------------------------------------*
 * PARAMETRIC ISM encoder/decoder (common) structure
 *----------------------------------------------------------------------------------*/

typedef struct ivas_param_ism_data_structure
{
#ifdef PARAM_ISM_REFACTOR
    IVAS_FB_MIXER_HANDLE hFbMixer;

#endif
    int16_t nbands;
    int16_t nblocks[MAX_PARAM_ISM_NBANDS];
    int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1];

    int16_t azi_index[MAX_NUM_OBJECTS];
    int16_t ele_index[MAX_NUM_OBJECTS];

    int16_t obj_indices[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE];
    int16_t power_ratios_idx[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS];

    int16_t last_az_sgn[MAX_NUM_OBJECTS];
    int16_t last_az_diff[MAX_NUM_OBJECTS];
    int16_t last_el_sgn[MAX_NUM_OBJECTS];
    int16_t last_el_diff[MAX_NUM_OBJECTS];

    int16_t flag_noisy_speech;
    int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE];
    int16_t flag_equal_energy;

    float last_dmx_gain;
    float last_cardioid_left[MAX_NUM_OBJECTS];

} PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE;


#endif /* IVAS_STAT_COM */
+1 −0
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@
#define FIX_747_ISM_TODOS                               /* VA: issue 747 - address ISM ToDos */
#define FIX_ISMRENDERER_HANDLE_DEALLOC                  /* VA: issue 781: harmonize Deallocation of handle 'hIsmRendererData' */
#define FIX_782_OSBA_FUNCTION_NAMES                     /* VA: fix 782: correct OSBA function names */
#define PARAM_ISM_REFACTOR                              /* FhG: Issue 768: Refactoring to decouple hDirAC and hParamISM */


/* #################### End BE switches ################################## */
+4 −0
Original line number Diff line number Diff line
@@ -186,7 +186,11 @@ ivas_error ivas_dec(
        }
        else if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
#ifndef PARAM_ISM_REFACTOR
            if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt, st_ivas->hSCE[0]->hCoreCoder[0] ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hParamIsmDec->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt, st_ivas->hSCE[0]->hCoreCoder[0] ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
+12 −0
Original line number Diff line number Diff line
@@ -85,8 +85,10 @@ static ivas_error ivas_dirac_dec_config_internal(
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) );
        }

#ifndef PARAM_ISM_REFACTOR
        hDirAC->hParamIsm = NULL;
        hDirAC->hParamIsmRendering = NULL;
#endif
        st_ivas->hDirAC = hDirAC;
    }

@@ -1535,7 +1537,9 @@ void ivas_dirac_dec_set_md_map(
    hDirAC = st_ivas->hDirAC;
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
#ifdef DEBUGGING
#ifndef PARAM_ISM_REFACTOR
    assert( hDirAC );
#endif
    assert( hSpatParamRendCom );
#endif

@@ -1562,7 +1566,11 @@ void ivas_dirac_dec_set_md_map(
    {
        ivas_jbm_dec_get_md_map_even_spacing( nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map );
    }
#ifndef PARAM_ISM_REFACTOR
    else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
#else
    else if ( hDirAC == NULL || hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
#endif
    {
        ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map );
    }
@@ -1571,7 +1579,11 @@ void ivas_dirac_dec_set_md_map(
        ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hSpatParamRendCom->dirac_read_idx, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map );
    }

#ifndef PARAM_ISM_REFACTOR
    if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
#else
    if ( hDirAC == NULL || hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
#endif
    {
        float tmp;
        int16_t sf_idx, slot_idx, slot_idx_abs;
Loading