Commit 3fb390b1 authored by multrus's avatar multrus
Browse files

Merge branch 'main' into 166-valgrind-sba-reading-of-uninitialized-memory-for-384-kbit-s-hoa3

parents 0baf11e2 81bba972
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ target_link_libraries(lib_enc lib_com lib_debug)
file(GLOB libRendSrcs "lib_rend/*.c")
file(GLOB libRendHeaders "lib_rend/*.h")
add_library(lib_rend ${libRendSrcs} ${libRendHeaders})
target_link_libraries(lib_rend lib_com lib_debug)
target_link_libraries(lib_rend lib_dec lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed.

file(GLOB libDecSrcs "lib_dec/*.c")
file(GLOB libDecHeaders "lib_dec/*.h")
+2 −2
Original line number Diff line number Diff line
@@ -184,8 +184,8 @@ $(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(L
$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG)
	$(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIDEC)

$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG)
	$(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasutil -livasdebug -livascom $(LDLIBS) -o $(CLI_APIREND)
$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC)
	$(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasdec -livasutil -livasdebug -livascom $(LDLIBS) -o $(CLI_APIREND)

$(CLI_UTESTS_CREND): $(OBJS_CLI_UTESTS_CREND) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG)
	$(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_UTESTS_CREND) -L. -livasdec -livascom -livasutil -livasdebug $(LDLIBS) -o $(UTESTS_CREND_DIR)/$(CLI_UTESTS_CREND)
+4 −0
Original line number Diff line number Diff line
@@ -223,6 +223,10 @@
      <Project>{54509728-928B-44D9-A118-A6F92F08B34F}</Project>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>
    <ProjectReference Include="lib_dec.vcxproj">
      <Project>{E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}</Project>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>
    <ProjectReference Include="lib_util.vcxproj">
      <Project>{2FA8F384-0775-F3B7-F8C3-85209222FC70}</Project>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+84 −1
Original line number Diff line number Diff line
@@ -424,7 +424,12 @@ static int16_t getTotalNumInChannels(
    IVAS_REND_HANDLE hIvasRend,
    IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS],
    IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS],
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] )
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS]
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    ,
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS]
#endif
)
{
    int16_t totalNumInChannels = 0;
    int16_t i, numInputChannels;
@@ -479,6 +484,24 @@ static int16_t getTotalNumInChannels(
        totalNumInChannels += numInputChannels;
    }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( int32_t i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        if ( masaIds[i] == 0 )
        {
            /* Skip inactive inputs */
            continue;
        }

        if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, masaIds[i], &numInputChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
        }
        totalNumInChannels += numInputChannels;
    }
#endif

    return totalNumInChannels;
}

@@ -651,6 +674,9 @@ int main(
    IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 };
    IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 };
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] = { 0 };
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 };
#endif

    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
    {
@@ -759,7 +785,29 @@ int main(
        }
    }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( i = 0; i < args.inConfig.numMasaBuses; ++i )
    {
        if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
        }

        if ( ( error = IVAS_REND_SetInputGain( hIvasRend, masaIds[i], args.inputGainGlobal * dBToLin( args.inConfig.masaBuses[i].gain_dB ) ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
        }
    }
#endif

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

    if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */
         && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) )
    {
@@ -855,6 +903,7 @@ int main(
        }
#endif

#ifndef NOKIA_MASA_EXTERNAL_RENDERER
        for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
        {
            if ( masaReaders[i] != NULL )
@@ -865,6 +914,7 @@ int main(
                (void) hMasaMetadata;
            }
        }
#endif

        ObjectPositionBuffer mtdBuffer;
        IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer );
@@ -930,6 +980,37 @@ int main(
            }
        }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
        for ( i = 0; i < args.inConfig.numMasaBuses; ++i )
        {
            int16_t numChannels;
            if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, masaIds[i], &numChannels ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
            }
            IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, args.inConfig.masaBuses[i].inputChannelIndex, numChannels );

            if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
            }

            if ( masaReaders[i] != NULL )
            {
                /* This will update data in hMasaMetadata[i] */
                MasaFileReader_readNextFrame( masaReaders[i] );

                if ( ( error = IVAS_REND_FeedInputMasaMetadata( hIvasRend, masaIds[i], hMasaMetadata[i] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
            }
        }
#endif

        IVAS_REND_GetSamples( hIvasRend, outBuffer );

        int16_t num_out_channels;
@@ -1307,6 +1388,8 @@ static IVAS_REND_AudioConfig parseAudioConfig(
        switch ( charBuf[4] )
        {
            case '1':
                fprintf( stderr, "1TC MASA support is not functional and is pending on DirAC renderer refactoring.\n" );
                exit( EXIT_FAILURE );
                return IVAS_REND_AUDIO_CONFIG_MASA1;
            case '2':
                return IVAS_REND_AUDIO_CONFIG_MASA2;
+3 −0
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ typedef enum
    IVAS_ERR_TOO_MANY_INPUTS,
#else
    IVAS_ERR_TOO_MANY_OBJECT_INPUTS,
#endif
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    IVAS_ERR_MISSING_METADATA,
#endif
    IVAS_ERR_INDEX_OUT_OF_BOUNDS,
    IVAS_ERR_RECONFIGURE_NOT_SUPPORTED,
Loading