Commit 607f7e58 authored by vaclav's avatar vaclav
Browse files

Merge branch 'main' into 269-integer-vs-boolean-data-type

parents b39dedda 961ff0bd
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -795,7 +795,7 @@ sanitizer-test-masa:
.sanitizer-test-schedule-B:
  extends:
    - .sanitizer-test-template
  timeout: 3 hours
  timeout: 4 hours

sanitizer-test-mc-5_1:
  extends: .sanitizer-test-schedule-B
@@ -810,7 +810,7 @@ sanitizer-test-mc-5_1_2:
  rules:
    - if: $SANITIZER_SCHEDULE_B
      when: delayed
      start_in: 3 hours
      start_in: 4 hours
  script:
    - *update-ltv-repo
    - python3 ci/run_scheduled_sanitizer_test.py 5_1_2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS
@@ -820,7 +820,7 @@ sanitizer-test-mc-5_1_4:
  rules:
    - if: $SANITIZER_SCHEDULE_B
      when: delayed
      start_in: 6 hours
      start_in: 8 hours
  script:
    - *update-ltv-repo
    - python3 ci/run_scheduled_sanitizer_test.py 5_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS
@@ -830,7 +830,7 @@ sanitizer-test-mc-7_1:
  rules:
    - if: $SANITIZER_SCHEDULE_B
      when: delayed
      start_in: 9 hours
      start_in: 12 hours
  script:
    - *update-ltv-repo
    - python3 ci/run_scheduled_sanitizer_test.py 7_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS
@@ -840,7 +840,7 @@ sanitizer-test-mc-7_1_4:
  rules:
    - if: $SANITIZER_SCHEDULE_B
      when: delayed
      start_in: 12 hours
      start_in: 16 hours
  script:
    - *update-ltv-repo
    - python3 ci/run_scheduled_sanitizer_test.py 7_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other

apps/decoder.c

100755 → 100644
+1 −3
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -501,14 +501,12 @@ cleanup:
#ifdef DEBUG_SBA_AUDIO_DUMP
    IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels );
#endif
#ifdef FIX_235
    if ( arg.hrtfReaderEnabled )
    {
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
    }
#endif
    IVAS_DEC_Close( &hIvasDec );
    CustomLsReader_close( &hLsCustomReader );
    hrtfFileReader_close( &hrtfReader );
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+1 −128
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -132,14 +132,12 @@ typedef struct
    bool quietModeEnabled;
    bool sceneDescriptionInput;
    float inputGainGlobal; /* Linear gain (not in dB) */
#ifdef REND_CFG_LFE
    bool lfePanningEnabled;
    float lfeConfigGain; /* Linear gain (not in dB) */
    float lfeConfigAzimuth;
    float lfeConfigElevation;
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
#endif
} CmdlnArgs;

typedef enum
@@ -154,12 +152,8 @@ typedef enum
    CmdLnOptionId_renderConfigFile,
    CmdLnOptionId_noDiegeticPan,
    CmdLnOptionId_orientationTracking,
#ifdef REND_CFG_LFE
    CmdlnOptionId_lfePosition,
    CmdlnOptionId_lfeMatrix,
#else
    CmdLnOptionId_customLfeRouting,
#endif
    CmdLnOptionId_noDelayCmp,
    CmdLnOptionId_quietModeEnabled,
    CmdLnOptionId_inputMetadata,
@@ -235,26 +229,15 @@ static const CmdLnParser_Option cliOptions[] = {
        .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM) (todo: check implementation)",
    },
    {
#ifdef REND_CFG_LFE
        .id = CmdlnOptionId_lfePosition,
        .match = "lfe_position",
        .matchShort = "lp",
        .description = "Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear (like --gain, -g) and azimuth, elevation are in degrees.\nIf specified, overrides the default behavior which attempts to map input to output LFE channel(s)",
#else
        /* TODO(sgi): Replace with more configurable input, e.g. ask for a list of triplets: (gain, azimuth, elevation) to place LFE signal */
        /* rename to "lfeHandling" */
        .id = CmdLnOptionId_customLfeRouting,
        .match = "neverDropLfe",
        .matchShort = "ndl",
        .description = "[flag] If set, renderer tries to render LFE into other channels in an optimal way when rendering to configs w/o LFE",
#endif
    },
#ifdef REND_CFG_LFE
    { .id = CmdlnOptionId_lfeMatrix,
      .match = "lfe_matrix",
      .matchShort = "lm",
      .description = "LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). \nIf specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)" },
#endif
    {
        .id = CmdLnOptionId_noDelayCmp,
        .match = "no_delay_cmp",
@@ -360,11 +343,9 @@ static void parseMetadata(
    IsmPositionProvider *positionProvider,
    MasaFileReader **masaReaders );

#ifdef REND_CFG_LFE
static ivas_error parseLfePanMtxFile(
    const char *lfeRoutingMatrixFilePath,
    IVAS_REND_LfePanMtx *lfePanMtx );
#endif

static void convert_backslash( char *str );

@@ -582,9 +563,7 @@ int main(
    convert_backslash( args.inputFilePath );
    convert_backslash( args.outputFilePath );
    convert_backslash( args.headRotationFilePath );
#ifdef REND_CFG_LFE
    convert_backslash( args.inLfePanningMatrixFile );
#endif

    if ( !isEmptyString( args.headRotationFilePath ) )
    {
@@ -691,7 +670,6 @@ int main(
        }
    }

#ifdef REND_CFG_LFE
    IVAS_REND_LfePanMtx lfePanMatrix;

    /* parse input LFE panning matrix */
@@ -704,7 +682,6 @@ int main(
            exit( -1 );
        }
    }
#endif

    for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i )
    {
@@ -729,7 +706,6 @@ int main(
            }
        }

#ifdef REND_CFG_LFE
        /* set panning matrix for input LFE */
        if ( args.lfeCustomRoutingEnabled )
        {
@@ -754,9 +730,6 @@ int main(
                exit( -1 );
            }
        }
#else
        /* TODO(sgi): Test custom LFE routing here */
#endif
    }

    for ( i = 0; i < args.inConfig.numAudioObjects; ++i )
@@ -1100,7 +1073,6 @@ static IVAS_REND_AudioConfig ambisonicsOrderToEnum(
    return IVAS_REND_AUDIO_CONFIG_UNKNOWN;
}

#ifdef FIX_293_EXT_RENDERER_CLI
static const CmdLnParser_Option *findOptionById(
    const int32_t id )
{
@@ -1114,7 +1086,6 @@ static const CmdLnParser_Option *findOptionById(

    return NULL;
}
#endif

static bool parseInConfig(
    const char *inFormatStr,
@@ -1203,13 +1174,9 @@ static bool parseInConfig(

                if ( error == IVAS_ERR_FAILED_FILE_OPEN )
                {
#ifdef FIX_293_EXT_RENDERER_CLI
                    /* Failed to open with given string - most likely wasn't a file path */
                    const CmdLnParser_Option *listOption = findOptionById( CmdLnOptionId_listFormats );
                    fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match );
#else
                    fprintf( stderr, "Unsupported input format: %s\n", inFormatStr );
#endif
                    return false;
                }
                if ( error != IVAS_ERR_OK )
@@ -1224,7 +1191,6 @@ static bool parseInConfig(
            }
            break;
        default:
#ifdef FIX_293_EXT_RENDERER_CLI
        {
            /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum,
             * but cannot be used at input, e.g. BINAURAL */
@@ -1232,12 +1198,6 @@ static bool parseInConfig(
            fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match );
            return false;
        }
#else
            /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum,
             * but cannot be used at input, e.g. BINAURAL */
            fprintf( stderr, "Unsupported input format: %s\n", inFormatStr );
            return false;
#endif
    }

    return true;
@@ -1265,18 +1225,10 @@ static bool parseOutConfig(
    return true;
}

#ifdef REND_CFG_LFE
static bool parseDiegeticPan(
#else
static int8_t parseDiegeticPan(
#endif
    char *value,
    float *noDiegeticPan )
{
#ifndef REND_CFG_LFE
    int8_t success;
    success = 1;
#endif
    to_upper( value );

    if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) )
@@ -1298,32 +1250,16 @@ static int8_t parseDiegeticPan(
        if ( *noDiegeticPan > 1.0f || *noDiegeticPan < -1.0f )
        {
            fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" );
#ifdef REND_CFG_LFE
            return false;
#else
            success = 0;
#endif
        }
    }
#ifdef REND_CFG_LFE
    return false;
#else
    return success ? 0 : -1;
#endif
}

#ifdef REND_CFG_LFE
static bool parseOrientationTracking(
#else
static int8_t parseOrientationTracking(
#endif
    char *value,
    int8_t *tracking_type )
{
#ifndef REND_CFG_LFE
    int8_t success;
    success = 1;
#endif

    to_upper( value );

@@ -1338,18 +1274,10 @@ static int8_t parseOrientationTracking(
    else
    {
        fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", value );
#ifdef REND_CFG_LFE
        return false;
#else
        success = 0;
#endif
    }

#ifdef REND_CFG_LFE
    return true;
#else
    return success ? 0 : -1;
#endif
}

static IVAS_REND_AudioConfig parseAudioConfig(
@@ -1403,7 +1331,6 @@ static IVAS_REND_AudioConfig parseAudioConfig(
    }
    if ( strncmp( charBuf, "ISM", 3 ) == 0 )
    {
#ifdef FIX_293_EXT_RENDERER_CLI
        /* Accept input config as ISM only if the 4th character is a number from 1 to 4.
         * Otherwise, do nothing. Unknown audio config will be returned. */
        switch ( charBuf[3] )
@@ -1414,9 +1341,6 @@ static IVAS_REND_AudioConfig parseAudioConfig(
            case '4':
                return IVAS_REND_AUDIO_CONFIG_OBJECT;
        }
#else
        return IVAS_REND_AUDIO_CONFIG_OBJECT;
#endif
    }
    if ( strncmp( charBuf, "MASA", 4 ) == 0 )
    {
@@ -1444,7 +1368,6 @@ static IVAS_REND_AudioConfig parseAudioConfig(
    return IVAS_REND_AUDIO_CONFIG_UNKNOWN;
}

#ifdef REND_CFG_LFE
static bool parseLfePositionConfig(
    const char *value,
    float *lfeGain,
@@ -1490,23 +1413,7 @@ static bool parseLfePositionConfig(
    *lfeElevation = values[2];
    return true;
}
#endif

#ifndef FIX_293_EXT_RENDERER_CLI
static const CmdLnParser_Option *findOptionById(
    const int32_t id )
{
    for ( int32_t i = 0; i < numCliOptions; ++i )
    {
        if ( cliOptions[i].id == id )
        {
            return &cliOptions[i];
        }
    }

    return NULL;
}
#endif

static bool checkRequiredArgs(
    CmdlnArgs args )
@@ -1591,7 +1498,6 @@ static CmdlnArgs defaultArgs(
    args.sceneDescriptionInput = false;
    args.inputGainGlobal = 1.0f;

#ifdef REND_CFG_LFE
    args.lfePanningEnabled = false;
    args.lfeConfigGain = 1.0f;
    args.lfeConfigAzimuth = 0;
@@ -1599,7 +1505,6 @@ static CmdlnArgs defaultArgs(

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );
#endif
    return args;
}

@@ -1670,11 +1575,7 @@ static void parseOption(
            break;
        case CmdLnOptionId_noDiegeticPan:
            assert( numOptionValues == 1 );
#ifdef REND_CFG_LFE
            if ( !parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) )
#else
            if ( parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) != 0 )
#endif
            {
                fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] );
                exit( -1 );
@@ -1682,17 +1583,12 @@ static void parseOption(
            break;
        case CmdLnOptionId_orientationTracking:
            assert( numOptionValues == 1 );
#ifdef REND_CFG_LFE
            if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) )
#else
            if ( parseOrientationTracking( optionValues[0], &args->orientationTracking ) != 0 )
#endif
            {
                fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] );
                exit( -1 );
            }
            break;
#ifdef REND_CFG_LFE
        case CmdlnOptionId_lfePosition:
            assert( numOptionValues == 1 );
            if ( !parseLfePositionConfig( optionValues[0], &args->lfeConfigGain, &args->lfeConfigAzimuth, &args->lfeConfigElevation ) )
@@ -1702,18 +1598,12 @@ static void parseOption(
            }
            args->lfePanningEnabled = true;
            break;
#else
        case CmdLnOptionId_customLfeRouting:
            assert( 0 && "Not yet implemented in CLI" );
#endif
            break;
#ifdef REND_CFG_LFE
        case CmdlnOptionId_lfeMatrix:
            assert( numOptionValues == 1 );
            strncpy( args->inLfePanningMatrixFile, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            args->lfeCustomRoutingEnabled = true;
            break;
#endif
        case CmdLnOptionId_noDelayCmp:
            assert( numOptionValues == 0 );
            args->delayCompensationEnabled = false;
@@ -1836,7 +1726,6 @@ void IsmPositionProvider_getNextFrame(

    for ( objIdx = 0; objIdx < positionProvider->numObjects; ++objIdx )
    {
#ifdef FIX_293_EXT_RENDERER_CLI
        /* If ISM metadata reader is open, read from metadata file */
        if ( positionProvider->ismReaders[objIdx] != NULL )
        {
@@ -1853,16 +1742,6 @@ void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].azimuth = 0.0f;
            objectMetadataBuffer->positions[objIdx].elevation = 0.0f;
        }
#else
        if ( positionProvider->ismReaders[objIdx] != NULL )
        {
            getMetadataFromFileReader( positionProvider->ismReaders[objIdx], objectMetadataBuffer, objIdx );
        }
        else
        {
            readFromShorthandMetadata( positionProvider, objectMetadataBuffer, objIdx );
        }
#endif

        /* Wrap azimuth to lie within (-180, 180] range */
        while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f )
@@ -2250,11 +2129,7 @@ static void parseMasa(
    if ( strncmp( line, "MASA", 4 ) != 0 )
    {
        char numTcs = *line;
#ifdef FIX_293_EXT_RENDERER_CLI
        snprintf( line, 6 /* write at most 6 characters: MASAx + null termination */, "MASA%c", numTcs );
#else
        sprintf( line, "MASA%c", numTcs );
#endif
    }

    inConfig->masaBuses[idx].audioConfig = parseAudioConfig( line );
@@ -2496,7 +2371,6 @@ static void printSupportedAudioConfigs()
    return;
}

#ifdef REND_CFG_LFE
static ivas_error parseLfePanMtxFile(
    const char *lfeRoutingMatrixFilePath,
    IVAS_REND_LfePanMtx *lfePanMtx )
@@ -2560,7 +2434,6 @@ static ivas_error parseLfePanMtxFile(
    fclose( mtxFile );
    return IVAS_ERR_OK;
}
#endif

// VE2AT: possibly move these functions to cmdln_parser.c ?
static void convert_backslash(
Loading