From 05d573ced1365a1caa31be4c582460d36b7e0daa Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 26 Sep 2025 12:15:16 +0200 Subject: [PATCH] replace 0x0290 by INV_FRAME_PER_SEC_Q15 --- lib_dec/core_dec_init_fx.c | 8 ++++---- lib_dec/core_dec_switch_fx.c | 10 +++++----- lib_dec/lib_dec_fx.c | 2 +- lib_enc/core_enc_init_fx.c | 8 ++++---- lib_enc/core_enc_switch_fx.c | 4 ++-- lib_enc/init_enc_fx.c | 8 ++++---- lib_enc/ivas_sce_enc_fx.c | 4 ++-- lib_enc/updt_enc_fx.c | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 2722d4303..aa86fc624 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -55,9 +55,9 @@ void open_decoder_LPD_fx( fscaleFB = sr2fscale_fx( st->output_Fs ); /* initializing variables for frame lengths etc. right in the beginning */ - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); move16(); - hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); IF( st->ini_frame == 0 ) { @@ -1159,7 +1159,7 @@ void open_decoder_LPD_ivas_fx( move16(); /* initializing variables for frame lengths etc. right in the beginning */ - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); /* 0.02 in Q15 */ + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); move16(); if ( st->ini_frame == 0 ) { @@ -1169,7 +1169,7 @@ void open_decoder_LPD_ivas_fx( } IF( st->hTcxDec != NULL ) { - st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); /* 0.02 in Q15 */ + st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */ move16(); diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 94b6efb1b..90379c732 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -99,10 +99,10 @@ void mode_switch_decoder_LPD_fx( move16(); st->fscale = fscale; move16(); - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); /* Q0 */ + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */ IF( hTcxDec != NULL ) { - hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); /* Q0 */ + hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */ move16(); } IF( st->hTcxCfg != NULL ) @@ -320,7 +320,7 @@ void mode_switch_decoder_LPD_ivas_fx( test(); test(); - assert( (Word16) ( st->sr_core / FRAMES_PER_SEC ) == extract_l( Mult_32_16( st->sr_core, 0x0290 ) ) ); + assert( (Word16) ( st->sr_core / FRAMES_PER_SEC ) == extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ) ); IF( NE_16( fscale, st->fscale ) || switchWB || bSwitchFromAmrwbIO || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) { open_decoder_LPD_ivas_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0, Q_syn_Overl_TDAC, Q_fer_samples, Q_syn_Overl, Q_syn_Overl_TDACFB, Q_syn_OverlFB, Q_old_out, Q_old_outLB, Q_old_Aq_12_8 ); @@ -332,11 +332,11 @@ void mode_switch_decoder_LPD_ivas_fx( move16(); st->fscale = fscale; move16(); - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); move16(); IF( st->hTcxDec != NULL ) { - st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); /* Q0 */ + st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */ move16(); st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */ move16(); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index c1cc0bd04..edf907253 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -3986,7 +3986,7 @@ static ivas_error evs_dec_main_fx( hCoreCoder = st_ivas->hSCE[0]->hCoreCoder; hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); - hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, 0x0290 /*Q0*/ ) ); // Q0 + hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); // Q0 move16(); mdct_switching_dec_fx( hCoreCoder[0] ); diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 7bf836a6d..a7ffcc229 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -71,12 +71,12 @@ void init_coder_ace_plus_fx( /* Core Framing */ L_frame_old = st->last_L_frame; move16(); - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 /* 1/FRAMES_PER_SEC in Q15*/ ) ); + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); st->L_frame_past = -1; move16(); move16(); - hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 /* 1/FRAMES_PER_SEC in Q15*/ ) ); + hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); st->nb_subfr = NB_SUBFR; move16(); @@ -960,14 +960,14 @@ void init_coder_ace_plus_ivas_fx( /* Core Framing */ L_frame_old = st->last_L_frame; move16(); - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/ + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); move16(); st->L_frame_past = -1; move16(); IF( hTcxEnc != NULL ) { - hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/ + hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); IF( st->ini_frame == 0 ) diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 25581505c..440c02d04 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -65,7 +65,7 @@ void core_coder_mode_switch_fx( move32(); st->sr_core = sr_core; move32(); - st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); + st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); assert( st->L_frame == st->sr_core / 50 ); st->tcxonly = (Word8) getTcxonly( st->total_brate ); /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale ) * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ; */ @@ -379,7 +379,7 @@ void core_coder_mode_switch_ivas_fx( move16(); IF( hTcxEnc != NULL ) { - hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/ + hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); } st->currEnergyHF_fx = 0; diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 9e4f609b9..105bb7d10 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -879,7 +879,7 @@ ivas_error init_encoder_fx( move16(); init_coder_ace_plus_fx( st_fx, st_fx->last_total_brate, 0, -10 /*hack*/ ); // PMT("Transient detector init needs review, handle hTranDet is missing") - InitTransientDetection_fx( extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) ), + InitTransientDetection_fx( extract_l( Mult_32_16( st_fx->input_Fs, INV_FRAME_PER_SEC_Q15 ) ), NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ), &st_fx->transientDetection ); @@ -1662,7 +1662,7 @@ ivas_error init_encoder_ivas_fx( IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* open analysis for input SR */ - st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); + st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); if ( ( error = openCldfb( &st->cldfbAnaEnc, CLDFB_ANALYSIS, CLDFB_getNumChannels( st->input_Fs ), st->input_frame_fx ) ) != IVAS_ERR_OK ) { @@ -2066,7 +2066,7 @@ ivas_error init_encoder_ivas_fx( TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; IF( hTcxEnc != NULL ) { - hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/ + hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); } st->currEnergyHF_fx = 0; @@ -2149,7 +2149,7 @@ ivas_error init_encoder_ivas_fx( } ELSE { - InitTransientDetection_fx( extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ), + InitTransientDetection_fx( extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ), NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), &st->transientDetection ); } diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 180e175ec..12a6fecf8 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -472,7 +472,7 @@ ivas_error create_sce_enc_fx( move32(); st->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; st->input_Fs = st_ivas->hEncoderConfig->input_Fs; - st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); + st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) { @@ -556,7 +556,7 @@ ivas_error create_evs_sce_enc_fx( st_fx->total_brate = st_ivas->hEncoderConfig->ivas_total_brate; move32(); - st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) ); + st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); IF( NE_32( ( error = init_encoder_fx( st_fx, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID ) ), IVAS_ERR_OK ) ) diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c index 6c7e3ff02..9b6f80c3f 100644 --- a/lib_enc/updt_enc_fx.c +++ b/lib_enc/updt_enc_fx.c @@ -449,7 +449,7 @@ void updt_enc_common_fx( st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0 ); move32(); - // st->L_frame = extract_l(Mult_32_16(st->sr_core, 0x0290)); /*(int16_t)(st->sr_core / FRAMES_PER_SEC);*/ + // st->L_frame = extract_l(Mult_32_16(st->sr_core, INV_FRAME_PER_SEC_Q15)); /*(int16_t)(st->sr_core / FRAMES_PER_SEC);*/ IF( EQ_32( st->sr_core, INT_FS_12k8 ) ) { -- GitLab