Commit 699753bd authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into...

Merge remote-tracking branch 'remotes/origin/main' into basop-2492-remove-duplicates-for-decode_indexes-function
parents 03f3375f 7838c2fa
Loading
Loading
Loading
Loading
Loading

lib_com/options.h

100644 → 100755
+6 −0
Original line number Diff line number Diff line
@@ -141,7 +141,13 @@
#define NONBE_FIX_2575                                  /* Fhg: Fix issue 2575, precision loss in FD CNG */
#define FIX_2584_TD_SM_ISSUE                            /* VA: Fix inconsistencies in the SM part of the TD stereo */
#define FIX_2556_ALIGN_CONDITIONS                       /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */
#define FIX_NONBE_2579_INCORRECT_LAG_CALCULATION        /* Dolby: fix 2579: Incorrect lag calculation */

/* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */
/* The changes for F0+thdModification are mainly for IVAS better float compatibility, */
/* for EVS_MONO, all is kept BE. */
#define FIX_ISSUE_1966_PHASE_DIFF                       /* FhG: Basop issue 1966: shift phase range to [-2PI..+2PI[, handle 4 quadrants */
#define FIX_ISSUE_1966_F0_32BIT                         /* FhG: Basop issue 1966: use 32-bit variables for F0 and thresholdModification */
/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */
+426 −33

File changed.

Preview size limit exceeded, changes collapsed.

+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
#include <assert.h>
#include "ivas_prot_fx.h"


/*  static void setnoiseLevelMemory_fx()
 *
 *      Helper function - updates buffer for minimumStatistics_fx function
+0 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#include "basop_proto_func.h"
#include "ivas_prot_fx.h"


/*-----------------------------------------------------------------*
 * Function mdct_read_IGF_bits()
 *
+79 −3
Original line number Diff line number Diff line
@@ -23,7 +23,11 @@ static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const Word16 typ
static void CalcPowerSpec( const Word32 *mdctSpec, const Word16 mdctSpec_exp, const Word32 *mdstSpec, const Word16 mdstSpec_exp, const Word16 nSamples, const Word16 floorPowerSpectrum, Word32 *powerSpec, Word16 *powerSpec_exp );
static void CalcPowerSpecAndDetectTonalComponents_fx( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDST[], Word16 secondLastMDST_exp, Word32 secondLastMDCT[], Word16 secondLastMDCT_exp, Word32 const pitchLag, const PsychoacousticParameters *psychParamsCurrent, Word16 element_mode );
static void FindPhases( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDCT[], Word32 secondLastMDST[], Word16 diff_exp );
#ifdef FIX_ISSUE_1966_PHASE_DIFF
static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 powerSpectrum[], const Word16 element_mode );
#else
static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 powerSpectrum[] );
#endif


/*******************************************************/
@@ -598,7 +602,12 @@ static void FindPhases(
/* o: Phase difference [-pi;pi]         2Q13*/
static void FindPhaseDifferences(
    TonalMDCTConcealPtr const hTonalMDCTConc, /* i  : Pointer to internal structure        */
    Word32 powerSpectrum[] )                  /* i  : Power spectrum data Qx                 */
    Word32 powerSpectrum[]                    /* i  : Power spectrum data Qx                 */
#ifdef FIX_ISSUE_1966_PHASE_DIFF
    ,
    const Word16 element_mode /* i  : EVS_MONO or anything else */
#endif
)
{
    Word16 i, k;
    Word16 *phaseDiff;
@@ -627,6 +636,13 @@ static void FindPhaseDifferences(
        {
            phaseDiff[i] = 0; /*(float)tan(0.0f*EVS_PI/bandwidth);*/
            move16();

#ifdef FIX_ISSUE_1966_PHASE_DIFF
            /* Note: This version is closer to the float reference, except */
            /*       for the phase range. It is here [-2PI..+2PI[, while */
            /*       in float it is [0..4PI[. */
            IF( EQ_16( element_mode, EVS_MONO ) )
            {
                if ( s_and( k, 1 ) != 0 )
                {
                    phaseDiff[i] = -12868 /*-EVS_PI 3Q12*/;
@@ -634,16 +650,73 @@ static void FindPhaseDifferences(
                }
            }
            ELSE
            {
                if ( EQ_16( s_and( k, 3 ), 1 ) )
                {
                    phaseDiff[i] = 12868 /* 1*EVS_PI 3Q12*/;
                    move16();
                }
                if ( EQ_16( s_and( k, 3 ), 2 ) )
                {
                    phaseDiff[i] = -25736 /*-2*EVS_PI 3Q12*/;
                    move16();
                }
                if ( EQ_16( s_and( k, 3 ), 3 ) )
                {
                    phaseDiff[i] = -12868 /*-1*EVS_PI 3Q12*/;
                    move16();
                }
            }
#else
            if ( s_and( k, 1 ) != 0 )
            {
                phaseDiff[i] = -12868 /*-EVS_PI 3Q12*/;
                move16();
            }

#endif
        }
        ELSE
        {
            IF( GE_32( Mpy_32_16_1( powerSpectrum[k + 1], 512 /*1.0f Q9*/ ), Mpy_32_16_1( powerSpectrum[k - 1], MAXRATIO ) ) )
            {
                phaseDiff[i] = 12868 /*EVS_PI 3Q12*/; /*(float)tan(2.0f*PI/bandwidth);*/
                move16();

#ifdef FIX_ISSUE_1966_PHASE_DIFF
                IF( EQ_16( element_mode, EVS_MONO ) )
                {
                    if ( s_and( k, 1 ) != 0 )
                    {
                        phaseDiff[i] = 0 /*0 Q13*/; /*2Q13*/
                        move16();
                    }
                }
                ELSE
                {
                    if ( EQ_16( s_and( k, 3 ), 1 ) )
                    {
                        phaseDiff[i] = -25736 /*-2*EVS_PI 3Q12*/;
                        move16();
                    }
                    if ( EQ_16( s_and( k, 3 ), 2 ) )
                    {
                        phaseDiff[i] = -12868 /*-1*EVS_PI 3Q12*/;
                        move16();
                    }
                    if ( EQ_16( s_and( k, 3 ), 3 ) )
                    {
                        phaseDiff[i] = 0 /* 0*EVS_PI 3Q12*/;
                        move16();
                    }
                }
#else
                if ( s_and( k, 1 ) != 0 )
                {
                    phaseDiff[i] = 0 /*0 Q13*/; /*2Q13*/
                    move16();
                }
#endif
            }
            ELSE
            {
@@ -793,10 +866,13 @@ static void CalcPowerSpecAndDetectTonalComponents_fx(
                              nSamples,
                              hTonalMDCTConc->nSamplesCore,
                              floorPowerSpectrum, psychParamsCurrent, element_mode );

    FindPhases( hTonalMDCTConc, secondLastMDCT, secondLastMDST, sub( secondLastMDST_exp, secondLastMDCT_exp ) );

#ifdef FIX_ISSUE_1966_PHASE_DIFF
    FindPhaseDifferences( hTonalMDCTConc, powerSpectrum, element_mode );
#else
    FindPhaseDifferences( hTonalMDCTConc, powerSpectrum );
#endif

    IF( hTonalMDCTConc->pTCI->numIndexes > 0 )
    {
@@ -944,8 +1020,8 @@ void TonalMDCTConceal_Detect_fx(
    Word16 i, powerSpectrum_exp, secondLastMDST_exp, s;
    Word16 nSamples;
    Word32 sns_int_scf_fx[FDNS_NPTS];
    set32_fx( sns_int_scf_fx, 0, FDNS_NPTS );

    set32_fx( sns_int_scf_fx, 0, FDNS_NPTS );

    nSamples = hTonalMDCTConc->nSamples;
    move16();
Loading