Commit c823b5b2 authored by malenovsky's avatar malenovsky
Browse files

Merge branch 'va/wmc_tool' into 'main'

Update of wmc tool [BE]

See merge request !307
parents e6d8da68 2dc1a18b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ stages:

.build-job-linux:
  stage: build
  timeout: "2 minutes"
  timeout: "4 minutes"
  tags:
    - ivas-linux

+2 −5
Original line number Diff line number Diff line
@@ -143,19 +143,16 @@
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="..\lib_debug\debug.c" />
    <ClCompile Include="..\lib_debug\memory.c" />
    <ClCompile Include="..\lib_debug\mem_count.c" />
    <ClCompile Include="..\lib_debug\snr.c" />
    <ClCompile Include="..\lib_debug\sba_debug.c" />
    <ClCompile Include="..\lib_debug\wmops.c" />
    <ClCompile Include="..\lib_debug\wmc_auto.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_debug\debug.h" />
    <ClInclude Include="..\lib_debug\deb_out.h" />
    <ClInclude Include="..\lib_debug\errorhnd.h" />
    <ClInclude Include="..\lib_debug\mem_count.h" />
    <ClInclude Include="..\lib_debug\sba_debug.h" />
    <ClInclude Include="..\lib_debug\wmops.h" />
    <ClInclude Include="..\lib_debug\wmc_auto.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
+14 −72
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@

*******************************************************************************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "options.h"
#include "lib_dec.h"
#include "cmdl_tools.h"
#include "audio_file_writer.h"
@@ -41,25 +45,14 @@
#include "head_rotation_file_reader.h"
#include "jbm_file_writer.h"
#include "evs_rtp_payload.h"
#include <stdio.h>
#include <string.h>
#ifdef WMOPS
#include "PROM_Size_lib_com.h"
#include "PROM_Size_lib_dec.h"
#include "wmops.h"
#endif
#ifdef RAM_COUNTING_TOOL
#include "mem_count.h"
#else
#include <stdlib.h>
#endif
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
#include "render_config_reader.h"


#define WMC_TOOL_MAN
#define WMC_TOOL_SKIP

/*------------------------------------------------------------------------------------------*
 * Local constants, enums, structures
@@ -137,41 +130,6 @@ static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeCha
#endif


#ifdef WMOPS
/*------------------------------------------------------------------------------------------*
 * Function to print complexity & memory estimates at the decoder
 *------------------------------------------------------------------------------------------*/

extern int16_t *ptr_base_stack;
extern int16_t *ptr_base_stack;
extern int16_t *ptr_max_stack;
extern int32_t wc_frame;
extern char location_max_stack[256];
void print_stack_call_tree( void );

static void print_mem_dec( size_t SRAM_size )
{
    fprintf( stdout, "\n\n --- Decoder memory usage ---  \n\n" );

    fprintf( stdout, "PROM size (decoder):                      %d words (or instructions)\n", PROM_Size_lib_dec );
    fprintf( stdout, "PROM size (common):                       %d words (or instructions)\n", PROM_Size_lib_com );
    fprintf( stdout, "Stack size (decoder):                     %ld words in %s() in frame #%d\n", ( ( ptr_base_stack - ptr_max_stack ) * sizeof( int16_t ) ) / sizeof( float ), location_max_stack, wc_frame );
    fprintf( stdout, "Table ROM size (decoder):                 %ld words\n", ( Const_Data_Size_rom_dec() + Const_Data_Size_ivas_rom_dec() ) / sizeof( float ) );
    fprintf( stdout, "Table ROM size (binaural renderer):       %ld words\n", ( Const_Data_Size_ivas_rom_binauralRen() + Const_Data_Size_ivas_rom_TdBinauralR() + Const_Data_Size_ivas_rom_binaural_cr() ) / sizeof( float ) );
    fprintf( stdout, "Table ROM size (common):                  %ld words\n", ( Const_Data_Size_rom_com() + Const_Data_Size_ivas_rom_com() ) / sizeof( float ) );
#ifdef RAM_COUNTING_TOOL
    fprintf( stdout, "Static RAM size (decoder):                %ld words\n\n", SRAM_size );
#endif
    print_stack_call_tree();

    fprintf( stdout, "Note: this is an optimistic estimate of the memory consumption assuming\n" );
    fprintf( stdout, "      that each variable (short, long or float) in the codec requires\n" );
    fprintf( stdout, "      32 bits of memory and may therefore be represented by 1 word.\n" );
    fprintf( stdout, "      The following formula is used: sizeof('memory array')/sizeof(float)\n\n" );
}
#endif


/*------------------------------------------------------------------------------------------*
 * main()
 *
@@ -200,18 +158,12 @@ int main(
#endif
#endif

#ifdef WMOPS
    size_t SRAM_size = 0;
    reset_stack();
    reset_wmops();
#endif

#ifdef DEBUGGING
    dbgargs( &argc, argv );
#endif

#ifdef RAM_COUNTING_TOOL
    mem_count_init( 0, USE_32BITS );
#ifdef WMOPS
    reset_wmops();
    reset_mem( USE_32BITS );
#endif

    /*------------------------------------------------------------------------------------------*
@@ -575,15 +527,9 @@ cleanup:
        fprintf( stderr, "\nError while closing file: %s\nContinuing...\n\n", arg.inputBitstreamFilename );
    }

#ifdef RAM_COUNTING_TOOL
#ifdef WMOPS
    SRAM_size =
#endif
        mem_count_summary( USE_DEFAULT );
#endif
#ifdef WMOPS
    print_wmops();
    print_mem_dec( SRAM_size );
    print_mem( NULL );
#endif

    if ( !arg.quietModeEnabled )
@@ -1672,10 +1618,8 @@ static ivas_error decodeG192(
        }
#ifdef WMOPS
        update_wmops();
#endif
#ifdef DEBUGGING
#ifdef RAM_ANALYSIS
        mem_analyze();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
#endif
    }
@@ -2241,10 +2185,8 @@ static ivas_error decodeVoIP(

#ifdef WMOPS
        update_wmops();
#endif
#ifdef DEBUGGING
#ifdef RAM_ANALYSIS
        mem_analyze();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
#endif
    }
+12 −68
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@

*******************************************************************************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "options.h"
#include "lib_enc.h"
#include "cmdl_tools.h"
#include "audio_file_reader.h"
@@ -37,24 +41,12 @@
#include "jbm_file_reader.h"
#include "masa_file_reader.h"
#include "ism_file_reader.h"
#include <stdio.h>
#include <string.h>
#ifdef WMOPS
#include "PROM_Size_lib_com.h"
#include "PROM_Size_lib_enc.h"
#include "wmops.h"
#endif
#ifdef RAM_COUNTING_TOOL
#include "mem_count.h"
#else
#include <stdlib.h>
#endif
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"

#define WMC_TOOL_MAN

#define WMC_TOOL_SKIP

/*------------------------------------------------------------------------------------------*
 * Local constants, enums, structures
@@ -154,40 +146,6 @@ static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar );
#endif


#ifdef WMOPS
/*------------------------------------------------------------------------------------------*
 * Function to print complexity & memory estimates at the encoder
 *------------------------------------------------------------------------------------------*/

extern int16_t *ptr_base_stack;
extern int16_t *ptr_base_stack;
extern int16_t *ptr_max_stack;
extern int32_t wc_frame;
extern char location_max_stack[256];
void print_stack_call_tree( void );

static void print_mem_enc( size_t SRAM_size )
{
    fprintf( stdout, "\n\n --- Encoder memory usage ---  \n\n" );

    fprintf( stdout, "PROM size (encoder):                      %d words (or instructions)\n", PROM_Size_lib_enc );
    fprintf( stdout, "PROM size (common):                       %d words (or instructions)\n", PROM_Size_lib_com );
    fprintf( stdout, "Stack size (encoder):                     %ld words in %s() in frame #%d\n", ( ( ptr_base_stack - ptr_max_stack ) * sizeof( int16_t ) ) / sizeof( float ), location_max_stack, wc_frame );
    fprintf( stdout, "Table ROM size (encoder):                 %ld words\n", ( Const_Data_Size_rom_enc() + Const_Data_Size_ivas_rom_enc() ) / sizeof( float ) );
    fprintf( stdout, "Table ROM size (common):                  %ld words\n", ( Const_Data_Size_rom_com() + Const_Data_Size_ivas_rom_com() ) / sizeof( float ) );
#ifdef RAM_COUNTING_TOOL
    fprintf( stdout, "Static RAM size (encoder):                %ld words\n\n", SRAM_size );
#endif
    print_stack_call_tree();

    fprintf( stdout, "Note: this is an optimistic estimate of the memory consumption assuming\n" );
    fprintf( stdout, "      that each variable (short, long or float) in the codec requires\n" );
    fprintf( stdout, "      32 bits of memory and may therefore be represented by 1 word.\n" );
    fprintf( stdout, "      The following formula is used: sizeof('memory array')/sizeof(float)\n\n" );
}
#endif


/*------------------------------------------------------------------------------------------*
 * main()
 *
@@ -224,18 +182,12 @@ int main(
#endif
#endif

#ifdef WMOPS
    size_t SRAM_size = 0;
    reset_wmops();
    reset_stack();
#endif

#ifdef DEBUGGING
    dbgargs( &argc, argv );
#endif

#ifdef RAM_COUNTING_TOOL
    mem_count_init( 0, USE_32BITS );
#ifdef WMOPS
    reset_wmops();
    reset_mem( USE_32BITS );
#endif

    initArgStruct( &arg );
@@ -765,10 +717,8 @@ int main(

#ifdef WMOPS
        update_wmops();
#endif
#ifdef DEBUGGING
#ifdef RAM_ANALYSIS
        mem_analyze();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
#endif
    }
@@ -834,15 +784,9 @@ cleanup:

    IVAS_ENC_Close( &hIvasEnc );

#ifdef RAM_COUNTING_TOOL
#ifdef WMOPS
    SRAM_size =
#endif
        mem_count_summary( USE_DEFAULT );
#endif
#ifdef WMOPS
    print_wmops();
    print_mem_enc( SRAM_size );
    print_mem( NULL );
#endif

#ifdef DEBUGGING
+28 −77
Original line number Diff line number Diff line
@@ -30,6 +30,13 @@

*******************************************************************************************************/

#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "options.h"
#include "audio_file_reader.h"
#include "audio_file_writer.h"
@@ -44,23 +51,7 @@
#include "masa_file_reader.h"
#include "prot.h"
#include "render_config_reader.h"
#ifdef WMOPS
#include "PROM_Size_lib_rend.h"
#include "wmops.h"
#endif
#ifdef DEBUGGING
#include "debug.h"
#endif
#ifdef RAM_COUNTING_TOOL
#include "mem_count.h"
#endif
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "wmc_auto.h"


#define RENDERER_MAX_CLI_ARG_LENGTH       ( FILENAME_MAX )
@@ -78,37 +69,6 @@ static
#define SEP_FOLDER '/'
#endif

#ifdef WMOPS
void print_stack_call_tree( void );
int Const_Data_Size_ivas_rom_rend( void );
extern int16_t *ptr_base_stack;
extern int16_t *ptr_max_stack;
extern int32_t wc_frame;
extern char location_max_stack[256];

/*------------------------------------------------------------------------------------------*
 * Function to print complexity & memory estimates
 *------------------------------------------------------------------------------------------*/
static void print_mem_renderer( size_t SRAM_size )
{
    fprintf( stdout, "\n\n --- Renderer memory usage ---  \n\n" );

    fprintf( stdout, "PROM size (renderer):                     %d words (or instructions)\n", PROM_Size_lib_rend );
    fprintf( stdout, "Stack size:                               %d words in %s() in frame #%d\n", ( ptr_base_stack - ptr_max_stack ) * sizeof( int16_t ) / sizeof( float ), location_max_stack, wc_frame );
    fprintf( stdout, "Table ROM size(renderer):                 %d words\n", ( Const_Data_Size_ivas_rom_rend() ) / sizeof( float ) );
    fprintf( stdout, "Table ROM size (binaural renderer):       %ld words\n", ( Const_Data_Size_ivas_rom_binauralRen() + Const_Data_Size_ivas_rom_TdBinauralR() + Const_Data_Size_ivas_rom_binaural_cr() ) / sizeof( float ) );
#ifdef RAM_COUNTING_TOOL
    fprintf( stdout, "Static RAM size:                          %d words\n\n", SRAM_size );
#endif
    print_stack_call_tree();

    fprintf( stdout, "Note: this is an optimistic estimate of the memory consumption assuming\n" );
    fprintf( stdout, "      that each variable (short, long or float) in the codec requires\n" );
    fprintf( stdout, "      32 bits of memory and may therefore be represented by 1 word.\n" );
    fprintf( stdout, "      The following formula is used: sizeof('memory array')/sizeof(float)\n\n" );
}
#endif

typedef struct
{
    uint32_t frameCounter;
@@ -571,17 +531,10 @@ int main(
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
    ivas_error error = IVAS_ERR_OK;
#ifdef WMOPS
    size_t SRAM_size;
#endif

#ifdef WMOPS
    reset_wmops();
    reset_stack();
#endif

#ifdef RAM_COUNTING_TOOL
    mem_count_init( 0, USE_32BITS );
    reset_mem( USE_32BITS );
#endif

    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
@@ -809,10 +762,10 @@ int main(

    inBufferSize = frameSize_smpls * totalNumInChannels;
    outBufferSize = frameSize_smpls * numOutChannels;
    inpInt16Buffer = count_malloc( inBufferSize * sizeof( int16_t ) );
    inFloatBuffer = count_malloc( inBufferSize * sizeof( float ) );
    outInt16Buffer = count_malloc( outBufferSize * sizeof( int16_t ) );
    outFloatBuffer = count_malloc( outBufferSize * sizeof( float ) );
    inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) );
    inFloatBuffer = malloc( inBufferSize * sizeof( float ) );
    outInt16Buffer = malloc( outBufferSize * sizeof( int16_t ) );
    outFloatBuffer = malloc( outBufferSize * sizeof( float ) );

    inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls;
    inBuffer.config.numChannels = (int16_t) totalNumInChannels;
@@ -823,6 +776,7 @@ int main(
    outBuffer.data = outFloatBuffer;

#ifdef WMOPS
    reset_stack();
    reset_wmops();
#endif

@@ -1013,6 +967,9 @@ int main(

#ifdef WMOPS
        update_wmops();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
#endif
    }

@@ -1044,10 +1001,10 @@ int main(
#endif

    /* === Close === */
    count_free( inpInt16Buffer );
    count_free( inFloatBuffer );
    count_free( outInt16Buffer );
    count_free( outFloatBuffer );
    free( inpInt16Buffer );
    free( inFloatBuffer );
    free( outInt16Buffer );
    free( outFloatBuffer );
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        MasaFileReader_close( &masaReaders[i] );
@@ -1060,15 +1017,9 @@ int main(
    IsmPositionProvider_close( positionProvider );
    RenderConfigReader_close( &renderConfigReader );

#ifdef RAM_COUNTING_TOOL
#ifdef WMOPS
    SRAM_size =
#endif
        mem_count_summary( USE_DEFAULT );
#endif
#ifdef WMOPS
    print_wmops();
    print_mem_renderer( SRAM_size );
    print_mem( NULL );
#endif

    return 0;
@@ -1597,7 +1548,7 @@ IsmPositionProvider *IsmPositionProvider_open(
    IsmPositionProvider *ipp;
    uint16_t i;

    ipp = (IsmPositionProvider *) count_malloc( sizeof( IsmPositionProvider ) );
    ipp = (IsmPositionProvider *) malloc_( sizeof( IsmPositionProvider ) );
    ipp->frameCounter = 0;
    ipp->numObjects = 0;

@@ -1714,16 +1665,16 @@ void IsmPositionProvider_close( IsmPositionProvider *positionProvider )

        if ( positionProvider->positions[i] != NULL )
        {
            count_free( positionProvider->positions[i] );
            free( positionProvider->positions[i] );
        }

        if ( positionProvider->positionDurations[i] != NULL )
        {
            count_free( positionProvider->positionDurations[i] );
            free( positionProvider->positionDurations[i] );
        }
    }

    count_free( positionProvider );
    free( positionProvider );

    return;
}
@@ -1972,8 +1923,8 @@ static void parseIsm(
    if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 )
    {
        positionProvider->numPositions[idx] = numberOfObjectPositionsToRead;
        positionProvider->positions[idx] = count_malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) );
        positionProvider->positionDurations[idx] = count_malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) );
        positionProvider->positions[idx] = malloc_( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) );
        positionProvider->positionDurations[idx] = malloc_( numberOfObjectPositionsToRead * sizeof( uint16_t ) );

        for ( i = 0; i < numberOfObjectPositionsToRead; ++i )
        {
Loading