Commit ce7069c6 authored by Jouni Paulus's avatar Jouni Paulus
Browse files

fix DirAC refactoring merge issues in OMASA branch. fix memory leak in separate object renderer.

parent 2cd6b8a2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -553,7 +553,11 @@ int16_t get_ivas_max_num_indices(
        }
        else if ( ivas_total_brate <= IVAS_160k )
        {
#ifdef OMASA_BIT_BUFF_SZ1
            return 900;
#else
            return 850;
#endif
        }
        else if ( ivas_total_brate <= IVAS_192k )
        {
+5 −0
Original line number Diff line number Diff line
@@ -366,7 +366,12 @@ ivas_error ivas_ism_config(

#ifdef FIX_562_ISM2_64KBPS
        /* limitation to avoid too high bitrate in one active TCX channel */
#ifdef FIX_ISM2_64KBPS_COMBINED_FORMAT
        /* Todo: the alternative is to make sure there are less than n_ism -1 objects inactive; but this way is simpler (Todo VE to check )*/
        if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k && combined_format_flag == 0 )
#else
        if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k )
#endif
        {
            diff = 0;
            limit_high = MAX_BRATE_TCX_32k / FRAMES_PER_SEC;
+62 −221
Original line number Diff line number Diff line
@@ -1074,6 +1074,7 @@ ivas_error ivas_param_ism_dec_open(

void ivas_param_ism_dec_close(
    DIRAC_DEC_HANDLE *hDirAC,                                   /* i/o: decoder DirAC handle                        */
    SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out,  /* i/o: common spatial renderer data                */
    const AUDIO_CONFIG output_config                            /* i  : output audio configuration                  */
);

@@ -3215,8 +3216,9 @@ int16_t ivas_qmetadata_dec_sid_decode(

void ivas_qmetadata_to_dirac(
    const IVAS_QMETADATA_HANDLE hQMetaData,                     /* i  : frame of MASA q_metadata                */
    DIRAC_DEC_HANDLE hDirAC,                                    /* o  : DirAC decoder structure                 */
    DIRAC_DEC_HANDLE hDirAC,                                    /* i  : DirAC decoder structure                 */
    MASA_DECODER_HANDLE hMasa,                                  /* i  : MASA decoder structure                  */
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom,       /* i/o: common spatial renderer data handle     */
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int16_t hodirac_flag,                                 /* i  : flag to indicate HO-DirAC mode          */
@@ -3618,33 +3620,20 @@ ivas_error ivas_dirac_sba_config(
    const int16_t nbands                                        /* i  : number of frequency bands                            */
);

ivas_error ivas_dirac_dec_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

ivas_error ivas_dirac_allocate_parameters(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: decoder DirAC handle                    */
    const int16_t params_flag                                   /* i  : set of parameters flag                  */
);

ivas_error ivas_dirac_dec_config(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                       */
    const DIRAC_CONFIG_FLAG flag_configopen                     /* i/ : Flag determining if we open or reconfigure the DirAC decoder */
);

void ivas_dirac_dec_close(
    DIRAC_DEC_HANDLE *hDirAC                                    /* i/o: decoder DirAC handle                    */
);

void ivas_dirac_deallocate_parameters(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: decoder DirAC handle                    */
    const int16_t params_flag                                   /* i  : set of parameters flag                  */
    DIRAC_DEC_HANDLE *hDirAC_out
);

void ivas_dirac_dec_read_BS(
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
    Decoder_State *st,                                          /* i/o: decoder Core state structure            */
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: decoder DirAC handle                    */
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom,       /* i/o: common spatial rendering data handle    */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q metadata                              */
    int16_t *nb_bits,                                           /* o  : number of bits read                     */
    const int16_t hodirac_flag,                                 /* i  : flag to indicate HO-DirAC mode          */
@@ -3695,12 +3684,6 @@ ivas_error ivas_td_decorr_reconfig_dec(
    uint16_t *useTdDecorr                                       /* i/o: TD decorrelator flag                    */
);

/*! r: Configured reqularization factor value */
float configure_reqularization_factor(
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int32_t ivas_total_brate                              /* i  : total IVAS bitrate                      */
);

void computeDiffuseness_mdft(
    float **buffer_intensity[DIRAC_NUM_DIMS],
    const float *buffer_energy,
@@ -3727,109 +3710,6 @@ void computeDiffuseness(
    float *diffuseness 
);

ivas_error ivas_dirac_dec_onset_detection_open(
    const int16_t num_channels,
    const int16_t num_freq_bands,
    const int16_t max_band_decorr,
    DIRAC_ONSET_DETECTION_PARAMS *ph_dirac_onset_detection_params,
    DIRAC_ONSET_DETECTION_STATE *ph_dirac_onset_detection_state 
);

void ivas_dirac_dec_onset_detection_process(
    const float *input_power_f,
    float *onset_filter,
    const int16_t num_protos_diff,
    DIRAC_ONSET_DETECTION_PARAMS h_dirac_onset_detection_params,
    DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state 
);

ivas_error ivas_dirac_dec_decorr_open(
    DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params,
    DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state,
    const int16_t num_freq_bands,
    int16_t num_outputs_diff,
    const int16_t num_protos_diff,
    const DIRAC_SYNTHESIS_CONFIG synthesisConf,
    float *frequency_axis,
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const int32_t output_Fs                                     /* i  : output sampling rate                        */
);

void ivas_dirac_dec_decorr_process(
    const int16_t num_freq_bands,
    int16_t num_channels,
    const int16_t num_protos_diff,
    const DIRAC_SYNTHESIS_CONFIG synthesisConf,
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const float *input_frame_f,
    const int16_t num_protos_dir,
    const int16_t *proto_index_dir,
    float *frame_dec_f,
    float *onset_filter,
    HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params,
    HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state 
);

void ivas_dirac_dec_decorr_close(
    HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params,
    HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state 
);

ivas_error  ivas_dirac_dec_output_synthesis_open(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                               */
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const int32_t output_Fs                                     /* i  : output sampling rate                        */
	,
    const int16_t hodirac_flag                                  /* i  : flag to indicate HO-DirAC mode              */
);

void ivas_dirac_dec_output_synthesis_init(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const int16_t nchan_out_woLFE,                              /* i  : number of output audio channels without LFE */
    const int16_t hodirac_flag                                  /* i  : flag to indicate HO-DirAC mode              */
);

void ivas_dirac_dec_output_synthesis_close(
    DIRAC_DEC_HANDLE hDirAC                                     /* i/o: DirAC handle                                */
);

void ivas_dirac_dec_output_synthesis_process_slot(
    const float *reference_power,                               /* i  : Estimated power                             */
    const float *onset,                                         /* i  : onset filter                                */
    const int16_t *azimuth,
    const int16_t *elevation,
    const float *diffuseness,
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const int16_t sh_rot_max_order,
    const float *p_Rmat,                                        /* i  : rotation matrix                             */
    const VBAP_HANDLE hVBAPdata,                                /* i  : VBAP structure                              */
    const IVAS_OUTPUT_SETUP hOutSetup,                          /* i  : output setup structure                      */
	const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const int16_t ind_slot,                                     /* i  : index of the slot to be added to the input covariance */
    const int16_t hodirac_flag                                  /* i  : flag to indicate HO-DirAC mode              */
);

void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
    float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals                        */
    float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals                        */
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const int16_t nbslots,                                      /* i  : number of slots to process                  */
    const float *onset_filter,
    float *diffuseness,
    const int16_t hodirac_flag                                  /* i  : flag to indicate HO-DirAC mode              */
);

void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls(
    float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals                        */
    float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals                        */
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const int16_t nbslots,                                      /* i  : number of slots to process                  */
    float *diffuseness_vector,                                  /* i  : diffuseness (needed for direction smoothing)*/
    float *reference_power_smooth,
    float qualityBasedSmFactor
);

void ivas_dirac_dec_get_response(
    const int16_t azimuth,
@@ -3838,51 +3718,6 @@ void ivas_dirac_dec_get_response(
    const int16_t ambisonics_order
);

void compute_hoa_encoder_mtx(
    const float *azimuth,
    const float *elevation,
    float *response,
    const int16_t num_responses,
    const int16_t ambisonics_order );

void ivas_dirac_dec_compute_gain_factors(
    const int16_t num_freq_bands,
    const float *diffuseness,
    const int16_t max_band_decorr,
    float *direct_gain_factor,
    float *diffuse_gain_factor 
);

void ivas_dirac_dec_compute_power_factors(
    const int16_t num_freq_bands,
    const float *diffuseness,
    const int16_t max_band_decorr,
    float *direct_power_factor,
    float *diffuse_power_factor 
);

void ivas_dirac_dec_compute_directional_responses(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                    */
    const VBAP_HANDLE hVBAPdata,                                /* i  : VBAP structure                                  */
    const MASA_DECODER_HANDLE hMasa,                            /* i  : MASA decoder structure                          */
#ifdef MASA_AND_OBJECTS
    MASA_ISM_DATA_HANDLE hMasaIsm,                              /* i  : MASA_ISM data structure                         */
#endif
    const int16_t *azimuth,
    const int16_t *elevation,
    const int16_t md_idx,
    const float *surCohRatio,
    const int16_t shd_rot_max_order,                            /* i  : split-order rotation method                     */
    const float *p_Rmat,                                        /* i  : rotation matrix                                 */
    const int16_t hodirac_flag                                  /* i  : flag to indicate HO-DirAC mode                  */
);

void ivas_dirac_dec_get_frequency_axis( 
    float *frequency_axis,                                      /* o  : array of center frequencies of a real filter bank */
    const int32_t output_Fs,                                    /* i  : sampling frequency                                */
    const int16_t num_freq_bands                                /* i  : number of frequency bands                         */
);

void calculate_hodirac_sector_parameters(
    DIRAC_ENC_HANDLE hDirAC,
    float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part       */
@@ -5159,7 +4994,7 @@ ivas_error ivas_masa_enc_config(
);

void ivas_masa_set_elements(
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                              */
    const int32_t ivas_total_brate,                             /* i  : codec total bitrate                             */
    const int16_t mc_mode,                                      /* i  : MC format mode                                  */
    const int16_t nchan_transport,                              /* i  : number of MASA input/transport channels         */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q_metadata handle                               */
@@ -5261,7 +5096,7 @@ void ivas_get_stereo_panning_gains(
void ivas_masa_set_coding_config(
    MASA_CODEC_CONFIG* config,                                  /* i/o: MASA coding config structure                    */
    int16_t* band_mapping,                                      /* o  : Band mapping used                               */
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                              */
    const int32_t ivas_total_brate,                             /* i  : codec total bitrate                             */
    const int16_t nchan_transport,                              /* i  : number of transport channel (mono/stereo)       */
    const uint8_t isMcMasa                                      /* i  : toggle for selecting McMASA specific config     */
);
@@ -5599,7 +5434,7 @@ void ivas_mcmasa_set_separate_channel_mode(

void ivas_mcmasa_split_brate(
    const uint8_t separateChannelEnabled,                       /* i  : Transport running in "separate channel" mode      */
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate available to be split          */
    const int32_t ivas_total_brate,                             /* i  : Total bitrate available to be split               */
    const int16_t nSCE,                                         /* i  : Number of SCEs in use (0 or 1)                    */
    const int16_t nCPE,                                         /* i  : Number of CPEs in use (0 or 1)                    */
    int32_t *brate_sce,                                         /* o  : Pointer to SCE element bitrate                    */
@@ -5930,6 +5765,12 @@ ivas_error ivas_masa_ism_separate_object_renderer_open(
    Decoder_Struct* st_ivas                                     /* i/o: IVAS decoder structure                  */
);

#ifdef OMASA_OBJ_REND_CLOSE
ivas_error ivas_masa_ism_separate_object_renderer_close(
    Decoder_Struct* st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif

void ivas_masa_ism_separate_object_render(
    Decoder_Struct* st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float input_f[][L_FRAME48k],                                /* i  : separated object signal                 */
+3 −0
Original line number Diff line number Diff line
@@ -220,6 +220,9 @@
#define OMASA_FIX_LOW_FS                                /* Nokia: fixes related to lower input signal sampling rates */
#define OMASA_BIT_BUFF_SZ                               /* Nokia: increase bitstream index buffer initial size */
#define OMASA_EXT_OUTPUT                                /* VA: support of EXT output configuration for OMASA DISC mode */
#define OMASA_BIT_BUFF_SZ1                              /* Nokia: increase bitstream index buffer initial size */
#define FIX_ISM2_64KBPS_COMBINED_FORMAT                 /* Nokia: Making the fix_562 work with combined format */
#define OMASA_OBJ_REND_CLOSE                            /* Nokia: close OMASA separate object renderer */
#endif

/* #################### Start NON-BE CR switches ########################## */
+1 −1
Original line number Diff line number Diff line
@@ -691,7 +691,7 @@ ivas_error create_cpe_dec(
    }

#ifdef MASA_AND_OBJECTS
    if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC )
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
    {
        cpe_brate = element_brate;
    }
Loading