Commit b444199a authored by multrus's avatar multrus
Browse files

Merge branch 'main' into...

Merge branch 'main' into basop-2521-probable-porting-bug-in-ivas_sba_dirac_stereo_compute_td_stefi_nrgs
parents 642f08ec 398de840
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -95,6 +95,14 @@
#define FIX_FLOAT_1539_G192_FORMAT_SWITCH               /* VA/Nokia: reintroduce format switching for g192 bitstreams */
#define HARMONIZE_2499_CONFIGUREFDCNGDEC                /* FhG: basop issue 2499: harmonoize configureFdCngDec */
#define FIX_BASOP_2530_IVAS_DECISION_MAT                /* VA: Fix ambiguous usage of extract_l() */
#define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR             /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/
#define FIX_BASOP_2532_cx_e                             /* FhG: Fix issue 2532 about additional exponent variable*/
#define HARMONIZE_2543_SQ_gain                          /* FhG: Harmonize SQ_gain */
#define FIX_ISSUE_2533_EXTRA_CONDITION                  /* FhG: Fix issue basop 2533 removing the extra condition*/

/*Harmonize SetTCXModeInfo, GetTCXMaxenergyChange*/                                                        
#define HARMONIZE_2537_SetTCXModeInfo                 /* FhG: Harmonize SetTCXModeInfo  - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */
#define HARMONIZE_2537_GetTCXMaxenergyChange            /* FhG: Harmonize GetTCXMaxenergyChange */

/* #################### End BE switches ################################## */

+25 −1
Original line number Diff line number Diff line
@@ -1801,6 +1801,10 @@ void ivas_param_mc_dec_prepare_renderer(
            }
        }
        cx_e = max_e;
#ifdef FIX_BASOP_2532_cx_e
        cx_next_band_e = max_e;
        move16();
#endif
        move16();

        /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/
@@ -1815,7 +1819,11 @@ void ivas_param_mc_dec_prepare_renderer(
                Scale_sig32( cx_fx, len, -Q1 );           // add one bit head room
                Scale_sig32( cx_next_band_fx, len, -Q1 ); // add one bit head room
                cx_e = add( cx_e, Q1 );
#ifndef FIX_BASOP_2532_cx_e
                cx_next_band_e = add( cx_e, Q1 );
#else
                cx_next_band_e = add( cx_next_band_e, Q1 );
#endif // !FIX_BASOP_2532_cx_e
            }
            v_add_fx( cx_fx, cx_next_band_fx, cx_fx, len );
            Copy32( cx_fx, cx_next_band_fx, len );
@@ -1828,13 +1836,17 @@ void ivas_param_mc_dec_prepare_renderer(
            {
                CONTINUE;
            }

#ifndef FIX_ISSUE_2533_EXTRA_CONDITION
            IF( NE_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) )
            {
                IF( is_next_band )
                {

#ifndef FIX_BASOP_2532_cx_e
                    ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_next_band_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
#else
                    ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
#endif
                }
                ELSE
                {
@@ -1842,6 +1854,18 @@ void ivas_param_mc_dec_prepare_renderer(
                    ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
                }
            }
#else
            IF( is_next_band )
            {

                ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
            }
            ELSE
            {

                ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
            }
#endif
        }
    }

+66 −1
Original line number Diff line number Diff line
@@ -1432,10 +1432,18 @@ void QuantizeSpectrum_fx(

                /* Quantize original spectrum */

#ifdef HARMONIZE_2543_SQ_gain
                sqGain = SQ_gain_fx( OriginalSpectrum, OriginalSpectrum_e,
                                     shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ),
                                     L_spec,
                                     &sqGain_e,
                                     EVS_MONO );
#else
                sqGain = SQ_gain_fx( OriginalSpectrum, OriginalSpectrum_e,
                                     shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ),
                                     L_spec,
                                     &sqGain_e );
#endif

                tcx_scalar_quantization_fx( OriginalSpectrum, OriginalSpectrum_e,
                                            sqQ,
@@ -1524,10 +1532,18 @@ void QuantizeSpectrum_fx(
                PeriodicityIndex = -1;
                move16();

#ifdef HARMONIZE_2543_SQ_gain
                sqGain = SQ_gain_fx( spectrum, *spectrum_e,
                                     shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ),
                                     L_spec,
                                     &sqGain_e,
                                     EVS_MONO );
#else
                sqGain = SQ_gain_fx( spectrum, *spectrum_e,
                                     shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ),
                                     L_spec,
                                     &sqGain_e );
#endif

                /* Quantize spectrum */

@@ -1594,6 +1610,7 @@ void QuantizeSpectrum_fx(
                phm_cfg = hm_cfg;
                move16();
            }
#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR
            sqBits = tcx_scalar_quantization_rateloop_fx( spectrum, *spectrum_e,
                                                          sqQ,
                                                          L_spec,
@@ -1609,6 +1626,35 @@ void QuantizeSpectrum_fx(
                                                          hTcxCfg->tcxRateLoopOpt,
                                                          tcxonly,
                                                          phm_cfg );
#else
            Word16 max_iter = 4;
            move16();
            IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
            {
                max_iter = 2;
                move16();
            }
            sqBits = tcx_scalar_quantization_rateloop_fx( spectrum, *spectrum_e,
                                                          sqQ,
                                                          L_spec,
                                                          &sqGain, &sqGain_e,
                                                          hTcxCfg->sq_rounding,
                                                          hTcxEnc->memQuantZeros,
                                                          prm_lastnz, /* lastnz */
                                                          sqTargetBits,
                                                          &nEncoded,
                                                          &stop,
                                                          sqBits_noStop,
                                                          sqBits,
                                                          hTcxCfg->tcxRateLoopOpt,
                                                          tcxonly,
                                                          phm_cfg,
                                                          max_iter,
                                                          st->element_mode );
            // sqBits = tcx_scalar_quantization_rateloop_ivas_fx(spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode);

#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR


            IF( ctxHmBits > 0 ) /* Mapping tool is enabled */
            {
@@ -3027,7 +3073,11 @@ void QuantizeTCXSpectrum_fx(
            }

            /* Quantize original spectrum */
#ifdef HARMONIZE_2543_SQ_gain
            sqGain_fx = SQ_gain_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e, 1 /*signal non-EVS*/ );
#else
            sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e );
#endif

            tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly );

@@ -3118,7 +3168,11 @@ void QuantizeTCXSpectrum_fx(
            }
            ELSE
            {
#ifdef HARMONIZE_2543_SQ_gain
                sqGain_fx = SQ_gain_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e, 1 /*signal non-EVS*/ );
#else
                sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e );
#endif
            }
            /* Quantize spectrum */
            tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly );
@@ -3186,8 +3240,11 @@ void QuantizeTCXSpectrum_fx(
            max_iter = 2;
            move16();
        }
#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR
        sqBits = tcx_scalar_quantization_rateloop_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode );

#else
        sqBits = tcx_scalar_quantization_rateloop_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode );
#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR
        IF( ctxHmBits > 0 )
        {
            /* Mapping tool is enabled */
@@ -4906,7 +4963,11 @@ void TNSAnalysisStereo_fx(
                                ELSE
                                {
                                    Word16 maxEnergyChange_fx;
#ifdef HARMONIZE_2537_GetTCXMaxenergyChange
                                    maxEnergyChange_fx = mac_r( L_mult( GetTCXMaxenergyChange_fx( sts[0]->hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ ), 16384 ), GetTCXMaxenergyChange_fx( sts[1]->hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ ), 16384 );
#else
                                    maxEnergyChange_fx = mac_r( L_mult( GetTCXMaxenergyChange_ivas_fx( sts[0]->hTranDet, isTCX10, NSUBBLOCKS, 3 ), 16384 ), GetTCXMaxenergyChange_ivas_fx( sts[1]->hTranDet, isTCX10, NSUBBLOCKS, 3 ), 16384 );
#endif

                                    IF( GE_16( maxEnergyChange_fx, shl( pTnsParameters[0]->minEnergyChange, Q3 - Q7 ) ) )
                                    {
@@ -5200,7 +5261,11 @@ void TNSAnalysisStereo_fx(
                        }
                        ELSE
                        {
#ifdef HARMONIZE_2537_GetTCXMaxenergyChange
                            Word16 maxEnergyChange_fx = GetTCXMaxenergyChange_fx( sts[ch]->hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ );
#else
                            Word16 maxEnergyChange_fx = GetTCXMaxenergyChange_ivas_fx( sts[ch]->hTranDet, isTCX10, NSUBBLOCKS, 3 );
#endif

                            IF( GE_16( maxEnergyChange_fx, shl( pTnsParameters->minEnergyChange, Q3 - Q7 ) ) )
                            {
+4 −0
Original line number Diff line number Diff line
@@ -380,7 +380,11 @@ void pre_proc_ivas_fx(
        }
        IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
        {
#ifdef HARMONIZE_2537_SetTCXModeInfo
            SetTCXModeInfo_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode );
#else
            SetTCXModeInfo_ivas_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode );
#endif
        }
    }
    ELSE IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
+4 −0
Original line number Diff line number Diff line
@@ -1290,7 +1290,11 @@ void ivas_mdct_core_whitening_enc_fx(
        FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
            st = sts[ch];
#ifdef HARMONIZE_2537_SetTCXModeInfo
            SetTCXModeInfo_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode );
#else
            SetTCXModeInfo_ivas_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode );
#endif
        }
    }

Loading