Loading lib_com/ivas_prot.h +16 −0 Original line number Diff line number Diff line Loading @@ -2999,6 +2999,10 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame #ifdef SBA_HOA_HBR_IMPROV , const int16_t merged_sba_mode #endif ); /*----------------------------------------------------------------------------------* Loading Loading @@ -3866,6 +3870,10 @@ ivas_error ivas_spar_md_enc_open( ivas_spar_md_enc_state_t **hMdEnc, /* i/o: SPAR MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ const int16_t sba_order /* i : Ambisonic (SBA) order */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t spar_hoa_md_flag /* i : flag to send HOA MD for all bands */ #endif ); void ivas_spar_md_enc_close( Loading Loading @@ -3941,6 +3949,10 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t spar_hoa_md_flag /* i : flag to send HOA MD for all bands */ #endif ); void ivas_spar_md_dec_close( Loading Loading @@ -4766,6 +4778,10 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands /* i : Number of frequency bands */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t merged_sba_mode #endif ); Loading lib_com/ivas_spar_com.c +2 −1 Original line number Diff line number Diff line Loading @@ -1731,10 +1731,11 @@ void ivas_get_spar_md_from_dirac( /*SPAR from DirAC*/ set_f( response_avg, 0.0f, MAX_OUTPUT_CHANNELS ); #ifndef SBA_HOA_HBR_IMPROV set_f( hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].pred_re, 0.0f, IVAS_SPAR_MAX_CH - 1 ); set_f( &hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].C_re[0][0], 0.0f, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); set_f( &hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].P_re[0], 0.0f, ( IVAS_SPAR_MAX_CH - 1 ) ); #endif if ( n_ts > 1 ) { ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][i_ts], (int16_t) ele_dirac[band][i_ts], response_avg, order ); Loading lib_com/options.h +2 −2 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ #define FIX_ADAP_STEFI_SHIFT /* Issue 89: fix bug in parameter shift of adaptive stereo filling */ #define SPAR_SCALING_HARMONIZATION /* issue 80: Changes to harmonize scaling in spar */ #define SBA_HOA_HBR_IMPROV /* issue 91: Improvements to SBA high bitrate HOA3 coding */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading lib_dec/ivas_spar_decoder.c +35 −2 Original line number Diff line number Diff line Loading @@ -69,6 +69,9 @@ ivas_error ivas_spar_dec_open( IVAS_FB_CFG *fb_cfg; int16_t i, j, b, active_w_mixing; int32_t output_Fs; #ifdef SBA_HOA_HBR_IMPROV int16_t spar_hoa_md_flag; #endif error = IVAS_ERR_OK; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); Loading @@ -80,6 +83,17 @@ ivas_error ivas_spar_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); } #ifdef SBA_HOA_HBR_IMPROV if ( st_ivas->sba_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k ) { spar_hoa_md_flag = 1; } else { spar_hoa_md_flag = 0; } #endif output_Fs = st_ivas->hDecoderConfig->output_Fs; /* TD decorr. */ Loading @@ -89,7 +103,12 @@ ivas_error ivas_spar_dec_open( } /* MD handle */ if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal ) ) != IVAS_ERR_OK ) if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal #ifdef SBA_HOA_HBR_IMPROV , spar_hoa_md_flag #endif ) ) != IVAS_ERR_OK ) { return error; } Loading Loading @@ -632,7 +651,16 @@ static void ivas_spar_dec_MD( { ivas_parse_spar_header( hDecoderConfig->ivas_total_brate, sba_order, st0, &table_idx ); #ifdef SBA_HOA_HBR_IMPROV if ( hSpar->hMdDec->spar_hoa_md_flag ) { hSpar->hMdDec->spar_md.num_bands = IVAS_MAX_NUM_BANDS; } else #endif { hSpar->hMdDec->spar_md.num_bands = min( SPAR_DIRAC_SPLIT_START_BAND, IVAS_MAX_NUM_BANDS ); } if ( hSpar->hMdDec->table_idx != table_idx ) { Loading Loading @@ -775,7 +803,12 @@ void ivas_spar_get_parameters( weight = ivas_spar_get_cldfb_slot_gain( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms ); #ifdef SBA_HOA_HBR_IMPROV split_band = hSpar->hMdDec->spar_md.num_bands; #else split_band = SPAR_DIRAC_SPLIT_START_BAND; #endif for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { for ( out_ch = 0; out_ch < num_ch_out; out_ch++ ) Loading lib_dec/ivas_spar_md_dec.c +114 −10 Original line number Diff line number Diff line Loading @@ -252,6 +252,10 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t spar_hoa_md_flag /* i : flag to send HOA MD for all bands */ #endif ) { ivas_spar_md_dec_state_t *hMdDec; Loading @@ -269,6 +273,9 @@ ivas_error ivas_spar_md_dec_open( return error; } #ifdef SBA_HOA_HBR_IMPROV hMdDec->spar_hoa_md_flag = spar_hoa_md_flag; #endif hMdDec->table_idx = 0; /* just to initialize state variables*/ if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels ) ) != IVAS_ERR_OK ) Loading Loading @@ -440,7 +447,13 @@ ivas_error ivas_spar_md_dec_init( float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; hMdDec->spar_md_cfg.gen_bs = 1; // VE2DB : always 1 - can it be removed? ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) ); ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, #ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) #else min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) #endif ); nchan_transport = hMdDec->spar_md_cfg.nchan_transport; Loading Loading @@ -525,7 +538,11 @@ ivas_error ivas_spar_md_dec_init( ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); hMdDec->spar_md.dtx_vad = 0; #ifdef SBA_HOA_HBR_IMPROV hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); #else hMdDec->spar_md.num_bands = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); #endif hMdDec->td_decorr_flag = 1; set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); Loading Loading @@ -683,7 +700,11 @@ void ivas_spar_md_dec_process( /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) { #ifdef SBA_HOA_HBR_IMPROV for ( b = 0; b < hMdDec->spar_md.num_bands; b++ ) #else for ( b = 0; b < min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); b++ ) #endif { for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { Loading Loading @@ -1802,6 +1823,15 @@ static void ivas_decode_arith_bs( ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; pred_cell_dims[i].dim1 = ndm + ndec - 1; #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); } } #endif pred_cell_dims[i].dim2 = 1; drct_cell_dims[i].dim1 = ndec; drct_cell_dims[i].dim2 = ndm - 1; Loading @@ -1822,6 +1852,23 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { int16_t j; for ( i = 0; i < nB; i++ ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { for ( j = 0; j < pred_cell_dims[i].dim1; j++ ) { hMdDec->spar_md_prev.band_coeffs_idx_mapped[i].pred_index_re[j] = hMdDec->spar_md_prev.band_coeffs_idx_mapped[i].pred_index_re[j + ( FOA_CHANNELS - 1 )]; } } } } #endif ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); } Loading @@ -1830,6 +1877,28 @@ static void ivas_decode_arith_bs( ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { int16_t j; for ( i = 0; i < nB; i++ ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { for ( j = pred_cell_dims[i].dim1 - 1; j >= 0; j-- ) { hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j + ( FOA_CHANNELS - 1 )] = hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j]; } for ( j = 0; j < FOA_CHANNELS - 1; j++ ) { hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] = 0; } } } } #endif if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF, planarCP ); Loading Loading @@ -2069,7 +2138,7 @@ static void ivas_decode_huffman_bs( for ( i = 0; i < nB; i++ ) { int16_t ndm, ndec; int16_t pred_dim, drct_dim, decd_dim; int16_t pred_dim, drct_dim, decd_dim, pred_offset; ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; Loading @@ -2077,13 +2146,36 @@ static void ivas_decode_huffman_bs( pred_dim = ndec + ndm - 1; drct_dim = ndec * ( ndm - 1 ); decd_dim = ndec; pred_offset = 0; #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { pred_offset = FOA_CHANNELS - 1; } } #endif for ( j = 0; j < pred_dim; j++ ) for ( j = pred_offset; j < pred_dim; j++ ) { ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); } #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { for ( j = 0; j < pred_offset; j++ ) { hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] = 0; } } } #endif for ( j = 0; j < drct_dim; j++ ) { if ( planarCP && !keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) Loading Loading @@ -2761,7 +2853,13 @@ void ivas_spar_to_dirac( if ( hMdDec->spar_md_cfg.nchan_transport > 1 ) { ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, sba_order_internal, dtx_vad, NULL ); end_band, num_bands_out, #ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, #else sba_order_internal, #endif dtx_vad, NULL ); /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) Loading @@ -2774,7 +2872,13 @@ void ivas_spar_to_dirac( } ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, MAX_PARAM_SPATIAL_SUBFRAMES, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, sba_order_internal, dtx_vad, NULL ); end_band, num_bands_out, #ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, #else sba_order_internal, #endif dtx_vad, NULL ); /* expand DirAC TC 20ms MD for residual channels to all subframes*/ for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) Loading Loading
lib_com/ivas_prot.h +16 −0 Original line number Diff line number Diff line Loading @@ -2999,6 +2999,10 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame #ifdef SBA_HOA_HBR_IMPROV , const int16_t merged_sba_mode #endif ); /*----------------------------------------------------------------------------------* Loading Loading @@ -3866,6 +3870,10 @@ ivas_error ivas_spar_md_enc_open( ivas_spar_md_enc_state_t **hMdEnc, /* i/o: SPAR MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ const int16_t sba_order /* i : Ambisonic (SBA) order */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t spar_hoa_md_flag /* i : flag to send HOA MD for all bands */ #endif ); void ivas_spar_md_enc_close( Loading Loading @@ -3941,6 +3949,10 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t spar_hoa_md_flag /* i : flag to send HOA MD for all bands */ #endif ); void ivas_spar_md_dec_close( Loading Loading @@ -4766,6 +4778,10 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands /* i : Number of frequency bands */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t merged_sba_mode #endif ); Loading
lib_com/ivas_spar_com.c +2 −1 Original line number Diff line number Diff line Loading @@ -1731,10 +1731,11 @@ void ivas_get_spar_md_from_dirac( /*SPAR from DirAC*/ set_f( response_avg, 0.0f, MAX_OUTPUT_CHANNELS ); #ifndef SBA_HOA_HBR_IMPROV set_f( hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].pred_re, 0.0f, IVAS_SPAR_MAX_CH - 1 ); set_f( &hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].C_re[0][0], 0.0f, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); set_f( &hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].P_re[0], 0.0f, ( IVAS_SPAR_MAX_CH - 1 ) ); #endif if ( n_ts > 1 ) { ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][i_ts], (int16_t) ele_dirac[band][i_ts], response_avg, order ); Loading
lib_com/options.h +2 −2 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ #define FIX_ADAP_STEFI_SHIFT /* Issue 89: fix bug in parameter shift of adaptive stereo filling */ #define SPAR_SCALING_HARMONIZATION /* issue 80: Changes to harmonize scaling in spar */ #define SBA_HOA_HBR_IMPROV /* issue 91: Improvements to SBA high bitrate HOA3 coding */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
lib_dec/ivas_spar_decoder.c +35 −2 Original line number Diff line number Diff line Loading @@ -69,6 +69,9 @@ ivas_error ivas_spar_dec_open( IVAS_FB_CFG *fb_cfg; int16_t i, j, b, active_w_mixing; int32_t output_Fs; #ifdef SBA_HOA_HBR_IMPROV int16_t spar_hoa_md_flag; #endif error = IVAS_ERR_OK; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); Loading @@ -80,6 +83,17 @@ ivas_error ivas_spar_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); } #ifdef SBA_HOA_HBR_IMPROV if ( st_ivas->sba_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k ) { spar_hoa_md_flag = 1; } else { spar_hoa_md_flag = 0; } #endif output_Fs = st_ivas->hDecoderConfig->output_Fs; /* TD decorr. */ Loading @@ -89,7 +103,12 @@ ivas_error ivas_spar_dec_open( } /* MD handle */ if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal ) ) != IVAS_ERR_OK ) if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal #ifdef SBA_HOA_HBR_IMPROV , spar_hoa_md_flag #endif ) ) != IVAS_ERR_OK ) { return error; } Loading Loading @@ -632,7 +651,16 @@ static void ivas_spar_dec_MD( { ivas_parse_spar_header( hDecoderConfig->ivas_total_brate, sba_order, st0, &table_idx ); #ifdef SBA_HOA_HBR_IMPROV if ( hSpar->hMdDec->spar_hoa_md_flag ) { hSpar->hMdDec->spar_md.num_bands = IVAS_MAX_NUM_BANDS; } else #endif { hSpar->hMdDec->spar_md.num_bands = min( SPAR_DIRAC_SPLIT_START_BAND, IVAS_MAX_NUM_BANDS ); } if ( hSpar->hMdDec->table_idx != table_idx ) { Loading Loading @@ -775,7 +803,12 @@ void ivas_spar_get_parameters( weight = ivas_spar_get_cldfb_slot_gain( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms ); #ifdef SBA_HOA_HBR_IMPROV split_band = hSpar->hMdDec->spar_md.num_bands; #else split_band = SPAR_DIRAC_SPLIT_START_BAND; #endif for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { for ( out_ch = 0; out_ch < num_ch_out; out_ch++ ) Loading
lib_dec/ivas_spar_md_dec.c +114 −10 Original line number Diff line number Diff line Loading @@ -252,6 +252,10 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ #ifdef SBA_HOA_HBR_IMPROV , const int16_t spar_hoa_md_flag /* i : flag to send HOA MD for all bands */ #endif ) { ivas_spar_md_dec_state_t *hMdDec; Loading @@ -269,6 +273,9 @@ ivas_error ivas_spar_md_dec_open( return error; } #ifdef SBA_HOA_HBR_IMPROV hMdDec->spar_hoa_md_flag = spar_hoa_md_flag; #endif hMdDec->table_idx = 0; /* just to initialize state variables*/ if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels ) ) != IVAS_ERR_OK ) Loading Loading @@ -440,7 +447,13 @@ ivas_error ivas_spar_md_dec_init( float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; hMdDec->spar_md_cfg.gen_bs = 1; // VE2DB : always 1 - can it be removed? ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) ); ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, #ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) #else min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) #endif ); nchan_transport = hMdDec->spar_md_cfg.nchan_transport; Loading Loading @@ -525,7 +538,11 @@ ivas_error ivas_spar_md_dec_init( ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); hMdDec->spar_md.dtx_vad = 0; #ifdef SBA_HOA_HBR_IMPROV hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); #else hMdDec->spar_md.num_bands = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); #endif hMdDec->td_decorr_flag = 1; set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); Loading Loading @@ -683,7 +700,11 @@ void ivas_spar_md_dec_process( /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) { #ifdef SBA_HOA_HBR_IMPROV for ( b = 0; b < hMdDec->spar_md.num_bands; b++ ) #else for ( b = 0; b < min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); b++ ) #endif { for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { Loading Loading @@ -1802,6 +1823,15 @@ static void ivas_decode_arith_bs( ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; pred_cell_dims[i].dim1 = ndm + ndec - 1; #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); } } #endif pred_cell_dims[i].dim2 = 1; drct_cell_dims[i].dim1 = ndec; drct_cell_dims[i].dim2 = ndm - 1; Loading @@ -1822,6 +1852,23 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { int16_t j; for ( i = 0; i < nB; i++ ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { for ( j = 0; j < pred_cell_dims[i].dim1; j++ ) { hMdDec->spar_md_prev.band_coeffs_idx_mapped[i].pred_index_re[j] = hMdDec->spar_md_prev.band_coeffs_idx_mapped[i].pred_index_re[j + ( FOA_CHANNELS - 1 )]; } } } } #endif ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); } Loading @@ -1830,6 +1877,28 @@ static void ivas_decode_arith_bs( ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { int16_t j; for ( i = 0; i < nB; i++ ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { for ( j = pred_cell_dims[i].dim1 - 1; j >= 0; j-- ) { hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j + ( FOA_CHANNELS - 1 )] = hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j]; } for ( j = 0; j < FOA_CHANNELS - 1; j++ ) { hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] = 0; } } } } #endif if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF, planarCP ); Loading Loading @@ -2069,7 +2138,7 @@ static void ivas_decode_huffman_bs( for ( i = 0; i < nB; i++ ) { int16_t ndm, ndec; int16_t pred_dim, drct_dim, decd_dim; int16_t pred_dim, drct_dim, decd_dim, pred_offset; ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; Loading @@ -2077,13 +2146,36 @@ static void ivas_decode_huffman_bs( pred_dim = ndec + ndm - 1; drct_dim = ndec * ( ndm - 1 ); decd_dim = ndec; pred_offset = 0; #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { pred_offset = FOA_CHANNELS - 1; } } #endif for ( j = 0; j < pred_dim; j++ ) for ( j = pred_offset; j < pred_dim; j++ ) { ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); } #ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { for ( j = 0; j < pred_offset; j++ ) { hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] = 0; } } } #endif for ( j = 0; j < drct_dim; j++ ) { if ( planarCP && !keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) Loading Loading @@ -2761,7 +2853,13 @@ void ivas_spar_to_dirac( if ( hMdDec->spar_md_cfg.nchan_transport > 1 ) { ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, sba_order_internal, dtx_vad, NULL ); end_band, num_bands_out, #ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, #else sba_order_internal, #endif dtx_vad, NULL ); /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) Loading @@ -2774,7 +2872,13 @@ void ivas_spar_to_dirac( } ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, MAX_PARAM_SPATIAL_SUBFRAMES, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, sba_order_internal, dtx_vad, NULL ); end_band, num_bands_out, #ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, #else sba_order_internal, #endif dtx_vad, NULL ); /* expand DirAC TC 20ms MD for residual channels to all subframes*/ for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) Loading