Commit c2748af0 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main-pc' into 1704_basop_PortFlpMR1487

parents ceed256e 044fa947
Loading
Loading
Loading
Loading
+132 −191

File changed.

Preview size limit exceeded, changes collapsed.

+17 −0
Original line number Diff line number Diff line
@@ -12,16 +12,26 @@ variables:
  # They can be overwritten in the job templates to e.g. only test encoder or decoder in the chain
  DUT_ENCODER_PATH: "./IVAS_cod"
  DUT_DECODER_PATH: "./IVAS_dec"
  DUT_RENDERER_PATH: "./IVAS_rend"
  DUT_POST_RENDERER_PATH: "./ISAR_post_rend"
  REF_ENCODER_PATH: "./IVAS_cod_ref"
  REF_DECODER_PATH: "./IVAS_dec_ref"
  REF_RENDERER_PATH: "./IVAS_rend_ref"
  REF_POST_RENDERER_PATH: "./ISAR_post_rend_ref"
  MERGE_TARGET_ENCODER_PATH: "./IVAS_cod_merge_target"
  MERGE_TARGET_DECODER_PATH: "./IVAS_dec_merge_target"
  MERGE_TARGET_RENDERER_PATH: "./IVAS_rend_merge_target"
  MERGE_TARGET_POST_RENDERER_PATH: "./ISAR_post_rend_merge_target"
  # These path variables are used for building the binaries
  # They should never be overwritten!
  REF_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_ref"
  REF_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_ref"
  REF_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_rend_ref"
  REF_POST_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./ISAR_post_rend_ref"
  MERGE_TARGET_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_merge_target"
  MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_merge_target"
  MERGE_TARGET_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_rend_merge_target"
  MERGE_TARGET_POST_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./ISAR_post_rend_merge_target"
  LEVEL_SCALING: "1.0"
  BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch"
  PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm"
@@ -46,6 +56,9 @@ variables:
  FLOAT_REF_COMMIT_FILE: "float-ref-git-sha.txt"
  CUT_COMMIT_FILE: "CuT-git-sha.txt"
  MERGE_TARGET_COMMIT_FILE: "merge-target-git-sha.txt"
  RUNNER_TAG: "ivas-basop-linux"
  LOGS_BACKUP_SOURCE_DIR: ""
  LOGS_BACKUP_TARGET_DIR: ""
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec."
    value: 'default'
@@ -54,6 +67,7 @@ variables:
      - 'pytest-compare'
      - 'pytest-compare-enc-dmx'
      - 'pytest-compare-long'
      - 'pytest-compare-long-fx-fx'
      - 'pytest-compare-to-input'
      - 'pytest-saturation-smoke-test'
      - 'evs-26444'
@@ -62,4 +76,7 @@ variables:
      - 'complexity'
      - 'coverage'
      - 'voip-be-test'
      - 'renderer-framesize-be'
      - 'peaq-enc-passthrough'
      - 'long-term-logs'
      - 'backup-long-term-logs'
+93 −73
Original line number Diff line number Diff line
@@ -166,9 +166,7 @@ int main(
    IVAS_RENDER_FRAMESIZE asked_frame_size;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
#endif

#ifdef WMOPS
    reset_wmops();
@@ -497,7 +495,8 @@ int main(

            if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK )
            {
                return error;
                fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }

            if ( arg.renderFramesize != asked_frame_size )
@@ -572,20 +571,6 @@ int main(
            goto cleanup;
        }

        if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
#ifdef FIX_OLD_BINARY_FORMAT
                hrtfFileReader_close( &hrtfReader );
                strcat( arg.hrtfFileName, "new" );

                if ( hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                    goto cleanup;
                }

        if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
@@ -598,29 +583,7 @@ int main(
                destroy_td_hrtf( hHrtfTD );
            }
        }
#else
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
#endif
            }
            else
            {
                destroy_td_hrtf( hHrtfTD );
            }
        }

#ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
        if ( ( *hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
        }
#endif
#endif
        if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfCRendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -629,29 +592,6 @@ int main(

        if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_OLD_BINARY_FORMAT
            cleanup_SetOfHRTF( hSetOfHRTF );
            hrtfFileReader_close( &hrtfReader );
            strcat( arg.hrtfFileName, "new" );

            if ( hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                    goto cleanup;
                }
                else
                {
                    destroy_SetOfHRTF( hSetOfHRTF );
                }
            }
#else
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
@@ -661,7 +601,6 @@ int main(
            {
                destroy_SetOfHRTF( hSetOfHRTF );
            }
#endif
        }

        IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
@@ -703,8 +642,6 @@ int main(
                destroy_parambin_hrtf( hHrtfParambin );
            }
        }
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -722,14 +659,6 @@ int main(
                destroy_hrtf_statistics( hHrtfStatistics );
            }
        }
#else
        if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -2878,7 +2807,14 @@ static ivas_error decodeVoIP(
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        frame++;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        if ( vec_pos_update == 0 )
        {
            systemTime_ms += vec_pos_len * systemTimeInc_ms;
        }
#else
        systemTime_ms += systemTimeInc_ms;
#endif

#ifdef WMOPS
        update_mem();
@@ -2886,6 +2822,90 @@ static ivas_error decodeVoIP(
#endif
    }


#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t nSamplesFlushed = 0;

    /* decode and get samples */
    if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( nSamplesFlushed )
    {
        /* Write current frame */
        if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, nSamplesFlushed * nOutChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nOutput audio file writer error\n" );
            goto cleanup;
        }

        /* Write ISm metadata to external file(s) */
        if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
            if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
            {
                if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

                for ( i = 0; i < numObj; ++i )
                {
                    IVAS_ISM_METADATA IsmMetadata;

                    if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }

                    if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) );
                        goto cleanup;
                    }
                }
            }

            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
            {
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                int16_t fullDelayNumSamples[3];
                float delayMs;

                /* delayNumSamples is zeroed, and delayNumSamples_orig is updated only on first good frame, so need to re-fetch delay info */
                if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                }
#endif
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
                }
            }
        }
    }
#endif


    /*------------------------------------------------------------------------------------------*
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/
+1 −6
Original line number Diff line number Diff line
@@ -758,12 +758,7 @@ int main(
        }

        /* *** Encode one frame *** */
        if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits
#ifdef DBG_BITSTREAM_ANALYSIS
                                                     ,
                                                     frame
#endif
                                                     ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nencodeFrame failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
            goto cleanup;
+74 −62
Original line number Diff line number Diff line
@@ -682,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;
@@ -716,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;
@@ -727,7 +731,6 @@ int main(
    bitsBuffer.config.isar_frame_size_ms = 20;
    bitsBuffer.config.lc3plusHighRes = 0;


    CmdlnArgs args = parseCmdlnArgs( argc, argv );

    convert_backslash( args.inputFilePath );
@@ -738,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,14 +767,14 @@ int main(
                                        &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;
        }
    }

@@ -788,8 +791,8 @@ int main(
                                        &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;
    }
@@ -814,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;
@@ -836,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 )
@@ -864,8 +868,8 @@ int main(
                                                              bitsBuffer.config.isar_frame_size_ms,
                                                              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;
        }
    }

@@ -881,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;
        }
    }

@@ -890,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;
@@ -977,7 +981,7 @@ int main(
                else
                {
                    fprintf( stderr, "\nUnable to read from bitstream file!\n" );
                    exit( -1 );
                    goto cleanup;
                }
            }
        }
@@ -988,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;
            }
        }

@@ -1014,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 */
@@ -1037,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;
            }
        }

@@ -1054,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;
@@ -1095,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 )
@@ -1120,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;
            }
@@ -1155,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;
            }
        }

@@ -1163,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;
    }
@@ -1187,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 );
@@ -1218,7 +1230,7 @@ int main(
    print_mem( NULL );
#endif

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


Loading