Commit 88f1eb3c authored by vaclav's avatar vaclav
Browse files

acceptance of switches, step 2

parent 60093d3e
Loading
Loading
Loading
Loading
+0 −76
Original line number Diff line number Diff line
@@ -45,9 +45,7 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#include "split_render_file_read_write.h"
#include "obj_edit_file_reader.h"
#include "vector3_pair_file_reader.h"
@@ -135,9 +133,7 @@ typedef struct
    bool applyPiData;
    char *piOutputFilename;
    bool rtpOutSR;
#ifdef FIX_1419_MONO_STEREO_UMX
    bool evsMode;
#endif
    IVAS_ROOM_SIZE_T roomSize;

} DecArguments;
@@ -888,9 +884,7 @@ static bool parseCmdlIVAS_dec(
    arg->output_Fs = IVAS_MAX_SAMPLING_RATE;
    arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
    arg->decMode = IVAS_DEC_MODE_IVAS;
#ifdef FIX_1419_MONO_STEREO_UMX
    arg->evsMode = false;
#endif
    arg->quietModeEnabled = false;
    arg->delayCompensationEnabled = true;
    arg->voipMode = false;
@@ -1289,7 +1283,6 @@ static bool parseCmdlIVAS_dec(

            if ( !is_digits_only( argv[i] ) )
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                aeidFileReader *aeidReader = NULL;
                if ( aeidFileReader_open( argv[i], &aeidReader ) != IVAS_ERR_OK )
                {
@@ -1305,67 +1298,6 @@ static bool parseCmdlIVAS_dec(
                }
                aeidFileReader_close( &aeidReader );
                i++;
#else
                uint16_t k;
                char *s = argv[i];
                char *token = argv[i];

                for ( k = 0; s[k]; )
                {
                    s[k] == ',' ? k++ : *s++;
                }
                k++;

                if ( k == 0 )
                {
                    fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", argv[i] );
                    usage_dec();
                    return false;
                }

                if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) * k ) ) ||
                     NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) * k ) ) )
                {
                    fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] );
                    usage_dec();
                    return false;
                }

                arg->aeSequence.count = k;

                k = 0;
                token = strtok( argv[i++], ":" );

                while ( token != NULL )
                {
                    if ( !is_number( token ) )
                    {
                        fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] );
                        usage_dec();
                        return false;
                    }
                    arg->aeSequence.pID[k] = (uint16_t) atoi( token );

                    token = strtok( NULL, "," );
                    if ( !is_number( token ) )
                    {
                        fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] );
                        usage_dec();
                        return false;
                    }
                    arg->aeSequence.pValidity[k] = (uint16_t) atoi( token );

                    token = strtok( NULL, ":" );
                    k++;
                }

                if ( k != arg->aeSequence.count )
                {
                    fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", argv[i] );
                    usage_dec();
                    return false;
                }
#endif
            }
            else
            {
@@ -1444,14 +1376,12 @@ static bool parseCmdlIVAS_dec(
            }
            i++;
        }
#ifdef FIX_1419_MONO_STEREO_UMX
        else if ( strcmp( argv_to_upper, "-EVS" ) == 0 )
        {
            arg->evsMode = true;
            arg->decMode = IVAS_DEC_MODE_EVS;
            i++;
        }
#endif
        else if ( strcmp( argv_to_upper, "-ROOM_SIZE" ) == 0 )
        {
            i++;
@@ -1539,7 +1469,6 @@ static bool parseCmdlIVAS_dec(
            usage_dec();
            return false;
        }
#ifdef FIX_1419_MONO_STEREO_UMX
        else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->evsMode )
        {
            fprintf( stderr, "Error: Both non-diegetic panning and stereo output specified!\n\n" );
@@ -1547,7 +1476,6 @@ static bool parseCmdlIVAS_dec(
            return false;
        }

#endif
        if ( arg->outputMdFilename != NULL && arg->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            fprintf( stderr, "Error: Output split rendering metadata file is supported for BINAURAL_SPLIT_PCM output config. only\n\n" );
@@ -1639,9 +1567,7 @@ static bool parseCmdlIVAS_dec(
static void usage_dec( void )
{
    fprintf( stdout, "Usage for EVS:   IVAS_dec.exe [Options] Fs bitstream_file output_file\n" );
#ifdef FIX_1419_MONO_STEREO_UMX
    fprintf( stdout, "                 OR usage for IVAS (below) with -evs option and OutputConf\n" );
#endif
    fprintf( stdout, "Usage for IVAS:  IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file\n\n" );

    fprintf( stdout, "Mandatory parameters:\n" );
@@ -1658,9 +1584,7 @@ static void usage_dec( void )

    fprintf( stdout, "Options:\n" );
    fprintf( stdout, "--------\n" );
#ifdef FIX_1419_MONO_STEREO_UMX
    fprintf( stdout, "-evs                : Specify that the supplied bitstream is an EVS bitstream\n" );
#endif
    fprintf( stdout, "-VOIP               : VoIP mode: RTP in G192\n" );
    fprintf( stdout, "-VOIP_hf_only=0     : VoIP mode: EVS RTP Payload Format hf_only=0 in rtpdump\n" );
    fprintf( stdout, "-VOIP_hf_only=1     : VoIP mode: EVS or IVAS RTP Payload Format hf_only=1 in rtpdump\n" );
+4 −157
Original line number Diff line number Diff line
@@ -46,9 +46,7 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#include "split_render_file_read_write.h"
#include "split_rend_bfi_file_reader.h"
#include "vector3_pair_file_reader.h"
@@ -394,11 +392,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_acousticEnvironmentId,
        .match = "acoustic_environment_id",
        .matchShort = "aeid",
#ifdef FIX_1053_REVERB_RECONFIGURATION
        .description = "Acoustic environment ID (number > 0) alternatively, it can be a text file where each line contains \"ID duration\" for BINAURAL_ROOM_REVERB output configuration.",
#else
        .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
#endif
    },
    {
        .id = CmdLnOptionId_roomSize,
@@ -810,9 +804,7 @@ int main(
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
    uint16_t aeID;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    IVAS_RENDER_CONFIG_DATA renderConfig;
#endif
    ivas_error error = IVAS_ERR_OK;

#ifdef WMOPS
@@ -1175,11 +1167,6 @@ int main(

    if ( args.renderConfigFilePath[0] != '\0' )
    {

#ifndef FIX_1053_REVERB_RECONFIGURATION
        IVAS_RENDER_CONFIG_DATA renderConfig;
#endif

        /* sanity check */
        if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) &&
             ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) &&
@@ -1542,16 +1529,7 @@ int main(
            audioWriter = NULL;
        }

#ifdef FIX_1437_LC3PLUS_EXTREND_HIRES
        if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend,
                                                              &bitsBuffer.config.codec,
                                                              &bitsBuffer.config.poseCorrection,
                                                              &bitsBuffer.config.codec_frame_size_ms,
                                                              &bitsBuffer.config.isar_frame_size_ms,
                                                              &bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK )
#endif
        if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader(): %s!\n", ivas_error_to_string( error ) );
            goto cleanup;
@@ -1676,9 +1654,6 @@ int main(
        {
            if ( ++args.aeSequence.frameCounter >= args.aeSequence.pValidity[args.aeSequence.selected] )
            {
#ifndef FIX_1053_REVERB_RECONFIGURATION
                IVAS_RENDER_CONFIG_DATA renderConfig;
#endif
                if ( ++args.aeSequence.selected >= args.aeSequence.count )
                {
                    args.aeSequence.selected = 0;
@@ -2654,9 +2629,10 @@ static bool parseAcousticEnvironmentIds(
    const char *value,
    AcousticEnvironmentSequence *aeSequence )
{
#ifdef FIX_1053_REVERB_RECONFIGURATION
    char config_string[RENDERER_MAX_METADATA_LINE_LENGTH];

    strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH );

    if ( !is_digits_only( config_string ) )
    {
        aeidFileReader *aeidReader = NULL;
@@ -2672,72 +2648,6 @@ static bool parseAcousticEnvironmentIds(
        }
        aeidFileReader_close( &aeidReader );
    }
#else
    uint16_t k;
    char config_string[RENDERER_MAX_METADATA_LINE_LENGTH];
    char *s;
    char *token;

    strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH );
    s = config_string;
    token = config_string;

    if ( !is_digits_only( config_string ) )
    {

        for ( k = 0; s[k]; )
        {
            s[k] == ',' ? k++ : *s++;
        }
        k++;

        if ( k == 0 )
        {
            fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", config_string );
            return false;
        }

        if ( NULL == ( aeSequence->pID = malloc( sizeof( uint16_t ) * k ) ) ||
             NULL == ( aeSequence->pValidity = malloc( sizeof( uint16_t ) * k ) ) )
        {
            fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", config_string );
            return false;
        }

        aeSequence->count = k;

        k = 0;

        token = strtok( config_string, ":" );

        while ( token != NULL )
        {
            if ( !is_number( token ) )
            {
                fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string );
                return false;
            }
            aeSequence->pID[k] = (uint16_t) atoi( token );

            token = strtok( NULL, "," );
            if ( !is_number( token ) )
            {
                fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string );
                return false;
            }
            aeSequence->pValidity[k] = (uint16_t) atoi( token );

            token = strtok( NULL, ":" );
            k++;
        }

        if ( k != aeSequence->count )
        {
            fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", config_string );
            return false;
        }
    }
#endif
    else
    {
        /* A single acoustic environment */
@@ -3191,25 +3101,12 @@ void getMetadataFromFileReader(
        fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) );
        exit( -1 );
    }
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS

    objectMetadataBuffer->positions[objIdx].azimuth_fx = ismMetadata.azimuth_fx;
    objectMetadataBuffer->positions[objIdx].elevation_fx = ismMetadata.elevation_fx;
    objectMetadataBuffer->positions[objIdx].radius_fx = ismMetadata.radius_fx;
    objectMetadataBuffer->positions[objIdx].yaw_fx = ismMetadata.yaw_fx;
    objectMetadataBuffer->positions[objIdx].pitch_fx = ismMetadata.pitch_fx;
#else
    objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32) ( ismMetadata.azimuth * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32) ( ismMetadata.elevation * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].radius_fx = (Word16) ( ismMetadata.radius * ( 1 << 9 ) );
    objectMetadataBuffer->positions[objIdx].yaw_fx = (Word32) ( ismMetadata.yaw * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].pitch_fx = (Word32) ( ismMetadata.pitch * ( 1 << 22 ) );

    objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth;
    objectMetadataBuffer->positions[objIdx].elevation = ismMetadata.elevation;
    objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius;
    objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw;
    objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch;
#endif
    objectMetadataBuffer->positions[objIdx].non_diegetic_flag = ismMetadata.non_diegetic_flag;

    return;
@@ -3263,25 +3160,15 @@ static void IsmPositionProvider_getNextFrame(
        /* Otherwise fall back to default position */
        else
        {
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
            objectMetadataBuffer->positions[objIdx].azimuth_fx = 0;
            objectMetadataBuffer->positions[objIdx].elevation_fx = 0;
            objectMetadataBuffer->positions[objIdx].radius_fx = 512; // 1.f in Q9
            objectMetadataBuffer->positions[objIdx].yaw_fx = 0;
            objectMetadataBuffer->positions[objIdx].pitch_fx = 0;
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#else
            objectMetadataBuffer->positions[objIdx].azimuth = 0.0f;
            objectMetadataBuffer->positions[objIdx].elevation = 0.0f;
            objectMetadataBuffer->positions[objIdx].radius = 1.0f;
            objectMetadataBuffer->positions[objIdx].yaw = 0.0f;
            objectMetadataBuffer->positions[objIdx].pitch = 0.0f;
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#endif
        }

        /* Wrap azimuth to lie within (-180, 180] range */
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
        while ( LT_32( objectMetadataBuffer->positions[objIdx].azimuth_fx, 0 ) )
        {
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_add( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
@@ -3306,35 +3193,6 @@ static void IsmPositionProvider_getNextFrame(

        /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].pitch_fx = L_min( L_max( objectMetadataBuffer->positions[objIdx].pitch_fx, -DEG_90_IN_Q22 ), DEG_90_IN_Q22 );
#else
        while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f )
        {
            objectMetadataBuffer->positions[objIdx].azimuth += 360.0f;
        }
        while ( objectMetadataBuffer->positions[objIdx].azimuth >= 360.0f )
        {
            objectMetadataBuffer->positions[objIdx].azimuth -= 360.0f;
        }

        /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 );
        objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32) ( objectMetadataBuffer->positions[objIdx].azimuth * ( 1 << 22 ) );
        objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32) ( objectMetadataBuffer->positions[objIdx].elevation * ( 1 << 22 ) );
        /* Wrap yaw to lie within (-180, 180] range */
        while ( objectMetadataBuffer->positions[objIdx].yaw < 0.0f )
        {
            objectMetadataBuffer->positions[objIdx].yaw += 360.0f;
        }
        while ( objectMetadataBuffer->positions[objIdx].yaw >= 360.0f )
        {
            objectMetadataBuffer->positions[objIdx].yaw -= 360.0f;
        }

        /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 );
        objectMetadataBuffer->positions[objIdx].yaw_fx = (Word32) ( ( objectMetadataBuffer->positions[objIdx].yaw ) * ( 1 << Q22 ) );
        objectMetadataBuffer->positions[objIdx].pitch_fx = (Word32) ( ( objectMetadataBuffer->positions[objIdx].pitch ) * ( 1 << Q22 ) );
#endif
    }

    ++positionProvider->frameCounter;
@@ -3640,23 +3498,12 @@ static void parseObjectPosition(
        exit( -1 );
    }

#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
    position->azimuth_fx = (Word32) ( meta_prm[0] * ( 1 << Q22 ) );   /* Q22 */
    position->elevation_fx = (Word32) ( meta_prm[1] * ( 1 << Q22 ) ); /* Q22 */
    position->radius_fx = (Word16) ( meta_prm[2] * ( 1 << Q9 ) );     /* Q9 */
    position->yaw_fx = (Word32) ( meta_prm[5] * ( 1 << Q22 ) );       /* Q22 */
    position->pitch_fx = (Word32) ( meta_prm[6] * ( 1 << Q22 ) );     /* Q22 */
    position->non_diegetic_flag = (Word16) meta_prm[7];
#else
    position->azimuth = meta_prm[0];
    position->elevation = meta_prm[1];
    position->azimuth_fx = (Word32) ( meta_prm[0] * ( 1 << 22 ) );
    position->elevation_fx = (Word32) ( meta_prm[1] * ( 1 << 22 ) );
    position->radius = meta_prm[2];
    position->yaw = meta_prm[5];
    position->pitch = meta_prm[6];
    position->non_diegetic_flag = (int16_t) meta_prm[7];
#endif

    return;
}
+0 −9
Original line number Diff line number Diff line
@@ -133,15 +133,6 @@ typedef struct _IVAS_ISM_METADATA
    Word32 gainFactor_fx; /* Q29 */
    Word32 yaw_fx;        /* Q22 */
    Word32 pitch_fx;      /* Q22 */
#ifndef FIX_2084_FLOATING_POINT_LEFTOVERS
    float azimuth;
    float elevation;
    float radius;
    float spread;
    float gainFactor;
    float yaw;
    float pitch;
#endif
    Word16 non_diegetic_flag;
    Word32 gain_fx; /* Q29 */

+0 −4
Original line number Diff line number Diff line
@@ -1291,11 +1291,7 @@ typedef enum
 *----------------------------------------------------------------------------------*/

#define MC_LS_SETUP_BITS                        3                           /* number of bits for writing the MC LS configuration */
#ifdef FIX_1419_MONO_STEREO_UMX
#define LS_SETUP_CONVERSION_NUM_MAPPINGS        41                          /* number of mappings for LS setup conversion         */
#else
#define LS_SETUP_CONVERSION_NUM_MAPPINGS        35                          /* number of mappings for LS setup conversion         */
#endif

typedef enum
{
+10 −16
Original line number Diff line number Diff line
@@ -69,7 +69,10 @@
/* #################### End DEBUGGING switches ############################ */


/* ################### Start FIXES switches ########################### */
/* ################### Start MAINTENANCE switches ########################### */

/* ################### Start BE switches ################################# */
/* only BE switches wrt wrt. TS 26.251 V3.0 */

/*#define FIX_I4_OL_PITCH*/                                  /* fix open-loop pitch used for EVS core switching */
#define FIX_1990_SANITIZER_IN_REVERB_LOAD                    /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
@@ -82,9 +85,7 @@


#define REMOVE_BASOP_Util_Divide3232_Scale_cadence           /* remove this division variant */
#define TEMP_FIX_2088_MSAN_INIT_ERROR                        /* Eri: Temporary fix for Issue 2088 - MSAN error. Will come with later port of JBM+Split rendering update */
#define FIX_2092_ASSERT_IN_OMASA_RENDER                      /* FhG, Nokia: Fix LTV crash due to overflow in OMASA EXT output */
#define FIX_2084_FLOATING_POINT_LEFTOVERS                    /* FhG: convert floating-point leftovers in IVAS_ENC_FeedObjectMetadata() */
#define FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING          /* FhG: Replace L_shl with L_shl_sat to prevent overflow when calculating scale factors for very small numbers in the logarithmic domain */
#define FIX_APA_EXECS_SCALING                                /* VA: fix scaling of JBM APA buffer */
#define FIX_2164_ASSERT_IN_OMASA_PREPROC_FOR_EDIT            /* Nokia: Issue 2164: Prevent overflow when calculating equalization coefficient for editing before clamping to safe range */
@@ -117,24 +118,17 @@



/* ################### End FIXES switches ########################### */

/* #################### Start BASOP porting switches ############################ */

#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
#define FIX_1053_REVERB_RECONFIGURATION
#define FIX_1419_MONO_STEREO_UMX                        /* FhG: fix for issue 1419 : support upmix to all output formats for mono and stereo */
#define FIX_1437_LC3PLUS_EXTREND_HIRES                  /* FhG: fix external renderer split bitstream header writing causing a crash for LC3plus High-res mode */


/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */

/* any switch which is non-be wrt last submitted floating point code */
/* any switch which is non-be wrt. TS 26.251 V3.0 */


/* #################### End BASOP porting switches ############################ */

/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */

/* clang-format on */

#endif
Loading