Commit bcd22742 authored by Jan Brouwer's avatar Jan Brouwer
Browse files

Merge remote-tracking branch...

Merge remote-tracking branch 'remotes/origin/philips/contribution-38-control-metadata-reverb' into philips/contribution-38-control-metadata-reverb-draft
parents ec2d70e1 4bad440e
Loading
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
@@ -388,6 +388,28 @@ codec-asan:
      - test_output.txt
    expose_as: "asan selftest results"

# code selftest testvectors with address-sanitizer binaries
codec-usan:
  extends:
    - .test-job-linux
    - .rules-merge-request
  stage: test
  needs: ["build-codec-sanitizers-linux"]
  script:
    - *print-common-info
    - make clean
    - make -j CLANG=3
    - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 scripts/self_test.py --create
    - grep_exit_code=0
    - grep UndefinedBehaviorSanitizer scripts/ref/logs/* || grep_exit_code=$?
    - if [ $grep_exit_code != 1 ] ; then echo "Run errors in self_test.py with Clang undefined-behavior-sanitizer"; exit 1; fi
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    paths:
      - scripts/ref/logs/
    expose_as: "usan selftest results"

# test renderer executable
renderer-smoke-test:
  extends:
@@ -455,6 +477,33 @@ renderer-msan:
      junit:
        - report-junit.xml

# test renderer executable with cmake + usan
renderer-usan:
  extends:
    - .test-job-linux
    - .rules-merge-request
  needs: ["build-codec-linux-cmake"]
  stage: test
  script:
    - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan  -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true
    - cmake --build cmake-build -- -j
    - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py
    - grep_exit_code=0
    - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest
    - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$?
    - if [ $grep_exit_code != 1 ] ; then echo "Run errors in test_renderer.py with Clang undefined-behavior-sanitizer"; exit 1; fi

  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results"
    expire_in: 1 week
    when: always
    paths:
      - report-junit.xml
    expose_as: "renderer usan pytest results"
    reports:
      junit:
        - report-junit.xml

# compare renderer bitexactness between target and source branch
renderer-pytest-on-merge-request:
  extends:
+14 −2
Original line number Diff line number Diff line
@@ -70,8 +70,20 @@ if(UNIX)
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
    elseif("${CLANG}" MATCHES "3" OR "${CLANG}" MATCHES "usan")
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
      # NOTE: keep in sync with list in Makefile
      set(USAN_CHECKS_ENABLE
        undefined # Default checks
        # Extra checks
        float-divide-by-zero
        implicit-conversion
        local-bounds
      )
      list(JOIN USAN_CHECKS_ENABLE "," USAN_CHECKS_ENABLE)

      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${USAN_CHECKS_ENABLE} -fsanitize-recover=${USAN_CHECKS_ENABLE}")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${USAN_CHECKS_ENABLE} -fsanitize-recover=${USAN_CHECKS_ENABLE}")
    else()
      message(FATAL_ERROR "Unknown CLANG setting: ${CLANG}")
    endif()
  endif()
  # GCOV
+6 −2
Original line number Diff line number Diff line
@@ -77,8 +77,12 @@ LDFLAGS += -fsanitize=address
endif
ifeq "$(CLANG)" "3"
CC       = $(CCCLANG) 
CFLAGS  += -fsanitize=undefined
LDFLAGS += -fsanitize=undefined
# NOTE: keep in sync with list in CMakeLists.txt
usan_checks = undefined,float-divide-by-zero,implicit-conversion,local-bounds
CFLAGS  += -fsanitize=$(usan_checks) 
CFLAGS  += -fsanitize-recover=$(usan_checks) 
LDFLAGS += -fsanitize=$(usan_checks)
LDFLAGS += -fsanitize-recover=$(usan_checks)
endif

ifeq "$(RELEASE)" "1"
+0 −2
Original line number Diff line number Diff line
@@ -2394,7 +2394,6 @@ static ivas_error decodeVoIP(
    uint32_t nextPacketRcvTime_ms = 0;
    uint32_t systemTime_ms = 0;
    uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS;
    int32_t nFramesWritten = 0;
    int32_t nFramesFed = 0;


@@ -2752,7 +2751,6 @@ static ivas_error decodeVoIP(

        frame++;
        systemTime_ms += systemTimeInc_ms;
        nFramesWritten++;

#ifdef WMOPS
        update_mem();
+39 −9
Original line number Diff line number Diff line
@@ -178,6 +178,9 @@ typedef struct
#ifdef CONTROL_METADATA_REVERB
    uint16_t acousticEnvironmentId;
#endif
#ifdef FIX_488_SYNC_DELAY
    float syncMdDelay;
#endif
} CmdlnArgs;

typedef enum
@@ -207,7 +210,10 @@ typedef enum
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
#ifdef CONTROL_METADATA_REVERB
    CmdLnOptionId_acousticEnvironmentId
    CmdLnOptionId_acousticEnvironmentId,
#endif
#ifdef FIX_488_SYNC_DELAY
    CmdLnOptionId_syncMdDelay,
#endif
} CmdLnOptionId;

@@ -356,6 +362,14 @@ static const CmdLnParser_Option cliOptions[] = {
        .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration",
    },
#endif
#ifdef FIX_488_SYNC_DELAY
    {
        .id = CmdLnOptionId_syncMdDelay,
        .match = "sync_md_delay",
        .matchShort = "smd",
        .description = "Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes)",
    },
#endif
};


@@ -1070,11 +1084,7 @@ int main(
        }

#ifdef CONTROL_METADATA_REVERB
#if ( defined SPLIT_REND_WITH_HEAD_ROT ) || ( defined DEBUGGING )
        if ( RenderConfigReader_read( renderConfigReader, args.renderConfigFilePath, &renderConfig ) != IVAS_ERR_OK )
#else
        if ( RenderConfigReader_read( renderConfigReader, args.renderConfigFilePath ) != IVAS_ERR_OK )
#endif
#else
        if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK )
#endif
@@ -1150,6 +1160,9 @@ int main(
    if ( args.inConfig.numAudioObjects > 0 )
    {
        IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects );
#ifdef FIX_488_SYNC_DELAY
        IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay );
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
@@ -1724,6 +1737,8 @@ int main(
                }
            }
        }


#ifdef SPLIT_REND_WITH_HEAD_ROT
        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
@@ -1934,6 +1949,13 @@ int main(
    }
#endif

#ifdef FIX_488_SYNC_DELAY
    if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
        fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) );
    }
#endif

    if ( !args.quietModeEnabled && args.delayCompensationEnabled )
    {
        fprintf( stdout, "\nRenderer delay:         %-5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale );
@@ -2520,11 +2542,12 @@ static CmdlnArgs defaultArgs(

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );

#ifdef CONTROL_METADATA_REVERB
    args.acousticEnvironmentId = 0;
#endif

#ifdef FIX_488_SYNC_DELAY
    args.syncMdDelay = 0;
#endif
    return args;
}

@@ -2669,6 +2692,13 @@ static void parseOption(
            assert( numOptionValues == 1 );
            args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 );
            break;
#endif
#ifdef FIX_488_SYNC_DELAY
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
            /* Metadata Delay to sync with audio delay in ms */
            args->syncMdDelay = strtof( optionValues[0], NULL );
            break;
#endif
       default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
@@ -3533,7 +3563,7 @@ static void parseSceneDescriptionFile(
    return;
}

static void printSupportedAudioConfigs()
static void printSupportedAudioConfigs( void )
{
    uint16_t i;
    const char *supportedFormats[] = {
Loading