Commit bf3548a2 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'main' of forge.3gpp.org:ivas-codec-pc/ivas-codec into...

Merge branch 'main' of forge.3gpp.org:ivas-codec-pc/ivas-codec into 1050-memory-optimization-efap-handle-in-ism-decoder
parents ce798af9 5d55224d
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@
    </Lib>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="..\lib_util\aeid_file_reader.c" />
    <ClCompile Include="..\lib_util\audio_file_reader.c" />
    <ClCompile Include="..\lib_util\audio_file_writer.c" />
    <ClCompile Include="..\lib_util\bitstream_reader.c" />
@@ -126,6 +127,7 @@
    <ClCompile Include="..\lib_util\tsm_scale_file_reader.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_util\aeid_file_reader.h" />
    <ClInclude Include="..\lib_util\audio_file_reader.h" />
    <ClInclude Include="..\lib_util\audio_file_writer.h" />
    <ClInclude Include="..\lib_util\bitstream_reader.h" />
+12 −51
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "split_render_file_read_write.h"
#endif
@@ -1543,65 +1546,25 @@ static bool parseCmdlIVAS_dec(
            if ( !is_digits_only( argv[i] ) )
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                uint16_t k;
                char *s = argv[i];
                char *token = argv[i];
                aeidFileReader *aeidReader = NULL;

                for ( k = 0; s[k]; )
                if ( aeidFileReader_open( argv[i], &aeidReader ) != IVAS_ERR_OK )
                {
                    s[k] == ',' ? k++ : *s++;
                }
                k++;

                if ( k == 0 )
                {
                    fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", argv[i] );
                    fprintf( stderr, "\nError: Can't open aeid file %s \n", argv[i] );
                    usage_dec();
                    return false;
                }

                if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) * k ) ) ||
                     NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) * k ) ) )
                if ( aeidFileReading( aeidReader, &arg->aeSequence.count, &arg->aeSequence.pID, &arg->aeSequence.pValidity ) != IVAS_ERR_OK )
                {
                    fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] );
                    fprintf( stderr, "\nError while reading aeid from %s\n", argv[i] );
                    usage_dec();
                    return false;
                }

                arg->aeSequence.count = k;

                k = 0;
                token = strtok( argv[i++], ":" );

                while ( token != NULL )
                {
                    if ( !is_number( token ) )
                    {
                        fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] );
                        usage_dec();
                        return false;
                    }
                    arg->aeSequence.pID[k] = (uint16_t) atoi( token );
                aeidFileReader_close( &aeidReader );

                    token = strtok( NULL, "," );
                    if ( !is_number( token ) )
                    {
                        fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] );
                        usage_dec();
                        return false;
                    }
                    arg->aeSequence.pValidity[k] = (uint16_t) atoi( token );

                    token = strtok( NULL, ":" );
                    k++;
                }

                if ( k != arg->aeSequence.count )
                {
                    fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", argv[i] );
                    usage_dec();
                    return false;
                }
                i++;
#else
                fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] );
                usage_dec();
@@ -1872,10 +1835,8 @@ static void usage_dec( void )
    fprintf( stdout, "                      ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" );
    fprintf( stdout, "                      otherwise a default directivity pattern is used.\n" );
#ifdef FIX_1053_REVERB_RECONFIGURATION
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number > 0) or\n" );
    fprintf( stdout, "                      a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" );
    fprintf( stdout, "                      without braces and spaces, with ':' character separating ID from duration and ',' separating\n" );
    fprintf( stdout, "                      ID and duration pairs, where duration is specified in frames\n" );
    fprintf( stdout, "-aeid ID | File     : Acoustic environment ID (number > 0)\n" );
    fprintf( stdout, "                      alternatively, it can be a text file where each line contains \"ID duration\"\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration.\n" );
#else
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
+16 −50
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "split_render_file_read_write.h"
#include "split_rend_bfi_file_reader.h"
@@ -400,7 +403,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .match = "acoustic_environment_id",
        .matchShort = "aeid",
#ifdef FIX_1053_REVERB_RECONFIGURATION
        .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
        .description = "Acoustic environment ID (number > 0) alternatively, it can be a text file where each line contains \"ID duration\" for BINAURAL_ROOM_REVERB output configuration.",
#else
        .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration",
#endif
@@ -737,6 +740,7 @@ int main(
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    IVAS_RENDER_CONFIG_DATA renderConfig;
    uint16_t aeID;
#endif
    ivas_error error = IVAS_ERR_OK;
@@ -1051,7 +1055,9 @@ int main(

    if ( args.renderConfigFilePath[0] != '\0' )
    {
#ifndef FIX_1053_REVERB_RECONFIGURATION
        IVAS_RENDER_CONFIG_DATA renderConfig;
#endif

        /* sanity check */
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -1563,8 +1569,10 @@ int main(
        {
            if ( ++args.aeSequence.frameCounter >= args.aeSequence.pValidity[args.aeSequence.selected] )
            {
#ifndef FIX_1053_REVERB_RECONFIGURATION
                IVAS_RENDER_CONFIG_DATA renderConfig;

#endif
                if ( ++args.aeSequence.selected >= args.aeSequence.count )
                {
                    args.aeSequence.selected = 0;
@@ -1574,7 +1582,7 @@ int main(
                {
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" );
                        fprintf( stderr, "Invalid acoustic environment configuration parameters\n\n" );
                        goto cleanup;
                    }
                }
@@ -2569,69 +2577,27 @@ static bool parseAcousticEnvironmentIds(
    const char *value,
    AcousticEnvironmentSequence *aeSequence )
{
    uint16_t k;
    char config_string[RENDERER_MAX_METADATA_LINE_LENGTH];
    char *s;
    char *token;

    strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH );
    s = config_string;
    token = config_string;

    if ( !is_digits_only( config_string ) )
    {
        aeidFileReader *aeidReader = NULL;

        for ( k = 0; s[k]; )
        {
            s[k] == ',' ? k++ : *s++;
        }
        k++;

        if ( k == 0 )
        if ( aeidFileReader_open( config_string, &aeidReader ) != IVAS_ERR_OK )
        {
            fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", config_string );
            fprintf( stderr, "\nError: Can't open aeid file %s \n", config_string );
            return false;
        }

        if ( NULL == ( aeSequence->pID = malloc( sizeof( uint16_t ) * k ) ) ||
             NULL == ( aeSequence->pValidity = malloc( sizeof( uint16_t ) * k ) ) )
        if ( aeidFileReading( aeidReader, &aeSequence->count, &aeSequence->pID, &aeSequence->pValidity ) != IVAS_ERR_OK )
        {
            fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", config_string );
            fprintf( stderr, "\nError while reading aeid from %s\n", config_string );
            return false;
        }

        aeSequence->count = k;

        k = 0;

        token = strtok( config_string, ":" );

        while ( token != NULL )
        {
            if ( !is_number( token ) )
            {
                fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string );
                return false;
            }
            aeSequence->pID[k] = (uint16_t) atoi( token );

            token = strtok( NULL, "," );
            if ( !is_number( token ) )
            {
                fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string );
                return false;
            }
            aeSequence->pValidity[k] = (uint16_t) atoi( token );

            token = strtok( NULL, ":" );
            k++;
        }

        if ( k != aeSequence->count )
        {
            fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", config_string );
            return false;
        }
        aeidFileReader_close( &aeidReader );
    }
    else
    {
+15 −8
Original line number Diff line number Diff line
@@ -31,20 +31,15 @@ Comparing:
</ul>

<br>
<b>Table is sorted by Difference in MLD.</b>
<b>Table is sorted by Difference in MLD with ERRORs or missing values ("None", "") being on top additionally.</b>
<br>

<table class="tbase"><thead>
  <tr>
    <th class="tunder" rowspan="2">Testcase</th>
    <th class="tunder" colspan="2">MLD</th>
    <th class="tunder" colspan="2">Max Abs Diff</th>
    {table_header_a}
  </tr>
  <tr>
    <th class="tcenter">{id_previous}</th>
    <th class="tcenter">{id_current}</th>
    <th class="tcenter">{id_previous}</th>
    <th class="tcenter">{id_current}</th>
    {table_header_b}
  </tr></thead>
<tbody>
{table_body}
@@ -55,6 +50,9 @@ TD_TMPL_NORMAL = "<td class='tleft'>{}</td>"
TD_TMPL_INCREASE = "<td class='tincrease'>{}</td>"
TD_TMPL_REDUCE = "<td class='treduce'>{}</td>"
TR_TMPL = "<tr>{}</tr>"
TH_TMPL_GLOBAL = '<th class="tunder" rowspan="2">{}</th>'
TH_TMPL_DIFFERENTIAL = '<th class="tunder" colspan="2">{}</th>'
TH_TMPL_SECOND_ROW = '<th class="tcenter">{}</th>'

# expected columns. actual columns are filtered from the incoming data later, this
# is mainly for controlling the order in the output table
@@ -76,6 +74,13 @@ def create_subpage(
        csv_current, csv_previous, id_current, id_previous
    )
    write_out_csv(merged_reports, merged_reports[0].keys(), csv_out)

    table_header_a = "".join([TH_TMPL_GLOBAL.format(c) for c in COLUMNS_GLOBAL] + [TH_TMPL_DIFFERENTIAL.format(c) for c in COLUMNS_DIFFERENTIAL])
    table_header_b = list()
    for c in COLUMNS_DIFFERENTIAL:
        table_header_b.append(TH_TMPL_SECOND_ROW.format(id_previous))
        table_header_b.append(TH_TMPL_SECOND_ROW.format(id_current))
    table_header_b = "".join(table_header_b)
    table_body = "\n".join(
        tr_from_row(row, id_current, id_previous) for row in merged_reports
    )
@@ -84,6 +89,8 @@ def create_subpage(
        id_previous=id_previous,
        table_body=table_body,
        job_name=job_name,
        table_header_a=table_header_a,
        table_header_b=table_header_b,
    )
    with open(html_out, "w") as f:
        f.write(new_subpage)
+9 −5
Original line number Diff line number Diff line
@@ -4393,6 +4393,10 @@ int16_t IVAS_REND_GetRenderConfig(
    hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er;
    hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity;

#ifdef FIX_1053_REVERB_RECONFIGURATION
    mvr2r( hRCin->distAtt, hRCout->distAtt, 3 );
#endif

    return IVAS_ERR_OK;
}

@@ -4439,6 +4443,9 @@ int16_t IVAS_REND_FeedRenderConfig(
    mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX );
    mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX );
    mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS );
#ifdef FIX_1053_REVERB_RECONFIGURATION
    mvr2r( renderConfig.distAtt, hRenderConfig->distAtt, 3 );
#endif

    hRenderConfig->roomAcoustics.use_er = 0;
    if ( renderConfig.roomAcoustics.use_er == 1 )
@@ -4468,16 +4475,13 @@ int16_t IVAS_REND_FeedRenderConfig(
                return error;
            }
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend[0] != NULL )
#else
        if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL )
#endif
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
        if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL )
        {
            if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
            {
Loading