Commit 4ec5387f authored by kinuthia's avatar kinuthia
Browse files

Merge branch 'main' into add-saturation-smoke-test

parents 35e60c09 19d7ac40
Loading
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ variables:
  LEVEL_SCALING: "1.0"
  IVAS_PIPELINE_NAME: ''
  BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch"
  PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm"
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'pytest-mld' to run MLD test against reference float codec." # Not implemented yet, but may be good to have a manual pipeline trigger
    value: 'default'
@@ -111,6 +112,8 @@ stages:
.update-scripts-repo: &update-scripts-repo
  - cd $SCRIPTS_DIR
  - git remote set-branches --add origin $BASOP_CI_BRANCH_PC_REPO
  - git remote prune origin
  - git branch
  - git fetch
  - git checkout $BASOP_CI_BRANCH_PC_REPO
  - git pull
@@ -120,13 +123,6 @@ stages:
  - cp -r $SCRIPTS_DIR/tests .
  - cp $SCRIPTS_DIR/pytest.ini .

# TODO: this needs to be updated in case the reference is updated
.remove-unsupported-testcases: &remove-unsupported-testcases
  - sed -i '1701,1707d' scripts/config/self_test.prm
  - sed -i '1659,1661d' scripts/config/self_test.prm
  - sed -i '1635,1637d' scripts/config/self_test.prm
  - sed -i '1603,1605d' scripts/config/self_test.prm

.apply-testv-scaling: &apply-testv-scaling
  - echo "Applying level scaling in scripts/testv using scale=$LEVEL_SCALING"
  - tests/scale_pcm.py ./scripts/testv/ $LEVEL_SCALING
@@ -205,7 +201,7 @@ stages:
    -    *update-ltv-repo
    -    *copy-ltv-files-to-testv-dir
    - fi
    - *remove-unsupported-testcases
    - python3 ci/remove_unsupported_testcases.py $PRM_FILES
    - if [ $LEVEL_SCALING != "1.0" ];then
    -   *apply-testv-scaling
    - fi
@@ -259,7 +255,7 @@ stages:
  script:
    - *print-common-info
    - *update-scripts-repo
    - *remove-unsupported-testcases
    - python3 ci/remove_unsupported_testcases.py $PRM_FILES
    - *setup-codec
    - make clean
    - make -j CLANG=$CLANG_NUM
+9 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@
#include "prot.h"
#include "rom_com.h"
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx2.h"
#endif

/*---------------------------------------------------------------------*
 * IGF_ApplyTransFac_flt()
@@ -504,6 +507,12 @@ static void IGF_gridSetUp_flt(
        hGrid->sfbWrap[t] = 0;
    }

#ifdef IVAS_FLOAT_FIXED
    hGrid->fFactor = float_to_fix16(hGrid->fFactor_flt, Q14);
    hGrid->lFactor = float_to_fix16(hGrid->lFactor_flt, Q14);
    hGrid->gFactor = float_to_fix16(hGrid->gFactor_flt, Q14);
#endif

    return;
}

+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@
#define SQRT2                                   1.414213562373095f
#define SQRT2_FIXED                             1518500250 // Q30
#define SQRT2_OVER_2                            (SQRT2 / 2.0f)
#define SQRT2_OVER_2_FIXED                      1518500250 // Q31

#define INV_SQRT2                               7.071067811865475e-1f /* 1/sqrt(2) */
#define INV_SQRT3                               0.577350269189626f    /* 1/sqrt(3) */
@@ -1544,6 +1545,7 @@ typedef enum
#define HRTF_NUM_BINS                           60
#define REVERB_PREDELAY_MAX                     20                          /* Max input delay for reverb module */
#define GAIN_LFE                                1.88364911f                 /* Gain applied to LFE during renderering */
#define GAIN_LFE_WORD32                         2022552831                 /* Gain applied to LFE during renderering */
#ifdef IVAS_FLOAT_FIXED
#define GAIN_LFE_FX                             30862                 /* Gain applied to LFE during renderering */
#endif // IVAS_FLOAT_FIXED
+74 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "ivas_prot.h"
#include "wmc_auto.h"
#include "prot.h"
#include "prot_fx2.h"

/*-----------------------------------------------------------------------------------------*
 * Local constants
@@ -65,6 +66,52 @@ static float ivas_calculate_update_factor(
}


#ifdef IVAS_FLOAT_FIXED
/*-----------------------------------------------------------------------------------------*
 * Function ivas_calculate_smoothning_factor_fx()
 *
 * To calculate the Smoothning factor
 *-----------------------------------------------------------------------------------------*/

static void ivas_calculate_smoothning_factor_fx(
    Word32 *Smoothing_factor,
    Word32 update_factor,
    const Word16 min_pool_size,
    const Word32 max_update_rate,
    const COV_SMOOTHING_TYPE smooth_mode,
    const Word32 ivas_total_brate,
    Word16 j )
{
    Word32 smooth_fact, L_tmp = 0;
    Word16 tmp, exp_diff = 0;

    tmp = BASOP_Util_Divide3232_Scale( update_factor, L_shl( L_deposit_l( min_pool_size ), Q22 ), &exp_diff ); // (Q15 - exp_diff)
    *Smoothing_factor = L_shl_sat( L_deposit_l( tmp ), ( Q15 + exp_diff ) );                                   // Q30

    IF( NE_32( smooth_mode, COV_SMOOTH_MC ) )
    {
        IF( LT_32( ivas_total_brate, IVAS_24k4 ) )
        {
            smooth_fact = (Word32) ( 0.5f * ONE_IN_Q31 );
        }
        ELSE
        {
            smooth_fact = (Word32) ( 0.75f * ONE_IN_Q31 );
        }

        L_tmp = Mpy_32_16_1( smooth_fact, add( j, 1 ) );           // (Q31 , Q0) -> Q16
        *Smoothing_factor = Mpy_32_32( *Smoothing_factor, L_tmp ); // (Q30, Q16) -> Q15
        *Smoothing_factor = L_shl_sat( *Smoothing_factor, Q15 );   // Q30
    }

    IF( *Smoothing_factor > max_update_rate ) // Q30
    {
        *Smoothing_factor = max_update_rate;
    }

    return;
}
#else
/*-----------------------------------------------------------------------------------------*
 * Function ivas_calculate_smoothning_factor()
 *
@@ -102,6 +149,7 @@ static void ivas_calculate_smoothning_factor(

    return;
}
#endif


/*-----------------------------------------------------------------------------------------*
@@ -120,13 +168,23 @@ static void ivas_set_up_cov_smoothing(
{
    int16_t j;
    float update_factor;
#ifdef IVAS_FLOAT_FIXED
    Word32 update_factor_fx, max_update_rate_fx;
    max_update_rate_fx = (Word32) ( max_update_rate * ONE_IN_Q30 );
#endif
    if ( smooth_mode == COV_SMOOTH_MC )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            int16_t active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j];
            update_factor = ivas_calculate_update_factor( pFb->fb_bin_to_band.pFb_bin_to_band[j], active_bins );
#ifdef IVAS_FLOAT_FIXED
            update_factor_fx = (Word32) ( update_factor * ONE_IN_Q22 );
            ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor_fx, min_pool_size, max_update_rate_fx, smooth_mode, ivas_total_brate, j );
            hCovState->pSmoothing_factor[j] = (float) hCovState->pSmoothing_factor_fx[j] / ONE_IN_Q30;
#else
            ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
#endif
        }
    }
    else
@@ -136,7 +194,13 @@ static void ivas_set_up_cov_smoothing(
            float *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j];
            int16_t active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j];
            update_factor = ivas_calculate_update_factor( p_bin_to_band, active_bins );
#ifdef IVAS_FLOAT_FIXED
            update_factor_fx = (Word32) ( update_factor * ONE_IN_Q22 );
            ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor_fx, min_pool_size, max_update_rate_fx, smooth_mode, ivas_total_brate, j );
            hCovState->pSmoothing_factor[j] = (float) hCovState->pSmoothing_factor_fx[j] / ONE_IN_Q30;
#else
            ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
#endif
        }
    }

@@ -173,6 +237,12 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" );
    }
#ifdef IVAS_FLOAT_FIXED
    IF( ( hCovState->pSmoothing_factor_fx = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" );
    }
#endif

    for ( i = 0; i < nchan_inp; i++ )
    {
@@ -214,6 +284,10 @@ void ivas_spar_covar_smooth_enc_close(
    {
        free( hCovState->pSmoothing_factor );
        hCovState->pSmoothing_factor = NULL;
#ifdef IVAS_FLOAT_FIXED
        free( hCovState->pSmoothing_factor_fx );
        hCovState->pSmoothing_factor_fx = NULL;
#endif

        for ( i = 0; i < nchan_inp; i++ )
        {
+5 −0
Original line number Diff line number Diff line
@@ -1551,6 +1551,11 @@ float stereo_dft_dmx_swb_nrg(
    const int16_t frame_length                                  /* i  : frame lanegth                       */
);

#ifdef IVAS_FLOAT_FIXED
Word16 stereo_dft_sg_recovery_fx(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: Decoder DFT stereo handle      */
);
#endif
int16_t stereo_dft_sg_recovery(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft                       /* i/o: Decoder DFT stereo handle           */
);
Loading