diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index bceefbb76a93a3bc021ed91ec7b1c2e99149d1f8..43a0375fe8c020e6ce25d401ebb70df82543392e 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1412,7 +1412,12 @@ void stereo_icBWE_dec_fx( const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz */ const Word16 *voice_factors_fx, /* i : voicing factors */ const Word16 output_frame, /* i : frame length */ - Word16 *Q_syn ); + Word16 *Q_syn +#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING + , + const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ +#endif +); void decoder_tcx_tns_fx( Decoder_State *st, /* i/o: coder memory state */ diff --git a/lib_com/options.h b/lib_com/options.h index e87c8d25785eb308846f6f5b699ab3466ab06918..1fbc63cc6f82990df3cd96c6213706e646ce6b2e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,8 @@ #define FIX_833_CORRECTION_to_826 /* VA : fix indexing error introduced in 826 */ #endif #define NONE_BE_FIX_816_LFE_PLC_FLOAT /* DLB: issue 816: reduce required precision to float for LFE-PLC*/ +#define FIX_839_FB_CONTENT_SOMETIME_MISSING /* VA : Fix scaling error for FB TB BWE */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 17a1fcce22945b8cf0ea1f6d90274215f1a841c4..95839cc7a60422a11bc0f2b1bc46a2cc74dbf9c4 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1255,8 +1255,12 @@ ivas_error ivas_core_dec_fx( hCPE->hStereoDft->td_gain_fx[0] = 1; move32(); } - Scale_sig( tmp_buffer_fx, L_FRAME48k, sub( Q11, Q_white_exc ) ); +#ifndef FIX_839_FB_CONTENT_SOMETIME_MISSING + Scale_sig( tmp_buffer_fx, L_FRAME48k, sub( Q11, Q_white_exc ) ); // for small value, this was just mostly p stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); +#else + stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q, Q_white_exc ); +#endif #ifdef MSAN_FIX test(); test(); diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 89faf3559193ee32776072164ada2fa0a06615d3..47da57810e32fc0984d4f727f5de20e4e540ead5 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -556,10 +556,14 @@ void stereo_icBWE_dec_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs Q11 */ Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs Q11 */ - const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz Q11 */ + const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz fb_synth_ref_fx */ const Word16 *voice_factors_fx, /* i : voicing factors Q15 */ const Word16 output_frame, /* i : frame length */ Word16 *Q_syn /* i : Q of synth and synthRef buffers */ +#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING + , + const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ +#endif ) { Word16 i, j, k, nbSubFr; @@ -1330,11 +1334,22 @@ void stereo_icBWE_dec_fx( { // v_add( fb_synth_nonref_fx, synth_fx, synth_fx, L_FRAME48k, 0 ); +#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING + tmp = shl_sat( 1, sub( Q11 + 15, Q_white_exc ) ); + IF( tmp != 0 ) + { + FOR( i = 0; i < L_FRAME48k; i++ ) + { + synth_fx[i] = L_mac( synth_fx[i], fb_synth_nonref_fx[i], tmp ); + } + } +#else FOR( i = 0; i < L_FRAME48k; i++ ) { synth_fx[i] = L_add( synth_fx[i], L_deposit_l( fb_synth_nonref_fx[i] ) ); move32(); } +#endif } /* copy to outputHB and reset hb_synth values */ diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 091915667571a8d7c23df57c502fd0766bc5d713..eceaa1eafb1b6ad3143ee625b23a459b268011aa 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -4957,7 +4957,11 @@ void fb_tbe_dec_ivas_fx( test(); IF( GE_16( st->element_mode, IVAS_CPE_DFT ) && ( st->idchan == 0 ) ) { +#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING + Copy_Scale_sig( fb_synth, fb_synth_ref, L_FRAME48k, sub( Q_fb_synth_ref, add( hb_synth_exp, 16 ) ) ); // scaling is required +#else Copy_Scale_sig( fb_synth, fb_synth_ref, L_FRAME48k, sub( Q_fb_synth_ref, hb_synth_exp ) ); // scaling is required +#endif } /* add the fb_synth component to the hb_synth component */ /* v_add_fx( hb_synth, fb_synth, hb_synth, L_FRAME48k );*/