From fa25814681e9a35e76056a3f7cf93f6d81fa874b Mon Sep 17 00:00:00 2001 From: rhb Date: Mon, 28 Aug 2023 16:18:02 +0200 Subject: [PATCH 01/10] allocate hIGFEnc only when needed at the encoder --- lib_com/options.h | 1 + lib_com/prot.h | 16 +++++++++++ lib_enc/cod_tcx.c | 19 ++++++++++++++ lib_enc/core_enc_init.c | 0 lib_enc/core_enc_switch.c | 0 lib_enc/ext_sig_ana.c | 4 +++ lib_enc/igf_enc.c | 38 +++++++++++++++++++++++++++ lib_enc/init_enc.c | 21 +++++++++++++++ lib_enc/ivas_corecoder_enc_reconfig.c | 21 +++++++++++++++ lib_enc/ivas_cpe_enc.c | 17 ++++++++++++ lib_enc/ivas_ism_enc.c | 13 +++++++++ lib_enc/ivas_mct_core_enc.c | 0 lib_enc/ivas_mct_enc.c | 15 +++++++++++ lib_enc/ivas_sce_enc.c | 16 ++++++++++- lib_enc/ivas_spar_encoder.c | 6 ++++- 15 files changed, 185 insertions(+), 2 deletions(-) mode change 100644 => 100755 lib_com/options.h mode change 100644 => 100755 lib_com/prot.h mode change 100644 => 100755 lib_enc/cod_tcx.c mode change 100644 => 100755 lib_enc/core_enc_init.c mode change 100644 => 100755 lib_enc/core_enc_switch.c mode change 100644 => 100755 lib_enc/ext_sig_ana.c mode change 100644 => 100755 lib_enc/igf_enc.c mode change 100644 => 100755 lib_enc/init_enc.c mode change 100644 => 100755 lib_enc/ivas_corecoder_enc_reconfig.c mode change 100644 => 100755 lib_enc/ivas_cpe_enc.c mode change 100644 => 100755 lib_enc/ivas_ism_enc.c mode change 100644 => 100755 lib_enc/ivas_mct_core_enc.c mode change 100644 => 100755 lib_enc/ivas_mct_enc.c mode change 100644 => 100755 lib_enc/ivas_sce_enc.c mode change 100644 => 100755 lib_enc/ivas_spar_encoder.c diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index be3261f808..d31482cfd9 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ +#define IGF_MEMORY_ALLOC_OPT /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h old mode 100644 new mode 100755 index 4746906225..4095e4263c --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2272,6 +2272,10 @@ ivas_error init_encoder( const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ const ISM_MODE ism_mode /* i : ISM mode */ +#ifdef IGF_MEMORY_ALLOC_OPT + , + const int32_t element_brate +#endif ); void LPDmem_enc_init( @@ -9869,6 +9873,18 @@ void IGFEncResetTCX10BitCounter( const IGF_ENC_INSTANCE_HANDLE hIGFEnc /* i : instance handle of IGF Encoder */ ); +#ifdef IGF_MEMORY_ALLOC_OPT +ivas_error IGF_Reconfig( + IGF_ENC_INSTANCE_HANDLE *hIGFEnc,/* i/o: instance handle of IGF Encoder */ + const int16_t igf, /* i : IGF on/off */ + const int16_t reset, /* i : reset flag */ + const int32_t brate, /* i : bitrate for configuration */ + const int16_t bwidth, /* i : signal bandwidth */ + const int16_t element_mode, /* i : IVAS element mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ +); +#endif + void IGFEncSetMode( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ const int32_t total_brate, /* i : encoder total bitrate */ diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c old mode 100644 new mode 100755 index ac24d74bf2..9fb184e247 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -1197,16 +1197,35 @@ void QuantizeTCXSpectrum( { noiseFillingBorder = st->hIGFEnc->infoStartLine; } +#ifndef IGF_MEMORY_ALLOC_OPT else { st->hIGFEnc->infoStopLine = noiseFillingBorder; } +#endif *pnoiseFillingBorder = noiseFillingBorder; +#ifdef IGF_MEMORY_ALLOC_OPT + if ( st->igf ) + { + for ( i = st->hIGFEnc->infoStopLine; i < max( L_frame, L_frameTCX ); i++ ) + { + spectrum[i] = 0.0f; + } + } + else + { + for ( i = noiseFillingBorder; i < max( L_frame, L_frameTCX ); i++ ) + { + spectrum[i] = 0.0f; + } + } +#else for ( i = st->hIGFEnc->infoStopLine; i < max( L_frame, L_frameTCX ); i++ ) { spectrum[i] = 0.0f; } +#endif /*-----------------------------------------------------------* * Quantization * diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c old mode 100644 new mode 100755 diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c old mode 100644 new mode 100755 diff --git a/lib_enc/ext_sig_ana.c b/lib_enc/ext_sig_ana.c old mode 100644 new mode 100755 index e76457e61c..6fc061fa1b --- a/lib_enc/ext_sig_ana.c +++ b/lib_enc/ext_sig_ana.c @@ -200,7 +200,11 @@ void core_signal_analysis_high_bitrate( overlap_mode[2] = curr_overlap; /* Overlap between the current and the next frame */ } +#ifdef IGF_MEMORY_ALLOC_OPT + if ( st->igf && transform_type[0] != TCX_20 ) +#else if ( transform_type[0] != TCX_20 ) +#endif { IGFEncResetTCX10BitCounter( st->hIGFEnc ); } diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c old mode 100644 new mode 100755 index 05faa0fac4..71799e3d81 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2005,3 +2005,41 @@ void IGFSaveSpectrumForITF( return; } + + +#ifdef IGF_MEMORY_ALLOC_OPT +ivas_error IGF_Reconfig( + IGF_ENC_INSTANCE_HANDLE *hIGFEnc,/* i/o: instance handle of IGF Encoder */ + const int16_t igf, /* i : IGF on/off */ + const int16_t reset, /* i : reset flag */ + const int32_t brate, /* i : bitrate for configuration */ + const int16_t bwidth, /* i : signal bandwidth */ + const int16_t element_mode, /* i : IVAS element mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ +) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + if ( igf && *hIGFEnc == NULL ) + { + if ( ( *hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) ); + } + IGFEncSetMode( *hIGFEnc, brate, bwidth, element_mode, rf_mode ); + } + else if ( igf && reset ) + { + IGFEncSetMode( *hIGFEnc, brate, bwidth, element_mode, rf_mode ); + } + else if ( !igf && *hIGFEnc != NULL ) + { + free( *hIGFEnc ); + *hIGFEnc = NULL; + } + + return error; +} +#endif diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c old mode 100644 new mode 100755 index 3eb363324e..62b5283488 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -61,6 +61,10 @@ ivas_error init_encoder( const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ const ISM_MODE ism_mode /* i : ISM mode */ +#ifdef IGF_MEMORY_ALLOC_OPT + , + const int32_t element_brate +#endif ) { int16_t i; @@ -742,7 +746,22 @@ ivas_error init_encoder( * IGF *-----------------------------------------------------------------*/ +#ifdef IGF_MEMORY_ALLOC_OPT + if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) + { + st->igf = getIgfPresent( st->element_mode, ( st->element_mode == IVAS_CPE_MDCT ) ? element_brate : st->total_brate, st->max_bwidth, st->rf_mode ); + } + else + { + st->igf = 0; + } +#endif + +#ifdef IGF_MEMORY_ALLOC_OPT + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && ( st->igf || st->element_mode == EVS_MONO ) ) +#else if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) +#endif { if ( ( st->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) { @@ -760,6 +779,7 @@ ivas_error init_encoder( st->last_sr_core = st->last_L_frame * FRAMES_PER_SEC; +#ifndef IGF_MEMORY_ALLOC_OPT if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) { st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); @@ -768,6 +788,7 @@ ivas_error init_encoder( { st->igf = 0; } +#endif /* PLC encoder */ if ( st->element_mode == EVS_MONO ) diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c old mode 100644 new mode 100755 index 153d85e4f2..61fcb11102 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -430,6 +430,16 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); +#ifdef IGF_MEMORY_ALLOC_OPT + error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, + st_ivas->hCPE[0]->hCoreCoder[n]->igf, + 1, + st_ivas->hCPE[0]->element_brate, + st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, + st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); + +#else if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { IGFEncSetMode( st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, @@ -438,6 +448,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); } +#endif } } @@ -503,6 +514,15 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); +#ifdef IGF_MEMORY_ALLOC_OPT + error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, + st_ivas->hCPE[0]->hCoreCoder[n]->igf, + 1, + st_ivas->hCPE[0]->element_brate, + st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, + st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); +#else if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { IGFEncSetMode( st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, @@ -511,6 +531,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); } +#endif /* reset mct_chan_mode */ st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c old mode 100644 new mode 100755 index cae9119000..6d9a942dd4 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -520,6 +520,19 @@ ivas_error ivas_cpe_enc( * Core codec configuration *----------------------------------------------------------------*/ +#ifdef IGF_MEMORY_ALLOC_OPT + /* IGF reconfiguration */ + for ( n = 0; n < n_CoreChannels; n++ ) + { + if ( hCPE->last_element_brate != hCPE->element_brate || sts[n]->last_bwidth != sts[n]->bwidth ) + { + int16_t igf; + igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->rf_mode ); + error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ); + } + } +#endif + if ( hCPE->element_mode == IVAS_CPE_MDCT && st_ivas->hMCT == NULL ) { /* set coded BW for MDCT stereo */ @@ -901,7 +914,11 @@ ivas_error create_cpe_enc( st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; if ( ( error = init_encoder( st, st_ivas, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, +#ifdef IGF_MEMORY_ALLOC_OPT + ISM_MODE_NONE, hCPE->element_brate ) ) != IVAS_ERR_OK ) +#else ISM_MODE_NONE ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c old mode 100644 new mode 100755 index 35878e5848..f758480149 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -308,6 +308,15 @@ ivas_error ivas_ism_enc( /*----------------------------------------------------------------* * Core codec configuration *----------------------------------------------------------------*/ +#ifdef IGF_MEMORY_ALLOC_OPT + /* IGF reconfiguration */ + if ( hSCE->last_element_brate != hSCE->element_brate ) + { + int16_t igf; + igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->rf_mode ); + error = IGF_Reconfig( &st->hIGFEnc, igf, 0, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->element_mode, st->rf_mode ); + } +#endif /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */ if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA ) @@ -345,6 +354,10 @@ ivas_error ivas_ism_enc( /* update input samples buffer */ mvr2r( st->input, st->old_input_signal, input_frame ); +#ifdef IGF_MEMORY_ALLOC_OPT + hSCE->last_element_brate = hSCE->element_brate; +#endif + /* Store previous attack detection flag */ st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c old mode 100644 new mode 100755 diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c old mode 100644 new mode 100755 index 895e864797..5a860c3724 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -417,6 +417,11 @@ ivas_error mct_enc_reconfigure( int16_t n, cpe_id, max_blocks; int32_t ivas_total_brate, cp_bitrate; IVAS_FORMAT ivas_format; +#ifdef IGF_MEMORY_ALLOC_OPT + ivas_error error; + + error = IVAS_ERR_OK; +#endif hMCT = st_ivas->hMCT; ivas_format = st_ivas->hEncoderConfig->ivas_format; @@ -484,10 +489,15 @@ ivas_error mct_enc_reconfigure( { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); + +#ifdef IGF_MEMORY_ALLOC_OPT + error = IGF_Reconfig( &st->hIGFEnc, st->igf, 1, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ); +#else if ( st->igf ) { IGFEncSetMode( st->hIGFEnc, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ); } +#endif } } } @@ -554,7 +564,12 @@ ivas_error mct_enc_reconfigure( *-----------------------------------------------------------------*/ set_mct_enc_params( hMCT, ivas_total_brate, ivas_format, b_nchan_change ); + +#ifdef IGF_MEMORY_ALLOC_OPT + return error; +#else return IVAS_ERR_OK; +#endif } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c old mode 100644 new mode 100755 index f8c7afa6ca..266df50d1d --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -230,6 +230,16 @@ ivas_error ivas_sce_enc( * Core codec configuration *----------------------------------------------------------------*/ +#ifdef IGF_MEMORY_ALLOC_OPT + /* IGF reconfiguration */ + if ( hSCE->last_element_brate != hSCE->element_brate ) + { + int16_t igf; + igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->rf_mode ); + error = IGF_Reconfig( &st->hIGFEnc, igf, 0, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->element_mode, st->rf_mode ); + } +#endif + /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */ if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA ) { @@ -358,7 +368,11 @@ ivas_error create_sce_enc( 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; - if ( ( error = init_encoder( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode +#ifdef IGF_MEMORY_ALLOC_OPT + , hSCE->element_brate +#endif + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c old mode 100644 new mode 100755 index 476a1f39c3..f5a4dcce64 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -224,7 +224,11 @@ ivas_error ivas_spar_enc_open( hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, st_ivas, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( hSpar->hCoreCoderVAD, st_ivas, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode +#ifdef IGF_MEMORY_ALLOC_OPT + , hSpar->hCoreCoderVAD->total_brate +#endif + ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From ce7c409ca75651cdbefd620fa3a3ebffa8ef0047 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 12:09:23 +0200 Subject: [PATCH 02/10] fix USAN error --- lib_enc/ivas_mct_enc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 5a860c3724..1b764a0a7e 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -224,7 +224,11 @@ ivas_error ivas_mct_enc( for ( n = 0; n < (int16_t) ( hMCT->nchan_out_woLFE * 0.5 ); n++ ) { +#ifdef IGF_MEMORY_ALLOC_OPT + initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->igf ? st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid : NULL, 0 ); +#else initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid, 0 ); +#endif } } @@ -381,7 +385,11 @@ ivas_error create_mct_enc( #ifdef DEBUGGING hMCT->hBlockData[n]->hStereoMdct->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; #endif +#ifdef IGF_MEMORY_ALLOC_OPT + initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, st_ivas->hEncoderConfig->max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->igf ? st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid : NULL, 1 ); +#else initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, st_ivas->hEncoderConfig->max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid, 1 ); +#endif } for ( ; n < MCT_MAX_BLOCKS; n++ ) @@ -540,7 +548,11 @@ ivas_error mct_enc_reconfigure( #ifdef DEBUGGING hMCT->hBlockData[n]->hStereoMdct->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; #endif +#ifdef IGF_MEMORY_ALLOC_OPT + initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, st_ivas->hEncoderConfig->max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->igf ? st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid : NULL, mem_init ); +#else initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, st_ivas->hEncoderConfig->max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid, mem_init ); +#endif } for ( ; n < MCT_MAX_BLOCKS; n++ ) -- GitLab From c935d1068ba196a56d2d033308dfac99ed554c46 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 13:27:51 +0200 Subject: [PATCH 03/10] fix ASAN error --- lib_enc/ivas_cpe_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 6d9a942dd4..3675a4f603 100755 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -524,7 +524,7 @@ ivas_error ivas_cpe_enc( /* IGF reconfiguration */ for ( n = 0; n < n_CoreChannels; n++ ) { - if ( hCPE->last_element_brate != hCPE->element_brate || sts[n]->last_bwidth != sts[n]->bwidth ) + if ( ( hCPE->last_element_brate != hCPE->element_brate || sts[n]->last_bwidth != sts[n]->bwidth ) && ( n == 0 || hCPE->element_mode == IVAS_CPE_MDCT ) ) { int16_t igf; igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->rf_mode ); -- GitLab From 18d2eba7d76489bb21031e96b8bbdc3b462e0981 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 15:50:34 +0200 Subject: [PATCH 04/10] fix crashes for WB and bandwidth switching --- lib_enc/init_enc.c | 38 +++++++++++++++++++++++++++++++++++++- lib_enc/ivas_ism_enc.c | 2 +- lib_enc/ivas_sce_enc.c | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 62b5283488..7c9158d60f 100755 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -69,6 +69,9 @@ ivas_error init_encoder( { int16_t i; ivas_error error; +#ifdef IGF_MEMORY_ALLOC_OPT + int32_t igf_brate; +#endif error = IVAS_ERR_OK; @@ -747,9 +750,42 @@ ivas_error init_encoder( *-----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT + igf_brate = st->total_brate; + switch ( st->element_mode ) + { + case IVAS_SCE: + if ( st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT ) + { + igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; + } + break; + case IVAS_CPE_DFT: + /* use nominal bitrates for DFT Stereo, same as in stereo_dft_config() */ + if ( element_brate == IVAS_13k2 ) + { + igf_brate = ACELP_9k60; + } + else if ( element_brate == IVAS_16k4 ) + { + igf_brate = ACELP_13k20; + } + else if ( element_brate == IVAS_24k4 ) + { + igf_brate = ACELP_16k40; + } + else if ( element_brate == IVAS_32k ) + { + igf_brate = ACELP_24k40; + } + break; + case IVAS_CPE_MDCT: + igf_brate = element_brate; + break; + } + if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) { - st->igf = getIgfPresent( st->element_mode, ( st->element_mode == IVAS_CPE_MDCT ) ? element_brate : st->total_brate, st->max_bwidth, st->rf_mode ); + st->igf = getIgfPresent( st->element_mode, igf_brate, st->max_bwidth, st->rf_mode ); } else { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index f758480149..14d5f2ed36 100755 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -310,7 +310,7 @@ ivas_error ivas_ism_enc( *----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT /* IGF reconfiguration */ - if ( hSCE->last_element_brate != hSCE->element_brate ) + if ( hSCE->last_element_brate != hSCE->element_brate || st->last_bwidth != st->bwidth ) { int16_t igf; igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->rf_mode ); diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 266df50d1d..f735d54121 100755 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -232,7 +232,7 @@ ivas_error ivas_sce_enc( #ifdef IGF_MEMORY_ALLOC_OPT /* IGF reconfiguration */ - if ( hSCE->last_element_brate != hSCE->element_brate ) + if ( hSCE->last_element_brate != hSCE->element_brate || st->last_bwidth != st->bwidth ) { int16_t igf; igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->rf_mode ); -- GitLab From 30e54d80dd7b64a0643d744138b5f06021e77536 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 16:23:07 +0200 Subject: [PATCH 05/10] fix further WB crashes for SBA --- lib_enc/init_enc.c | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 7c9158d60f..79dff09e73 100755 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -750,37 +750,37 @@ ivas_error init_encoder( *-----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT - igf_brate = st->total_brate; - switch ( st->element_mode ) - { - case IVAS_SCE: - if ( st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT ) - { - igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; - } - break; - case IVAS_CPE_DFT: - /* use nominal bitrates for DFT Stereo, same as in stereo_dft_config() */ - if ( element_brate == IVAS_13k2 ) - { - igf_brate = ACELP_9k60; - } - else if ( element_brate == IVAS_16k4 ) - { - igf_brate = ACELP_13k20; - } - else if ( element_brate == IVAS_24k4 ) - { - igf_brate = ACELP_16k40; - } - else if ( element_brate == IVAS_32k ) - { - igf_brate = ACELP_24k40; - } - break; - case IVAS_CPE_MDCT: - igf_brate = element_brate; - break; + if ( st->element_mode == IVAS_SCE && st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT ) + { + igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; + } + else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) ) ) + { + /* use nominal bitrates for DFT Stereo and (O)SBA, same as in stereo_dft_config()/ivas_spar_config() */ + if ( element_brate == IVAS_13k2 ) + { + igf_brate = ACELP_9k60; + } + else if ( element_brate == IVAS_16k4 ) + { + igf_brate = ACELP_13k20; + } + else if ( element_brate == IVAS_24k4 ) + { + igf_brate = ACELP_16k40; + } + else if ( element_brate == IVAS_32k ) + { + igf_brate = ACELP_24k40; + } + } + else if ( st->element_mode == IVAS_CPE_MDCT ) + { + igf_brate = element_brate; + } + else + { + igf_brate = st->total_brate; } if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) -- GitLab From 792bab859cc2be1464b5e69871f1a6860fad52e4 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 16:35:36 +0200 Subject: [PATCH 06/10] fix warning --- lib_enc/init_enc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 79dff09e73..d40efd4873 100755 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -750,6 +750,7 @@ ivas_error init_encoder( *-----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT + igf_brate = st->total_brate; if ( st->element_mode == IVAS_SCE && st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT ) { igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; @@ -778,10 +779,6 @@ ivas_error init_encoder( { igf_brate = element_brate; } - else - { - igf_brate = st->total_brate; - } if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) { -- GitLab From 996f3e1912841be9d171679e08ad09a4572d9ab2 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 17:37:44 +0200 Subject: [PATCH 07/10] add exits in case IGF_Reconfig() fails --- lib_enc/ivas_corecoder_enc_reconfig.c | 35 +++++++++++++++------------ lib_enc/ivas_cpe_enc.c | 5 +++- lib_enc/ivas_ism_enc.c | 5 +++- lib_enc/ivas_mct_enc.c | 5 +++- lib_enc/ivas_sce_enc.c | 5 +++- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index 61fcb11102..f6c547aed3 100755 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -431,14 +431,16 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); #ifdef IGF_MEMORY_ALLOC_OPT - error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, - st_ivas->hCPE[0]->hCoreCoder[n]->igf, - 1, - st_ivas->hCPE[0]->element_brate, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); - + if ( ( error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, + st_ivas->hCPE[0]->hCoreCoder[n]->igf, + 1, + st_ivas->hCPE[0]->element_brate, + st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, + st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } #else if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { @@ -515,13 +517,16 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); #ifdef IGF_MEMORY_ALLOC_OPT - error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, - st_ivas->hCPE[0]->hCoreCoder[n]->igf, - 1, - st_ivas->hCPE[0]->element_brate, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); + if ( ( error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, + st_ivas->hCPE[0]->hCoreCoder[n]->igf, + 1, + st_ivas->hCPE[0]->element_brate, + st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, + st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } #else if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 3675a4f603..8848b41eb9 100755 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -528,7 +528,10 @@ ivas_error ivas_cpe_enc( { int16_t igf; igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->rf_mode ); - error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ); + if ( ( error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } } } #endif diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 14d5f2ed36..8fefec48a5 100755 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -314,7 +314,10 @@ ivas_error ivas_ism_enc( { int16_t igf; igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->rf_mode ); - error = IGF_Reconfig( &st->hIGFEnc, igf, 0, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->element_mode, st->rf_mode ); + if ( ( error = IGF_Reconfig( &st->hIGFEnc, igf, 0, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->element_mode, st->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 1b764a0a7e..fbf6517d33 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -499,7 +499,10 @@ ivas_error mct_enc_reconfigure( st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); #ifdef IGF_MEMORY_ALLOC_OPT - error = IGF_Reconfig( &st->hIGFEnc, st->igf, 1, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ); + if ( ( error = IGF_Reconfig( &st->hIGFEnc, st->igf, 1, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } #else if ( st->igf ) { diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index f735d54121..5fa3cfc7d2 100755 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -236,7 +236,10 @@ ivas_error ivas_sce_enc( { int16_t igf; igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->rf_mode ); - error = IGF_Reconfig( &st->hIGFEnc, igf, 0, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->element_mode, st->rf_mode ); + if ( ( error = IGF_Reconfig( &st->hIGFEnc, igf, 0, st->bits_frame_nominal * FRAMES_PER_SEC, st->max_bwidth, st->element_mode, st->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif -- GitLab From c4af5ba48157472f5a25b68f66f1848bceeb8c18 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 17:54:52 +0200 Subject: [PATCH 08/10] fix (hopefully final) crash for WB in MC --- lib_enc/init_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index d40efd4873..b2bd511e9f 100755 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -755,7 +755,7 @@ ivas_error init_encoder( { igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; } - else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) ) ) + else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT || st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) ) ) { /* use nominal bitrates for DFT Stereo and (O)SBA, same as in stereo_dft_config()/ivas_spar_config() */ if ( element_brate == IVAS_13k2 ) -- GitLab From 4c50bd8cf372f52c694c1aab556821bad5b5f4be Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 30 Aug 2023 18:50:58 +0200 Subject: [PATCH 09/10] fix more crashes for WB, (O)MASA this time --- lib_enc/init_enc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index b2bd511e9f..1d4c09ae8a 100755 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -751,11 +751,15 @@ ivas_error init_encoder( #ifdef IGF_MEMORY_ALLOC_OPT igf_brate = st->total_brate; - if ( st->element_mode == IVAS_SCE && st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT ) + if ( st->element_mode == IVAS_SCE && ( st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT || st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) ) { igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; } - else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT || st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) ) ) + else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( + st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || + st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT || + st_ivas->hEncoderConfig->ivas_format == MC_FORMAT || + st_ivas->hEncoderConfig->ivas_format == MASA_FORMAT ) ) ) { /* use nominal bitrates for DFT Stereo and (O)SBA, same as in stereo_dft_config()/ivas_spar_config() */ if ( element_brate == IVAS_13k2 ) -- GitLab From 770f9bb95f2b3d499f5b81c00c6979b5b2b01b63 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 31 Aug 2023 10:51:47 +0200 Subject: [PATCH 10/10] Clang format --- lib_com/options.h | 2 +- lib_com/prot.h | 14 ++++++------ lib_enc/igf_enc.c | 14 ++++++------ lib_enc/init_enc.c | 9 ++++---- lib_enc/ivas_corecoder_enc_reconfig.c | 32 +++++++++++++-------------- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_ism_enc.c | 2 +- lib_enc/ivas_sce_enc.c | 7 +++--- lib_enc/ivas_spar_encoder.c | 5 +++-- 9 files changed, 44 insertions(+), 43 deletions(-) mode change 100755 => 100644 lib_com/prot.h mode change 100755 => 100644 lib_enc/igf_enc.c mode change 100755 => 100644 lib_enc/init_enc.c mode change 100755 => 100644 lib_enc/ivas_corecoder_enc_reconfig.c mode change 100755 => 100644 lib_enc/ivas_cpe_enc.c mode change 100755 => 100644 lib_enc/ivas_ism_enc.c mode change 100755 => 100644 lib_enc/ivas_sce_enc.c mode change 100755 => 100644 lib_enc/ivas_spar_encoder.c diff --git a/lib_com/options.h b/lib_com/options.h index d9ac2ebe4e..f6eebaeb80 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,8 +158,8 @@ #define OSBA_SPLIT_RENDERING #endif +#define IGF_MEMORY_ALLOC_OPT /* FhG: Issue 157: allocate IGF encoder structure only when needed */ -#define IGF_MEMORY_ALLOC_OPT /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h old mode 100755 new mode 100644 index 4095e4263c..8f2a8f8e13 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -9875,13 +9875,13 @@ void IGFEncResetTCX10BitCounter( #ifdef IGF_MEMORY_ALLOC_OPT ivas_error IGF_Reconfig( - IGF_ENC_INSTANCE_HANDLE *hIGFEnc,/* i/o: instance handle of IGF Encoder */ - const int16_t igf, /* i : IGF on/off */ - const int16_t reset, /* i : reset flag */ - const int32_t brate, /* i : bitrate for configuration */ - const int16_t bwidth, /* i : signal bandwidth */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t rf_mode /* i : flag to signal the RF mode */ + IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */ + const int16_t igf, /* i : IGF on/off */ + const int16_t reset, /* i : reset flag */ + const int32_t brate, /* i : bitrate for configuration */ + const int16_t bwidth, /* i : signal bandwidth */ + const int16_t element_mode, /* i : IVAS element mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ ); #endif diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c old mode 100755 new mode 100644 index 71799e3d81..2b2e3d8356 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2009,13 +2009,13 @@ void IGFSaveSpectrumForITF( #ifdef IGF_MEMORY_ALLOC_OPT ivas_error IGF_Reconfig( - IGF_ENC_INSTANCE_HANDLE *hIGFEnc,/* i/o: instance handle of IGF Encoder */ - const int16_t igf, /* i : IGF on/off */ - const int16_t reset, /* i : reset flag */ - const int32_t brate, /* i : bitrate for configuration */ - const int16_t bwidth, /* i : signal bandwidth */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t rf_mode /* i : flag to signal the RF mode */ + IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */ + const int16_t igf, /* i : IGF on/off */ + const int16_t reset, /* i : reset flag */ + const int32_t brate, /* i : bitrate for configuration */ + const int16_t bwidth, /* i : signal bandwidth */ + const int16_t element_mode, /* i : IVAS element mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ ) { ivas_error error; diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c old mode 100755 new mode 100644 index 1d4c09ae8a..c7b8ab3190 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -755,11 +755,10 @@ ivas_error init_encoder( { igf_brate = st->total_brate - ISM_NB_BITS_METADATA_NOMINAL * FRAMES_PER_SEC; } - else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( - st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || - st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT || - st_ivas->hEncoderConfig->ivas_format == MC_FORMAT || - st_ivas->hEncoderConfig->ivas_format == MASA_FORMAT ) ) ) + else if ( st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_SCE && ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT || + st_ivas->hEncoderConfig->ivas_format == SBA_ISM_FORMAT || + st_ivas->hEncoderConfig->ivas_format == MC_FORMAT || + st_ivas->hEncoderConfig->ivas_format == MASA_FORMAT ) ) ) { /* use nominal bitrates for DFT Stereo and (O)SBA, same as in stereo_dft_config()/ivas_spar_config() */ if ( element_brate == IVAS_13k2 ) diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c old mode 100755 new mode 100644 index f6c547aed3..cdfab16bad --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -432,12 +432,12 @@ ivas_error ivas_corecoder_enc_reconfig( #ifdef IGF_MEMORY_ALLOC_OPT if ( ( error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, - st_ivas->hCPE[0]->hCoreCoder[n]->igf, - 1, - st_ivas->hCPE[0]->element_brate, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ) ) != IVAS_ERR_OK ) + st_ivas->hCPE[0]->hCoreCoder[n]->igf, + 1, + st_ivas->hCPE[0]->element_brate, + st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, + st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ) ) != IVAS_ERR_OK ) { return error; } @@ -517,16 +517,16 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); #ifdef IGF_MEMORY_ALLOC_OPT - if ( ( error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, - st_ivas->hCPE[0]->hCoreCoder[n]->igf, - 1, - st_ivas->hCPE[0]->element_brate, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = IGF_Reconfig( &st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, + st_ivas->hCPE[0]->hCoreCoder[n]->igf, + 1, + st_ivas->hCPE[0]->element_brate, + st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, + st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ) ) != IVAS_ERR_OK ) + { + return error; + } #else if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c old mode 100755 new mode 100644 index 8848b41eb9..e3362d816a --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -521,7 +521,7 @@ ivas_error ivas_cpe_enc( *----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT - /* IGF reconfiguration */ + /* IGF reconfiguration */ for ( n = 0; n < n_CoreChannels; n++ ) { if ( ( hCPE->last_element_brate != hCPE->element_brate || sts[n]->last_bwidth != sts[n]->bwidth ) && ( n == 0 || hCPE->element_mode == IVAS_CPE_MDCT ) ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c old mode 100755 new mode 100644 index 8fefec48a5..eeb7689868 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -309,7 +309,7 @@ ivas_error ivas_ism_enc( * Core codec configuration *----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT - /* IGF reconfiguration */ + /* IGF reconfiguration */ if ( hSCE->last_element_brate != hSCE->element_brate || st->last_bwidth != st->bwidth ) { int16_t igf; diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c old mode 100755 new mode 100644 index 5fa3cfc7d2..e297d747a8 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -231,7 +231,7 @@ ivas_error ivas_sce_enc( *----------------------------------------------------------------*/ #ifdef IGF_MEMORY_ALLOC_OPT - /* IGF reconfiguration */ + /* IGF reconfiguration */ if ( hSCE->last_element_brate != hSCE->element_brate || st->last_bwidth != st->bwidth ) { int16_t igf; @@ -373,9 +373,10 @@ ivas_error create_sce_enc( if ( ( error = init_encoder( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode #ifdef IGF_MEMORY_ALLOC_OPT - , hSCE->element_brate + , + hSCE->element_brate #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c old mode 100755 new mode 100644 index f5a4dcce64..4b229f6446 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -226,9 +226,10 @@ ivas_error ivas_spar_enc_open( if ( ( error = init_encoder( hSpar->hCoreCoderVAD, st_ivas, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode #ifdef IGF_MEMORY_ALLOC_OPT - , hSpar->hCoreCoderVAD->total_brate + , + hSpar->hCoreCoderVAD->total_brate #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { return error; } -- GitLab