Commit f6a3b48c authored by vaclav's avatar vaclav
Browse files

Merge branch 'revision_tran_det' into 'main'

Transient detector revision

Closes #2037

See merge request !2258
parents fb1274d2 6dd044ac
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3170,9 +3170,9 @@ void stereo_tcx_core_enc(
Word16 transient_analysis_ivas_fx(
    TRAN_DET_HANDLE hTranDet,  /* i  : handle transient detection       */
    const Word16 cor_map_LT[], /* i  : LT correlation map  Q_cor_map = Qx */
    Word16 Q_cor_map,
    const Word16 Q_cor_map,
    const Word16 multi_harm_limit, /* i  : multi harmonic threshold Q_multi_harm_limit = Qx */
    Word16 Q_multi_harm_limit );
    const Word16 Q_multi_harm_limit );

void set_transient_stereo_fx(
    CPE_ENC_HANDLE hCPE,  /* i  : CPE structure                           */
+2 −2
Original line number Diff line number Diff line
@@ -698,7 +698,7 @@ void core_encode_openloop_fx(
            test();
            test();
            IF( rf_PLC_Mode == 0 && hRF->rf_gain_tcx[1] != 0 &&
                ( ( st->transientDetection.transientDetector.bIsAttackPresent != 0 && LT_16( hRF->rf_gain_tcx[0], mult_r( hRF->rf_gain_tcx[1], 31785 /*0.97f Q15*/ ) ) ) ||
                ( ( st->hTranDet->transientDetector.bIsAttackPresent != 0 && LT_16( hRF->rf_gain_tcx[0], mult_r( hRF->rf_gain_tcx[1], 31785 /*0.97f Q15*/ ) ) ) ||
                  LT_16( hRF->rf_gain_tcx[0], mult_r( hRF->rf_gain_tcx[1], 29491 /*0.90f Q15*/ ) ) ) )
            {
                TD_mode = 0;
@@ -898,7 +898,7 @@ void core_acelp_tcx20_switching_fx(
                       st->pit_fr2,
                       st->pit_max,
                       st->pit_res_max,
                       &st->transientDetection,
                       st->hTranDet,
                       0,
                       A_q_tcx,
                       M );
+2 −2
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ void core_signal_analysis_high_bitrate_fx(
                           &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &hTcxEnc->tcxltp_gain,
                           &hTcxEnc->tcxltp_pitch_int_past, &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past,
                           &hTcxEnc->tcxltp_norm_corr_past, st->last_core, st->pit_min, st->pit_fr1,
                           st->pit_fr2, st->pit_max, st->pit_res_max, &st->transientDetection,
                           st->pit_fr2, st->pit_max, st->pit_res_max, st->hTranDet,
                           tmp8, NULL, M );
    }
    ELSE
@@ -130,7 +130,7 @@ void core_signal_analysis_high_bitrate_fx(
                           &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &hTcxEnc->tcxltp_gain,
                           &hTcxEnc->tcxltp_pitch_int_past, &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past,
                           &hTcxEnc->tcxltp_norm_corr_past, st->last_core, st->pit_min, st->pit_fr1,
                           st->pit_fr2, st->pit_max, st->pit_res_max, &st->transientDetection,
                           st->pit_fr2, st->pit_max, st->pit_res_max, st->hTranDet,
                           tmp8, NULL, M );
    }

+1 −1
Original line number Diff line number Diff line
@@ -1811,7 +1811,7 @@ void IGFEncApplyMono_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in
                   pPowerSpectrumParameterWhitening, /* i: MDCT^2 + MDST^2 spectrum, or estimate     */
                   PowerSpectrum_e,                  /* i: exponent of powerSpectrum                 */
                   igfGridIdx,                       /* i: IGF grid index                            */
                   ( st->transientDetection.transientDetector.bIsAttackPresent == 1 ),
                   ( st->hTranDet->transientDetector.bIsAttackPresent == 1 ),
                   last_core_acelp ); /* i: last frame was acelp indicator            */

    pPowerSpectrumParameter = NULL;
+8 −5
Original line number Diff line number Diff line
@@ -878,10 +878,15 @@ ivas_error init_encoder_fx(
    st_fx->totalNoise_increase_len = 0;
    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")

    IF( ( st_fx->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) );
    }

    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 );
                               st_fx->hTranDet );

    st_fx->Q_syn2 = 0;
    move16();
@@ -2149,9 +2154,7 @@ ivas_error init_encoder_ivas_fx(
    }
    ELSE
    {
        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 );
        InitTransientDetection_fx( frame_length, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet );
    }

    /*-----------------------------------------------------------------*
Loading