From 9dbd70a5915d6b6688cda0fec620d3122cf84bd3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 13 Feb 2026 14:47:21 +0100 Subject: [PATCH 1/3] FIX_OUTPUT_FRAME --- lib_com/options.h | 1 + lib_dec/amr_wb_dec_fx.c | 4 ++++ lib_dec/core_dec_init_fx.c | 10 ++++++++++ lib_dec/core_dec_switch_fx.c | 2 ++ lib_dec/evs_dec_fx.c | 6 +++++- lib_dec/lib_dec_fx.c | 4 ++++ lib_dec/stat_dec.h | 2 ++ 7 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6f0d8e55e..888f212da 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,6 +92,7 @@ #define HARM_FD_BWE /* VA: harmonize core-coder FD BWE function duplications */ #define FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT /* FhG: basop issue 2411: harmonize TNSAnalysis*_fx(), DetectTnsFilt*_fx()*/ #define HARMONIZE_READ_DECODE_TNS /* FhG basop 2389: Harm between two pairs of functions. */ +#define FIX_OUTPUT_FRAME /* VA: harmonize "output_frame" parameter usage to correspond to FLP */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 3806f8c2a..076fa9f7d 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -136,8 +136,12 @@ ivas_error amr_wb_dec_fx( move16(); st_fx->coder_type = GENERIC; move16(); +#ifdef FIX_OUTPUT_FRAME + output_frame = extract_l( Mult_32_16( st_fx->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); +#else output_frame = st_fx->output_frame_fx; /*Q0*/ move16(); /* frame length of the input signal */ +#endif st_fx->bpf_off = 0; move16(); diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index a75acb7e1..55a135e4a 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -736,7 +736,11 @@ void open_decoder_LPD_fx( test(); IF( EQ_16( st->core, ACELP_CORE ) && EQ_16( st->last_core, HQ_CORE ) ) { +#ifdef FIX_OUTPUT_FRAME + frame_ener_fx( st->hTcxDec->L_frameTCX, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); +#else frame_ener_fx( st->output_frame_fx, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); +#endif } } ELSE @@ -1171,8 +1175,10 @@ void open_decoder_LPD_ivas_fx( { st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); +#ifndef FIX_OUTPUT_FRAME st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */ move16(); +#endif if ( st->ini_frame == 0 ) { st->L_frameTCX_past = st->hTcxDec->L_frameTCX; @@ -1795,9 +1801,13 @@ void open_decoder_LPD_ivas_fx( test(); IF( st->core == ACELP_CORE && EQ_16( st->last_core, HQ_CORE ) ) { +#ifdef FIX_OUTPUT_FRAME + frame_ener_fx( st->hTcxDec->L_frameTCX, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); +#else st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */ move16(); frame_ener_fx( st->output_frame_fx, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); +#endif } } ELSE diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 5c824532e..94b4ae0b4 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -338,8 +338,10 @@ void mode_switch_decoder_LPD_ivas_fx( { st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */ move16(); +#ifndef FIX_OUTPUT_FRAME st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */ move16(); +#endif } IF( st->hTcxCfg != NULL ) diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 0fa4c43f3..9c8c5c90d 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -97,7 +97,11 @@ ivas_error evs_dec_fx( move16(); } - output_frame = st_fx->output_frame_fx; /*Q0*/ +#ifdef FIX_OUTPUT_FRAME + output_frame = extract_l( Mult_32_16( st_fx->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); +#else + output_frame = st_fx->output_frame_fx; /*Q0*/ +#endif move16(); core_switching_flag = 0; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index cbf282037..25b72bb82 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -5587,10 +5587,14 @@ static ivas_error evs_dec_main_fx( hCoreCoder = st_ivas->hSCE[0]->hCoreCoder; hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); +#ifdef FIX_OUTPUT_FRAME + nOutSamples = extract_l( Mult_32_16( st_ivas->hDecoderConfig->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); +#else hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); // Q0 move16(); nOutSamples = hCoreCoder[0]->output_frame_fx; move16(); +#endif mdct_switching_dec_fx( hCoreCoder[0] ); diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index eafc5dd8a..eef675773 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1034,7 +1034,9 @@ typedef struct Decoder_State Word16 amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ Word16 BER_detect; /* flag to signal detected bit error in the bitstream */ Word32 output_Fs; /* output sampling rate */ +#ifndef FIX_OUTPUT_FRAME Word16 output_frame_fx; /* Output frame length Q0*/ +#endif Word32 total_brate; /* total bitrate in kbps of the codec */ Word32 last_total_brate; /* last total bitrate in kbps of the codec */ Word32 last_total_brate_ber; /* last total bitrate in kbps of the codec - used only when first frame is lost and BER is detected afterwards */ -- GitLab From f7e72647beab1b07ac170059a3169b5358cb8b99 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 13 Feb 2026 16:25:11 +0100 Subject: [PATCH 2/3] clang-format --- lib_dec/stat_dec.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index eef675773..655aae6ae 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1027,15 +1027,15 @@ typedef struct Decoder_State Word16 mdct_sw; /* MDCT switching indicator */ Word16 last_codec_mode; /* last used codec mode */ - UWord16 *bit_stream; /* pointer to bitstream buffer */ - Word16 next_bit_pos; /* position of the next bit to be read from the bitstream */ - Word16 bitstreamformat; /* Bitstream format flag (G.192/MIME/VOIP_G192_RTP/VOIP_RTPDUMP) */ - Word16 sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ - Word16 amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ - Word16 BER_detect; /* flag to signal detected bit error in the bitstream */ - Word32 output_Fs; /* output sampling rate */ + UWord16 *bit_stream; /* pointer to bitstream buffer */ + Word16 next_bit_pos; /* position of the next bit to be read from the bitstream */ + Word16 bitstreamformat; /* Bitstream format flag (G.192/MIME/VOIP_G192_RTP/VOIP_RTPDUMP) */ + Word16 sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ + Word16 amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ + Word16 BER_detect; /* flag to signal detected bit error in the bitstream */ + Word32 output_Fs; /* output sampling rate */ #ifndef FIX_OUTPUT_FRAME - Word16 output_frame_fx; /* Output frame length Q0*/ + Word16 output_frame_fx; /* Output frame length Q0*/ #endif Word32 total_brate; /* total bitrate in kbps of the codec */ Word32 last_total_brate; /* last total bitrate in kbps of the codec */ @@ -1507,7 +1507,6 @@ typedef struct Decoder_State Word16 igf; CLDFB_SCALE_FACTOR scaleFactor; - /*----------------------------------------------------------------------------------* * TEC *----------------------------------------------------------------------------------*/ -- GitLab From c107920e941322fa591c35852474c07ff3ae25fc Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 17 Feb 2026 12:39:37 -0500 Subject: [PATCH 3/3] fix clang-format --- lib_dec/evs_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 45f7d01bd..554e4e575 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -100,7 +100,7 @@ ivas_error evs_dec_fx( #ifdef FIX_OUTPUT_FRAME output_frame = extract_l( Mult_32_16( st_fx->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); #else - output_frame = st_fx->output_frame_fx; /*Q0*/ + output_frame = st_fx->output_frame_fx; /*Q0*/ #endif move16(); -- GitLab