diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index a3f003f97932a781ea8d2ff9bce2882e92caab3a..20f5032e1443ba954eadf0eb0ac8d578f7830e1c 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -166,6 +166,10 @@ int16_t getTcxonly( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ +#ifdef ISM_25k6_HZ_CORE + , + const int16_t is_ism_format +#endif ) { int16_t tcxonly = 0; @@ -179,6 +183,24 @@ int16_t getTcxonly( } break; case IVAS_SCE: +#ifdef ISM_25k6_HZ_CORE + if ( is_ism_format ) + { + if ( total_brate > MAX_ACELP_BRATE_ISM ) + { + tcxonly = 1; + } + } + else + { + if ( total_brate > MAX_ACELP_BRATE ) + { + tcxonly = 1; + } + } + break; + +#endif case IVAS_CPE_DFT: case IVAS_CPE_TD: if ( total_brate > MAX_ACELP_BRATE ) @@ -341,6 +363,10 @@ int32_t getCoreSamplerateMode2( const int16_t bwidth, /* i : audio bandwidth */ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ const int16_t rf_mode /* i : flag to signal the RF mode */ +#ifdef ISM_25k6_HZ_CORE + , + const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ +#endif ) { int32_t sr_core = 0; @@ -361,10 +387,25 @@ int32_t getCoreSamplerateMode2( { sr_core = INT_FS_16k; } +#ifdef ISM_25k6_HZ_CORE + else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format ) + { + sr_core = INT_FS_16k; + } + else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE_ISM && element_mode == IVAS_SCE && is_ism_format ) + { + sr_core = INT_FS_16k; + } + else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && is_ism_format ) + { + sr_core = 25600; + } +#else else if ( ( bwidth == SWB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) || ( bwidth == FB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) ) { sr_core = INT_FS_16k; } +#endif else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) ) { sr_core = 25600; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 27a361bdb883b290a922a0c0497db30246346099..416bb914fe13c2792b8249c016dfcde473de81b8 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -284,6 +284,9 @@ typedef enum #define MAX_VOICED_BRATE ACELP_13k20 /* max. per channel bitrate where VOICED is supported */ #define MIN_TC_BRATE 6450 /* min. per channel bitrate where TRANSITION is supported */ #define MAX_ACELP_BRATE 48000 /* max. per channel bitrate where ACELP core is supported */ +#ifdef ISM_25k6_HZ_CORE +#define MAX_ACELP_BRATE_ISM 40000 /* max. per channel bitrate where ACELP core is supported in ISM format */ +#endif #define ACELP_12k8_HIGH_LIMIT 24350 /* max. per channel bitrate where the ACELP@12.8kHz is supported */ #define ACELP_16k_LOW_LIMIT 13250 /* min. per channel bitrate where the ACELP@16kHz is supported */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b4759ee7208a8323918efd36d697c50d8db25f5d..ae25a9f89891d26f168388a089974cb064863d97 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -213,7 +213,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); ivas_error pre_proc_ivas( @@ -262,17 +262,17 @@ ivas_error ivas_compute_core_buffers( /*! r: number of clipped samples */ uint32_t ivas_syn_output( - float *synth[], /* i/o: float synthesis signal */ + float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ); void ivas_syn_output_f( - float *synth[], /* i/o: float synthesis signal */ - const int16_t output_frame, /* i : output frame length (one channel) */ - const int16_t n_channels, /* i : number of output channels */ - float *synth_out /* o : integer 16 bits synthesis signal */ + float *synth[], /* i/o: float synthesis signal */ + const int16_t output_frame, /* i : output frame length (one channel) */ + const int16_t n_channels, /* i : number of output channels */ + float *synth_out /* o : integer 16 bits synthesis signal */ ); void ivas_initialize_handles_enc( @@ -319,8 +319,8 @@ ivas_error ivas_dec( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - int16_t *data /* o : flushed PCM samples */ + uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ + int16_t *data /* o : flushed PCM samples */ ); ivas_error create_sce_dec( @@ -766,60 +766,60 @@ void dtx_read_padding_bits( *----------------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *data /* o : output synthesis signals */ ); ivas_error ivas_jbm_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t nSamplesAsked, /* i : number of samples wanted */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ - int16_t *data /* o : output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesAsked, /* i : number of samples wanted */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ + int16_t *data /* o : output synthesis signal */ ); ivas_error ivas_jbm_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 */ - const AUDIO_CONFIG intern_config_old, /* i : old internal config */ - const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ - const MC_MODE mc_mode_old, /* i : old MC mode */ - const ISM_MODE ism_mode_old, /* i : old ISM mode */ - uint16_t *nSamplesRendered, /* o : number of samples flushed */ - int16_t *data /* o : rendered samples */ + 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 */ + const AUDIO_CONFIG intern_config_old, /* i : old internal config */ + const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ + const MC_MODE mc_mode_old, /* i : old MC mode */ + const ISM_MODE ism_mode_old, /* i : old ISM mode */ + uint16_t *nSamplesRendered, /* o : number of samples flushed */ + int16_t *data /* o : rendered samples */ ); ivas_error ivas_jbm_dec_feed_tc_to_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + 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/o: transport channels/output synthesis signal */ + float *data /* i/o: transport channels/output synthesis signal */ ); ivas_error ivas_jbm_dec_set_discard_samples( - Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ + Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ ); void ivas_jbm_dec_get_adapted_linear_interpolator( - const int16_t default_interp_length, /* i : default length of the (full-frame) interpolator */ - const int16_t interp_length, /* i : length of the interpolator to be created */ - float *interpolator /* o : the interpolator */ + const int16_t default_interp_length, /* i : default length of the (full-frame) interpolator */ + const int16_t interp_length, /* i : length of the interpolator to be created */ + float *interpolator /* o : the interpolator */ ); void ivas_jbm_dec_get_adapted_subframes( - const int16_t nCldfbTs, /* i : number of time slots in the current frame */ - int16_t *subframe_nbslots, /* i/o: subframe grid */ - int16_t *nb_subframes /* i/o: number of subframes in the frame */ + const int16_t nCldfbTs, /* i : number of time slots in the current frame */ + int16_t *subframe_nbslots, /* i/o: subframe grid */ + int16_t *nb_subframes /* i/o: number of subframes in the frame */ ); void ivas_jbm_dec_get_md_map( - const int16_t default_len, /* i : default frame length in metadata slots */ - const int16_t len, /* i : length of the modfied frames in metadata slots */ - const int16_t subframe_len, /* i : default length of a subframe */ - const int16_t offset, /* i : current read offset into the md buffer */ - const int16_t buf_len, /* i : length of the metadata buffer */ - int16_t *map /* o : metadata index map */ + const int16_t default_len, /* i : default frame length in metadata slots */ + const int16_t len, /* i : length of the modfied frames in metadata slots */ + const int16_t subframe_len, /* i : default length of a subframe */ + const int16_t offset, /* i : current read offset into the md buffer */ + const int16_t buf_len, /* i : length of the metadata buffer */ + int16_t *map /* o : metadata index map */ ); int16_t ivas_jbm_dec_get_num_tc_channels( @@ -827,35 +827,35 @@ int16_t ivas_jbm_dec_get_num_tc_channels( ); TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( - Decoder_Struct *st_ivas /* i : IVAS decoder handle */ + Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( - const RENDERER_TYPE rendererType, /* i : renderer type */ - const int32_t output_Fs /* i : sampling rate */ + const RENDERER_TYPE rendererType, /* i : renderer type */ + const int32_t output_Fs /* i : sampling rate */ ); ivas_error ivas_jbm_dec_tc_buffer_open( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const TC_BUFFER_MODE tc_buffer_mode, /* i : buffer mode */ - const int16_t nchan_transport_jbm, /* i : number of real transport channels */ - const int16_t nchan_transport_internal, /* i : number of totally buffered channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : buffer mode */ + const int16_t nchan_transport_jbm, /* i : number of real transport channels */ + const int16_t nchan_transport_internal, /* i : number of totally buffered channels */ const int16_t nchan_full, /* i : number of channels to fully store */ - const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ + const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ); ivas_error ivas_jbm_dec_tc_buffer_reconfigure( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const TC_BUFFER_MODE tc_buffer_mode, /* i : new buffer mode */ - const int16_t nchan_transport_jbm, /* i : new number of real transport channels */ - const int16_t nchan_transport_internal, /* i : new number of totally buffered channels */ - const int16_t nchan_full, /* i : new number of channels to fully store */ - const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : new buffer mode */ + const int16_t nchan_transport_jbm, /* i : new number of real transport channels */ + const int16_t nchan_transport_internal, /* i : new number of totally buffered channels */ + const int16_t nchan_full, /* i : new number of channels to fully store */ + const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ); void ivas_jbm_dec_tc_buffer_close( - DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ + DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ ); void ivas_jbm_dec_td_renderers_adapt_subframes( @@ -1014,7 +1014,7 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ - int16_t *data /* o : flushed PCM samples */ + int16_t *data /* o : flushed PCM samples */ ); ivas_error ivas_param_ism_dec_open( @@ -1036,17 +1036,17 @@ 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 CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); 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 */ - uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ - uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ + 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 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ ); void ivas_param_ism_params_to_masa_param_mapping( @@ -3381,11 +3381,11 @@ ivas_error ivas_sba_dec_reconfigure( ); ivas_error ivas_sba_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nCldfbSlots, /* i : number of CLDFB slots */ - const int16_t nSamplesForRendering, /* i : number of samples provided */ - float *data[] /* i : transport channel samples */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering, /* i : number of samples provided */ + float *data[] /* i : transport channel samples */ ); void ivas_init_dec_get_num_cldfb_instances( @@ -3484,7 +3484,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ ); void ivas_sba2mc_cldfb( @@ -3522,7 +3522,7 @@ void ivas_dirac_enc( float data_f[][L_FRAME48k], /* i/o: SBA channels */ float **ppIn_FR_real, /* o : real freq domain values */ float **ppIn_FR_imag, /* o : imag freq domain values */ - const int16_t input_frame, /* i : input frame length */ + const int16_t input_frame, /* i : input frame length */ const int16_t dtx_vad, /* i : DTX vad flag */ const IVAS_FORMAT ivas_format, /* i : ivas format */ int16_t hodirac_flag /* i : hodirac flag */ @@ -3592,35 +3592,35 @@ void ivas_dirac_dec_read_BS( ); void generate_masking_noise_lb_dirac( - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ - const int16_t nCldfbTs, /* i : number of CLDFB slots that will be rendered */ - const int16_t cna_flag /* i : CNA flag for LB and HB */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ + const int16_t nCldfbTs, /* i : number of CLDFB slots that will be rendered */ + const int16_t cna_flag /* i : CNA flag for LB and HB */ ); void ivas_dirac_dec_set_md_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ ); void ivas_dirac_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport /* i : number of transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ ); void ivas_dirac_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ - uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ - uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ ); void ivas_dirac_dec_render_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] @@ -3755,7 +3755,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( 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 int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, #ifdef FIX_393_459_460_SBA_MD float *diffuseness, @@ -3766,14 +3766,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( ); 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 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 */ #ifdef FIX_393_459_460_SBA_MD float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ #else - const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ + const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ #endif float *reference_power_smooth, float qualityBasedSmFactor @@ -3817,7 +3817,7 @@ void ivas_dirac_dec_compute_directional_responses( 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 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 */ ); @@ -3832,50 +3832,50 @@ 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 */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ - const float beta, /* i : forgetting factor for average filtering */ - const int16_t *band_grouping, /* i : indices of band groups */ - const int16_t N_bands, /* i : number of bands (groups) */ - const int16_t enc_param_start_band, /* i : first band to process */ - float *azi, /* o : array of sector azimuth angles, flat */ - float *ele, /* o : array of sector elevation angles, flat */ - float *diff, /* o : array of sector diffuseness values, flat */ - float *ene /* o : array of sector energy values, flat */ + const float beta, /* i : forgetting factor for average filtering */ + const int16_t *band_grouping, /* i : indices of band groups */ + const int16_t N_bands, /* i : number of bands (groups) */ + const int16_t enc_param_start_band, /* i : first band to process */ + float *azi, /* o : array of sector azimuth angles, flat */ + float *ele, /* o : array of sector elevation angles, flat */ + float *diff, /* o : array of sector diffuseness values, flat */ + float *ene /* o : array of sector energy values, flat */ ); void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + const int16_t input_frame /* i : input frame length */ ); ivas_error ivas_mc_paramupmix_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mc_paramupmix_enc_close( - MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ const int32_t input_Fs /* i : input sampling rate */ ); void ivas_mc_paramupmix_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); ivas_error ivas_mc_paramupmix_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_mc_paramupmix_dec_close( - MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ ); void ivas_mc_paramupmix_dec_read_BS( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Decoder_State *st, /* i/o: decoder state structure */ - MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ - int16_t *nb_bits /* o : number of bits written */ + Decoder_State *st, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ ); void ivas_param_mc_metadata_open( @@ -3946,17 +3946,17 @@ 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 CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); void ivas_param_mc_dec_render( - 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 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ + 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 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ ); void ivas_param_mc_dec( @@ -4093,7 +4093,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( ); void ivas_dirac_dec_output_synthesis_get_interpolator( - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ const uint16_t interp_length /* i : interpolator length */ ); @@ -4111,8 +4111,8 @@ void ivas_dirac_dec_output_synthesis_cov_close( ); void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( - float *RealBuffer, /* i : input channel filter bank samples (real part) */ - float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ + float *RealBuffer, /* i : input channel filter bank samples (real part) */ + float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ @@ -4120,17 +4120,17 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( ); void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( - float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ - float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ + float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ + float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ - float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ - float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ - const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const int16_t nX, /* i : number of input channels */ - const int16_t nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ + float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ + float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ + const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const int16_t nX, /* i : number of input channels */ + const int16_t nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ); int16_t computeMixingMatricesISM( @@ -4214,7 +4214,7 @@ void ivas_sba_upmixer_renderer( ); ivas_error ivas_sba_linear_renderer( - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ @@ -4391,46 +4391,46 @@ int16_t ivas_is_res_channel( ); void ivas_spar_dec_agc_pca( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int16_t output_frame /* i : output frame length */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output[][L_FRAME48k], /* i/o: input/output audio channels */ + const int16_t output_frame /* i : output frame length */ ); void ivas_spar_dec_set_render_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ ); void ivas_spar_dec_set_render_params( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t n_cldfb_slots /* i : number of cldfb slots in this frame */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t n_cldfb_slots /* i : number of cldfb slots in this frame */ ); void ivas_spar_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nCldfbSlots, /* i : number of CLDFB slots */ - const int16_t nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering /* i : number of samples provided */ ); ivas_error ivas_sba_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t nCldfbSlots, /* i : number of CLDFB slots */ - const int16_t nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering /* i : number of samples provided */ ); void ivas_sba_dec_render( - 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 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ + 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 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ ); void ivas_spar_dec_upmixer_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *output[], /* o : output audio channels */ - const int16_t nchan_internal /* i : number of internal channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *output[], /* o : output audio channels */ + const int16_t nchan_internal /* i : number of internal channels */ ); void ivas_spar_dec_upmixer( @@ -4524,7 +4524,7 @@ void ivas_get_spar_md_from_dirac( ); int16_t ivas_get_spar_dec_md_num_subframes( - const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate ); ivas_error ivas_spar_md_dec_open( @@ -4568,7 +4568,7 @@ void ivas_spar_to_dirac( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t bw /* i : band joining factor */ + const int16_t bw /* i : band joining factor */ ); void ivas_spar_update_md_hist( @@ -4578,13 +4578,13 @@ void ivas_spar_update_md_hist( void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_setup_md_smoothing( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_dec_gen_umx_mat( @@ -4631,7 +4631,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp, /* i : number of input channels */ const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_smooth_enc_close( @@ -5150,9 +5150,9 @@ void ivas_binaural_cldfb( ); void ivas_binaural_cldfb_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ - float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); @@ -5174,8 +5174,8 @@ void ivas_binRenderer( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ - float *input_f[], /* i : transport channels */ - float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ + float *input_f[], /* i : transport channels */ + float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ ); @@ -5189,14 +5189,14 @@ ivas_error ivas_ism_renderer_open( void ivas_ism_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[], /* i/o: core-coder transport channels/object output */ + float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ ); 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 */ - const int16_t n_samples_to_render /* i : output frame length per channel */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: core-coder transport channels/object output */ + const int16_t n_samples_to_render /* i : output frame length per channel */ ); void ivas_ism_get_stereo_gains( @@ -5208,15 +5208,15 @@ void ivas_ism_get_stereo_gains( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ - float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ - float *buffer_td[], /* o : MC signals (on input) and the HOA3 (on output) */ + float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + float *buffer_td[], /* o : MC signals (on input) and the HOA3 (on output) */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order, /* i : SBA order */ const float gain_lfe /* i : gain for LFE, 0=ignore LFE */ ); void ivas_ism2sba( - float *buffer_td[], /* i/o: TD signal buffers */ + float *buffer_td[], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ const int16_t nchan_ism, /* i : number of objects */ @@ -5225,13 +5225,13 @@ void ivas_ism2sba( ); void ivas_ism2sba_sf( - float *buffer_in[], /* i : TC buffer */ - float *buffer_out[], /* o : TD signal buffers */ - ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ - const int16_t num_objects, /* i : number of objects */ - const int16_t n_samples_to_render, /* i : output frame length per channel */ - const int16_t offset, /* i : offset for the interpolatr */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + float *buffer_in[], /* i : TC buffer */ + float *buffer_out[], /* o : TD signal buffers */ + ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ + const int16_t num_objects, /* i : number of objects */ + const int16_t n_samples_to_render, /* i : output frame length per channel */ + const int16_t offset, /* i : offset for the interpolatr */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ); @@ -5287,8 +5287,8 @@ void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const int16_t input_chans, /* i : number of input channels to the renderer */ const int16_t output_frame, /* i : frame length */ - float *input[], /* i : LS input/output synthesis signal */ - float *output[] /* i/o: LS input/output synthesis signal */ + float *input[], /* i : LS input/output synthesis signal */ + float *output[] /* i/o: LS input/output synthesis signal */ ); void ivas_ls_setup_conversion_process_mdct( @@ -5302,7 +5302,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( ); void ivas_lssetupconversion_process_param_mc( - Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ + Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ const int16_t num_timeslots, /* i : number of time slots to process */ float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ @@ -5532,13 +5532,13 @@ ivas_error ivas_td_binaural_open( ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ); ivas_error ivas_td_binaural_renderer_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 4328602f5a105a9733328433e16ba0d3cba3fd38..fd47747186b4b63eb9de335b896c06ee5c20443b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,9 @@ #define EXTERNAL_ORIENTATIONS /* Nokia: Contribution 41: (external) orientation information handling */ #define MASA_PREREND /* Nokia: Contribution 42: Support for IVAS_rend to merge MASA + other format to MASA */ +#define ISM_25k6_HZ_CORE /* VA: issue 540: 1ISM 48 kbps - change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 1000e3738c314d23c2a8f1b63419e3ae1c3c264b..39b2f6372e11400f1797e7a633e4ea69ca0bb805 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -9766,6 +9766,10 @@ int16_t getTcxonly( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ +#ifdef ISM_25k6_HZ_CORE + , + const int16_t is_ism_format +#endif ); int16_t getTnsAllowed( @@ -9803,6 +9807,10 @@ int32_t getCoreSamplerateMode2( const int16_t bwidth, /* i : audio bandwidth */ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ const int16_t rf_mode /* i : flag to signal the RF mode */ +#ifdef ISM_25k6_HZ_CORE + , + const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ +#endif ); float getTcxBandwidth( diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index aa8f576cec3f5b277eaf4a1c8b980e6c96f0d167..d54ffe330e5a9923f251fe765b6415bd00c37396 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -73,7 +73,13 @@ void open_decoder_LPD( { st->fscale_old = st->fscale; } - st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag ); + + st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); fscaleFB = sr2fscale( st->output_Fs ); @@ -92,7 +98,12 @@ void open_decoder_LPD( } } - st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); /* the TD TCX PLC in MODE1 still runs with 80ms subframes */ if ( ( st->element_mode == EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= ACELP_32k ) || ( st->element_mode > EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= MAX_ACELP_BRATE ) || ( st->tcxonly && ( st->sr_core == 32000 || st->sr_core == 16000 ) ) ) diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index ef0a12696f448598703f5635ee0b0510f49cec17..3a5f163343333679fc9e48a976622d383a9f07dd 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -72,7 +72,12 @@ void mode_switch_decoder_LPD( { bSwitchFromAmrwbIO = 1; } - sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag ); + sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); fscale = sr2fscale( sr_core ); /* set number of coded lines */ diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index fcc1a5ec521f74564435923ae098780dd65e02b4..1be8873271ab93211b5b54ca427fbaee51334e72 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -183,7 +183,12 @@ ivas_error evs_dec( } /* if previous frame was HQ Core/TCX10/TCX20 (high bitrate), drop partial copy info and continue HQ Core/TCX10/TCX20 concealment */ - if ( st->use_partial_copy && ( st->last_core == HQ_CORE || st->last_core == TCX_10_CORE || ( st->last_core == TCX_20_CORE && getTcxonly( EVS_MONO, st->last_total_brate, 0 ) ) ) ) + if ( st->use_partial_copy && ( st->last_core == HQ_CORE || st->last_core == TCX_10_CORE || ( st->last_core == TCX_20_CORE && getTcxonly( EVS_MONO, st->last_total_brate, 0 +#ifdef ISM_25k6_HZ_CORE + , + 0 +#endif + ) ) ) ) { st->bfi = 1; st->codec_mode = st->last_codec_mode; diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index c9997f5782eade42665d738f97eaf86edda80139..23656c924e3e09397ab3e3de8807b5e9e07965c5 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -732,8 +732,9 @@ ivas_error init_decoder( st->cna_dirac_flag = 0; st->cng_sba_flag = 0; st->cng_ism_flag = 0; +#ifndef ISM_25k6_HZ_CORE st->is_ism_format = 0; - +#endif return error; } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 948b475c74383240756136ec6abea38f518a3608..8db688760d2e5d613bd208761623e21d334da2ba 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -688,6 +688,9 @@ ivas_error create_cpe_dec( st->total_brate = hCPE->element_brate / ( CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifdef ISM_25k6_HZ_CORE + st->is_ism_format = 0; +#endif if ( ( error = init_decoder( st, n, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 2ee76d24c529050f90bd8987a6762c462832e76f..37a283e45180e22679345706943e8f2e9e20e0cf 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -354,6 +354,13 @@ ivas_error create_sce_dec( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifdef ISM_25k6_HZ_CORE + st->is_ism_format = 0; + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + st->is_ism_format = 1; + } +#endif if ( ( error = init_decoder( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index c250b0b7b51200bfa37811d6ea5fcac64a67937b..d2d327fd6c627d8bc18ad4e02be06de99ad57258 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -73,7 +73,12 @@ void stereo_tcx_init_dec( st->core_brate = st->total_brate; /*sampling rate*/ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); /*frame size*/ @@ -107,7 +112,12 @@ void stereo_tcx_init_dec( if ( st->element_mode == IVAS_SCE ) { - st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); /* LPC quantization */ if ( st->sr_core <= INT_FS_16k && st->tcxonly == 0 ) diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index 774b1398c52a32bba57e2117744381bb9df33648..65190ce992abd2be62d730bfb467f306d933f570 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -72,10 +72,20 @@ void init_coder_ace_plus( int16_t L_subfr; /* Bitrate */ - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); /* Core Sampling Rate */ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); /* Narrowband? */ diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index d6c866d4c56e56a671a6b8b857f98bd106d2333d..4ccf86eb21ea1d5b81179efe88c47938e301370c 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -69,7 +69,12 @@ void core_coder_mode_switch( } /* force active frame for the first frame when switching from high bitrates when DTX is enabled*/ - sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); fscale = sr2fscale( sr_core ); @@ -79,7 +84,12 @@ void core_coder_mode_switch( switchWB = 1; /*force init when coming from MODE1*/ } - tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); + tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); if ( tcxonly_tmp != st->tcxonly ) { @@ -91,7 +101,12 @@ void core_coder_mode_switch( st->sr_core = sr_core; st->L_frame = (int16_t) ( sr_core / FRAMES_PER_SEC ); - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index 8a0a92c76a29628d2b24654c249e512a6b18cf2f..cc01594b790bf826ce568fc151b8392af0d06915 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -123,7 +123,6 @@ ivas_error evs_enc( st->mdct_sw = 0; st->rate_switching_reset = 0; - st->idchan = 0; st->flag_ACELP16k = set_ACELP_flag( EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 543f20a40683dc141e77bb5ef258076e005f05f9..9e9a7ca4b251ab522f7b49943edb45be5b2de0d9 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -105,6 +105,14 @@ ivas_error init_encoder( st->flag_ACELP16k = set_ACELP_flag( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); +#ifdef ISM_25k6_HZ_CORE + st->is_ism_format = 0; + if ( ism_mode != ISM_MODE_NONE ) + { + st->is_ism_format = 1; + } +#endif + /*-----------------------------------------------------------------* * Bitstream *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 7a0d25ddfa4e2883fd7db7eb507d72b24123e064..b6f86bb88754061f5eed18b50863af5303b027fa 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -129,6 +129,12 @@ ivas_error pre_proc_ivas( { st->L_frame = L_FRAME32k; } +#ifdef ISM_25k6_HZ_CORE + else if ( st->bwidth >= SWB && st->total_brate > MAX_ACELP_BRATE_ISM && st->total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && st->is_ism_format && st->tcxonly ) + { + st->L_frame = L_FRAME25_6k; + } +#endif else if ( st->flag_ACELP16k ) { st->L_frame = L_FRAME16k; @@ -236,7 +242,13 @@ ivas_error pre_proc_ivas( total_brate_tmp = st->total_brate; st->total_brate = st->bits_frame_nominal * FRAMES_PER_SEC; SetModeIndex( st, st->last_bits_frame_nominal * FRAMES_PER_SEC, last_element_mode, MCT_flag ); - st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + + st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->total_brate = total_brate_tmp; st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 3552ee779014b510ece46b739c455af32fead6ff..cadecf50834e74025c159d2349e861e2a721c005 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -108,7 +108,6 @@ ivas_error pre_proc_front_ivas( const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ - ) { float *inp_12k8, *new_inp_12k8; /* pointers to current frame and new data */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 900a9965731478cc3baca05347f37e3b2f986007..c66ee4e1a569dd25c52ed06af5fd586effd35c2f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -388,7 +388,14 @@ ivas_error ivas_cpe_enc( { int32_t internal_Fs; - internal_Fs = getTcxonly( IVAS_CPE_MDCT, sts[0]->bits_frame_nominal * FRAMES_PER_SEC, 0 ) == 0 ? INT_FS_16k : max( INT_FS_16k, sts[0]->sr_core ); + internal_Fs = getTcxonly( IVAS_CPE_MDCT, sts[0]->bits_frame_nominal * FRAMES_PER_SEC, 0 +#ifdef ISM_25k6_HZ_CORE + , + sts[0]->is_ism_format +#endif + ) == 0 + ? INT_FS_16k + : max( INT_FS_16k, sts[0]->sr_core ); /* iDFT at input sampling rate */ stereo_dft_enc_synthesize( hCPE->hStereoDft, sts[0]->input, 0, input_Fs, input_Fs, 0 ); diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index b8949329582e8684a9f1f185d86c71647ab7e807..a8a220641d89f218d41d3022e26b3b710f462110 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -170,6 +170,12 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; st->coder_type = AUDIO; st->sp_aud_decision2 = 0; +#ifdef ISM_25k6_HZ_CORE + if ( st->low_rate_mode ) + { + st->coder_type = INACTIVE; + } +#endif } } @@ -179,6 +185,13 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; } +#ifdef ISM_25k6_HZ_CORE + if ( st->is_ism_format && st->tcxonly ) + { + st->core = TCX_20_CORE; + } +#endif + #ifdef DEBUGGING if ( st->idchan == 0 ) { @@ -217,6 +230,13 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; st->coder_type = AUDIO; st->sp_aud_decision2 = 0; + +#ifdef ISM_25k6_HZ_CORE + if ( st->low_rate_mode ) + { + st->coder_type = INACTIVE; + } +#endif } } #endif diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 9931f1048dfd7372bc7d717a495d0735f71cea70..ac304e64a4f7249684e35b579e9edcfe7d2e90a4 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -79,7 +79,12 @@ void stereo_tcx_init_enc( } /*sampling rate*/ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); /*frame size*/ diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 82436a7dfccfe66ee5927de25526545248d559bd..e3f672c101c760f5c5697a500bb75fd1dbb3711e 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -600,7 +600,12 @@ void pre_proc( else { SetModeIndex( st, st->last_total_brate, EVS_MONO, 0 ); - st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + 0 +#endif + ); st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); st->encoderLookahead_enc = NS2SA( st->sr_core, ACELP_LOOK_NS ); st->encoderPastSamples_enc = ( st->L_frame * 9 ) >> 4; diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 762b8f6066e94f658f3dc04cccac84531106b2b1..3d4654493772be10abfa229ec0fe2081d6af8be7 100755 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1569,6 +1569,10 @@ typedef struct enc_core_structure /* MCT Channel mode indication: LFE, ignore channel? */ MCT_CHAN_MODE mct_chan_mode; +#ifdef ISM_25k6_HZ_CORE + int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ +#endif + int16_t dtx_sce_sba; /* enable use of FD CNG with transform domain cores in SCE SBA */ } Encoder_State, *ENC_CORE_HANDLE; diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index 6b8c595f5e1ca9b36c3c728a48a6c8711b78772b..ecfd51b65939ded2a1fdcd6b80da56e4442db3ad 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -393,7 +393,12 @@ void updt_enc_common( { st->codec_mode = MODE2; - st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + 0 +#endif + ); st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC );