Commit 67e28dc3 authored by multrus's avatar multrus
Browse files

Merge branch '20230221_cleanup' into 'main'

20230221 cleanup

See merge request !452
parents 5c280909 90cdc212
Loading
Loading
Loading
Loading
Loading
+0 −69
Original line number Diff line number Diff line
@@ -535,11 +535,9 @@ cleanup:
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
#ifdef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
#endif
    }
    IVAS_DEC_Close( &hIvasDec );
    CustomLsReader_close( &hLsCustomReader );
@@ -588,9 +586,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config(
    char argv_to_upper[FILENAME_MAX];

    strncpy( argv_to_upper, argv, sizeof( argv_to_upper ) - 1 );
#ifdef FIX_343_TO_UPPER
    argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#endif
    to_upper( argv_to_upper );

    if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */
@@ -669,9 +665,6 @@ static bool parseCmdlIVAS_dec(
    char argv_to_upper[FILENAME_MAX];
#ifdef DEBUGGING
    float ftmp;
#ifndef FIX_343_TO_UPPER
    char stmp[FILENAME_MAX];
#endif

    arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED;
    arg->forceSubframeBinauralization = false;
@@ -733,9 +726,7 @@ static bool parseCmdlIVAS_dec(
    while ( argv[i][0] == '-' )
    {
        strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
#ifdef FIX_343_TO_UPPER
        argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#endif
        to_upper( argv_to_upper );

        if ( strcmp( argv_to_upper, "-VOIP" ) == 0 )
@@ -743,21 +734,13 @@ static bool parseCmdlIVAS_dec(
            arg->voipMode = 1;
            i++;
        }
#ifdef FIX_343_TO_UPPER
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 )
#else
        else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=0" ) == 0 )
#endif
        {
            arg->voipMode = 1;
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP;
            i++;
        }
#ifdef FIX_343_TO_UPPER
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 )
#else
        else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=1" ) == 0 )
#endif
        {
            arg->voipMode = 1;
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF;
@@ -830,14 +813,9 @@ static bool parseCmdlIVAS_dec(
            i++;
            if ( i < argc - 3 )
            {
#ifdef FIX_343_TO_UPPER
                strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
                argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
                arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper );
#else
                strncpy( stmp, argv[i], sizeof( stmp ) );
                arg->forcedRendMode = parseForcedRendModeDec( stmp );
#endif
                i++;
            }
        }
@@ -890,7 +868,6 @@ static bool parseCmdlIVAS_dec(
                return false;
            }

#ifdef FIX_343_TO_UPPER
            strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            to_upper( argv_to_upper );
@@ -909,25 +886,6 @@ static bool parseCmdlIVAS_dec(
                usage_dec();
                return false;
            }
#else
            char tmp[4];
            strcpy( tmp, argv[i + 1] );

            if ( strcmp( to_upper( tmp ), "REF" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF;
            }
            else if ( strcmp( to_upper( tmp ), "AVG" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG;
            }
            else
            {
                fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", tmp );
                usage_dec();
                return false;
            }
#endif
            i += 2;
        }
        else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 )
@@ -954,7 +912,6 @@ static bool parseCmdlIVAS_dec(
                return false;
            }

#ifdef FIX_343_TO_UPPER
            strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) )
@@ -980,32 +937,6 @@ static bool parseCmdlIVAS_dec(
                    return false;
                }
            }
#else
            char *param = to_upper( argv[i] );
            if ( ( strcmp( param, "CENTER" ) == 0 ) || ( strchr( param, 'C' ) != NULL ) )
            {
                arg->no_diegetic_pan = 0.f;
            }
            else if ( ( strcmp( param, "LEFT" ) == 0 ) || ( strchr( param, 'L' ) != NULL ) )
            {
                arg->no_diegetic_pan = -1.f;
            }
            else if ( ( strcmp( param, "RIGHT" ) == 0 ) || ( strchr( param, 'R' ) != NULL ) )
            {
                arg->no_diegetic_pan = 1.f;
            }
            else
            {
                arg->no_diegetic_pan = (float) atof( param );

                if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f )
                {
                    fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" );
                    usage_dec();
                    return false;
                }
            }
#endif
            i++;
        }

+0 −26
Original line number Diff line number Diff line
@@ -884,9 +884,7 @@ static bool parseCmdlIVAS_enc(
    while ( i < argc - 4 )
    {
        strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
#ifdef FIX_343_TO_UPPER
        argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#endif
        to_upper( argv_to_upper );

        /*-----------------------------------------------------------------*
@@ -898,9 +896,7 @@ static bool parseCmdlIVAS_enc(
            arg->max_bwidth_user = true;

            strncpy( stmp, argv[i + 1], sizeof( stmp ) - 1 );
#ifdef FIX_343_TO_UPPER
            stmp[sizeof( stmp ) - 1] = '\0';
#endif
            to_upper( stmp );

            if ( strcmp( stmp, "-NB" ) == 0 || strcmp( stmp, "NB" ) == 0 )
@@ -1088,9 +1084,7 @@ static bool parseCmdlIVAS_enc(
            if ( i < argc - 4 )
            {
                strncpy( stmp, argv[i], sizeof( stmp ) );
#ifdef FIX_343_TO_UPPER
                stmp[sizeof( stmp ) - 1] = '\0';
#endif
                to_upper( argv[i] );
                if ( strcmp( argv[i], "LO" ) == 0 )
                {
@@ -1378,7 +1372,6 @@ static bool parseCmdlIVAS_enc(

            if ( i < argc - 4 )
            {
#ifdef FIX_343_TO_UPPER
                if ( strcmp( argv[i], "5_1" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1;
@@ -1396,25 +1389,6 @@ static bool parseCmdlIVAS_enc(
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4;
                }
                else if ( strcmp( argv[i], "7_1_4" ) == 0 )
#else
                if ( strcmp( to_upper( argv[i] ), "5_1" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1;
                }
                else if ( strcmp( to_upper( argv[i] ), "7_1" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1;
                }
                else if ( strcmp( to_upper( argv[i] ), "5_1_2" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_2;
                }
                else if ( strcmp( to_upper( argv[i] ), "5_1_4" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4;
                }
                else if ( strcmp( to_upper( argv[i] ), "7_1_4" ) == 0 )
#endif
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1_4;
                }
+0 −6
Original line number Diff line number Diff line
@@ -460,9 +460,7 @@ static void setupWithSingleFormatInput(
            /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */
            char charBuf[FILENAME_MAX];
            strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 );
#ifdef FIX_343_TO_UPPER
            charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0';
#endif
            to_upper( charBuf );
            if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 )
            {
@@ -1083,9 +1081,7 @@ static bool parseInConfig(

    /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */
    strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 );
#ifdef FIX_343_TO_UPPER
    charBuf[sizeof( charBuf ) - 1] = '\0';
#endif
    to_upper( charBuf );
    if ( strcmp( charBuf, "META" ) == 0 )
    {
@@ -1271,9 +1267,7 @@ static IVAS_REND_AudioConfig parseAudioConfig(
    charBuf[13] = '\0';

    strncpy( charBuf, configString, sizeof( charBuf ) - 1 );
#ifdef FIX_343_TO_UPPER
    charBuf[sizeof( charBuf ) - 1] = '\0';
#endif
    to_upper( charBuf );

    if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) )
+0 −6
Original line number Diff line number Diff line
@@ -585,11 +585,7 @@ typedef enum

#define STEREO_DFT_RES_BW_MAX                   66                          /*Maximum number of bin for residual signal in each frame (res_cod_band_max == 6 in 48kHz)*/

#ifdef DFT_STEREO_SPAR_MIXING
#define SBA_DIRAC_STEREO_NUM_BANDS              12
#else
#define SBA_DIRAC_STEREO_NUM_BANDS              5
#endif

#define SBA_DIRAC_NRG_SMOOTH_LONG               10
#define SBA_DIRAC_NRG_SMOOTH_SHORT              3
@@ -942,10 +938,8 @@ typedef enum
{
    DIRAC_OPEN,                                 /* initialize to default value              */
    DIRAC_RECONFIGURE                           /* HOA3                                     */
#ifdef SBA_BR_SWITCHING
    ,
    DIRAC_RECONFIGURE_MODE
#endif
} DIRAC_CONFIG_FLAG;


+0 −35
Original line number Diff line number Diff line
@@ -105,30 +105,12 @@ ivas_error mct_enc_reconfigure(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    const uint16_t b_nchan_change                               /* i  : flag indicating different channel count */
);
#ifndef SBA_BR_SWITCHING_RECONFIG
#ifdef SBA_BR_SWITCHING
ivas_error ivas_sba_enc_reinit(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder structure      */
);
#endif
#endif
#ifndef SBA_BR_SWITCHING_RECONFIG
#ifdef SBA_BR_SWITCHING
int16_t get_sba_reinit_flag(
    int32_t ivas_total_bitrate,                                /* i  : Current bitrate  */
    int32_t last_ivas_total_brate                              /* i  : Previous bitrate  */
    , int16_t sba_order
);
#endif
#endif
#ifdef SBA_BR_SWITCHING
ivas_error ivas_spar_md_enc_init
(
    ivas_spar_md_enc_state_t *hMdEnc,                         /* o  : MD encoder handle        */
    const ENCODER_CONFIG_HANDLE hEncoderConfig,               /* i  : configuration structure  */
    const int16_t sba_order                                   /* i  : Ambisonic (SBA) order    */
);
#endif
ivas_error ivas_sba_enc_reconfigure( 
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);
@@ -1089,10 +1071,8 @@ ivas_error stereo_dft_dec_create(
    const int32_t element_brate,                                /* i  : element bitrate                     */
    const int32_t output_Fs,                                    /* i  : output sampling rate                */
    const int16_t sba_dirac_stereo_flag                         /* i  : signal stereo output for SBA DirAC  */
#ifdef DFT_STEREO_SPAR_MIXING
    ,
    const int16_t nchan_transport
#endif
);

void stereo_dft_dec_reset(
@@ -1136,13 +1116,11 @@ void stereo_dft_dec(
    float *input_mem,                                           /* i/o: mem of buffer DFT analysis          */
    STEREO_CNG_DEC_HANDLE hStereoCng,                           /* i/o: Stereo CNG data structure           */
    const int16_t sba_dirac_stereo_flag                         /* i  : signal stereo output for SBA DirAC  */
#ifdef DFT_STEREO_SPAR_MIXING
    ,
    ivas_spar_md_dec_state_t *hMdDec,                          /* SPAR MD handle for upmixing */
    int16_t cross_fade_start_offset,                           /* i: SPAR mixer delay compensation */
    int32_t output_Fs,                                          /* i: Fs for delay calculation */
    int16_t nchan_transport            /* i: number of transpor channels */
#endif
);

void stereo_dft_res_ecu(
@@ -3161,13 +3139,6 @@ void ivas_sba_config(
ivas_error ivas_sba_dec_reconfigure(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#ifndef SBA_BR_SWITCHING_RECONFIG
#ifdef SBA_BR_SWITCHING
ivas_error ivas_sba_dec_reinit(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif
#endif

void ivas_init_dec_get_num_cldfb_instances(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                  */
@@ -3233,10 +3204,8 @@ void ivas_sba_dirac_stereo_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float output[CPE_CHANNELS][L_FRAME48k],                     /* o  : output synthesis signal                 */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
#ifdef DFT_STEREO_SPAR_MIXING
    ,
    const int16_t mcmasa
#endif
);

void ivas_sba_dirac_stereo_config(
@@ -3245,12 +3214,10 @@ void ivas_sba_dirac_stereo_config(

void ivas_sba_dirac_stereo_smooth_parameters(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft                       /* i/o: encoder DFT stereo handle               */
#ifdef DFT_STEREO_SPAR_MIXING
    ,
    ivas_spar_md_dec_state_t *hMdDec,                           /* i/o: SPAR MD handle for upmixing */
    int16_t cross_fade_start_offset,                            /* i: SPAR mixer delay compensation */
    int32_t output_Fs                                           /* i: Fs for delay calculation */
#endif
);

void ivas_sba2mc_cldfb(
@@ -4065,9 +4032,7 @@ ivas_error ivas_spar_md_dec_open(
    const DECODER_CONFIG_HANDLE hDecoderConfig,                 /* i  : configuration structure                 */
    const int16_t num_channels,                                 /* i  : number of internal channels             */
	const int16_t sba_order                                     /* i  : SBA order                               */
#ifdef SBA_BR_SWITCHING_RECONFIG
    ,const int16_t sid_format
#endif
);

void ivas_spar_md_dec_close(
Loading