Commit 591d92df authored by vaclav's avatar vaclav
Browse files

formatting around function calls related to SPLIT_REND_WITH_HEAD_ROT

parent 391151b1
Loading
Loading
Loading
Loading
Loading
+11 −16
Original line number Diff line number Diff line
@@ -2441,11 +2441,10 @@ static ivas_error decodeG192(
        if ( decodedGoodFrame )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
            if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
            {
                if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written,
                                                         splitRendBits.codec, splitRendBits.pose_correction,
                                                         splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK )
                                                         splitRendBits.codec, splitRendBits.pose_correction, splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nUnable to write to bitstream file!\n" );
                    goto cleanup;
@@ -2453,11 +2452,10 @@ static ivas_error decodeG192(
            }
            else
            {
                if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
                if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
                {
                    if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written,
                                                             splitRendBits.codec, splitRendBits.pose_correction,
                                                             splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK )
                                                             splitRendBits.codec, splitRendBits.pose_correction, splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nUnable to write to bitstream file!\n" );
                        goto cleanup;
@@ -2613,13 +2611,11 @@ static ivas_error decodeG192(
                goto cleanup;
            }


            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                       ,
                                                       DEFAULT_AXIS
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0 ) ) != IVAS_ERR_OK )
#endif
                                                       ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
@@ -2627,13 +2623,12 @@ static ivas_error decodeG192(
        }

        /* decode and get samples */
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples,

#ifdef SPLIT_REND_WITH_HEAD_ROT
                                       IVAS_DEC_PCM_INT16,
                                       (void *)
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#endif
                                           pcmBuf,
                                       &nSamplesFlushed ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
+29 −37
Original line number Diff line number Diff line
@@ -447,21 +447,16 @@ static void printSupportedAudioConfigs( void );

static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString );

static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                ,
                                const int16_t cldfb_in,
                                IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna
#endif
);
static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer, const int16_t cldfb_in, IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna );

static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                 ,
                                 const int16_t cldfb_in,
                                 IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn
static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer, const int16_t cldfb_in, IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn );
#else
static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer );

static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer );
#endif
);


/*------------------------------------------------------------------------------------------*
 * Local functions
@@ -902,12 +897,11 @@ int main(
    else
    {
        /* With single-format input, all information is given on command line. */
        setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                    ,
                                    &hSplitRendFileReadWrite
        setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders, &hSplitRendFileReadWrite );
#else
        setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders );
#endif
        );
    }

    /* Check that there is allowed configuration for MASA format output */
@@ -965,6 +959,7 @@ int main(
        inFileSampleRate = args.sampleRate;
    }
#endif

    switch ( error )
    {
        case IVAS_ERR_OK:
@@ -1016,8 +1011,7 @@ int main(
    IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS] = { 0 };
#endif

    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain,
                                   ( args.framing_5ms ) ? 1 : 4 ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, ( args.framing_5ms ) ? 1 : 4 ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
@@ -1311,12 +1305,11 @@ int main(
        }
    }

    const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                              ,
                                                              splitBinIds
    const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds, splitBinIds );
#else
    const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds );
#endif
    );

    if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels )
    {
@@ -1527,12 +1520,11 @@ int main(
        }

        /* Convert from int to float and from interleaved to packed */
        convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer
#ifdef SPLIT_REND_WITH_HEAD_ROT
                            ,
                            inBuffer.config.is_cldfb, cldfbAna
        convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer, inBuffer.config.is_cldfb, cldfbAna );
#else
        convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer );
#endif
        );

        int16_t num_subframes, sf_idx;
        num_subframes = ( args.framing_5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
@@ -1589,13 +1581,12 @@ int main(
                    fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
                if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos

#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                          ,
                                                          DEFAULT_AXIS
                if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos, sf_idx ) ) != IVAS_ERR_OK )
#endif
                                                          ,
                                                          sf_idx ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
@@ -1829,13 +1820,11 @@ int main(

        /* Convert from float to int and from packed to interleaved.
         * Values in outFloatBuffer are guaranteed to be within range INT16_MIN:INT16_MAX */
        convertOutputBuffer( outFloatBuffer, outBuffer.config.numSamplesPerChannel, num_out_channels, outInt16Buffer
#ifdef SPLIT_REND_WITH_HEAD_ROT
                             ,
                             cldfb_in,
                             cldfbSyn
        convertOutputBuffer( outFloatBuffer, outBuffer.config.numSamplesPerChannel, num_out_channels, outInt16Buffer, cldfb_in, cldfbSyn );
#else
        convertOutputBuffer( outFloatBuffer, outBuffer.config.numSamplesPerChannel, num_out_channels, outInt16Buffer );
#endif
        );

        if ( delayNumSamples == -1 )
        {
@@ -1850,6 +1839,7 @@ int main(
                    fprintf( stderr, "\nUnable to get delay of renderer!\n" );
                    exit( -1 );
                }

#ifdef SPLIT_REND_WITH_HEAD_ROT
                if ( is_split_post_rend_mode( &args ) && ( hSplitRendFileReadWrite != NULL ) )
                {
@@ -1858,6 +1848,7 @@ int main(
                    delayNumSamples += (int16_t) roundf( (float) pre_rend_delay_ns * delayTimeScale / 1000000000.f );
                }
#endif

                delayNumSamples_orig = delayNumSamples;
            }
            else
@@ -1868,7 +1859,7 @@ int main(
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( hSplitRendFileReadWrite != NULL ) && is_split_pre_rend_mode( &args ) )
        if ( is_split_pre_rend_mode( &args ) )
        {
            if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten,
                                                     bitsBuffer.config.codec, bitsBuffer.config.poseCorrection,
@@ -1878,6 +1869,7 @@ int main(
                exit( -1 );
            }
        }

        if ( audioWriter != NULL )
        {
#endif
+2 −2
Original line number Diff line number Diff line
@@ -2274,7 +2274,7 @@ ivas_error init_encoder(
    const ISM_MODE ism_mode          /* i  : ISM mode                               */
#ifdef IGF_MEMORY_ALLOC_OPT
    ,
    const int32_t element_brate
    const int32_t element_brate /* element bitrate                             */
#endif
);

+6 −8
Original line number Diff line number Diff line
@@ -1187,12 +1187,11 @@ ivas_error ivas_binRenderer_open(
    else
    {
        /* Allocate memories and buffers needed for convolutional module */
        if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                        ,
                                                        hBinRenderer->numPoses
        if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK )
#endif
                                                        ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -1421,12 +1420,11 @@ void ivas_binRenderer_close(

    if ( ( *hBinRenderer )->hBinRenConvModule != NULL )
    {
        ivas_binRenderer_convModuleClose( hBinRenderer
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                          ,
                                          ( *hBinRenderer )->numPoses
        ivas_binRenderer_convModuleClose( hBinRenderer, ( *hBinRenderer )->numPoses );
#else
        ivas_binRenderer_convModuleClose( hBinRenderer );
#endif
        );
    }

    if ( ( *hBinRenderer )->hReverb != NULL )
+7 −11
Original line number Diff line number Diff line
@@ -309,12 +309,11 @@ ivas_error ivas_dec(
            }
            else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
            {
                if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                       ,
                                                       0
                if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES, 0 ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK )
#endif
                                                       ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
@@ -815,15 +814,12 @@ ivas_error ivas_dec(
                }
                else
                {
#endif
                    if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig,
                                                           st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                           ,
                                                           0
                                                           st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES, 0 ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig,
                                                       st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK )
#endif
                                                           ) ) != IVAS_ERR_OK )

                    {
                        return error;
                    }
Loading