Commit 408738a1 authored by Vidhya V P's avatar Vidhya V P
Browse files

Merge branch 'main' into arithmetic_huffman_coder_changes

parents 65c1d78b a2bcdd0a
Loading
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -226,10 +226,18 @@ int main(
     * Open decoder handle
     *------------------------------------------------------------------------------------------*/

#ifdef FIX_439_OTR_PARAMS
#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.no_diegetic_pan ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.no_diegetic_pan ) ) != IVAS_ERR_OK )
#endif
#endif
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -395,10 +403,18 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

#ifdef FIX_439_OTR_PARAMS
#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#endif
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+42 −2
Original line number Diff line number Diff line
@@ -135,7 +135,11 @@ typedef struct
    char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef FIX_439_OTR_PARAMS
    int8_t orientation_tracking;
#else
    int8_t orientationTracking;
#endif
#ifdef NON_DIEGETIC_PAN
    int16_t nonDiegeticPan;
    float nonDiegeticPanGain;
@@ -732,7 +736,11 @@ int main(
        }
    }

#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
@@ -1424,30 +1432,54 @@ static bool parseDiegeticPan(

static bool parseOrientationTracking(
    char *value,
    int8_t *tracking_type )
#ifdef FIX_439_OTR_PARAMS
    int8_t *orientation_tracking
#else
    int8_t *tracking_type
#endif
)
{

    to_upper( value );

    if ( strcmp( value, "NONE" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_NONE;
#else
        *tracking_type = IVAS_ORIENT_TRK_NONE;
#endif
    }
    else if ( strcmp( value, "REF" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF;
#endif
    }
    else if ( strcmp( value, "AVG" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_AVG;
#else
        *tracking_type = IVAS_ORIENT_TRK_AVG;
#endif
    }
    else if ( strcmp( value, "REF_VEC" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF_VEC;
#endif
    }
    else if ( strcmp( value, "REF_VEC_LEV" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC_LEV;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV;
#endif
    }
    else
    {
@@ -1671,7 +1703,11 @@ static CmdlnArgs defaultArgs(
    clearString( args.customHrtfFilePath );
    clearString( args.renderConfigFilePath );

#ifdef FIX_439_OTR_PARAMS
    args.orientation_tracking = HEAD_ORIENT_TRK_NONE;
#else
    args.orientationTracking = IVAS_ORIENT_TRK_NONE;
#endif
#ifdef NON_DIEGETIC_PAN
    args.nonDiegeticPan = 0;
    args.nonDiegeticPanGain = 0.f;
@@ -1784,7 +1820,11 @@ static void parseOption(
            break;
        case CmdLnOptionId_orientationTracking:
            assert( numOptionValues == 1 );
#ifdef FIX_439_OTR_PARAMS
            if ( !parseOrientationTracking( optionValues[0], &args->orientation_tracking ) )
#else
            if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) )
#endif
            {
                fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] );
                exit( -1 );
+10 −0
Original line number Diff line number Diff line
@@ -96,6 +96,16 @@ typedef struct
    float x, y, z;
} IVAS_VECTOR3;

#ifdef FIX_439_OTR_PARAMS
typedef enum
{
    HEAD_ORIENT_TRK_NONE,
    HEAD_ORIENT_TRK_REF,
    HEAD_ORIENT_TRK_AVG,
    HEAD_ORIENT_TRK_REF_VEC,
    HEAD_ORIENT_TRK_REF_VEC_LEV
} HEAD_ORIENT_TRK_T;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE;
+10 −7
Original line number Diff line number Diff line
@@ -885,6 +885,9 @@ enum fea_names
#define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG       0.001f
#define MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME      2 * FRAMES_PER_SEC
#define MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN         20
#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY
#define MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE    3
#endif

typedef enum {
    EQUAL_CORES,
@@ -1026,7 +1029,7 @@ typedef enum

#define SPAR_CONFIG_BW                          FB

#ifndef SPAR_TUNING
#ifndef HODIRAC
#define IVAS_SPAR_MAX_CH                        (FOA_CHANNELS + 2 * ( IVAS_MAX_SBA_ORDER - 1 )) /* FOA + planar HOA */
#else
#define IVAS_SPAR_MAX_CH                        ((( IVAS_MAX_SBA_ORDER ) * ( IVAS_MAX_SBA_ORDER )) + 2) /* HOA2 + pHOA3*/
@@ -1037,7 +1040,6 @@ typedef enum
#define IVAS_SPAR_MAX_FB_IN_CHAN                11
#endif


#define IVAS_SPAR_P_LOWERTRI                    ((IVAS_SPAR_MAX_CH - 1) * (IVAS_SPAR_MAX_CH - 2)) >> 1
#define IVAS_SPAR_MAX_C_COEFF                   (IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS) * ( IVAS_SPAR_MAX_DMX_CHS - 1)

@@ -1644,6 +1646,7 @@ typedef enum
} SFX_OpMode_t;


#ifndef FIX_439_OTR_PARAMS
/*----------------------------------------------------------------------------------*
 * Orientation tracking constants
 *----------------------------------------------------------------------------------*/
@@ -1664,7 +1667,7 @@ typedef enum
    OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */
    OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV  /* track orientation relative to level component of external reference vector */
} OTR_TRACKING_T;

#endif

/*----------------------------------------------------------------------------------*
 * Reverberator constants
+67 −32
Original line number Diff line number Diff line
@@ -48,6 +48,32 @@

static uint16_t deindex_sph_idx_general( const int16_t idx_sph, const int16_t no_bits, float *theta_dec, float *phi_dec, uint16_t *p_id_phi, const MC_LS_SETUP mc_format );


#ifdef HODIRAC
/*-------------------------------------------------------------------------
 * ivas_get_hodirac_flag()
 *
 * Return flag for HO-DirAC method at high bitrates
 *------------------------------------------------------------------------*/

/*! r: HO-DirAC flag */
int16_t ivas_get_hodirac_flag(
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate      */
    const int16_t sba_order         /* i  : Ambisonic (SBA) order   */
)
{
    if ( sba_order > 1 && ivas_total_brate > IVAS_256k )
    {
        return 1;
    }
    else
    {
        return 0;
    }
}
#endif


/*-------------------------------------------------------------------------
 * ivas_dirac_sba_config()
 *
@@ -132,8 +158,9 @@ ivas_error ivas_dirac_config(
        hConfig->nbands = IVAS_MAX_NUM_BANDS;

        spar_dirac_split_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND );

#ifdef HODIRAC
        if ( sba_order > 1 && ivas_total_brate > IVAS_256k )
        if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) )
        {
            spar_dirac_split_band = 0;
        }
@@ -173,8 +200,9 @@ ivas_error ivas_dirac_config(
            {
                hConfig->enc_param_start_band = spar_dirac_split_band;
            }

#ifdef HODIRAC
            if ( sba_order > 1 && ivas_total_brate > IVAS_256k )
            if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) )
            {
                hConfig->dec_param_estim = FALSE;
                hConfig->enc_param_start_band = 0;
@@ -195,15 +223,11 @@ ivas_error ivas_dirac_config(

    if ( sba_mode == SBA_MODE_SPAR )
    {
        ivas_dirac_config_bands( band_grouping,
                                 IVAS_MAX_NUM_BANDS,
                                 (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                 dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft );
        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft );
    }
    else
    {
        ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                 NULL, 0, 0, hFbMdft );
        ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft );
    }

    return error;
@@ -399,10 +423,16 @@ ivas_error ivas_dirac_sba_config(
    int16_t i;
    int16_t nbands_wb;
    int16_t nbands_coded;
#ifdef HODIRAC
    int16_t hodirac_flag;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
    hQMetaData->is_masa_ivas_format = 0;
#ifdef HODIRAC
    hodirac_flag = ivas_get_hodirac_flag( sba_total_brate, sba_order );
#endif

    if ( sba_mode == SBA_MODE_SPAR )
    {
@@ -440,7 +470,7 @@ ivas_error ivas_dirac_sba_config(
        {
            hQMetaData->useLowerBandRes = 0;
#ifdef HODIRAC
            if ( !( sba_order > 1 && sba_total_brate > IVAS_256k ) )
            if ( hodirac_flag == 0 )
#endif
            {
                nbands_coded = nbands - 1; /* always combine the last two bands */
@@ -450,7 +480,7 @@ ivas_error ivas_dirac_sba_config(
        {
            int16_t no_dirs = 1;
#ifdef HODIRAC
            if ( sba_order > 1 && sba_total_brate > IVAS_256k )
            if ( hodirac_flag )
            {
                no_dirs = 2;
            }
@@ -460,8 +490,7 @@ ivas_error ivas_dirac_sba_config(
            {
                return error;
            }
#if defined( HODIRAC_FIX_BR_SWITCHING_DTX ) && !defined( FIX_DTX_428 )
            if ( sba_order > 1 && sba_total_brate > IVAS_256k )
#if defined( HODIRAC ) && !defined( FIX_DTX_428 )
            {
                int16_t dir, j;
                for ( dir = 0; dir < hQMetaData->no_directions; dir++ )
@@ -580,7 +609,7 @@ ivas_error ivas_dirac_sba_config(
            {
                int16_t no_dirs = 1;
#ifdef HODIRAC
                if ( sba_order > 1 && sba_total_brate > IVAS_256k )
                if ( hodirac_flag )
                {
                    no_dirs = 2;
                }
@@ -617,8 +646,9 @@ ivas_error ivas_dirac_sba_config(
            for ( i = 0; i < hQMetaData->no_directions; i++ )
            {
                hQMetaData->q_direction[i].cfg.search_effort = 1;

#ifdef HODIRAC
                if ( sba_order > 1 && sba_total_brate > IVAS_256k )
                if ( hodirac_flag )
                {
                    hQMetaData->q_direction[i].cfg.start_band = 0;
                }
@@ -929,7 +959,14 @@ void deindex_spherical_component(
    return;
}


#ifdef HODIRAC
/*----------------------------------------------------------------
 * calculate_hodirac_sector_parameters()
 *
 *
 *-----------------------------------------------------------------*/

void calculate_hodirac_sector_parameters(
    float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : signal vector (L+1)^2 x N_bins, real part  */
    float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : signal vector, imaginary part              */
@@ -1132,14 +1169,12 @@ void calculate_hodirac_sector_parameters(
                *p_azi_prev = *p_azi;
                *p_ele_prev = *p_ele;
            }
#ifdef HODIRAC_CHECK_VALUE_RANGE
            assert( *p_azi >= -180.f && *p_azi <= 180.f );
            assert( *p_ele >= -90.f && *p_ele <= 90.f );
#endif
        } // i_band
    }     // i_sec
        }
    }

    firstrun_sector_params = 0;

    return;
}
#endif

Loading