From 62dbac2d0908f99ed77780c271c532b001c74c90 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 19 Dec 2022 10:58:30 +0100 Subject: [PATCH 1/2] correct merge with FIX_GET_DELAY_RETURN --- lib_com/delay_comp.c | 11 ++++++----- lib_com/prot.h | 4 ++-- lib_dec/lib_dec.c | 6 +++--- lib_enc/lib_enc.c | 12 ++---------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index cce609a00d..46aca5ceb5 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -50,8 +50,8 @@ *--------------------------------------------------------------------------*/ /*! r: delay value in ns */ -float get_delay( - const int16_t what_delay, /* i : what delay? (ENC or DEC) */ +int32_t get_delay( + const int16_t enc_dec, /* i : encoder/decoder flag */ const int32_t io_fs, /* i : input/output sampling frequency */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ @@ -63,9 +63,9 @@ float get_delay( #endif ) { - float delay = 0; + int32_t delay = 0; - if ( what_delay == ENC ) + if ( enc_dec == ENC ) { if ( ivas_format == MONO_FORMAT ) /* EVS mono */ { @@ -82,7 +82,7 @@ float get_delay( delay += IVAS_FB_ENC_DELAY_NS; } } - else + else /* DEC */ { if ( ivas_format == MONO_FORMAT ) /* EVS mono */ { @@ -98,6 +98,7 @@ float get_delay( else /* IVAS */ { delay = IVAS_DEC_DELAY_NS; + #ifdef FIX_I59_LFE_TD_DELAY if ( hCldfb != NULL ) { diff --git a/lib_com/prot.h b/lib_com/prot.h index b3b31e24fa..1ccbe276fa 100755 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -712,8 +712,8 @@ int16_t lev_dur( ); /*! r: delay value in ns */ -float get_delay( - const int16_t what_delay, /* i : what delay? (ENC or DEC) */ +int32_t get_delay( + const int16_t enc_dec, /* i : encoder/decoder flag */ const int32_t io_fs, /* i : input/output sampling frequency */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 38d1d129f3..57590e6fcd 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1056,15 +1056,15 @@ ivas_error IVAS_DEC_GetDelay( hDecoderConfig = st_ivas->hDecoderConfig; #ifdef FIX_I59_LFE_TD_DELAY #ifdef FIX_I59_DELAY_ROUNDING - *nSamples = (int16_t) roundf( get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) * hDecoderConfig->output_Fs / 1000000000.f ); + *nSamples = (int16_t) roundf( (float) get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) * hDecoderConfig->output_Fs / 1000000000.f ); #else - *nSamples = NS2SA( hDecoderConfig->output_Fs, (int32_t) ( get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) + 0.5f ) ); + *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) ); #endif #else #ifdef FIX_I59_DELAY_ROUNDING *nSamples = (int16_t) roundf( get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns ) * hDecoderConfig->output_Fs / 1000000000.f ); #else - *nSamples = NS2SA( hDecoderConfig->output_Fs, (int32_t) ( get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns ) + 0.5f ) ); + *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns ) ); #endif #endif diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 0088c2c107..df7319c012 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -955,17 +955,9 @@ ivas_error IVAS_ENC_GetDelay( } #ifdef FIX_I59_LFE_TD_DELAY -#ifdef FIX_I59_DELAY_ROUNDING - *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, 0 ) + 0.5f ); + *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, 0 ) ); #else - *delay = NS2SA( hEncoderConfig->input_Fs, (int32_t) ( get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, 0 ) + 0.5f ) ); -#endif -#else -#ifdef FIX_I59_DELAY_ROUNDING - *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0 ) + 0.5f ); -#else - *delay = NS2SA( hEncoderConfig->input_Fs, (int32_t) ( get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0 ) + 0.5f ) ); -#endif + *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0 ) ); #endif *delay *= hEncoderConfig->nchan_inp; -- GitLab From 53ff07d8eb8dde5618a6bf654b81ddf1952ae3cd Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 19 Dec 2022 14:19:40 +0100 Subject: [PATCH 2/2] clang-format --- lib_com/prot.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_com/prot.h b/lib_com/prot.h index c7958eaf7a..5f48ddc825 100755 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3895,10 +3895,10 @@ void td_cng_enc_init( ); void dtx( - Encoder_State *st, /* i/o: encoder state structure */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t vad, /* i : VAD flag for DTX */ - const float speech[] /* i : Pointer to the speech frame */ + Encoder_State *st, /* i/o: encoder state structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t vad, /* i : VAD flag for DTX */ + const float speech[] /* i : Pointer to the speech frame */ ); void dtx_hangover_control( -- GitLab