Commit 1be52a61 authored by Lauros Pajunen's avatar Lauros Pajunen
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 541-rotations-missing-in-the-external-renderer-masa-path
parents bf5c93b1 e1a07bb6
Loading
Loading
Loading
Loading
Loading
+52 −6
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#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"
@@ -275,7 +276,11 @@ int main(
    if ( arg.hrtfReaderEnabled )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
@@ -297,7 +302,11 @@ int main(
    if ( arg.enableHeadRotation )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -321,7 +330,11 @@ int main(
    if ( arg.enableReferenceRotation )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -352,7 +365,11 @@ int main(
    if ( arg.enableReferenceVectorTracking )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -407,7 +424,11 @@ int main(
    if ( arg.renderConfigEnabled )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -440,14 +461,17 @@ int main(

    if ( arg.voipMode )
    {
#ifdef VARIABLE_SPEED_DECODING
        if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }
#ifdef VARIABLE_SPEED_DECODING
#ifdef DEBUGGING
    else if ( arg.variableSpeedMode )
    {
        if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VARIABLE_SPEED, arg.tsmScale, 60, arg.inputFormat ) ) != IVAS_ERR_OK )
@@ -457,7 +481,6 @@ int main(
        }
    }
#endif
#endif

#ifdef DEBUGGING
    /*-----------------------------------------------------------------*
@@ -491,7 +514,6 @@ int main(
        IVAS_DEC_PrintConfigWithBitstream( hIvasDec, arg.quietModeEnabled, bit_stream, num_bits );

#ifdef VARIABLE_SPEED_DECODING
#ifdef DEBUGGING
        if ( arg.variableSpeedMode )
        {
            if ( arg.tsmScaleFileEnabled )
@@ -503,7 +525,6 @@ int main(
                fprintf( stdout, "Variable speed factor:  %i\n", arg.tsmScale );
            }
        }
#endif
#endif
    }

@@ -575,9 +596,17 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL )
#endif
        {
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
            fprintf( stderr, "\nExternal Renderer Config is supported only for binaural output configurations. Exiting. \n\n" );
#else
            fprintf( stderr, "\nExternal Renderer Config is supported only for BINAURAL and BINAURAL_ROOM. Exiting. \n\n" );
#endif
            goto cleanup;
        }

@@ -688,7 +717,6 @@ int main(
        error = decodeVoIP( arg, hBsReader, hIvasDec );
    }
#ifdef VARIABLE_SPEED_DECODING
#ifdef DEBUGGING
    else if ( arg.variableSpeedMode )
    {
        error = decodeVariableSpeed( arg, hBsReader, headRotReader,
@@ -697,7 +725,6 @@ int main(
#endif
                                     refRotReader, referenceVectorReader, hIvasDec );
    }
#endif
#endif
    else
    {
@@ -866,6 +893,20 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config(
    {
        output_config = IVAS_DEC_OUTPUT_HOA3;
    }
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    else if ( strcmp( argv_to_upper, "BINAURAL" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL;
    }
    else if ( strcmp( argv_to_upper, "BINAURAL_ROOM_IR" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR;
    }
    else if ( strcmp( argv_to_upper, "BINAURAL_ROOM_REVERB" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB;
    }
#else
    else if ( strcmp( argv_to_upper, "BINAURAL" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL;
@@ -874,6 +915,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config(
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM;
    }
#endif
    else
    {
        output_config = IVAS_DEC_OUTPUT_LS_CUSTOM;
@@ -1423,7 +1465,11 @@ static void usage_dec( void )
    fprintf( stdout, "Mandatory parameters:\n" );
    fprintf( stdout, "---------------------\n" );
    fprintf( stdout, "OutputConf           : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" );
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    fprintf( stdout, "                       HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT\n" );
#else
    fprintf( stdout, "                       HOA2, HOA3, BINAURAL, BINAURAL_ROOM, EXT\n" );
#endif
    fprintf( stdout, "                       By default, channel order and loudspeaker positions are equal to the\n" );
    fprintf( stdout, "                       encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker\n" );
    fprintf( stdout, "                       layout file. See readme.txt for details.\n" );
+65 −1
Original line number Diff line number Diff line
@@ -236,25 +236,41 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_trajFile,
        .match = "trajectory_file",
        .matchShort = "tf",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        .description = "Head rotation trajectory file for simulation of head tracking (only for binaural outputs)",
#else
        .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)",
#endif
    },
    {
        .id = CmdLnOptionId_refRotFile,
        .match = "reference_rotation_file",
        .matchShort = "rf",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        .description = "Reference rotation trajectory file for simulation of head tracking (only for binaural outputs)",
#else
        .description = "Reference rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)",
#endif
    },
    {
        .id = CmdLnOptionId_customHrtfFile,
        .match = "custom_hrtf",
        .matchShort = "hrtf",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        .description = "Custom HRTF file for binaural rendering (only for binaural outputs)",
#else
        .description = "Custom HRTF file for binaural rendering (only for BINAURAL and BINAURAL_ROOM outputs)",
#endif
    },
    {
        .id = CmdLnOptionId_renderConfigFile,
        .match = "render_config",
        .matchShort = "rc",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        .description = "Binaural renderer configuration file (only for binaural outputs)",
#else
        .description = "Binaural renderer configuration file (only for BINAURAL and BINAURAL_ROOM outputs)",
#endif
    },
    {
        .id = CmdLnOptionId_nonDiegeticPan,
@@ -270,7 +286,11 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_orientationTracking,
        .match = "tracking_type",
        .matchShort = "otr",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for binaural outputs)",
#else
        .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for BINAURAL and BINAURAL_ROOM)",
#endif
    },
    {
        .id = CmdlnOptionId_lfePosition,
@@ -310,7 +330,11 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_referenceVectorFile,
        .match = "reference_vector_file",
        .matchShort = "rvf",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        .description = "Reference vector trajectory file for simulation of head tracking (only for binaural outputs)",
#else
        .description = "Reference vector trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)",
#endif
    },
#ifdef EXTERNAL_ORIENTATIONS
    {
@@ -817,9 +841,17 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
#else
        if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) )
#endif
        {
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
            fprintf( stderr, "\nExternal Renderer Config is only supported for binaural output configurations. Exiting. \n" );
#else
            fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" );
#endif
            exit( -1 );
        }

@@ -835,6 +867,13 @@ int main(
            exit( -1 );
        }

#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            renderConfig.room_acoustics.override = TRUE;
        }
#endif

        if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" );
@@ -1763,8 +1802,13 @@ static bool parseOrientationTracking(
static IVAS_REND_AudioConfig parseAudioConfig(
    const char *configString )
{
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    char charBuf[21];
    charBuf[20] = '\0';
#else
    char charBuf[14];
    charBuf[13] = '\0';
#endif

    strncpy( charBuf, configString, sizeof( charBuf ) - 1 );
    charBuf[sizeof( charBuf ) - 1] = '\0';
@@ -1837,6 +1881,20 @@ static IVAS_REND_AudioConfig parseAudioConfig(
                return IVAS_REND_AUDIO_CONFIG_UNKNOWN;
        }
    }
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    if ( strcmp( charBuf, "BINAURAL" ) == 0 )
    {
        return IVAS_REND_AUDIO_CONFIG_BINAURAL;
    }
    if ( strcmp( charBuf, "BINAURAL_ROOM_IR" ) == 0 )
    {
        return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR;
    }
    if ( strcmp( charBuf, "BINAURAL_ROOM_REVERB" ) == 0 )
    {
        return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB;
    }
#else
    if ( strcmp( charBuf, "BINAURAL_ROOM" ) == 0 )
    {
        return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM;
@@ -1845,7 +1903,7 @@ static IVAS_REND_AudioConfig parseAudioConfig(
    {
        return IVAS_REND_AUDIO_CONFIG_BINAURAL;
    }

#endif
    return IVAS_REND_AUDIO_CONFIG_UNKNOWN;
}

@@ -3061,8 +3119,14 @@ static void printSupportedAudioConfigs()
        "HOA3",
        "ISMx (input only)",
        "MASAx (input only)",
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        "BINAURAL (output only)",
        "BINAURAL_ROOM_IR (output only)",
        "BINAURAL_ROOM_REVERB (output only)",
#else
        "BINAURAL (output only)",
        "BINAURAL_ROOM (output only)",
#endif
    };

    fprintf( stdout, "Supported audio formats:\n" );
+2 −2
Original line number Diff line number Diff line
@@ -93,11 +93,11 @@ modes_with_ext_out=$(./scripts/runIvasCodec.py -l | grep 'MASA\|ISM' | grep -v I
echo "\n======================= 4. JBM, modes with no EXT =======================\n\n"
./scripts/runIvasCodec.py -m $modes_with_no_ext_out -p $cfg $duration_arg $WORKERS --decoder_only --jbm_file $dly_profile | tee smoke_test_output_jbm_noEXT.txt
echo "\n======================= 5. JBM, modes with EXT =======================\n\n"
./scripts/runIvasCodec.py -m $modes_with_ext_out -p $cfg $duration_arg $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt
./scripts/runIvasCodec.py -m $modes_with_ext_out -p $cfg $duration_arg $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM_IR mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt

# run all modes with binaural output using external files
modes_with_bin_out="SBA PlanarSBA MASA MC ISM1 ISM2 ISM3 ISM4"
bin_out_modes="BINAURAL BINAURAL_ROOM"
bin_out_modes="BINAURAL BINAURAL_ROOM_IR"

echo "\n======================= 6. binaural out with HRTF files - WB =======================\n\n"
wb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _wb_)
+2 −0
Original line number Diff line number Diff line
@@ -133,8 +133,10 @@ typedef struct
typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
{
    int16_t override;
#ifndef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    int16_t use_brir;
    int16_t late_reverb_on;
#endif
    int16_t nBands;                                   /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
    float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX];      /* Center frequencies for which following values are provided: */
    float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /*  - The room's T60 per center frequency */
+41 −0
Original line number Diff line number Diff line
@@ -166,6 +166,10 @@ int16_t getTcxonly(
    const int16_t element_mode, /* i  : IVAS element mode                   */
    const int32_t total_brate,  /* i  : total bitrate                       */
    const int16_t MCT_flag      /* i  : hMCT handle allocated (1) or not (0)*/
#ifdef ISM_25k6_HZ_CORE
    ,
    const int16_t is_ism_format
#endif
)
{
    int16_t tcxonly = 0;
@@ -179,6 +183,24 @@ int16_t getTcxonly(
            }
            break;
        case IVAS_SCE:
#ifdef ISM_25k6_HZ_CORE
            if ( is_ism_format )
            {
                if ( total_brate > MAX_ACELP_BRATE_ISM )
                {
                    tcxonly = 1;
                }
            }
            else
            {
                if ( total_brate > MAX_ACELP_BRATE )
                {
                    tcxonly = 1;
                }
            }
            break;

#endif
        case IVAS_CPE_DFT:
        case IVAS_CPE_TD:
            if ( total_brate > MAX_ACELP_BRATE )
@@ -341,6 +363,10 @@ int32_t getCoreSamplerateMode2(
    const int16_t bwidth,        /* i  : audio bandwidth                */
    const int16_t flag_ACELP16k, /* i  : ACELP@16kHz flag               */
    const int16_t rf_mode        /* i  : flag to signal the RF mode     */
#ifdef ISM_25k6_HZ_CORE
    ,
    const IVAS_FORMAT is_ism_format /* i  : flag indicating ISM format     */
#endif
)
{
    int32_t sr_core = 0;
@@ -361,10 +387,25 @@ int32_t getCoreSamplerateMode2(
    {
        sr_core = INT_FS_16k;
    }
#ifdef ISM_25k6_HZ_CORE
    else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format )
    {
        sr_core = INT_FS_16k;
    }
    else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE_ISM && element_mode == IVAS_SCE && is_ism_format )
    {
        sr_core = INT_FS_16k;
    }
    else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && is_ism_format )
    {
        sr_core = 25600;
    }
#else
    else if ( ( bwidth == SWB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) || ( bwidth == FB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) )
    {
        sr_core = INT_FS_16k;
    }
#endif
    else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) )
    {
        sr_core = 25600;
Loading