Commit b8241ded authored by malenov's avatar malenov
Browse files

fixing TD object renderer

parent 8a2cd8ff
Loading
Loading
Loading
Loading
Loading
+26 −18
Original line number Diff line number Diff line
@@ -137,9 +137,13 @@ int main( int argc, char *argv[] )
    Decoder_Struct st_ivas_static;
    Decoder_Struct *st_ivas = &st_ivas_static;

    MixFrame = count_malloc( 2 * L_FRAME48k * sizeof( float ) );
    MixFrameWav = count_malloc( 2 * L_FRAME48k * sizeof( int16_t ) );
    input_buff = count_malloc( MAX_CICP_CHANNELS * L_FRAME48k * sizeof( int16_t ) );
#ifdef WMOPS
    reset_mem( USE_32BITS );
#endif

    MixFrame = malloc_( 2 * L_FRAME48k * sizeof( float ) );
    MixFrameWav = malloc_( 2 * L_FRAME48k * sizeof( int16_t ) );
    input_buff = malloc_( MAX_CICP_CHANNELS * L_FRAME48k * sizeof( int16_t ) );
    nChannels = 0;
#ifdef FIX_I214_CLIPPING_STANDALONE_REND
    noClipping = 0;
@@ -155,7 +159,6 @@ int main( int argc, char *argv[] )
        f_metadata[i] = NULL;
    }


    /*------------------------------------------------------------------------------------------*
     * Struct initializations
     *------------------------------------------------------------------------------------------*/
@@ -164,7 +167,7 @@ int main( int argc, char *argv[] )
    st_ivas->hHeadTrackData = NULL;
    st_ivas->ivas_format = ISM_FORMAT;
    f_quat_traj = NULL;
    if ( ( st_ivas->hDecoderConfig = (DECODER_CONFIG_HANDLE) count_malloc( sizeof( DECODER_CONFIG ) ) ) == NULL )
    if ( ( st_ivas->hDecoderConfig = (DECODER_CONFIG_HANDLE) malloc_( sizeof( DECODER_CONFIG ) ) ) == NULL )
    {
        return IVAS_ERR_FAILED_ALLOC;
    }
@@ -283,7 +286,7 @@ int main( int argc, char *argv[] )
                fprintf( stderr, "\nError: Unable to open metadata file %s \n\n", argv[i] );
                exit( -1 );
            }
            st_ivas->hIsmMetaData[j] = (ISM_METADATA_HANDLE) count_malloc( sizeof( ISM_METADATA_FRAME ) );
            st_ivas->hIsmMetaData[j] = (ISM_METADATA_HANDLE) malloc_( sizeof( ISM_METADATA_FRAME ) );
            i++;
        }
    }
@@ -316,11 +319,10 @@ int main( int argc, char *argv[] )
        usage_rend();
    }


    if ( f_quat_traj != NULL )
    {
        st_ivas->hDecoderConfig->Opt_Headrotation = 1;
        if ( ( st_ivas->hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) count_malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL )
        if ( ( st_ivas->hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc_( sizeof( HEAD_TRACK_DATA ) ) ) == NULL )
        {
            fprintf( stderr, "Can not allocate memory for head-tracking\n" );
            exit( -1 );
@@ -354,6 +356,7 @@ int main( int argc, char *argv[] )
    /*------------------------------------------------------------------------------------------*
     * Main rendering loop
     *------------------------------------------------------------------------------------------*/

    fprintf( stdout, "Rendering...\n" );
    while ( 1 )
    {
@@ -511,6 +514,10 @@ int main( int argc, char *argv[] )
        fwrite( MixFrameWav, sizeof( int16_t ), ( currFrameLength - offset ) * NumLdspks, f_output );
#endif

#ifdef WMOPS
        update_wmops();
#endif

        nFrameCount++;

        frame++;
@@ -527,12 +534,12 @@ int main( int argc, char *argv[] )
    fclose( f_input );
    fclose( f_output );

    count_free( MixFrame );
    count_free( MixFrameWav );
    count_free( input_buff );
    free_( MixFrame );
    free_( MixFrameWav );
    free_( input_buff );

    ivas_td_binaural_close( &st_ivas->hBinRendererTd );
    count_free( st_ivas->hDecoderConfig );
    free_( st_ivas->hDecoderConfig );
    st_ivas->hHrtfTD = NULL;

    /* ISM metadata handles */
@@ -540,23 +547,19 @@ int main( int argc, char *argv[] )
    {
        if ( st_ivas->hIsmMetaData[n] != NULL )
        {
            count_free( st_ivas->hIsmMetaData[n] );
            free_( st_ivas->hIsmMetaData[n] );
            st_ivas->hIsmMetaData[n] = NULL;
        }
    }

    if ( st_ivas->hHeadTrackData != NULL )
    {
        count_free( st_ivas->hHeadTrackData );
        free_( st_ivas->hHeadTrackData );
        fclose( f_quat_traj );
    }

    ivas_limiter_close( &st_ivas->hLimiter );

#ifdef RAM_COUNTING_TOOL
    mem_count_summary( USE_DEFAULT );
#endif

#ifdef DEBUGGING
    dbgclose();
#endif
@@ -568,6 +571,11 @@ int main( int argc, char *argv[] )
        fprintf( stderr, "*** Clipping on %d samples.\n", noClipping );
    }
#endif

#ifdef WMOPS
    print_mem( NULL );
#endif

    /* system( "pause" ); */
    return 0;
}