Commit f892353c authored by vaclav's avatar vaclav
Browse files

add external renderer appl info printing

parent f0684411
Loading
Loading
Loading
Loading
Loading
+126 −90
Original line number Diff line number Diff line
@@ -433,8 +433,7 @@ static int16_t getTotalNumInChannels(
    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 masaIds[RENDERER_MAX_MASA_INPUTS]
)
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] )
{
    int16_t totalNumInChannels = 0;
    int16_t i, numInputChannels;
@@ -520,8 +519,7 @@ static void setupWithSingleFormatInput(
    CmdlnArgs args,
    char *audioFilePath,
    IsmPositionProvider *positionProvider,
    MasaFileReader **masaReaders
)
    MasaFileReader **masaReaders )
{
    /* With single-format input, inputFilePath is the path to input audio file. */
    strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 );
@@ -580,8 +578,6 @@ static float dBToLin(
}




/*------------------------------------------------------------------------------------------*
 * main()
 *
@@ -641,6 +637,8 @@ int main(
        lfeRoutingConfigs[i] = NULL;
    }

    IVAS_REND_PrintDisclaimer();

    CmdlnArgs args = parseCmdlnArgs( argc, argv );

    if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) ||
@@ -800,6 +798,48 @@ int main(
        exit( -1 );
    }

    fprintf( stdout, "Input audio file:       %s\n", args.inputFilePath );
    fprintf( stdout, "Output audio file:      %s\n\n", args.outputFilePath );

    if ( args.inConfig.numAudioObjects > 0 )
    {
        if ( args.inConfig.numAudioObjects == 1 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM1 );
        }
        else if ( args.inConfig.numAudioObjects == 2 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM2 );
        }
        else if ( args.inConfig.numAudioObjects == 3 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM3 );
        }
        else if ( args.inConfig.numAudioObjects == 4 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM4 );
        }
    }
    for ( i = 0; i < args.inConfig.numMultiChannelBuses; i++ )
    {
        IVAS_REND_PrintInputConfig( args.inConfig.multiChannelBuses[i].audioConfig );
    }
    for ( i = 0; i < args.inConfig.numMasaBuses; i++ )
    {
        IVAS_REND_PrintInputConfig( args.inConfig.masaBuses[i].audioConfig );
    }
    for ( i = 0; i < args.inConfig.numAmbisonicsBuses; i++ )
    {
        IVAS_REND_PrintInputConfig( args.inConfig.ambisonicsBuses[i].audioConfig );
    }

    if ( ( error = IVAS_REND_PrintConfig( hIvasRend ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\n IVAS_REND_PrintConfig failed: %s\n\n", ivas_error_to_string( error ) );
        //goto cleanup;
        exit( -1 );
    }

    /* === Configure === */
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
    {
@@ -855,7 +895,6 @@ int main(
            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" );
            exit( -1 );
        }

    }

    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK )
@@ -1366,7 +1405,6 @@ int main(
        }



        if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error in getting samples\n" );
@@ -3270,8 +3308,7 @@ static void convertInputBuffer(
    const int16_t numIntSamplesPerChannel,
    const int16_t numFloatSamplesPerChannel,
    const int16_t numChannels,
    float *floatBuffer
)
    float *floatBuffer )
{
    int16_t chnl, smpl, i;

@@ -3308,8 +3345,7 @@ static void convertOutputBuffer(
    const float *floatBuffer,
    const int16_t numSamplesPerChannel,
    const int16_t numChannels,
    int16_t *intBuffer
)
    int16_t *intBuffer )
{
    int16_t chnl, smpl, i;
    float temp;
+16 −104
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#include "jbm_pcmdsp_fifo.h"
#include <math.h>
#include <assert.h>
#include <string.h>
#ifdef DEBUGGING
#include "debug.h"
#endif
@@ -458,7 +457,6 @@ ivas_error IVAS_DEC_Configure(
}



/*---------------------------------------------------------------------*
 * get_render_framesize_ms( )
 *
@@ -938,8 +936,6 @@ ivas_error IVAS_DEC_GetSamples(
}




/*---------------------------------------------------------------------*
 * IVAS_DEC_Setup( )
 *
@@ -1094,8 +1090,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples(
    const uint16_t nSamplesForRendering, /* i  : number of TC samples wanted from the renderer              */
    uint16_t *nSamplesRendered,          /* o  : number of samples rendered                                 */
    uint16_t *nSamplesAvailableNext,     /* o  : number of samples still available in the renerer pipeline  */
    int16_t *pcmBuf
)
    int16_t *pcmBuf )
{
    Decoder_Struct *st_ivas;
    ivas_error error;
@@ -2453,85 +2448,6 @@ const char *IVAS_DEC_GetErrorMessage(
}


/*---------------------------------------------------------------------*
 * get_channel_config()
 *
 * Gets a str related to input config
 *---------------------------------------------------------------------*/

static ivas_error get_channel_config(
    AUDIO_CONFIG config,
    char *str )
{
    if ( config == IVAS_AUDIO_CONFIG_MONO )
    {
        strcpy( str, "Mono" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_STEREO )
    {
        strcpy( str, "Stereo" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_5_1 )
    {
        strcpy( str, "Multichannel 5.1 (CICP6)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_7_1 )
    {
        strcpy( str, "Multichannel 7.1 (CICP12)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_5_1_2 )
    {
        strcpy( str, "Multichannel 5.1+2 (CICP14)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_5_1_4 )
    {
        strcpy( str, "Multichannel 5.1+4 (CICP16)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_7_1_4 )
    {
        strcpy( str, "Multichannel 7.1+4 (CICP19)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_LS_CUSTOM )
    {
        strcpy( str, "Multichannel (custom loudspeaker layout)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_FOA )
    {
        strcpy( str, "Ambisonics: First Order (FOA)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_HOA2 )
    {
        strcpy( str, "Ambisonics: Second Order (HOA2)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_HOA3 )
    {
        strcpy( str, "Ambisonics: Third Order (HOA3)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL )
    {
        strcpy( str, "Binaural: no room" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
    {
        strcpy( str, "Binaural: room with impulse responses" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
        strcpy( str, "Binaural: room with reverb" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_EXTERNAL )
    {
        strcpy( str, "External renderer" );
    }
    else
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" );
    }

    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * printConfigInfo_dec( )
 *
@@ -3216,7 +3132,3 @@ static ivas_error IVAS_DEC_VoIP_reconfigure(

    return IVAS_ERR_OK;
}



+112 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "ivas_prot_rend.h"
#include "ivas_rom_com.h"
#include "ivas_prot.h"
#include <string.h>
#ifdef DEBUGGING
#include "debug.h"
#include <assert.h>
@@ -435,3 +436,114 @@ ivas_error ivas_output_buff_dec(

    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * get_channel_config()
 *
 * Gets a str related to input config
 *---------------------------------------------------------------------*/

ivas_error get_channel_config(
    const AUDIO_CONFIG config,
    char *str )
{
    if ( config == IVAS_AUDIO_CONFIG_MONO )
    {
        strcpy( str, "Mono" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_STEREO )
    {
        strcpy( str, "Stereo" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_ISM1 )
    {
        strcpy( str, "Object-based audio (1 object)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_ISM2 )
    {
        strcpy( str, "Object-based audio (2 objects)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_ISM3 )
    {
        strcpy( str, "Object-based audio (3 objects)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_ISM4 )
    {
        strcpy( str, "Object-based audio (4 objects)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_5_1 )
    {
        strcpy( str, "Multichannel 5.1 (CICP6)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_7_1 )
    {
        strcpy( str, "Multichannel 7.1 (CICP12)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_5_1_2 )
    {
        strcpy( str, "Multichannel 5.1+2 (CICP14)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_5_1_4 )
    {
        strcpy( str, "Multichannel 5.1+4 (CICP16)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_7_1_4 )
    {
        strcpy( str, "Multichannel 7.1+4 (CICP19)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_LS_CUSTOM )
    {
        strcpy( str, "Multichannel (custom loudspeaker layout)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_MASA1 )
    {
        strcpy( str, "Metadata-Assisted Spatial Audio mono (MASA1)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_MASA2 )
    {
        strcpy( str, "Metadata-Assisted Spatial Audio stereo (MASA2)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_FOA )
    {
        strcpy( str, "Ambisonics: First Order (FOA)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_HOA2 )
    {
        strcpy( str, "Ambisonics: Second Order (HOA2)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_HOA3 )
    {
        strcpy( str, "Ambisonics: Third Order (HOA3)" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL )
    {
        strcpy( str, "Binaural: no room" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
    {
        strcpy( str, "Binaural: room with impulse responses" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
        strcpy( str, "Binaural: room with reverb" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
    {
        strcpy( str, "BINAURAL_SPLIT_CODED" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        strcpy( str, "Binaural_Split_PCM" );
    }
    else if ( config == IVAS_AUDIO_CONFIG_EXTERNAL )
    {
        strcpy( str, "External renderer" );
    }
    else
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" );
    }

    return IVAS_ERR_OK;
}
+6 −1
Original line number Diff line number Diff line
@@ -77,6 +77,12 @@ int16_t ivas_get_nchan_buffers_dec(
    const int32_t ivas_total_brate                              /* i  : total IVAS bitrate                              */
);

ivas_error get_channel_config(
    const AUDIO_CONFIG config,
    char *str 
);


/*----------------------------------------------------------------------------------*
 * Limiter prototypes
 *----------------------------------------------------------------------------------*/
@@ -1532,7 +1538,6 @@ void masaPrerendClose(
);



/* clang-format on */

#endif /* IVAS_PROT_REND_H */
+206 −140
Original line number Diff line number Diff line
@@ -170,7 +170,6 @@ typedef struct
} input_sba;



typedef struct
{
    input_base base;
@@ -2268,8 +2267,6 @@ static ivas_error initSbaPanGainsForSbaOut(
}




static ivas_error updateSbaPanGains(
    input_sba *inputSba,
    const AUDIO_CONFIG outConfig,
@@ -2338,8 +2335,6 @@ static ivas_error updateSbaPanGains(
}




static ivas_error initSbaMasaRendering(
    input_sba *inputSba,
    int32_t inSampleRate )
@@ -2407,8 +2402,6 @@ static ivas_error setRendInputActiveSba(
}




static void clearInputSba(
    input_sba *inputSba )
{
@@ -2502,8 +2495,6 @@ static void clearInputMasa(
}




/*-------------------------------------------------------------------------
 * IVAS_REND_Open()
 *
@@ -3015,8 +3006,6 @@ static ivas_error findFreeInputSlot(
}




/*-------------------------------------------------------------------*
 * IVAS_REND_AddInput()
 *
@@ -3792,8 +3781,6 @@ int16_t IVAS_REND_FeedRenderConfig(
}




/*-------------------------------------------------------------------*
 * IVAS_REND_SetHeadRotation()
 *
@@ -3900,8 +3887,6 @@ ivas_error IVAS_REND_DisableHeadRotation(
}




/*-------------------------------------------------------------------*
 * IVAS_REND_SetOrientationTrackingMode()
 *
@@ -4840,8 +4825,6 @@ static ivas_error renderIsmToSba(
}




static void renderIsmToMasa(
    input_ism *ismInput,
    IVAS_REND_AudioBuffer outAudio )
@@ -5354,8 +5337,6 @@ static void renderMcToMasa(
}




static ivas_error renderInputMc(
    input_mc *mcInput,
    const AUDIO_CONFIG outConfig,
@@ -5486,7 +5467,6 @@ static void renderSbaToSba(
}



static ivas_error renderSbaToBinaural(
    input_sba *sbaInput,
    const AUDIO_CONFIG outConfig,
@@ -5658,8 +5638,6 @@ static ivas_error renderSbaToBinauralRoom(
}




static void renderSbaToMasa(
    input_sba *sbaInput,
    IVAS_REND_AudioBuffer outAudio )
@@ -5732,8 +5710,6 @@ static ivas_error renderInputSba(
}




static ivas_error renderActiveInputsSba(
    IVAS_REND_HANDLE hIvasRend,
    IVAS_REND_AudioBuffer outAudio )
@@ -6334,8 +6310,6 @@ ivas_error IVAS_REND_GetSamples(
}




/*-------------------------------------------------------------------*
 * IVAS_REND_Close()
 *
@@ -6397,8 +6371,6 @@ void IVAS_REND_Close(
}




#ifdef DEBUGGING
/*-------------------------------------------------------------------*
 * IVAS_REND_GetNoCLipping()
@@ -7135,3 +7107,97 @@ static void freeMasaExtRenderer(

    return;
}


static ivas_error printConfigInfo_rend(
    IVAS_REND_HANDLE hIvasRend /* i  : IVAS renderer handle     */
)
{
    ivas_error error;
    char config_str[50];

    /*-----------------------------------------------------------------*
     * Print output audio configuration
     *-----------------------------------------------------------------*/

    if ( ( error = get_channel_config( hIvasRend->outputConfig, &config_str[0] ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    fprintf( stdout, "Output configuration:   %s\n", config_str );

    /*-----------------------------------------------------------------*
     * Print renderer configurations
     *-----------------------------------------------------------------*/

    fprintf( stdout, "Output sampling rate:   %d Hz\n", hIvasRend->sampleRateOut );

    if ( hIvasRend->headRotData.headRotEnabled == 1 )
    {
        fprintf( stdout, "Head-tracking:          ON\n" );
    }

    if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL ||
         hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ||
         hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ||
         hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
         hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        fprintf( stdout, "Render framesize:       %dms\n", hIvasRend->num_subframes * 5 );
    }

    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * IVAS_REND_PrintInputConfig()
 *
 *
 *---------------------------------------------------------------------*/

void IVAS_REND_PrintInputConfig(
    const IVAS_AUDIO_CONFIG inputConfig /* i  : input audio configuration    */
)
{
    char config_str[50];

    get_channel_config( inputConfig, &config_str[0] );
    fprintf( stdout, "Input configuration:    %s\n", config_str );

    return;
}


/*---------------------------------------------------------------------*
 * IVAS_REND_PrintConfig()
 *
 *
 *---------------------------------------------------------------------*/

ivas_error IVAS_REND_PrintConfig(
    IVAS_REND_HANDLE hIvasRend /* i  : IVAS renderer handle    */
)
{
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    return printConfigInfo_rend( hIvasRend );
}


/*---------------------------------------------------------------------*
 * IVAS_REND_PrintDisclaimer()
 *
 * Print IVAS disclaimer to console
 *---------------------------------------------------------------------*/

void IVAS_REND_PrintDisclaimer( void )
{
    print_disclaimer( stderr );

    return;
}
Loading