Commit 3fc58bbf authored by bayers's avatar bayers
Browse files

fix a few compiler warnings, fix split rendering

parent 5b2b2dba
Loading
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -441,6 +441,11 @@ int main(
     *--------------------------------------------------------------------*/

    IVAS_RENDER_CONFIG_DATA renderConfig;
    if ( ( error = IVAS_DEC_GetDefaultRenderConfig( &renderConfig ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_GetDefaultRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
    if ( arg.renderConfigEnabled )
    {
        /* sanity check */
@@ -459,13 +464,6 @@ int main(
            goto cleanup;
        }
#endif

        if ( ( error = IVAS_DEC_GetDefaultRenderConfig( &renderConfig ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetDefaultRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
@@ -515,7 +513,12 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec
#ifdef API_5MS_BASELINE
                                                      ,
                                                      renderConfig
#endif
                                                      ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
@@ -666,6 +669,7 @@ int main(
    IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode );
#endif /* DEBUGGING */

#ifndef API_5MS
    /*-------------------------------------------------------------------*
     * Load renderer configuration from file
     *--------------------------------------------------------------------*/
@@ -709,7 +713,7 @@ int main(
            goto cleanup;
        }
    }

#endif
    /*------------------------------------------------------------------------------------------*
     * Load custom loudspeaker layout data
     *------------------------------------------------------------------------------------------*/
+19 −9
Original line number Diff line number Diff line
@@ -693,6 +693,10 @@ ivas_error IVAS_DEC_Configure(

ivas_error IVAS_DEC_EnableSplitRendering(
    IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle                             */
#ifdef API_5MS_BASELINE
    ,
    IVAS_RENDER_CONFIG_DATA renderConfig
#endif
)
{
    DECODER_CONFIG_HANDLE hDecoderConfig;
@@ -709,7 +713,11 @@ ivas_error IVAS_DEC_EnableSplitRendering(
    hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig;

    hDecoderConfig->Opt_Headrotation = 1;
    hDecoderConfig->Opt_5ms = 0;
#ifdef API_5MS_BASELINE
    hDecoderConfig->Opt_5ms = ( ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) || renderConfig.split_rend_config.dof == 0 );
#endif


    hDecoderConfig->Opt_Limiter = 0;

    return error;
@@ -1277,7 +1285,8 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        error = IVAS_DEC_GetSamples(
            hIvasDec,
            numSamplesPerChannelToDecode,
            output_int,
            IVAS_DEC_PCM_FLOAT,
            pcmBuf,
            nOutSamples,
            needNewFrame );
        if ( error != IVAS_ERR_OK )
@@ -1286,17 +1295,17 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        }
        assert( numSamplesPerChannelToDecode == *nOutSamples );
#ifdef DEBUGGING
        dbgwrite( output_int, sizeof( int16_t ), numSamplesPerChannelToDecode * 2, 1, "res/output_int.pcm" );
        dbgwrite( output, sizeof( float ), numSamplesPerChannelToDecode * 2, 1, "res/output_float.pcm" );
#endif

        /* copy to cache if cache is in use */
        if ( hSplitBinRend->tdDataOut != NULL )
        {
            float *writePtr;
            int16_t *readPtr, *readEnd;
            float *readPtr, *readEnd;
            writePtr = hSplitBinRend->tdDataOut;
            readPtr = output_int + numSamplesPerChannelToSplitEncode * BINAURAL_CHANNELS * numPoses;
            readEnd = output_int + *nOutSamples * BINAURAL_CHANNELS * numPoses;
            readPtr = pcmBuf + numSamplesPerChannelToSplitEncode * BINAURAL_CHANNELS * numPoses;
            readEnd = pcmBuf + *nOutSamples * BINAURAL_CHANNELS * numPoses;

            while ( readPtr != readEnd )
            {
@@ -1310,11 +1319,11 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        /* copy from cache */
        assert( hSplitBinRend->tdDataOut != NULL );

        int16_t *writePtr;
        float *writePtr;
        float *readPtr, *readEnd;
        readPtr = hSplitBinRend->tdDataOut + ( numSamplesPerChannelCacheSize - hSplitBinRend->numTdSamplesPerChannelCached ) * BINAURAL_CHANNELS * numPoses;
        readEnd = readPtr + numSamplesPerChannelToSplitEncode * BINAURAL_CHANNELS * numPoses;
        writePtr = output_int;
        writePtr = pcmBuf;

        while ( readPtr != readEnd )
        {
@@ -2250,9 +2259,10 @@ ivas_error IVAS_DEC_GetRenderConfig(
    hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB;
    hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection;
#endif
#endif


    return IVAS_ERR_OK;
#endif
}

#ifdef API_5MS
+5 −1
Original line number Diff line number Diff line
@@ -387,6 +387,10 @@ ivas_error IVAS_DEC_EnableVoIP(
/*! r: error code */
ivas_error IVAS_DEC_EnableSplitRendering(
    IVAS_DEC_HANDLE hIvasDec               /* i/o: IVAS decoder handle                             */
#ifdef API_5MS_BASELINE
    ,
    IVAS_RENDER_CONFIG_DATA renderConfig   /* i  : render configuration                            */
#endif
);
#endif
#endif