Commit 39f0380b authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

Merge branch 'main-pc' of https://forge.3gpp.org/rep/sa4/audio/ivas-basop into...

Merge branch 'main-pc' of https://forge.3gpp.org/rep/sa4/audio/ivas-basop into 1738_basop_port_fl1429
parents 5575a014 0b2c7a94
Loading
Loading
Loading
Loading
Loading
+30 −25
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@ variables:
  SHORT_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_basop_encoder.prm"
  LONG_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_ltv_basop_encoder.prm"
  TEST_SUITE: ""
  DISABLE_HRTF_MODEL_TESTS: ""
  # DISABLE_HRTF_MODEL_TESTS: "-k not model" #enable this declaration to disable HRTF model from file tests

  # These path variables are used by the pytest calls.
  # They can be overwritten in the job templates to e.g. only test encoder or decoder in the chain
  DUT_ENCODER_PATH: "./IVAS_cod"
@@ -29,7 +32,7 @@ variables:
  MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_merge_target"
  LEVEL_SCALING: "1.0"
  IVAS_PIPELINE_NAME: ''
  BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch"
  BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch-pc"
  PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm"
  TESTCASE_TIMEOUT_STV: 900
  TESTCASE_TIMEOUT_LTV: 2400
@@ -273,9 +276,11 @@ stages:
  - sed -i '/fetch/d' .git/config # Remove all fetch lines to clean out dead links
  - git remote set-branches --add origin $BASOP_CI_BRANCH_PC_REPO # Add currently used branch
  - git fetch
  - git restore --staged . # Needed if HRTF model files were updated.
  - git restore . # Just as a precaution
  - git checkout $BASOP_CI_BRANCH_PC_REPO
  - git pull origin $BASOP_CI_BRANCH_PC_REPO

  - cd -
  - cp -r $SCRIPTS_DIR/ci .
  - cp -r $SCRIPTS_DIR/scripts .
@@ -688,11 +693,11 @@ stages:
    - *check-up-to-date-in-comparison-jobs

    - exit_code_target=0
    - python3 -m pytest $TEST_SUITE -v --update_ref 1 --create_ref -n auto --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH > $PYTEST_LOG_TARGET_BRANCH || exit_code_target=$?
    - python3 -m pytest $TEST_SUITE -v --update_ref 1 --create_ref -n auto --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH $DISABLE_HRTF_MODEL_TESTS > $PYTEST_LOG_TARGET_BRANCH || exit_code_target=$?

    - exit_code=0
    - rm -rf .pytest_cache || true
    - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$?
    - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout $DISABLE_HRTF_MODEL_TESTS > pytest_log.txt || exit_code=$?

    - if [ $exit_code -ne 0 ]; then
    -   exit_code=$EXIT_CODE_NON_BE
@@ -1051,7 +1056,7 @@ branch-is-up-to-date-with-target-pre:
  stage: prevalidate
  needs: []
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *get-commits-behind-count
    - echo $commits_behind_count
@@ -1066,7 +1071,7 @@ branch-is-up-to-date-with-target-post:
    - .rules-merge-request-to-main-pc
  stage: postvalidate
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *get-commits-behind-count
    - echo $commits_behind_count
@@ -1096,7 +1101,7 @@ check-naming-of-branch-for-main-pc-merges:
    - .rules-merge-request-to-main-pc
  stage: prevalidate
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *update-scripts-repo
    - if [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[skip[[:space:]_-]name[[:space:]_-]check\] ]] && [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[CI\] ]]; then
@@ -1113,7 +1118,7 @@ branch-is-up-to-date-with-target-pre:
  stage: prevalidate
  needs: []
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *get-commits-behind-count
    - |
@@ -1127,7 +1132,7 @@ branch-is-up-to-date-with-target-post:
    - .rules-merge-request
  stage: postvalidate
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *get-commits-behind-count
    - |
@@ -1149,7 +1154,7 @@ clang-format-check:
    ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix"
  stage: prevalidate
  tags:
    - ivas-basop-linux
    - ivas-linux
  needs: []
  timeout: "5 minutes"
  script:
@@ -1232,7 +1237,7 @@ build-codec-linux-make:
  extends:
    - .build-job-linux
  tags:
    - ivas-basop-linux
    - ivas-linux
  timeout: "10 minutes"
  script:
    - *print-common-info
@@ -1250,7 +1255,7 @@ build-codec-linux-cmake:
  extends:
    - .build-job-linux
  tags:
    - ivas-basop-linux
    - ivas-linux
  timeout: "10 minutes"
  script:
    - *print-common-info
@@ -1271,7 +1276,7 @@ build-codec-linux-instrumented-make:
    - .build-job-linux
  timeout: "10 minutes"
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *print-common-info
    - *update-scripts-repo
@@ -1285,7 +1290,7 @@ build-codec-sanitizers-linux:
    - .build-job-linux
    - .rules-basis
  tags:
    - ivas-basop-linux
    - ivas-linux
  timeout: "10 minutes"
  script:
    - *update-scripts-repo
@@ -1702,7 +1707,7 @@ ivas-pytest-enc-msan:
  extends:
    - .test-job-linux
  tags:
    - ivas-basop-linux-fast
    - ivas-linux-fast
  before_script:
    - CLANG_NUM=1
    - DUT_DECODER_PATH=./$REF_DECODER_PATH
@@ -1713,7 +1718,7 @@ ivas-pytest-enc-asan:
  extends:
    - .test-job-linux
  tags:
    - ivas-basop-linux-fast
    - ivas-linux-fast
  before_script:
    - CLANG_NUM=2
    - DUT_DECODER_PATH=./$REF_DECODER_PATH
@@ -1724,7 +1729,7 @@ ivas-pytest-enc-usan:
  extends:
    - .test-job-linux
  tags:
    - ivas-basop-linux-fast
    - ivas-linux-fast
  before_script:
    - CLANG_NUM=3
    - DUT_DECODER_PATH=./$REF_DECODER_PATH
@@ -1792,7 +1797,7 @@ ivas-pytest-dec-msan:
  extends:
    - .test-job-linux
  tags:
    - ivas-basop-linux-fast
    - ivas-linux-fast
  before_script:
    - CLANG_NUM=1
    - DUT_ENCODER_PATH=./$REF_ENCODER_PATH
@@ -1803,7 +1808,7 @@ ivas-pytest-dec-asan:
  extends:
    - .test-job-linux
  tags:
    - ivas-basop-linux-fast
    - ivas-linux-fast
  before_script:
    - CLANG_NUM=2
    - DUT_ENCODER_PATH=./$REF_ENCODER_PATH
@@ -1814,7 +1819,7 @@ ivas-pytest-dec-usan:
  extends:
    - .test-job-linux
  tags:
    - ivas-basop-linux-fast
    - ivas-linux-fast
  before_script:
    - CLANG_NUM=3
    - DUT_ENCODER_PATH=./$REF_ENCODER_PATH
@@ -2094,7 +2099,7 @@ voip-be-on-merge-request:
    - .rules-merge-request-no-draft
  timeout: "20 minutes"
  tags:
    - ivas-basop-linux
    - ivas-linux
  stage: test
  needs: ["build-codec-linux-make"] #, "build-codec-instrumented-linux", "build-codec-sanitizers-linux"]
  script:
@@ -2128,7 +2133,7 @@ renderer-pytest-on-merge-request:
  # TODO: set reasonable timeout, will most likely take less
  timeout: "20 minutes"
  tags:
    - ivas-basop-linux
    - ivas-linux
  stage: compare
  script:
    - *print-common-info
@@ -2188,7 +2193,7 @@ ivas-pytest-on-merge-request:
  needs: ["build-codec-linux-make"] #, "codec-smoke-test"]
  timeout: "40 minutes"
  tags:
    - ivas-basop-linux
    - ivas-linux
  script:
    - *print-common-info
    - *get-commits-behind-count
@@ -2209,7 +2214,7 @@ ivas-pytest-on-merge-request:

    ### prepare pytest
    # create references
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 $DISABLE_HRTF_MODEL_TESTS

    ### Run test using branch scripts and input
    - if [ $ref_using_target == 1 ]; then git checkout $source_branch_commit_sha; fi
@@ -2217,7 +2222,7 @@ ivas-pytest-on-merge-request:
    ### run pytest
    - exit_code=0
    - testcase_timeout=600
    - 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=$?
    - 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 $DISABLE_HRTF_MODEL_TESTS || exit_code=$?
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true

    - *merge-request-comparison-check
@@ -2681,7 +2686,7 @@ complexity-osba-in-binaural_room_ir-out:
pages:
  stage: deploy
  tags:
    - ivas-basop-linux
    - ivas-linux
  rules:
    - if: $UPDATE_PAGES
  script:
+26 −231

File changed.

Preview size limit exceeded, changes collapsed.

+0 −4
Original line number Diff line number Diff line
@@ -681,11 +681,7 @@ int main(
        {
            if ( ( error = JbmFileReader_readCAconfig( jbmReader, &caConfig ) ) != IVAS_ERR_OK )
            {
#ifdef FIX_699_FILE_READER_JBM_TSM
                fprintf( stderr, "\nError (%s) while reading Channel-Aware Config. from: %s\n\n", IVAS_ENC_GetErrorMessage( error ), JbmFileReader_getFilePath( jbmReader ) );
#else
                fprintf( stderr, "JbmFileReader_readCAconfig() failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
#endif
                goto cleanup;
            }

+81 −106
Original line number Diff line number Diff line
@@ -33,17 +33,6 @@
#include "lib_isar_post_rend.h"
//#undef IVAS_FLOAT_FIXED

#ifndef SPLIT_REND_WITH_HEAD_ROT

int main( int argc, char **argv )
{
    (void) argc;
    (void) argv;
    ISAR_POST_REND_void_func();
    return 0;
}

#else

#include <assert.h>
#include <math.h>
@@ -693,19 +682,20 @@ int main(
    int argc,
    char **argv )
{
    ISAR_POST_REND_HANDLE hIsarPostRend;
    bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */
    ISAR_POST_REND_HANDLE hIsarPostRend = NULL;
    RotFileReader *headRotReader = NULL;
    RotFileReader *externalOrientationFileReader = NULL;
    SplitRendBFIFileReader *splitRendBFIReader = NULL;
    AudioFileReader *audioReader = NULL;
    AudioFileWriter *audioWriter;
    AudioFileWriter *audioWriter = NULL;
    int32_t inBufferSize;
    int32_t outBufferSize;
    int32_t bitsBufferSize;
    int16_t *inpInt16Buffer;
    Word32 *inFloatBuffer_fx;
    int16_t *outInt16Buffer;
    Word32 *outFloatBuffer_fx;
    int16_t *inpInt16Buffer = NULL;
    Word32 *inFloatBuffer_fx = NULL;
    int16_t *outInt16Buffer = NULL;
    Word32 *outFloatBuffer_fx = NULL;
    uint8_t *bitsBufferData = NULL;
    IVAS_REND_AudioBuffer inBuffer;
    IVAS_REND_AudioBuffer outBuffer;
@@ -727,6 +717,9 @@ int main(
    reset_mem( USE_BYTES );
#endif

    inBuffer.pq_fact = NULL;
    outBuffer.pq_fact = NULL;

    hSplitRendFileReadWrite = NULL;
    bitsBuffer.bits = NULL;
    bitsBuffer.config.bitsRead = 0;
@@ -734,14 +727,9 @@ int main(
    bitsBuffer.config.bufLenInBytes = 0;
    bitsBuffer.config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
    bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    bitsBuffer.config.codec_frame_size_ms = 5;
    bitsBuffer.config.isar_frame_size_ms = 20;
    bitsBuffer.config.lc3plusHighRes = 0;
#else
    bitsBuffer.config.codec_frame_size_ms = 20;
#endif


    CmdlnArgs args = parseCmdlnArgs( argc, argv );

@@ -753,8 +741,8 @@ int main(
    {
        if ( RotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath );
            exit( -1 );
            fprintf( stderr, "\nError opening file: %s\n", args.headRotationFilePath );
            goto cleanup;
        }
    }

@@ -764,9 +752,7 @@ int main(
        SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader );
    }

#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    int32_t inFileSampleRate = 0;
#endif
    strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 );
    hSplitRendFileReadWrite = NULL;
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
@@ -775,24 +761,20 @@ int main(
                                        args.inMetadataFilePaths[0],
                                        &bitsBuffer.config.codec,
                                        &bitsBuffer.config.poseCorrection,
                                        &bitsBuffer.config.codec_frame_size_ms
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
                                        ,
                                        &bitsBuffer.config.codec_frame_size_ms,
                                        &bitsBuffer.config.isar_frame_size_ms,
                                        &inFileSampleRate,
                                        &bitsBuffer.config.lc3plusHighRes
#endif
        );
                                        &bitsBuffer.config.lc3plusHighRes );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] );
            exit( -1 );
            fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.inMetadataFilePaths[0] );
            goto cleanup;
        }

        if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error opening file: %s\n", audioFilePath );
            exit( -1 );
            fprintf( stderr, "\nError opening file: %s\n", audioFilePath );
            goto cleanup;
        }
    }

@@ -803,33 +785,23 @@ int main(
                                        args.inputFilePath,
                                        &bitsBuffer.config.codec,
                                        &bitsBuffer.config.poseCorrection,
                                        &bitsBuffer.config.codec_frame_size_ms
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
                                        ,
                                        &bitsBuffer.config.codec_frame_size_ms,
                                        &bitsBuffer.config.isar_frame_size_ms,
                                        &inFileSampleRate,
                                        &bitsBuffer.config.lc3plusHighRes
#endif
        );
                                        &bitsBuffer.config.lc3plusHighRes );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath );
            exit( -1 );
            fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.inputFilePath );
            goto cleanup;
        }
        audioReader = NULL;
    }

#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS
    int32_t inFileSampleRate = 0;
#endif
    if ( audioReader != NULL )
    {
        error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate );
    }
    else
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
        if ( hSplitRendFileReadWrite == NULL )
#endif
    else if ( hSplitRendFileReadWrite == NULL )
    {
        inFileSampleRate = args.sampleRate;
    }
@@ -845,20 +817,20 @@ int main(
            /* else if sampling rate given on command line, compare with wav file */
            else if ( inFileSampleRate != args.sampleRate )
            {
                fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath );
                exit( -1 );
                fprintf( stderr, "\nSampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath );
                goto cleanup;
            }
            break;
        case IVAS_ERR_SAMPLING_RATE_UNKNOWN: /* Returned when input is raw PCM */
            if ( args.sampleRate == 0 )
            {
                fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" );
                exit( -1 );
                fprintf( stderr, "\nSampling rate must be specified on command line when using raw PCM input\n" );
                goto cleanup;
            }
            break;
        default:
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
            fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
    }

    int16_t inFileNumChannels = 0;
@@ -867,23 +839,24 @@ int main(
        error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels );
        if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
            fprintf( stderr, "\nAudioFileReader_getNumChannels failed: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
    }

    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL;
    if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
        fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
    }

    /* === Configure === */
    if ( ( error = ISAR_POST_REND_InitConfig( hIsarPostRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
        fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
    }

    if ( args.inConfig.numBinBuses > 0 )
@@ -891,16 +864,12 @@ int main(
        if ( ( error = ISAR_REND_SetSplitRendBitstreamHeader( hIsarPostRend,
                                                              bitsBuffer.config.codec,
                                                              bitsBuffer.config.poseCorrection,
                                                              bitsBuffer.config.codec_frame_size_ms
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
                                                              ,
                                                              bitsBuffer.config.codec_frame_size_ms,
                                                              bitsBuffer.config.isar_frame_size_ms,
                                                              bitsBuffer.config.lc3plusHighRes
#endif
                                                              ) ) != IVAS_ERR_OK )
                                                              bitsBuffer.config.lc3plusHighRes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error in getting split renderer bitstream header: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
            fprintf( stderr, "\nError in getting split renderer bitstream header: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
    }

@@ -916,8 +885,8 @@ int main(
    {
        if ( ( error = ISAR_POST_REND_AddInput( hIsarPostRend, args.inConfig.binBuses[i].audioConfig, &splitBinIds[i] ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
            fprintf( stderr, "\nISAR_POST_REND_AddInput failed: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
    }

@@ -925,16 +894,16 @@ int main(

    if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels )
    {
        fprintf( stderr, "Number of channels in input file does not match selected configuration\n" );
        exit( -1 );
        fprintf( stderr, "\nNumber of channels in input file does not match selected configuration\n" );
        goto cleanup;
    }

    int16_t numOutChannels = 2;

    if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath );
        exit( -1 );
        fprintf( stderr, "\nFailed to open file: %s\n", args.outputFilePath );
        goto cleanup;
    }

    inBufferSize = frameSize_smpls * totalNumInChannels;
@@ -1012,7 +981,7 @@ int main(
                else
                {
                    fprintf( stderr, "\nUnable to read from bitstream file!\n" );
                    exit( -1 );
                    goto cleanup;
                }
            }
        }
@@ -1023,7 +992,7 @@ int main(
            if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError reading from file %s\n", audioFilePath );
                exit( -1 );
                goto cleanup;
            }
        }

@@ -1049,21 +1018,21 @@ int main(

                IF( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                    fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }

                if ( ( error = ISAR_POST_REND_SetHeadRotation( hIsarPostRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                    fprintf( stderr, "\nError setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }
            }
        }
        else
        {
            fprintf( stderr, "Head Rotation should be enabled in post renderer\n" );
            exit( -1 );
            fprintf( stderr, "\nHead Rotation should be enabled in post renderer\n" );
            goto cleanup;
        }

        /* Read from split renderer bfi file if specified */
@@ -1072,14 +1041,14 @@ int main(
            int16_t bfi;
            if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) );
                exit( -1 );
                fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                exit( -1 );
                fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
        }

@@ -1089,31 +1058,32 @@ int main(
            {
                if ( ( error = ISAR_POST_REND_GetInputNumChannels( hIsarPostRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                    fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }

                ISAR_POST_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.binBuses[i].inputChannelIndex, numChannels );

                if ( ( error = ISAR_POST_REND_FeedInputAudio( hIsarPostRend, splitBinIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                    fprintf( stderr, "\nISAR_POST_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }
            }
            if ( splitBinNeedsNewFrame )
            {
                if ( ( error = ISAR_POST_REND_FeedSplitBinauralBitstream( hIsarPostRend, splitBinIds[i], &bitsBuffer ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                    fprintf( stderr, "\nISAR_POST_REND_FeedSplitBinauralBitstream failed: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }
            }
        }

        if ( ( error = ISAR_POST_REND_GetSplitBinauralSamples( hIsarPostRend, outBuffer, &splitBinNeedsNewFrame ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
            fprintf( stderr, "\nISAR_POST_REND_GetSplitBinauralSamples failed: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

        int16_t num_out_channels;
@@ -1130,7 +1100,7 @@ int main(
                if ( ISAR_POST_REND_GetDelay( hIsarPostRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nUnable to get delay of renderer!\n" );
                    exit( -1 );
                    goto cleanup;
                }

                if ( hSplitRendFileReadWrite != NULL )
@@ -1155,8 +1125,8 @@ int main(
            {
                if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath );
                    exit( -1 );
                    fprintf( stderr, "\nError writing audio file %s\n", args.outputFilePath );
                    goto cleanup;
                }
                delayNumSamples = 0;
            }
@@ -1190,7 +1160,7 @@ int main(
            if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nOutput audio file writer error\n" );
                exit( -1 );
                goto cleanup;
            }
        }

@@ -1198,7 +1168,7 @@ int main(
        if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nOutput audio file writer error\n" );
            exit( -1 );
            goto cleanup;
        }
        zeroPadToWrite = 0;
    }
@@ -1222,7 +1192,14 @@ int main(
    }
#endif

    /* === Close === */
    /*------------------------------------------------------------------------------------------*
     * Close files and deallocate resources
     *------------------------------------------------------------------------------------------*/

    mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */

cleanup:

    free( inpInt16Buffer );
    free( inFloatBuffer_fx );
    free( inBuffer.pq_fact );
@@ -1253,10 +1230,8 @@ int main(
    print_mem( NULL );
#endif

    return 0;
    return mainFailed ? -1 : 0;
}


#undef WMC_TOOL_SKIP

#endif /* SPLIT_REND_WITH_HEAD_ROT */
+296 −462

File changed.

Preview size limit exceeded, changes collapsed.

Loading