Commit a6d6cf44 authored by norvell's avatar norvell
Browse files

Merge with main

parents 87fac8a6 f06bf0be
Loading
Loading
Loading
Loading
Loading
+0 −41
Original line number Diff line number Diff line
@@ -104,9 +104,6 @@ typedef struct
    char *renderConfigFilename;

#ifdef DEBUGGING
#ifndef REMOVE_FORCE_SUBFRAME_BIN
    bool forceSubframeBinauralization;
#endif
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
#ifdef DEBUG_FOA_AGC
    FILE *agcBitstream; /* temporary */
@@ -222,7 +219,6 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifdef FIX_351_HRTF_COMMAND
        /* sanity check */
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
        {
@@ -230,13 +226,10 @@ int main(
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_351_HRTF_COMMAND
            arg.hrtfReaderEnabled = false;
#endif
            fprintf( stderr, "\nError: Can't open HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
@@ -248,14 +241,12 @@ int main(

    if ( arg.enableHeadRotation )
    {
#ifdef FIX_351_HRTF_COMMAND
        /* sanity check */
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
        {
            fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = HeadRotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK )
        {
@@ -283,14 +274,12 @@ int main(

    if ( arg.renderConfigEnabled )
    {
#ifdef FIX_351_HRTF_COMMAND
        /* sanity check */
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
        {
@@ -303,23 +292,7 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

#ifdef REMOVE_FORCE_SUBFRAME_BIN
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#else
#ifdef DEBUGGING
#ifdef FIX_351_HRTF_COMMAND
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef FIX_351_HRTF_COMMAND
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK )
#endif
#endif
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -718,9 +691,6 @@ static bool parseCmdlIVAS_dec(
    float ftmp;

    arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED;
#ifndef REMOVE_FORCE_SUBFRAME_BIN
    arg->forceSubframeBinauralization = false;
#endif
#ifdef DEBUG_FOA_AGC
    arg->agcBitstream = NULL;
#endif
@@ -872,13 +842,6 @@ static bool parseCmdlIVAS_dec(
                i++;
            }
        }
#ifndef REMOVE_FORCE_SUBFRAME_BIN
        else if ( strcmp( argv_to_upper, "-FORCE_SUBFRAME_BIN" ) == 0 ) /* Force binauralization to subframe (5 ms) resolution */
        {
            arg->forceSubframeBinauralization = true;
            i++;
        }
#endif
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
        /*-----------------------------------------------------------------*
@@ -1128,10 +1091,6 @@ static void usage_dec( void )
    fprintf( stdout, "-T File             : Head rotation specified by external trajectory File\n" );
    fprintf( stdout, "-hrtf File          : HRTF filter File used in BINAURAL output configuration\n" );
#ifdef DEBUGGING
#ifndef REMOVE_FORCE_SUBFRAME_BIN
    fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" );
    fprintf( stdout, "                      output time resolution is larger.\n" );
#endif
    fprintf( stdout, "-FEC X              : Insert frame erasures, X = 0-10 is the percentage\n" );
    fprintf( stdout, "                      of erased frames, or X may be the name of binary file or \n" );
    fprintf( stdout, "                      file with G192 headers indicating GOOD FRAME or BAD FRAME\n" );
+0 −24
Original line number Diff line number Diff line
@@ -216,23 +216,6 @@ int main(
        goto cleanup;
    }

#ifndef FIX_94_VERIFY_WAV_NUM_CHANNELS
    /*------------------------------------------------------------------------------------------*
     * Open input audio file
     *------------------------------------------------------------------------------------------*/
    int32_t inFileSampleRate = 0;
    if ( AudioFileReader_open( &audioReader, arg.inputWavFilename, &inFileSampleRate ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nCan't open %s\n\n", arg.inputWavFilename );
        goto cleanup;
    }
    if ( inFileSampleRate != 0 && /* inFileSampleRate will remain zero if input file is raw PCM */
         inFileSampleRate != arg.inputFs )
    {
        fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", arg.inputFs, inFileSampleRate, arg.inputWavFilename );
        goto cleanup;
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Open output bitstream file
@@ -459,7 +442,6 @@ int main(
        goto cleanup;
    }

#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS
    /*------------------------------------------------------------------------------------------*
     * Open input audio file
     *------------------------------------------------------------------------------------------*/
@@ -518,7 +500,6 @@ int main(
            fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Open input metadata files
@@ -1657,7 +1638,6 @@ static void usage_enc( void )
    fprintf( stdout, "                                                *VBR mode (average bitrate),\n" );
    fprintf( stdout, "                      for AMR-WB IO modes R =  (6600, 8850, 12650, 14250, 15850, 18250,\n" );
    fprintf( stdout, "                                                19850, 23050, 23850) \n" );
#ifdef ISM_HIGHEST_BITRATE
    fprintf( stdout, "                      for IVAS stereo R =      (13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" );
    fprintf( stdout, "                                                96000, 128000, 160000, 192000, 256000) \n" );
    fprintf( stdout, "                      for IVAS ISM R =          13200 for 1 ISM, 16400 for 1 ISM and 2 ISM, \n" );
@@ -1665,10 +1645,6 @@ static void usage_enc( void )
    fprintf( stdout, "                                                for 2 ISM, 3 ISM and 4 ISM also 160000, 192000, 256000) \n" );
    fprintf( stdout, "                                                for 3 ISM and 4 ISM also 384000 \n" );
    fprintf( stdout, "                                                for 4 ISM also 512000 \n" );
#else
    fprintf( stdout, "                      for IVAS stereo & ISm R =(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" );
    fprintf( stdout, "                                                96000, 128000, 160000, 192000, 256000) \n" );
#endif
    fprintf( stdout, "                      for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" );
    fprintf( stdout, "                                                96000, 128000, 160000, 192000, 256000, 384000, 512000) \n" );
    fprintf( stdout, "                      Alternatively, R can be a bitrate switching file which consists of R values\n" );
+0 −28
Original line number Diff line number Diff line
@@ -568,7 +568,6 @@ int main(
        setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders );
    }

#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS
    if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error opening file: %s\n", audioFilePath );
@@ -612,28 +611,6 @@ int main(
        fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
    }
#else
    int32_t inFileSampleRate = 0;
    if ( AudioFileReader_open( &audioReader, audioFilePath, &inFileSampleRate ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error opening file: %s\n", audioFilePath );
        exit( -1 );
    }
    if ( args.sampleRate == 0 && inFileSampleRate == 0 )
    {
        fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" );
        exit( -1 );
    }
    if ( args.sampleRate != 0 && inFileSampleRate != 0 && args.sampleRate != inFileSampleRate )
    {
        fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath );
        exit( -1 );
    }
    if ( args.sampleRate == 0 )
    {
        args.sampleRate = inFileSampleRate;
    }
#endif
    const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 );

    IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 };
@@ -813,12 +790,7 @@ int main(

    const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds );

#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS
    if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels )
#else
    if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */
         && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) )
#endif
    {
        fprintf( stderr, "Number of channels in input file does not match selected configuration\n" );
        exit( -1 );
+0 −8
Original line number Diff line number Diff line
@@ -341,11 +341,9 @@ typedef enum
#define PARAM_ISM_MAX_CHAN                      16
#define PARAM_ISM_HYS_BUF_SIZE                  10

#ifdef PARAM_ISM_DTX_CNG
#define PARAM_ISM_DTX_COH_SCA_BITS              4
#define PARAM_ISM_DTX_AZI_BITS                  5 
#define PARAM_ISM_DTX_ELE_BITS                  4
#endif

typedef enum 
{
@@ -366,18 +364,12 @@ enum
    IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
#endif
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
#ifdef PARAM_ISM_DTX_CNG
    IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG,
    IND_ISM_DTX_COH_SCA,
#endif

    /* ------------- loop for objects -------------- */
#ifdef PARAM_ISM_DTX_CNG
    TAG_ISM_LOOP_START = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS,
#else
    TAG_ISM_LOOP_START = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
    #endif
    IND_ISM_AZIMUTH_DIFF_FLAG = TAG_ISM_LOOP_START,
    IND_ISM_AZIMUTH = TAG_ISM_LOOP_START,
    IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START,
+5 −44
Original line number Diff line number Diff line
@@ -39,9 +39,7 @@
#include "wmc_auto.h"
#include "prot.h"

#ifdef SMOOTH_WITH_TRANS_DET
#define BAND_SMOOTH_REST_START_IDX ( 2 )
#endif
/*-----------------------------------------------------------------------------------------*
 * Function ivas_set_up_cov_smoothing()
 *
@@ -52,19 +50,14 @@ static void ivas_set_up_cov_smoothing(
    ivas_cov_smooth_state_t *hCovState,
    ivas_filterbank_t *pFb,
    const float max_update_rate,
    const int16_t min_pool_size
#ifdef COV_SMOOTH_TUNING
    ,
    const int16_t min_pool_size,
    const int16_t nchan_inp /* i  : number of input channels       */
#endif
)
{
    int16_t j, k;

#ifdef COV_SMOOTH_TUNING
    if ( nchan_inp <= FOA_CHANNELS )
    {
#endif
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float update_factor;
@@ -82,8 +75,6 @@ static void ivas_set_up_cov_smoothing(
                hCovState->pSmoothing_factor[j] = max_update_rate;
            }
        }

#ifdef COV_SMOOTH_TUNING
    }
    else
    {
@@ -107,7 +98,6 @@ static void ivas_set_up_cov_smoothing(
            }
        }
    }
#endif
    hCovState->prior_bank_idx = -1;

    return;
@@ -152,12 +142,8 @@ ivas_error ivas_spar_covar_smooth_enc_open(
        }
    }

    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size
#ifdef COV_SMOOTH_TUNING
                               ,
                               nchan_inp
#endif
    );
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size,
                               nchan_inp );

    *hCovState_out = hCovState;

@@ -218,25 +204,17 @@ static void ivas_compute_smooth_cov(
    const int16_t start_band,
    const int16_t end_band,
    const int16_t num_ch,
#ifdef SMOOTH_WITH_TRANS_DET
    const int16_t transient_det[2]
#else
    const int16_t transient_det
#endif
)
    const int16_t transient_det[2] )
{
    int16_t i, j, k;
    int16_t prev_idx = hCovState->prior_bank_idx;
    float factor = 0;
#ifdef SMOOTH_WITH_TRANS_DET
    int16_t sm_b;
    int16_t non_sm_b_idx;
    sm_b = BAND_SMOOTH_REST_START_IDX;
#endif

    assert( end_band <= pFb->filterbank_num_bands );

#ifdef SMOOTH_WITH_TRANS_DET
    if ( prev_idx == -1 || transient_det[1] == 1 )
    {
        for ( i = 0; i < num_ch; i++ )
@@ -277,18 +255,6 @@ static void ivas_compute_smooth_cov(
            }
        }
    }
#else
    if ( prev_idx == -1 || transient_det == 1 )
    {
        for ( i = 0; i < num_ch; i++ )
        {
            for ( k = start_band; k < end_band; k++ )
            {
                pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac );
            }
        }
    }
#endif
    else if ( prev_idx == 0 )
    {
        for ( i = 0; i < num_ch; i++ )
@@ -329,12 +295,7 @@ void ivas_cov_smooth_process(
    const int16_t start_band,
    const int16_t end_band,
    const int16_t num_ch,
#ifdef SMOOTH_WITH_TRANS_DET
    const int16_t transient_det[2]
#else
    const int16_t transient_det
#endif
)
    const int16_t transient_det[2] )
{
    int16_t i, j;
    int16_t num_bands = end_band - start_band;
Loading