Loading lib_com/prot_fx.h +4 −4 Original line number Diff line number Diff line Loading @@ -7694,10 +7694,10 @@ void fd_bwe_dec_init( void hq_core_enc_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *audio_fx, /* i : input audio signal Q0 */ const Word16 input_frame, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */ const Word16 vad_hover_flag /* i : VAD hangover flag */ const Word16 input_frame, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ); // hq_core_dec_fx.c Loading lib_enc/gain_enc_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -622,6 +622,16 @@ void gain_enc_mless_ivas_fx( /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code ); exp_inov = sub( exp_code, 18 + 6 ); // To avoid crash in case code value is 0 IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) ) { L_tmp = 21474836; exp_inov = 0; move32(); move16(); } exp_code = sub( exp_code, 30 ); /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ Loading lib_enc/hq_classifier_enc_fx.c +177 −139 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_enc/hq_core_enc.c +37 −33 Original line number Diff line number Diff line Loading @@ -54,10 +54,10 @@ void hq_core_enc_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *audio_fx, /* i : input audio signal Q0 */ const Word16 input_frame_orig, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */ const Word16 vad_hover_flag /* i : VAD hangover flag */ const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ) { Word16 i, is_transient, num_bits, extra_unused; Loading Loading @@ -89,18 +89,19 @@ void hq_core_enc_ivas_fx( move16(); set_zero_fx( t_audio_fx, L_FRAME48k_EXT ); /* set input_frame length */ input_frame = input_frame_orig; input_frame = input_frame_orig; /* Q0 */ /* Sanity check, it should never happen at the encoder side (no BFI) */ IF( st->hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) { st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; move16(); } ELSE { st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; } move16(); } st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; move16(); Loading @@ -110,8 +111,8 @@ void hq_core_enc_ivas_fx( * Write signaling information *--------------------------------------------------------------------------*/ num_bits = BASOP_Util_Divide3232_Scale( st->total_brate, FRAMES_PER_SEC, &exp ); num_bits = shr( num_bits, sub( 15, exp ) ); num_bits = BASOP_Util_Divide3232_Scale( st->total_brate, FRAMES_PER_SEC, &exp ); /* Q15-exp */ num_bits = shr( num_bits, sub( 15, exp ) ); /* Q0 */ extra_unused = 0; move16(); Loading @@ -119,7 +120,7 @@ void hq_core_enc_ivas_fx( * Detect signal transition *--------------------------------------------------------------------------*/ is_transient = detect_transient_fx( audio_fx, input_frame, 0, st ); is_transient = detect_transient_fx( audio_fx, input_frame, 0, st ); /* Q0 */ move16(); test(); Loading @@ -144,10 +145,10 @@ void hq_core_enc_ivas_fx( Q_audio = sub( Q16, q ); TCX_MDCT( wtda_audio_fx16, t_audio_fx, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); Q_audio = sub( Q31, Q_audio ); Copy_Scale_sig_16_32( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); Copy_Scale_sig_16_32( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ inner_frame = inner_frame_tbl[st->bwidth]; L_spec = l_spec_ext_tbl[st->bwidth]; inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ is_transient = 0; move16(); move16(); Loading @@ -161,14 +162,14 @@ void hq_core_enc_ivas_fx( *--------------------------------------------------------------------------*/ Q_audio = 0; move16(); Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); Scale_sig( st->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( st->q_inp ) ); Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); /* Q0 */ Scale_sig( st->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( st->q_inp ) ); /* Q0 */ st->q_old_inp = 0; move16(); st->q_inp = 0; move16(); Copy( st->old_input_signal_fx, two_frames_buffer, input_frame ); Copy( audio_fx, two_frames_buffer + input_frame, input_frame ); Copy( st->old_input_signal_fx, two_frames_buffer, input_frame ); /* Q0 */ Copy( audio_fx, two_frames_buffer + input_frame, input_frame ); /* Q0 */ wtda_fx( two_frames_buffer + input_frame, &Q_audio, wtda_audio_fx32, NULL, 0, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, input_frame ); Loading @@ -191,7 +192,7 @@ void hq_core_enc_ivas_fx( Word16 tmp_q = Q_audio; move16(); direct_transform_fx( wtda_audio_fx32, t_audio_fx, is_transient, input_frame, &Q_audio, st->element_mode ); scale_sig32( wtda_audio_fx32, L_FRAME48k_EXT, sub( Q_audio, tmp_q ) ); scale_sig32( wtda_audio_fx32, L_FRAME48k_EXT, sub( Q_audio, tmp_q ) ); /* Q_audio */ /* scale coefficients to their nominal level (8kHz) */ IF( NE_16( input_frame, NORM_MDCT_FACTOR ) ) Loading @@ -199,17 +200,18 @@ void hq_core_enc_ivas_fx( UWord16 lsb; tmp = mult_r( input_frame, 410 / 2 ); /* 1/8000 in Q15 */ Word16 ener_match_fx = hq_nominal_scaling[tmp]; move16(); FOR( i = 0; i < input_frame; i++ ) { /*t_audio_q[i] *= ener_match; */ Mpy_32_16_ss( t_audio_fx[i], ener_match_fx, &t_audio_fx[i], &lsb ); move16(); /* Q12 */ Mpy_32_16_ss( t_audio_fx[i], ener_match_fx, &t_audio_fx[i], &lsb ); /* Q12 */ move16(); } } /* limit encoded band-width according to the command-line OR BWD limitation */ inner_frame = inner_frame_tbl[st->bwidth]; L_spec = l_spec_tbl[st->bwidth]; inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_tbl[st->bwidth]; /* Q0 */ move16(); move16(); Loading @@ -222,7 +224,7 @@ void hq_core_enc_ivas_fx( FOR( i = 1; i < NUM_TIME_SWITCHING_BLOCKS; i++ ) { tmp = shr( inner_frame, 2 ); Copy32( t_audio_fx + i_mult2( i, shr( input_frame, 2 ) ), t_audio_fx + i_mult2( i, tmp ), tmp ); Copy32( t_audio_fx + i_mult2( i, shr( input_frame, 2 ) ), t_audio_fx + i_mult2( i, tmp ), tmp ); /* Q_audio */ } } Loading @@ -232,7 +234,7 @@ void hq_core_enc_ivas_fx( /* subtract signaling bits */ num_bits = sub( num_bits, hBstr->nb_bits_tot ); num_bits = sub( num_bits, hBstr->nb_bits_tot ); /* Q0 */ /*-------------------------------------------------------------------------- * High-band gain control in case of BWS Loading @@ -241,9 +243,9 @@ void hq_core_enc_ivas_fx( IF( st->bwidth_sw_cnt > 0 ) { Word32 L_tmp; tmp = BASOP_Util_Divide1616_Scale( 3, BWS_TRAN_PERIOD, &exp ); tmp = BASOP_Util_Divide1616_Scale( 3, BWS_TRAN_PERIOD, &exp ); /* Q15-exp */ shr( tmp, exp ); L_tmp = L_deposit_h( tmp ); L_tmp = L_deposit_h( tmp ); /* Q31-exp */ IF( is_transient ) { FOR( i = 0; i < NUM_TIME_SWITCHING_BLOCKS; i++ ) Loading Loading @@ -315,7 +317,7 @@ void hq_core_enc_ivas_fx( test(); IF( st->element_mode > EVS_MONO && ( st->last_core == ACELP_CORE || EQ_16( st->last_core, AMR_WB_CORE ) ) ) { overlap = st->hTcxCfg->tcx_mdct_window_length; overlap = st->hTcxCfg->tcx_mdct_window_length; /* Q0 */ move16(); nz = NS2SA( st->sr_core, N_ZERO_MDCT_NS ); Loading Loading @@ -349,7 +351,7 @@ void hq_core_enc_ivas_fx( /*Compute windowed synthesis in case of switching to ALDO windows in next frame*/ Copy( wtda_audio_fx16 + sub( L_frame, nz ), st->hTcxEnc->old_out_fx, nz + overlap ); Copy( wtda_audio_fx16 + sub( L_frame, nz ), st->hTcxEnc->old_out_fx, nz + overlap ); /* Q0 */ set16_fx( st->hTcxEnc->old_out_fx + add( nz, overlap ), 0, nz ); tcx_windowing_synthesis_past_frame( st->hTcxEnc->old_out_fx + nz, st->hTcxCfg->tcx_aldo_window_1_trunc, st->hTcxCfg->tcx_mdct_window_half, st->hTcxCfg->tcx_mdct_window_minimum, overlap, st->hTcxCfg->tcx_mdct_window_half_length, st->hTcxCfg->tcx_mdct_window_min_length, FULL_OVERLAP ); Loading @@ -359,9 +361,11 @@ void hq_core_enc_ivas_fx( // This implementation is diffrent in float code need to revisit to check its correctness. st->hTcxEnc->old_out_fx[nz + overlap + i] = mult( wtda_audio_fx16[L_frame - 1 - i], st->hTcxCfg->tcx_aldo_window_1_trunc[i].v.re ); // Q0 + Q15 - Q15 -> Q0; st->hTcxEnc->old_out_fx[nz / 2 + ( nz + overlap + i )] = mult( wtda_audio_fx16[nz / 2 + ( L_frame - 1 - i )], st->hTcxCfg->tcx_aldo_window_1_trunc[nz / 2 - 1 - i].v.im ); // Q0 + Q15 - Q15 -> Q0; move16(); move16(); } Copy( wtda_audio_fx16 + sub( shr( overlap, 1 ), tcx_offset ), output_fx, st->L_frame ); Copy( wtda_audio_fx16 + sub( shr( overlap, 1 ), tcx_offset ), output_fx, st->L_frame ); /* Q0 */ } ELSE { Loading @@ -371,12 +375,12 @@ void hq_core_enc_ivas_fx( move32(); FOR( i = 0; i < input_frame; i++ ) { t_audio_fx[i] = Mpy_32_32( t_audio_fx[i], ener_match_fx ); move32(); /* Q12 - 1 -> Q11 */ t_audio_fx[i] = Mpy_32_32( t_audio_fx[i], ener_match_fx ); /* Q12 - 1 -> Q11 */ move32(); } Q_audio = sub( Q_audio, 1 ); scale_sig32( wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, tmp_q ) ); scale_sig32( wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, tmp_q ) ); /* Q_audio */ Inverse_Transform( t_audio_fx, &Q_audio, wtda_audio_fx32, is_transient, L_FRAME16k, inner_frame, st->element_mode ); Loading @@ -384,8 +388,8 @@ void hq_core_enc_ivas_fx( move16(); window_ola_fx( wtda_audio_fx32, output_fx, &out_q, st->hTcxEnc->old_out_fx, &old_q, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL ); Scale_sig( output_fx, L_FRAME16k, negate( out_q ) ); Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( old_q ) ); Scale_sig( output_fx, L_FRAME16k, negate( out_q ) ); /* Q0 */ Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( old_q ) ); /* Q0 */ st->hTcxEnc->Q_old_out = 0; move16(); } Loading lib_enc/hq_core_enc_fx.c +24 −18 Original line number Diff line number Diff line Loading @@ -19,10 +19,10 @@ void hq_core_enc_fx( Encoder_State *st_fx, const Word16 *audio, /* i : input audio signal Q0 */ const Word16 input_frame_orig, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */ const Word16 vad_hover_flag /* i : VAD hangover flag */ const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ) { Word16 i, is_transient, num_bits, extra_unused; Loading @@ -31,6 +31,7 @@ void hq_core_enc_fx( Word16 Q_audio = 0; Word16 inner_frame, input_frame; Word16 ener_match; /* Q13/Q15 */ move16(); Word16 tmp; Word32 L_tmp; Loading @@ -52,7 +53,7 @@ void hq_core_enc_fx( move16(); /* set input_frame length */ input_frame = input_frame_orig; input_frame = input_frame_orig; /* Q0 */ move16(); /* Sanity check, it should never happen at the encoder side (no BFI) */ IF( EQ_16( st_fx->hTcxCfg->tcx_curr_overlap_mode, FULL_OVERLAP ) ) Loading Loading @@ -85,13 +86,13 @@ void hq_core_enc_fx( * Detect signal transition *--------------------------------------------------------------------------*/ is_transient = detect_transient_fx( audio, input_frame, 0, st_fx ); is_transient = detect_transient_fx( audio, input_frame, 0, st_fx ); /* Q0 */ #ifdef ADD_IVAS_HQ_CODE test(); test(); test(); IF( GT_16( st_fx->element_mode, EVS_MONO ) && ( EQ_16( st_fx->last_core, ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) IF( ( st_fx->element_mode > EVS_MONO ) && ( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) { /*-------------------------------------------------------------------------- * IVAS switching frame Loading Loading @@ -124,8 +125,8 @@ void hq_core_enc_fx( * DCT transform *--------------------------------------------------------------------------*/ Copy( st_fx->old_input_signal_fx, two_frames_buffer, input_frame ); Copy( audio, two_frames_buffer + input_frame, input_frame ); Copy( st_fx->old_input_signal_fx, two_frames_buffer, input_frame ); /* st_fx->q_old_inp */ Copy( audio, two_frames_buffer + input_frame, input_frame ); /* Q0 */ wtda_fx( two_frames_buffer + input_frame, &Q_audio, wtda_audio, NULL, 0, st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, input_frame ); Loading @@ -146,7 +147,7 @@ void hq_core_enc_fx( } #ifndef ADD_IVAS_HQ_CODE /* subtract signalling bits */ num_bits = sub( num_bits, hBstr->nb_bits_tot ); num_bits = sub( num_bits, hBstr->nb_bits_tot ); /* Q0 */ #endif direct_transform_fx( wtda_audio, t_audio, is_transient, input_frame, &Q_audio, st_fx->element_mode ); Loading @@ -161,17 +162,18 @@ void hq_core_enc_fx( { tmp = mult_r( input_frame, 410 / 2 ); /* 1/8000 in Q15 */ ener_match = hq_nominal_scaling[tmp]; move16(); FOR( i = 0; i < input_frame; i++ ) { /*t_audio_q[i] *= ener_match; */ Mpy_32_16_ss( t_audio[i], ener_match, &t_audio[i], &lsb ); move16(); /* Q12 */ Mpy_32_16_ss( t_audio[i], ener_match, &t_audio[i], &lsb ); /* Q12 */ move16(); } } } /* limit encoded band-width according to the command-line OR BWD limitation */ inner_frame = inner_frame_tbl[st_fx->bwidth]; inner_frame = inner_frame_tbl[st_fx->bwidth]; /* Q0 */ move16(); #ifdef ADD_IVAS_HQ_CODE_L_SPEC L_spec = l_spec_tbl[st_fx->bwidth]; Loading @@ -185,7 +187,7 @@ void hq_core_enc_fx( { tmp = i_mult2( i, shr( input_frame, 2 ) ); tmp = shr( inner_frame, 2 ); Copy32( t_audio + i_mult2( i, shr( input_frame, 2 ) ), t_audio + i_mult2( i, tmp ), tmp ); Copy32( t_audio + i_mult2( i, shr( input_frame, 2 ) ), t_audio + i_mult2( i, tmp ), tmp ); /* Q12 */ } } Loading Loading @@ -221,6 +223,8 @@ void hq_core_enc_fx( * Classify whether to put extra bits for FER mitigation *--------------------------------------------------------------------------*/ test(); test(); test(); IF( ( EQ_16( st_fx->last_core, TCX_20_CORE ) || EQ_16( st_fx->last_core, TCX_10_CORE ) || EQ_16( st_fx->last_core, HQ_CORE ) ) && GT_32( st_fx->core_brate, MINIMUM_RATE_TO_ENCODE_VOICING_FLAG ) ) { Loading @@ -246,6 +250,7 @@ void hq_core_enc_fx( FOR( i = 0; i < inner_frame; i++ ) { t_audio[i] = L_shr( t_audio[i], sub( Q_audio, 12 ) ); /* Q12 */ move32(); } hq_lr_enc_fx( st_fx, t_audio, inner_frame, &num_bits, is_transient ); Q_audio = 12; Loading @@ -257,6 +262,7 @@ void hq_core_enc_fx( FOR( i = 0; i < inner_frame; i++ ) { t_audio[i] = L_shr( t_audio[i], sub( Q_audio, 12 ) ); /* Q12 */ move32(); } #ifdef ADD_IVAS_HQ_CODE_L_SPEC Loading Loading @@ -360,7 +366,7 @@ void HQ_core_enc_init_fx( move16(); hHQ_core->prev_stab_hfe2 = 0; move16(); hHQ_core->prev_ni_ratio_fx = 16384; hHQ_core->prev_ni_ratio_fx = 16384; /* Q15 */ move16(); /* 0.5 */ set16_fx( hHQ_core->prev_En_sb_fx, 0, NB_SWB_SUBBANDS ); set16_fx( hHQ_core->last_bitalloc_max_band, 0, 2 ); Loading @@ -370,11 +376,11 @@ void HQ_core_enc_init_fx( move16(); #ifdef MSAN_FIX hHQ_core->crest_lp_fx = HQ_CREST_THRESHOLD_FX; hHQ_core->crest_lp_fx = HQ_CREST_THRESHOLD_FX; /* Q28 */ move32(); hHQ_core->crest_lp_q = Q28; move16(); hHQ_core->crest_mod_lp_fx = HQ_CREST_MOD_THRESHOLD_FX; hHQ_core->crest_mod_lp_fx = HQ_CREST_MOD_THRESHOLD_FX; /* Q29 */ move32(); hHQ_core->crest_mod_lp_q = Q29; move16(); Loading Loading
lib_com/prot_fx.h +4 −4 Original line number Diff line number Diff line Loading @@ -7694,10 +7694,10 @@ void fd_bwe_dec_init( void hq_core_enc_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *audio_fx, /* i : input audio signal Q0 */ const Word16 input_frame, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */ const Word16 vad_hover_flag /* i : VAD hangover flag */ const Word16 input_frame, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ); // hq_core_dec_fx.c Loading
lib_enc/gain_enc_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -622,6 +622,16 @@ void gain_enc_mless_ivas_fx( /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code ); exp_inov = sub( exp_code, 18 + 6 ); // To avoid crash in case code value is 0 IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) ) { L_tmp = 21474836; exp_inov = 0; move32(); move16(); } exp_code = sub( exp_code, 30 ); /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ Loading
lib_enc/hq_classifier_enc_fx.c +177 −139 File changed.Preview size limit exceeded, changes collapsed. Show changes
lib_enc/hq_core_enc.c +37 −33 Original line number Diff line number Diff line Loading @@ -54,10 +54,10 @@ void hq_core_enc_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *audio_fx, /* i : input audio signal Q0 */ const Word16 input_frame_orig, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */ const Word16 vad_hover_flag /* i : VAD hangover flag */ const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ) { Word16 i, is_transient, num_bits, extra_unused; Loading Loading @@ -89,18 +89,19 @@ void hq_core_enc_ivas_fx( move16(); set_zero_fx( t_audio_fx, L_FRAME48k_EXT ); /* set input_frame length */ input_frame = input_frame_orig; input_frame = input_frame_orig; /* Q0 */ /* Sanity check, it should never happen at the encoder side (no BFI) */ IF( st->hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) { st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; move16(); } ELSE { st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; } move16(); } st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; move16(); Loading @@ -110,8 +111,8 @@ void hq_core_enc_ivas_fx( * Write signaling information *--------------------------------------------------------------------------*/ num_bits = BASOP_Util_Divide3232_Scale( st->total_brate, FRAMES_PER_SEC, &exp ); num_bits = shr( num_bits, sub( 15, exp ) ); num_bits = BASOP_Util_Divide3232_Scale( st->total_brate, FRAMES_PER_SEC, &exp ); /* Q15-exp */ num_bits = shr( num_bits, sub( 15, exp ) ); /* Q0 */ extra_unused = 0; move16(); Loading @@ -119,7 +120,7 @@ void hq_core_enc_ivas_fx( * Detect signal transition *--------------------------------------------------------------------------*/ is_transient = detect_transient_fx( audio_fx, input_frame, 0, st ); is_transient = detect_transient_fx( audio_fx, input_frame, 0, st ); /* Q0 */ move16(); test(); Loading @@ -144,10 +145,10 @@ void hq_core_enc_ivas_fx( Q_audio = sub( Q16, q ); TCX_MDCT( wtda_audio_fx16, t_audio_fx, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); Q_audio = sub( Q31, Q_audio ); Copy_Scale_sig_16_32( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); Copy_Scale_sig_16_32( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ inner_frame = inner_frame_tbl[st->bwidth]; L_spec = l_spec_ext_tbl[st->bwidth]; inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ is_transient = 0; move16(); move16(); Loading @@ -161,14 +162,14 @@ void hq_core_enc_ivas_fx( *--------------------------------------------------------------------------*/ Q_audio = 0; move16(); Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); Scale_sig( st->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( st->q_inp ) ); Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); /* Q0 */ Scale_sig( st->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( st->q_inp ) ); /* Q0 */ st->q_old_inp = 0; move16(); st->q_inp = 0; move16(); Copy( st->old_input_signal_fx, two_frames_buffer, input_frame ); Copy( audio_fx, two_frames_buffer + input_frame, input_frame ); Copy( st->old_input_signal_fx, two_frames_buffer, input_frame ); /* Q0 */ Copy( audio_fx, two_frames_buffer + input_frame, input_frame ); /* Q0 */ wtda_fx( two_frames_buffer + input_frame, &Q_audio, wtda_audio_fx32, NULL, 0, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, input_frame ); Loading @@ -191,7 +192,7 @@ void hq_core_enc_ivas_fx( Word16 tmp_q = Q_audio; move16(); direct_transform_fx( wtda_audio_fx32, t_audio_fx, is_transient, input_frame, &Q_audio, st->element_mode ); scale_sig32( wtda_audio_fx32, L_FRAME48k_EXT, sub( Q_audio, tmp_q ) ); scale_sig32( wtda_audio_fx32, L_FRAME48k_EXT, sub( Q_audio, tmp_q ) ); /* Q_audio */ /* scale coefficients to their nominal level (8kHz) */ IF( NE_16( input_frame, NORM_MDCT_FACTOR ) ) Loading @@ -199,17 +200,18 @@ void hq_core_enc_ivas_fx( UWord16 lsb; tmp = mult_r( input_frame, 410 / 2 ); /* 1/8000 in Q15 */ Word16 ener_match_fx = hq_nominal_scaling[tmp]; move16(); FOR( i = 0; i < input_frame; i++ ) { /*t_audio_q[i] *= ener_match; */ Mpy_32_16_ss( t_audio_fx[i], ener_match_fx, &t_audio_fx[i], &lsb ); move16(); /* Q12 */ Mpy_32_16_ss( t_audio_fx[i], ener_match_fx, &t_audio_fx[i], &lsb ); /* Q12 */ move16(); } } /* limit encoded band-width according to the command-line OR BWD limitation */ inner_frame = inner_frame_tbl[st->bwidth]; L_spec = l_spec_tbl[st->bwidth]; inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_tbl[st->bwidth]; /* Q0 */ move16(); move16(); Loading @@ -222,7 +224,7 @@ void hq_core_enc_ivas_fx( FOR( i = 1; i < NUM_TIME_SWITCHING_BLOCKS; i++ ) { tmp = shr( inner_frame, 2 ); Copy32( t_audio_fx + i_mult2( i, shr( input_frame, 2 ) ), t_audio_fx + i_mult2( i, tmp ), tmp ); Copy32( t_audio_fx + i_mult2( i, shr( input_frame, 2 ) ), t_audio_fx + i_mult2( i, tmp ), tmp ); /* Q_audio */ } } Loading @@ -232,7 +234,7 @@ void hq_core_enc_ivas_fx( /* subtract signaling bits */ num_bits = sub( num_bits, hBstr->nb_bits_tot ); num_bits = sub( num_bits, hBstr->nb_bits_tot ); /* Q0 */ /*-------------------------------------------------------------------------- * High-band gain control in case of BWS Loading @@ -241,9 +243,9 @@ void hq_core_enc_ivas_fx( IF( st->bwidth_sw_cnt > 0 ) { Word32 L_tmp; tmp = BASOP_Util_Divide1616_Scale( 3, BWS_TRAN_PERIOD, &exp ); tmp = BASOP_Util_Divide1616_Scale( 3, BWS_TRAN_PERIOD, &exp ); /* Q15-exp */ shr( tmp, exp ); L_tmp = L_deposit_h( tmp ); L_tmp = L_deposit_h( tmp ); /* Q31-exp */ IF( is_transient ) { FOR( i = 0; i < NUM_TIME_SWITCHING_BLOCKS; i++ ) Loading Loading @@ -315,7 +317,7 @@ void hq_core_enc_ivas_fx( test(); IF( st->element_mode > EVS_MONO && ( st->last_core == ACELP_CORE || EQ_16( st->last_core, AMR_WB_CORE ) ) ) { overlap = st->hTcxCfg->tcx_mdct_window_length; overlap = st->hTcxCfg->tcx_mdct_window_length; /* Q0 */ move16(); nz = NS2SA( st->sr_core, N_ZERO_MDCT_NS ); Loading Loading @@ -349,7 +351,7 @@ void hq_core_enc_ivas_fx( /*Compute windowed synthesis in case of switching to ALDO windows in next frame*/ Copy( wtda_audio_fx16 + sub( L_frame, nz ), st->hTcxEnc->old_out_fx, nz + overlap ); Copy( wtda_audio_fx16 + sub( L_frame, nz ), st->hTcxEnc->old_out_fx, nz + overlap ); /* Q0 */ set16_fx( st->hTcxEnc->old_out_fx + add( nz, overlap ), 0, nz ); tcx_windowing_synthesis_past_frame( st->hTcxEnc->old_out_fx + nz, st->hTcxCfg->tcx_aldo_window_1_trunc, st->hTcxCfg->tcx_mdct_window_half, st->hTcxCfg->tcx_mdct_window_minimum, overlap, st->hTcxCfg->tcx_mdct_window_half_length, st->hTcxCfg->tcx_mdct_window_min_length, FULL_OVERLAP ); Loading @@ -359,9 +361,11 @@ void hq_core_enc_ivas_fx( // This implementation is diffrent in float code need to revisit to check its correctness. st->hTcxEnc->old_out_fx[nz + overlap + i] = mult( wtda_audio_fx16[L_frame - 1 - i], st->hTcxCfg->tcx_aldo_window_1_trunc[i].v.re ); // Q0 + Q15 - Q15 -> Q0; st->hTcxEnc->old_out_fx[nz / 2 + ( nz + overlap + i )] = mult( wtda_audio_fx16[nz / 2 + ( L_frame - 1 - i )], st->hTcxCfg->tcx_aldo_window_1_trunc[nz / 2 - 1 - i].v.im ); // Q0 + Q15 - Q15 -> Q0; move16(); move16(); } Copy( wtda_audio_fx16 + sub( shr( overlap, 1 ), tcx_offset ), output_fx, st->L_frame ); Copy( wtda_audio_fx16 + sub( shr( overlap, 1 ), tcx_offset ), output_fx, st->L_frame ); /* Q0 */ } ELSE { Loading @@ -371,12 +375,12 @@ void hq_core_enc_ivas_fx( move32(); FOR( i = 0; i < input_frame; i++ ) { t_audio_fx[i] = Mpy_32_32( t_audio_fx[i], ener_match_fx ); move32(); /* Q12 - 1 -> Q11 */ t_audio_fx[i] = Mpy_32_32( t_audio_fx[i], ener_match_fx ); /* Q12 - 1 -> Q11 */ move32(); } Q_audio = sub( Q_audio, 1 ); scale_sig32( wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, tmp_q ) ); scale_sig32( wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, tmp_q ) ); /* Q_audio */ Inverse_Transform( t_audio_fx, &Q_audio, wtda_audio_fx32, is_transient, L_FRAME16k, inner_frame, st->element_mode ); Loading @@ -384,8 +388,8 @@ void hq_core_enc_ivas_fx( move16(); window_ola_fx( wtda_audio_fx32, output_fx, &out_q, st->hTcxEnc->old_out_fx, &old_q, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL ); Scale_sig( output_fx, L_FRAME16k, negate( out_q ) ); Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( old_q ) ); Scale_sig( output_fx, L_FRAME16k, negate( out_q ) ); /* Q0 */ Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( old_q ) ); /* Q0 */ st->hTcxEnc->Q_old_out = 0; move16(); } Loading
lib_enc/hq_core_enc_fx.c +24 −18 Original line number Diff line number Diff line Loading @@ -19,10 +19,10 @@ void hq_core_enc_fx( Encoder_State *st_fx, const Word16 *audio, /* i : input audio signal Q0 */ const Word16 input_frame_orig, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */ const Word16 vad_hover_flag /* i : VAD hangover flag */ const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ) { Word16 i, is_transient, num_bits, extra_unused; Loading @@ -31,6 +31,7 @@ void hq_core_enc_fx( Word16 Q_audio = 0; Word16 inner_frame, input_frame; Word16 ener_match; /* Q13/Q15 */ move16(); Word16 tmp; Word32 L_tmp; Loading @@ -52,7 +53,7 @@ void hq_core_enc_fx( move16(); /* set input_frame length */ input_frame = input_frame_orig; input_frame = input_frame_orig; /* Q0 */ move16(); /* Sanity check, it should never happen at the encoder side (no BFI) */ IF( EQ_16( st_fx->hTcxCfg->tcx_curr_overlap_mode, FULL_OVERLAP ) ) Loading Loading @@ -85,13 +86,13 @@ void hq_core_enc_fx( * Detect signal transition *--------------------------------------------------------------------------*/ is_transient = detect_transient_fx( audio, input_frame, 0, st_fx ); is_transient = detect_transient_fx( audio, input_frame, 0, st_fx ); /* Q0 */ #ifdef ADD_IVAS_HQ_CODE test(); test(); test(); IF( GT_16( st_fx->element_mode, EVS_MONO ) && ( EQ_16( st_fx->last_core, ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) IF( ( st_fx->element_mode > EVS_MONO ) && ( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) { /*-------------------------------------------------------------------------- * IVAS switching frame Loading Loading @@ -124,8 +125,8 @@ void hq_core_enc_fx( * DCT transform *--------------------------------------------------------------------------*/ Copy( st_fx->old_input_signal_fx, two_frames_buffer, input_frame ); Copy( audio, two_frames_buffer + input_frame, input_frame ); Copy( st_fx->old_input_signal_fx, two_frames_buffer, input_frame ); /* st_fx->q_old_inp */ Copy( audio, two_frames_buffer + input_frame, input_frame ); /* Q0 */ wtda_fx( two_frames_buffer + input_frame, &Q_audio, wtda_audio, NULL, 0, st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, input_frame ); Loading @@ -146,7 +147,7 @@ void hq_core_enc_fx( } #ifndef ADD_IVAS_HQ_CODE /* subtract signalling bits */ num_bits = sub( num_bits, hBstr->nb_bits_tot ); num_bits = sub( num_bits, hBstr->nb_bits_tot ); /* Q0 */ #endif direct_transform_fx( wtda_audio, t_audio, is_transient, input_frame, &Q_audio, st_fx->element_mode ); Loading @@ -161,17 +162,18 @@ void hq_core_enc_fx( { tmp = mult_r( input_frame, 410 / 2 ); /* 1/8000 in Q15 */ ener_match = hq_nominal_scaling[tmp]; move16(); FOR( i = 0; i < input_frame; i++ ) { /*t_audio_q[i] *= ener_match; */ Mpy_32_16_ss( t_audio[i], ener_match, &t_audio[i], &lsb ); move16(); /* Q12 */ Mpy_32_16_ss( t_audio[i], ener_match, &t_audio[i], &lsb ); /* Q12 */ move16(); } } } /* limit encoded band-width according to the command-line OR BWD limitation */ inner_frame = inner_frame_tbl[st_fx->bwidth]; inner_frame = inner_frame_tbl[st_fx->bwidth]; /* Q0 */ move16(); #ifdef ADD_IVAS_HQ_CODE_L_SPEC L_spec = l_spec_tbl[st_fx->bwidth]; Loading @@ -185,7 +187,7 @@ void hq_core_enc_fx( { tmp = i_mult2( i, shr( input_frame, 2 ) ); tmp = shr( inner_frame, 2 ); Copy32( t_audio + i_mult2( i, shr( input_frame, 2 ) ), t_audio + i_mult2( i, tmp ), tmp ); Copy32( t_audio + i_mult2( i, shr( input_frame, 2 ) ), t_audio + i_mult2( i, tmp ), tmp ); /* Q12 */ } } Loading Loading @@ -221,6 +223,8 @@ void hq_core_enc_fx( * Classify whether to put extra bits for FER mitigation *--------------------------------------------------------------------------*/ test(); test(); test(); IF( ( EQ_16( st_fx->last_core, TCX_20_CORE ) || EQ_16( st_fx->last_core, TCX_10_CORE ) || EQ_16( st_fx->last_core, HQ_CORE ) ) && GT_32( st_fx->core_brate, MINIMUM_RATE_TO_ENCODE_VOICING_FLAG ) ) { Loading @@ -246,6 +250,7 @@ void hq_core_enc_fx( FOR( i = 0; i < inner_frame; i++ ) { t_audio[i] = L_shr( t_audio[i], sub( Q_audio, 12 ) ); /* Q12 */ move32(); } hq_lr_enc_fx( st_fx, t_audio, inner_frame, &num_bits, is_transient ); Q_audio = 12; Loading @@ -257,6 +262,7 @@ void hq_core_enc_fx( FOR( i = 0; i < inner_frame; i++ ) { t_audio[i] = L_shr( t_audio[i], sub( Q_audio, 12 ) ); /* Q12 */ move32(); } #ifdef ADD_IVAS_HQ_CODE_L_SPEC Loading Loading @@ -360,7 +366,7 @@ void HQ_core_enc_init_fx( move16(); hHQ_core->prev_stab_hfe2 = 0; move16(); hHQ_core->prev_ni_ratio_fx = 16384; hHQ_core->prev_ni_ratio_fx = 16384; /* Q15 */ move16(); /* 0.5 */ set16_fx( hHQ_core->prev_En_sb_fx, 0, NB_SWB_SUBBANDS ); set16_fx( hHQ_core->last_bitalloc_max_band, 0, 2 ); Loading @@ -370,11 +376,11 @@ void HQ_core_enc_init_fx( move16(); #ifdef MSAN_FIX hHQ_core->crest_lp_fx = HQ_CREST_THRESHOLD_FX; hHQ_core->crest_lp_fx = HQ_CREST_THRESHOLD_FX; /* Q28 */ move32(); hHQ_core->crest_lp_q = Q28; move16(); hHQ_core->crest_mod_lp_fx = HQ_CREST_MOD_THRESHOLD_FX; hHQ_core->crest_mod_lp_fx = HQ_CREST_MOD_THRESHOLD_FX; /* Q29 */ move32(); hHQ_core->crest_mod_lp_q = Q29; move16(); Loading