diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 0a1fe1d3287ee24cb325e1eae7a65acee2c82841..fc23ea45b5513295a240ce9bf87af3f1d4950dc8 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -166,7 +166,9 @@ void initFdCngCom( set16_fx( hFdCngCom->coherence_fx, 16384 /* 0.5 in Q15 */, MDCT_ST_DTX_NUM_COHERENCE_BANDS ); +#ifndef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING set32_fx( hFdCngCom->olapBufferSynth_fx, 0, FFTLEN ); +#endif set32_fx( hFdCngCom->olapBufferSynth2_fx, 0, FFTLEN ); set32_fx( hFdCngCom->exc_cng_32fx, 0, L_FRAME16k ); set16_fx( hFdCngCom->exc_cng, 0, L_FRAME16k ); diff --git a/lib_com/options.h b/lib_com/options.h index dd5034c929face931c707a25699bef0a9952a1e2..0feca9ea2db460ac7b1da407e9eeddff353972a1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,6 +99,7 @@ #define FIX_2448_RENDERER_MSAN_ERROR /* FhG: basop issue 2448: fix MSAN error with MSA rendering */ #define FIX_2283_ISM_MD_DELAY /* Dolby: Fix ISM metadata delay round-off */ +#define FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING /* FhG: basop issue 2262: correct buffer update for FD-CNG buffer in case of BR switching */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index f678394227320346ea2bcf74b2dc12bcb9fdde8f..f32d05534d06517f2b9e81dca1a40013fb058929 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -7214,7 +7214,9 @@ ivas_error core_switching_pre_dec_fx( const Word16 last_element_mode, /* i : last_element_mode */ const Word32 last_element_brate, /* i : last element bitrate */ const Word16 Q_old_synthFB, +#ifndef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING Word16 *Q_olapBufferSynth, +#endif Word16 *Q_olapBufferSynth2 ); ivas_error core_switching_post_dec_fx( diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index a85d6c7c013d62a4da41d8f93132dce64e52df2e..0ae17b976195e3dfec27be08c5e30a47dc9d8899 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -367,8 +367,10 @@ typedef struct Word16 fftlenFac; // Q0 Word16 timeDomainBuffer[L_FRAME16k]; /*Q15*/ - Word32 olapBufferSynth_fx[FFTLEN]; /*Q_olapBufferSynth*/ - Word32 olapBufferSynth2_fx[FFTLEN]; /*Q_olapBufferSynth2*/ +#ifndef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + Word32 olapBufferSynth_fx[FFTLEN]; /*Q_olapBufferSynth*/ +#endif + Word32 olapBufferSynth2_fx[FFTLEN]; /*Q_olapBufferSynth2*/ const Word32 *olapWinAna_fx; /* Q30 */ const Word16 *olapWinSyn_fx; /* Q15 */ diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 5eef39ba7f50e78f89b6f447f4fc34632ecf4b4c..b8515e399a7295b860f692c97c728634fb763c35 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -173,7 +173,11 @@ ivas_error amr_wb_dec_fx( } /* Updates in case of EVS -> AMR-WB IO switching */ +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + IF( NE_32( ( error = core_switching_pre_dec_fx( st_fx, output_frame, -1, 1, EVS_MONO, EVS_MONO, -1, &tmp16 ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = core_switching_pre_dec_fx( st_fx, output_frame, -1, 1, EVS_MONO, EVS_MONO, -1, &tmp16, &tmp16 ) ), IVAS_ERR_OK ) ) +#endif { return error; } diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index b8f4cc63f126f5fbef8fc1dd48013db3d982e251..2eab8f473a48006755fe8567e3b7485fb0497e7c 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1158,7 +1158,9 @@ ivas_error core_switching_pre_dec_fx( const Word16 last_element_mode, /* i : last_element_mode */ const Word32 last_element_brate, /* i : last element bitrate */ const Word16 Q_old_synthFB, +#ifndef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING Word16 *Q_olapBufferSynth, +#endif Word16 *Q_olapBufferSynth2 ) { Word32 tmp_fx; /*Q-12*/ @@ -1952,23 +1954,40 @@ ivas_error core_switching_pre_dec_fx( test(); IF( LE_32( st->total_brate, SID_2k40 ) && LE_32( st->last_total_brate, SID_2k40 ) ) { +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + lerp( st->hFdCngDec->hFdCngCom->olapBufferSynth, st->hFdCngDec->hFdCngCom->olapBufferSynth, shl( st->L_frame, 1 ), shl( st->last_L_frame, 1 ) ); +#else L_lerp_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx, st->hFdCngDec->hFdCngCom->olapBufferSynth_fx, shl( st->L_frame, 1 ), shl( st->last_L_frame, 1 ), Q_olapBufferSynth ); +#endif IF( EQ_16( st->L_frame, L_FRAME ) ) { FOR( i = 0; i < shl( st->L_frame, 1 ); i++ ) { +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + st->hFdCngDec->hFdCngCom->olapBufferSynth[i] = mult_r( st->hFdCngDec->hFdCngCom->olapBufferSynth[i], 20480 /* Q15*/ ); /* (Q15 - olapBufferSynth_exp) */ + move16(); +#else st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], (Word16) 20480 /* 0.6250f in Q15 */ ); move32(); +#endif } } ELSE { FOR( i = 0; i < shl( st->L_frame, 1 ); i++ ) { +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + st->hFdCngDec->hFdCngCom->olapBufferSynth[i] = mult_r( st->hFdCngDec->hFdCngCom->olapBufferSynth[i], 26214 /* Q14*/ ); /* (Q15 - olapBufferSynth_exp) + 1 */ + move16(); +#else st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( L_shl( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], 1 ), (Word16) 26214 /* 1.6f in Q14 */ ); move32(); +#endif } +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + st->hFdCngDec->hFdCngCom->olapBufferSynth_exp = add( st->hFdCngDec->hFdCngCom->olapBufferSynth_exp, 1 ); +#endif } } } diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index e9673e0caf79d40d1b80babad186e3c2874ae703..016a41a0411a3be0f5aaa777dd003263da9637b2 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -315,8 +315,11 @@ ivas_error evs_dec_fx( /*---------------------------------------------------------------------* * Preprocessing (preparing) for ACELP/HQ core switching *---------------------------------------------------------------------*/ - +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + IF( ( error = core_switching_pre_dec_fx( st_fx, output_frame, -1, 1, EVS_MONO, EVS_MONO, -1, &tmp16 ) ) != IVAS_ERR_OK ) +#else IF( ( error = core_switching_pre_dec_fx( st_fx, output_frame, -1, 1, EVS_MONO, EVS_MONO, -1, &tmp16, &tmp16 ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 425ceb05b1e3e5a38eebaa06e447c70dcfe4e2f1..a90da1f416e9a433a75dbcad536b23bd4b469f54 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -438,7 +438,13 @@ ivas_error ivas_core_dec_fx( /*---------------------------------------------------------------------* * Preprocessing (preparing) for ACELP/HQ core switching *---------------------------------------------------------------------*/ +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + Word16 Q_olapBufferSynth2; + Q_olapBufferSynth2 = Q15; /*Initializing with max values to avoid warnings*/ + move16(); + IF( NE_32( ( error = core_switching_pre_dec_fx( st, output_frame, sts[0]->last_core_brate, nchan_out, last_element_mode, last_element_brate, st->Q_syn, &Q_olapBufferSynth2 ) ), IVAS_ERR_OK ) ) +#else Word16 Q_olapBufferSynth, Q_olapBufferSynth2; Q_olapBufferSynth = Q15; /*Initializing with max values to avoid warnings*/ @@ -447,6 +453,7 @@ ivas_error ivas_core_dec_fx( move16(); IF( NE_32( ( error = core_switching_pre_dec_fx( st, output_frame, sts[0]->last_core_brate, nchan_out, last_element_mode, last_element_brate, st->Q_syn, &Q_olapBufferSynth, &Q_olapBufferSynth2 ) ), IVAS_ERR_OK ) ) +#endif { return error; }