Commit a003f2ba authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main' into...

Merge branch 'main' into 184-scaling-of-old_synthesis-part-for-first-good-frame-after-frameloss-missing-in-mct
parents 4af195db 5edfff67
Loading
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -121,11 +121,7 @@ typedef struct
    bool mimeOutput;

#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
#ifdef AGC_ENABLE_FOR_LBR
    IVAS_ENC_AGC agc;
#else
    bool agc;
#endif /* AGC_ENABLE_FOR_LBR */
#endif /* DEBUG_AGC_ENCODER_CMD_OPTION */
    bool pca;
#ifdef DEBUG_FOA_AGC
@@ -891,11 +887,7 @@ static void initArgStruct( EncArguments *arg )
    arg->mimeOutput = false;

#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
#ifdef AGC_ENABLE_FOR_LBR
    arg->agc = IVAS_ENC_AGC_UNDEFINED;
#else
    arg->agc = IVAS_DEFAULT_AGC;
#endif /* AGC_ENABLE_FOR_LBR */
#endif /* DEBUG_AGC_ENCODER_CMD_OPTION */
    arg->pca = false;
#ifdef DEBUG_FOA_AGC
@@ -1408,11 +1400,7 @@ static bool parseCmdlIVAS_enc(
            i++;
            if ( i < argc - 4 )
            {
#ifdef AGC_ENABLE_FOR_LBR
                arg->agc = ( atoi( argv[i] ) ) ? IVAS_ENC_AGC_ENABLED : IVAS_ENC_AGC_DISABLED;
#else
                arg->agc = (int16_t) atoi( argv[i] );
#endif
                if ( argv[i] == NULL || atoi( argv[i] ) < 0 || atoi( argv[i] ) > 1 )
                {
                    fprintf( stderr, "Error: wrong adaptive gain control option specified (%d), expected 0 or 1\n\n", (int32_t) atoi( argv[i] ) );
@@ -1669,13 +1657,9 @@ static void usage_enc( void )
    fprintf( stdout, "-tag                : Tag name for intermediate debug files\n" );
#endif
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
#ifdef AGC_ENABLE_FOR_LBR
    fprintf( stdout, "-agc op             : SBA Adaptive gain control, op = (0, 1).  \n" );
    fprintf( stdout, "                      By default op is 1 (activated) for bitrates between 24400 and 32000,\n" );
    fprintf( stdout, "                      otherwise it is 0 (deactivated) for all other bitrates\n" );
#else
    fprintf( stdout, "-agc op             : SBA Adaptive gain control, op = (0, 1), by default op is 0 or deactivated\n" );
#endif /* AGC_ENABLE_FOR_LBR */
#endif /* DEBUG_AGC_ENCODER_CMD_OPTION */

    fprintf( stdout, "-bypass mode        : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" );
+2 −24
Original line number Diff line number Diff line
@@ -40,9 +40,7 @@
#endif
#include <math.h>
#include "wmops.h"
#ifdef AGC_TUNING_IMPROVEMENT
#include "prot.h"
#endif

/*------------------------------------------------------------------------------------------*
 * Local constants
@@ -50,11 +48,9 @@

#define SQRKMAX      ( 1.5f )
#define NBITS_DIFFG  ( 2 )
#ifdef AGC_TUNING_IMPROVEMENT
#define DBSTEP       ( -6.f ) /* desired dB step value in dB*/
#define ABS_EMIN_MAX ( 3 )
#define MAXATTEXP    ( 1 ) /* the desired maximum attenuation exponent range per frame*/
#endif

/*-----------------------------------------------------------------------------------------*
 * Function ivas_agc_initWindowFunc()
@@ -68,22 +64,14 @@ void ivas_agc_initWindowFunc(
{
    int16_t i;
    float N;
#ifdef AGC_TUNING_IMPROVEMENT
    float a;
#endif

    N = (float) ( length - 1 );
#ifdef AGC_TUNING_IMPROVEMENT
    a = 0.5f * ( 1.f - powf( 10.f, DBSTEP / 20.f ) );
#endif

    for ( i = 0; i < length; i++ )
    {
#ifdef AGC_TUNING_IMPROVEMENT
        pWinFunc[i] = 1.f + a * ( cosf( EVS_PI * i / N ) - 1.f );
#else
        pWinFunc[i] = 0.75f + 0.25f * cosf( EVS_PI * i / N );
#endif
    }

    return;
@@ -107,11 +95,7 @@ void ivas_agc_calcGainParams(

    nbits = NBITS_DIFFG;

#ifdef AGC_TUNING_IMPROVEMENT
    *absEmin = max( ABS_EMIN_MAX, (uint16_t) ceilf( logf( ceilf( SQRKMAX * numCoeffs ) ) * INV_LOG_2 ) );
#else
    *absEmin = (uint16_t) ceilf( logf( ceilf( SQRKMAX * numCoeffs ) ) * INV_LOG_2 );
#endif

    totExp = *absEmin + AGC_EMAX + 1;
    *betaE = (uint16_t) ceilf( logf( totExp ) * INV_LOG_2 );
@@ -120,17 +104,11 @@ void ivas_agc_calcGainParams(

    if ( nbits > 0 )
    {
#ifdef AGC_TUNING_IMPROVEMENT
        Bm = min( AGC_BITS_PER_CH - 1, NBITS_DIFFG );
#else
        Bm = NBITS_DIFFG;
#endif
    }

    *maxAttExp = ( (uint16_t) powf( 2, Bm ) ) - 2;
#ifdef AGC_TUNING_IMPROVEMENT
    *maxAttExp = min( MAXATTEXP, *maxAttExp );
#endif

    return;
}
+0 −2
Original line number Diff line number Diff line
@@ -841,9 +841,7 @@ typedef enum {
#define SBA_MIN_BRATE_HOA                       IVAS_256k
#define SBA_NHARM_HOA3                          16
#define SBA_T_DESIGN_11_SIZE                    70
#ifdef FIX_SBA_DTX_DECODE_ERROR
#define SBA_DTX_BITRATE_THRESHOLD               IVAS_80k
#endif

typedef enum 
{
+0 −2
Original line number Diff line number Diff line
@@ -3767,7 +3767,6 @@ void ivas_sba_prototype_renderer(
);

/* AGC */
#ifdef AGC_ENABLE_FOR_LBR
/*! r: AGC enable flag */
int16_t ivas_agc_enc_get_flag(
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
@@ -3775,7 +3774,6 @@ int16_t ivas_agc_enc_get_flag(
#endif
    int16_t nchan_transport                                     /* i  : number of transport channels            */
);
#endif

ivas_error ivas_spar_agc_enc_open( 
    ivas_agc_enc_state_t **hAgcEnc,                             /* i/o: AGC decoder handle                      */
+0 −10
Original line number Diff line number Diff line
@@ -145,22 +145,12 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define FIX_I1_113                                      /* under review : MCT bit distribution optimization for SBA high bitrates*/
#define PRINT_SBA_ORDER                                 /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */
#define SPAR_STEREO_NO_DIRAC                            /* Issue 180: skip DirAC processing channels for stereo output */
#define AGC_TUNING_IMPROVEMENT                          /* Issue 168: Enable AGC for low bit rate (1 TC) */
#ifdef AGC_TUNING_IMPROVEMENT
#define AGC_ENABLE_FOR_LBR                              /* Issue 168: Enable AGC for low bit rate (1 TC) */
#endif
#define FIX_I173_I174                                   /* Issues 173 and 174: Remove frame and subframe index from ISm metadata and headtracking respectively. */
#define FIX_TCX_DEC_RECONF_BFI
#define FIX_SBA_DTX_DECODE_ERROR                        /* Issue 176: SBA decoder error with DTX at 80kbps SWB, Issue 21: SBA front-VAD threshold (203) */
#define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS              /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */
#define FIX_MCT_PLC_RECOVERY                            /* Issue 184: scale the old synthesis part correctly in the first good frame after lost frames in MCT modes - to be activated after previous switch is merged */
#define FIX_MSAN_ERROR_STEREO_RATE_SWITCHING            /* addresses Issue 177 */
#define SBA_BR_SWITCHING                                /* Issue 114: Changes for sba bit rate switching*/
#define FIX_AGC_WINFUNC_MEMORY                          /* Issue 62: lower agc_com.winFunc memory consumption */



/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
Loading