Commit 9ef8ee5e authored by multrus's avatar multrus
Browse files

Merge branch 'main' into 1405-add-trap-for-denormals

parents 6c9d94fe 255e5a38
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ IVAS_cod
IVAS_dec
IVAS_rend
ISAR_post_rend
ambi_converter
obj/
*.a
*.o
@@ -18,6 +19,7 @@ IVAS_cod.exe
IVAS_dec.exe
IVAS_rend.exe
ISAR_post_rend.exe
ambi_converter.exe
*.user
.vs/
Debug_*/
+111 −115
Original line number Diff line number Diff line
@@ -564,12 +564,6 @@ renderer-smoke-test:
  before_script:
    - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=$SANITIZER_BUILD_STRING -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true
    - cmake --build cmake-build -- -j
    # rename files to fit naming convention
    # en- and decoder needed because of split rendering testcases
    - mv IVAS_cod IVAS_cod_ref
    - mv IVAS_dec IVAS_dec_ref
    - mv IVAS_rend IVAS_rend_ref
    - mv ISAR_post_rend ISAR_post_rend_ref
    - testcase_timeout=180

# test renderer executable with cmake + asan
@@ -579,7 +573,7 @@ renderer-asan:
  variables:
    SANITIZER_BUILD_STRING: "asan"
  script:
    - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout
    - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout
  artifacts:
    expose_as: "renderer asan result"

@@ -591,7 +585,7 @@ renderer-msan:
  variables:
    SANITIZER_BUILD_STRING: "msan"
  script:
    - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout
    - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout
  artifacts:
    expose_as: "renderer msan result"

@@ -603,7 +597,7 @@ renderer-usan:
  variables:
    SANITIZER_BUILD_STRING: "usan"
  script:
    - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout
    - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout
  artifacts:
    expose_as: "renderer usan result"

@@ -1122,113 +1116,115 @@ be-2-evs-windows:
    - cd evs_be_win_test
    - python ../ci/run_evs_be_win_test.py

# TODO: turn into manual job if needed
# check bitexactness to EVS
be-2-evs-linux:
  extends:
    - .test-job-linux
    - .rules-main-push
  tags:
    - be-2-evs-temp
  stage: test
  needs: ["build-codec-linux-cmake"]
  timeout: "20 minutes" # To be revisited
  script:
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh

    - mkdir build
    - cd build
    - cmake ..
    - make -j
    - cd ..

    # copy over to never change the testvector dir
    - cp -r $EVS_BE_TEST_DIR ./evs_be_test
    - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod
    - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec

    - cd evs_be_test
    - python3 ../ci/run_evs_be_test.py

codec-comparison-on-main-push:
  extends:
    - .test-job-linux-needs-testv-dir
    - .rules-main-push
  stage: compare
  needs: ["build-codec-linux-cmake"]
  timeout: "30 minutes" # To be revisited
  script:
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh
    - latest_commit=$(git rev-parse HEAD) # Latest commit
    - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H)
    - echo "Comparing changes from $previous_merge_commit to $latest_commit"
    - git --no-pager diff --stat $previous_merge_commit..$latest_commit

    # Rest is more or less placeholder adapted from MR self test. This should be replaced with more complex tests.

    ### build test binaries, initial clean for paranoia reasons
    - make clean
    - mkdir build
    - cd build
    - cmake ..
    - make -j
    - mv IVAS_cod ../IVAS_cod_test
    - mv IVAS_dec ../IVAS_dec_test
    - cd ..
    - rm -rf build/*

    ### compare to the previous merge commit in the main branch
    - git fetch origin main
    - git checkout $previous_merge_commit
    - echo "Building reference codec at commit $previous_merge_commit"

    ### build reference binaries
    - cd build
    - cmake ..
    - make -j
    - mv IVAS_cod ../IVAS_cod_ref
    - mv IVAS_dec ../IVAS_dec_ref
    - cd ..

    # helper variable - "|| true" to prevent failures from grep not finding anything
    # write to temporary file as workaround for failures observed with piping echo
    - echo $CI_COMMIT_MESSAGE > tmp.txt
    - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true
    - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true

    ### re-checkout the latest commit in the main branch, if ref_using_main is not set
    - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi

    ### prepare pytest
    # rename test binaries back
    - mv IVAS_cod_test IVAS_cod
    - mv IVAS_dec_test IVAS_dec
    # create references
    - testcase_timeout=60
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 --testcase_timeout=$testcase_timeout

    ### re-checkout the latest commit here, if ref_using_main is set
    - if [ $ref_using_main -eq 1 ]; then git checkout $latest_commit;fi

    ### run pytest
    - exit_code=0
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$?
    - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - if [ $exit_code -ne 0 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi;
  allow_failure:
    exit_codes:
      - 123
  artifacts:
    name: "main-push--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results"
    expire_in: 1 week
    when: always
    paths:
      - report-junit.xml
      - report.html
    expose_as: "Results of comparison to previous merge commit"
    reports:
      junit: report-junit.xml
# be-2-evs-linux:
#   extends:
#     - .test-job-linux
#     - .rules-main-push
#   tags:
#     - be-2-evs-temp
#   stage: test
#   needs: ["build-codec-linux-cmake"]
#   timeout: "20 minutes" # To be revisited
#   script:
#     - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh
#
#     - mkdir build
#     - cd build
#     - cmake ..
#     - make -j
#     - cd ..
#
#     # copy over to never change the testvector dir
#     - cp -r $EVS_BE_TEST_DIR ./evs_be_test
#     - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod
#     - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec
#
#     - cd evs_be_test
#     - python3 ../ci/run_evs_be_test.py

# TODO: do we still need this?
# codec-comparison-on-main-push:
#   extends:
#     - .test-job-linux-needs-testv-dir
#     - .rules-main-push
#   stage: compare
#   needs: ["build-codec-linux-cmake"]
#   timeout: "30 minutes" # To be revisited
#   script:
#     - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh
#     - latest_commit=$(git rev-parse HEAD) # Latest commit
#     - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H)
#     - echo "Comparing changes from $previous_merge_commit to $latest_commit"
#     - git --no-pager diff --stat $previous_merge_commit..$latest_commit
#
#     # Rest is more or less placeholder adapted from MR self test. This should be replaced with more complex tests.
#
#     ### build test binaries, initial clean for paranoia reasons
#     - make clean
#     - mkdir build
#     - cd build
#     - cmake ..
#     - make -j
#     - mv IVAS_cod ../IVAS_cod_test
#     - mv IVAS_dec ../IVAS_dec_test
#     - cd ..
#     - rm -rf build/*
#
#     ### compare to the previous merge commit in the main branch
#     - git fetch origin main
#     - git checkout $previous_merge_commit
#     - echo "Building reference codec at commit $previous_merge_commit"
#
#     ### build reference binaries
#     - cd build
#     - cmake ..
#     - make -j
#     - mv IVAS_cod ../IVAS_cod_ref
#     - mv IVAS_dec ../IVAS_dec_ref
#     - cd ..
#
#     # helper variable - "|| true" to prevent failures from grep not finding anything
#     # write to temporary file as workaround for failures observed with piping echo
#     - echo $CI_COMMIT_MESSAGE > tmp.txt
#     - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true
#     - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true
#
#     ### re-checkout the latest commit in the main branch, if ref_using_main is not set
#     - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi
#
#     ### prepare pytest
#     # rename test binaries back
#     - mv IVAS_cod_test IVAS_cod
#     - mv IVAS_dec_test IVAS_dec
#     # create references
#     - testcase_timeout=60
#     - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 --testcase_timeout=$testcase_timeout
#
#     ### re-checkout the latest commit here, if ref_using_main is set
#     - if [ $ref_using_main -eq 1 ]; then git checkout $latest_commit;fi
#
#     ### run pytest
#     - exit_code=0
#     - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$?
#     - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi
#     - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
#     - if [ $exit_code -ne 0 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi
#     - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi;
#   allow_failure:
#     exit_codes:
#       - 123
#   artifacts:
#     name: "main-push--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results"
#     expire_in: 1 week
#     when: always
#     paths:
#       - report-junit.xml
#       - report.html
#     expose_as: "Results of comparison to previous merge commit"
#     reports:
#       junit: report-junit.xml


# ---------------------------------------------------------------
+19 −13
Original line number Diff line number Diff line
@@ -52,33 +52,34 @@ int main( int argc, char *argv[] )

    uint32_t samplingRate;
    uint32_t samplesInFile;
    uint32_t numSamples = L_FRAME48k;
    uint32_t numSamples = AMBI_MAX_FRAME_LENGTH;
    uint32_t numSamplesRead32 = 0;
    uint32_t numSamplesClipped = 0;

    int16_t bps;
    int16_t samples[L_FRAME48k * AMBI_MAX_CHANNELS];
    int16_t samples[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS];
    int16_t order = 0;
    int16_t numChannels;
    const char *name_conventions[6] = { "ACN-SN3D", "ACN-N3D", "FuMa-MaxN", "FuMa-FuMa", "SID-SN3D", "SID-N3D" };

    AMBI_FMT in_format, out_format;

    float samples_f_in[L_FRAME48k * AMBI_MAX_CHANNELS];
    float samples_f_out[L_FRAME48k * AMBI_MAX_CHANNELS];
    float samples_f_in[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS];
    float samples_f_out[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS];
    float *in[AMBI_MAX_CHANNELS], *out[AMBI_MAX_CHANNELS];

    for ( int16_t j = 0; j < AMBI_MAX_CHANNELS; j++ )
    {
        in[j] = &samples_f_in[j * L_FRAME48k];
        out[j] = &samples_f_out[j * L_FRAME48k];
        in[j] = &samples_f_in[j * AMBI_MAX_FRAME_LENGTH];
        out[j] = &samples_f_out[j * AMBI_MAX_FRAME_LENGTH];
    }

    printf( "Ambisonics converter program\n" );
    if ( argc != 5 )
    {
        printf( "Ambisonics converter program\n" );
        printf( "----------------------------------------------------------------------------------\n" );
        printf( "Usage:\n" );
        printf( "./ambi_conveter input_file output_file input_convention output_convention\n" );
        printf( "./ambi_converter input_file output_file input_convention output_convention\n" );
        printf( "\n" );
        printf( "input_convention and output convention must be an integer number in [0,5]\n" );
        printf( "the following conventions are supported:\n" );
@@ -97,8 +98,12 @@ int main( int argc, char *argv[] )
    fileName_out = argv[2];
    in_format = atoi( argv[3] );
    out_format = atoi( argv[4] );

    printf( "In %d, Out: %d\n", in_format, out_format );
    if ( in_format < 0 || out_format < 0 || in_format > 5 || out_format > 5 )
    {
        printf( "input_convention and output convention must be an integer number in [0,5]\n" );
        return -1;
    }
    printf( "In: [%s], Out: [%s]\n", name_conventions[in_format], name_conventions[out_format] );

    wavFile_in = OpenWav( fileName_in, &samplingRate, &numChannels, &samplesInFile, &bps );
    if ( !wavFile_in )
@@ -117,6 +122,7 @@ int main( int argc, char *argv[] )
    order = (int16_t) sqrtf( numChannels ) - 1;
    assert( order > 0 && order <= 3 );

    numSamples = ( samplingRate * 20 * numChannels ) / 1000; /* 20ms worth of samples */
    while ( ReadWavShort( wavFile_in, samples, numSamples, &numSamplesRead32 ) == __TWI_SUCCESS )
    {
        int32_t err = 0;
@@ -126,7 +132,7 @@ int main( int argc, char *argv[] )
            break;
        }

        for ( uint16_t i = 0; i < numSamplesRead32; i++ )
        for ( uint16_t i = 0; i < (uint16_t) numSamplesRead32 / numChannels; i++ )
        {
            for ( int16_t j = 0; j < numChannels; j++ )
            {
@@ -134,14 +140,14 @@ int main( int argc, char *argv[] )
            }
        }

        if ( ( err = convert_ambi_format( in, out, order, in_format, out_format ) ) != 0 )
        if ( ( err = convert_ambi_format( in, out, order, in_format, out_format, ( const uint16_t )( numSamples / numChannels ) ) ) != 0 )
        {
            printf( "Error converting the input signal!\n" );
            return err;
        }


        for ( uint16_t i = 0; i < numSamplesRead32; i++ )
        for ( uint16_t i = 0; i < (uint16_t) numSamplesRead32 / numChannels; i++ )
        {
            for ( int16_t j = 0; j < numChannels; j++ )
            {
+0 −61
Original line number Diff line number Diff line
@@ -130,7 +130,6 @@ typedef struct
    bool tsmEnabled;
    IVAS_RENDER_FRAMESIZE renderFramesize;
#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
#ifdef DEBUG_FOA_AGC
    FILE *agcBitstream; /* temporary */
#endif
@@ -183,7 +182,6 @@ static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
static int16_t app_own_random( int16_t *seed );
static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar );
#endif
static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );

@@ -543,28 +541,6 @@ int main(
#endif
    }

    /*------------------------------------------------------------------------------------------*
     * Binaural rendering mode: set and print info
     *------------------------------------------------------------------------------------------*/

    if ( arg.forcedRendMode != IVAS_DEC_FORCE_REND_UNFORCED )
    {
        if ( ( error = IVAS_DEC_SetForcedRendMode( hIvasDec, arg.forcedRendMode ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Forcing binaural rendering mode failed (only TDREND and CLDFBREND are expected).\n\n" );
            goto cleanup;
        }

        if ( arg.forcedRendMode == IVAS_DEC_FORCE_REND_TD_RENDERER )
        {
            fprintf( stdout, "Forcing rendering to:   TD renderer\n" );
        }
        else if ( arg.forcedRendMode == IVAS_DEC_FORCE_REND_CLDFB_RENDERER )
        {
            fprintf( stdout, "Forcing rendering to:   CLDFB renderer\n" );
        }
    }

    /*-----------------------------------------------------------------*
     * Open Error pattern file for simulation
     *-----------------------------------------------------------------*/
@@ -971,7 +947,6 @@ static bool parseCmdlIVAS_dec(
#ifdef DEBUGGING
    float ftmp;

    arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED;
#ifdef DEBUG_FOA_AGC
    arg->agcBitstream = NULL;
#endif
@@ -1141,17 +1116,6 @@ static bool parseCmdlIVAS_dec(
            }
            i += 2;
        }
        else if ( strcmp( argv_to_upper, "-FORCE" ) == 0 )
        {
            i++;
            if ( i < argc - 3 )
            {
                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 );
                i++;
            }
        }
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
        /* Define additional subfolder for debug info output in ./res */
@@ -3906,31 +3870,6 @@ static void do_object_editing(
}


#ifdef DEBUGGING

/*---------------------------------------------------------------------*
 * parseForcedRendModeDec()
 *
 *
 *---------------------------------------------------------------------*/

static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec(
    char *forcedRendModeChar )
{
    if ( ( strcmp( to_upper( forcedRendModeChar ), "TDREND" ) == 0 ) )
    {
        return IVAS_DEC_FORCE_REND_TD_RENDERER;
    }
    if ( ( strcmp( to_upper( forcedRendModeChar ), "CLDFBREND" ) == 0 ) )
    {
        return IVAS_DEC_FORCE_REND_CLDFB_RENDERER;
    }

    return IVAS_DEC_FORCE_REND_UNDEFINED;
}
#endif


/*---------------------------------------------------------------------*
 * load_hrtf_from_file()
 *
+0 −14
Original line number Diff line number Diff line
@@ -5161,20 +5161,6 @@ ivas_error ivas_allocate_binaural_hrtf(
    const int16_t allocate_init_flag                            /* i  : Memory allocation flag                          */
);

#ifdef DEBUGGING
void ivas_binaural_cldfb(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                  */
    float *output_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output  */
);

void ivas_binaural_cldfb_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                  */
    const int16_t n_samples_to_render,                          /* i  : output frame length per channel                         */
    const int16_t slot_size,                                    /* i  : JBM slot size                                           */
    float *output_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output  */
);
#endif

void ivas_binRenderer(
    BINAURAL_RENDERER_HANDLE hBinRenderer,                      /* i/o: binaural renderer handle                                */
    const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,          /* i/o: pose correction data handle                             */
Loading