Commit 943bf5b9 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'main' into 196-refactor-renderer-output-configuration

parents 2920c38d b3ff8488
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
IVAS_cod
IVAS_dec
IVAS_rend
IVAS_crend_unit_test
obj/
*.a
*.o
@@ -17,7 +16,6 @@ build*/**/*
IVAS_cod.exe
IVAS_dec.exe
IVAS_rend.exe
IVAS_crend_unit_test.exe
*.user
.vs/
Debug_*/
@@ -25,12 +23,6 @@ Release_*/
*.obj
*.pdb

# Unittests
scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test
scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test.exe
scripts/ivas_pytests/tests/unit_tests/crend/Debug_*/
scripts/ivas_pytests/tests/unit_tests/crend/Release_*/

# Standalone TD object renderer
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone.exe
+1 −1
Original line number Diff line number Diff line
@@ -690,7 +690,7 @@ clang-format-check:
# ---------------------------------------------------------------

# check bitexactness to EVS windows binaries
be-2-evs-windows:
.be-2-evs-windows: # Temporarily disabled -- Ericsson Windows runner used for HL activities which the reduces capacity for this job. To be resumed after selection
  extends:
    - .rules-main-push
  tags:
+32 −0
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@ typedef struct
    char *outputBitstreamFilename;
    int32_t inputFs;
    IVAS_ENC_INPUT_FORMAT inputFormat;
#ifdef BINAURAL_AUDIO_CMDLINE
    bool is_binaural;
#endif
    EncInputFormatConfig inputFormatConfig;
    bool max_bwidth_user;
    IVAS_ENC_BANDWIDTH maxBandwidth;
@@ -362,17 +365,29 @@ int main(
    switch ( arg.inputFormat )
    {
        case IVAS_ENC_INPUT_MONO:
#ifdef BINAURAL_AUDIO_CMDLINE
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix, arg.is_binaural ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForMono failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
            }
            break;
        case IVAS_ENC_INPUT_STEREO:
#ifdef BINAURAL_AUDIO_CMDLINE
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -865,6 +880,9 @@ static void initArgStruct( EncArguments *arg )
    arg->outputBitstreamFilename = NULL;
    arg->inputFs = 0;
    arg->inputFormat = IVAS_ENC_INPUT_MONO;
#ifdef BINAURAL_AUDIO_CMDLINE
    arg->is_binaural = false;
#endif
    arg->inputFormatConfig.stereoToMonoDownmix = false;
    arg->max_bwidth_user = false;
    arg->maxBandwidth = IVAS_ENC_BANDWIDTH_UNDEFINED;
@@ -1207,6 +1225,16 @@ static bool parseCmdlIVAS_enc(
         * IVAS Formats
         *-----------------------------------------------------------------*/

#ifdef BINAURAL_AUDIO_CMDLINE
        else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
        {
            i++;
            if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
            {
                arg->is_binaural = true;
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-STEREO" ) == 0 )
        {
            i++;
@@ -1487,6 +1515,7 @@ static bool parseCmdlIVAS_enc(
        {
            arg->inputFormat = IVAS_ENC_INPUT_MONO;
            arg->inputFormatConfig.stereoToMonoDownmix = true;

            i++;
        }
        else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // TODO: should be renamed to "-pca"
@@ -1674,6 +1703,9 @@ static void usage_enc( void )
    fprintf( stdout, "Options:\n" );
    fprintf( stdout, "--------\n" );
    fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" );
#ifdef BINAURAL_AUDIO_CMDLINE
    fprintf( stdout, "-binaural           : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" );
#endif
    fprintf( stdout, "-stereo             : Stereo format \n" );
    fprintf( stdout, "-ism (+)Ch Files    : ISM format \n" );
    fprintf( stdout, "                      where Ch specifies the number of ISMs (1-4)\n" );
+80 −1
Original line number Diff line number Diff line
@@ -907,16 +907,22 @@ int16_t get_ivas_max_num_indices_metadata( /* o
 * Move indices inside the buffer or among two buffers
 *-------------------------------------------------------------------*/

#ifdef FIX_545_ASSERT
void move_indices(
#else
ivas_error move_indices(
#endif
    INDICE_HANDLE old_ind_list, /* i/o: old location of indices */
    INDICE_HANDLE new_ind_list, /* i/o: new location of indices */
    const int16_t nb_indices    /* i  : number of moved indices */
)
{
    int16_t i;
#ifndef FIX_545_ASSERT
    ivas_error error;

    error = IVAS_ERR_OK;
#endif

    if ( new_ind_list < old_ind_list )
    {
@@ -941,7 +947,11 @@ ivas_error move_indices(
        }
    }

#ifdef FIX_545_ASSERT
    return;
#else
    return error;
#endif
}

#endif
@@ -969,13 +979,24 @@ ivas_error check_ind_list_limits(
    if ( ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ) >= *( hBstr->ivas_max_num_indices ) )
    {
#ifdef DEBUGGING
#ifdef FIX_545_ASSERT
        fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#else
        /* TODO: replace with the warning message below before the finalization of the IVAS codec */
        /* fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); */
        assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#endif
#endif

        /* reallocate the buffer of indices with increased limit */
#ifdef FIX_545_ASSERT
        if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
        ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES );
#endif
    }

    /* check, if we will not overwrite an existing indice */
@@ -996,13 +1017,24 @@ ivas_error check_ind_list_limits(
            if ( hBstr->ind_list >= ivas_ind_list_last )
            {
#ifdef DEBUGGING
#ifdef FIX_545_ASSERT
                fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#else
                /* TODO: replace with the warning message below before the finalization of the IVAS codec */
                /* fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); */
                assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#endif
#endif

                /* no available empty slot -> need to re-allocate the buffer */
#ifdef FIX_545_ASSERT
                if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#else
                ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES );
#endif
            }
        }
        else
@@ -1080,8 +1112,15 @@ ivas_error push_indice(

#ifdef IND_LIST_DYN
    /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
    if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
    {
        return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame );
    }
#else
    error = check_ind_list_limits( hBstr );
#endif
#endif

#ifdef IND_LIST_DYN
    /* find the location in the list of indices based on ID */
@@ -1203,8 +1242,15 @@ ivas_error push_next_indice(

#ifdef IND_LIST_DYN
    /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
    if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    error = check_ind_list_limits( hBstr );
#endif
#endif

#ifdef IND_LIST_DYN
    /* get the id of the previous indice -> it will be re-used */
@@ -1246,9 +1292,17 @@ ivas_error push_next_indice(
 *-------------------------------------------------------------------*/

#ifdef DEBUG_BS_READ_WRITE
#ifdef FIX_545_ASSERT
ivas_error push_next_bits_(
#else
void push_next_bits_(
#endif
#else
#ifdef FIX_545_ASSERT
ivas_error push_next_bits(
#else
void push_next_bits(
#endif
#endif
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle                     */
    const uint16_t bits[], /* i  : bit buffer to pack, sequence of single bits  */
@@ -1265,6 +1319,11 @@ void push_next_bits(
    Indice *ptr;
#ifdef IND_LIST_DYN
    int16_t prev_id;
#ifdef FIX_545_ASSERT
    ivas_error error;

    error = IVAS_ERR_OK;
#endif
#endif
#ifdef DEBUG_BS_READ_WRITE
    printf( "%s: %d: %d\n", func, line, nb_bits );
@@ -1293,7 +1352,14 @@ void push_next_bits(

#ifdef IND_LIST_DYN
        /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
        if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
        }
#else
        check_ind_list_limits( hBstr );
#endif
        ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
#endif

@@ -1313,7 +1379,14 @@ void push_next_bits(
    {
#ifdef IND_LIST_DYN
        /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
        if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
        }
#else
        check_ind_list_limits( hBstr );
#endif
        ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
#endif

@@ -1334,7 +1407,11 @@ void push_next_bits(
#endif
    hBstr->nb_bits_tot = hBstr->nb_bits_tot + nb_bits;

#ifdef FIX_545_ASSERT
    return error;
#else
    return;
#endif
}


@@ -1535,10 +1612,12 @@ uint16_t get_indice(
{
    uint16_t value;
    int16_t i;
    int32_t nbits_total;

    assert( nb_bits <= 16 );
    int32_t nbits_total;

    nbits_total = st->total_brate / FRAMES_PER_SEC;

    /* detect corrupted bitstream */
    if ( pos + nb_bits > nbits_total )
    {
+35 −0
Original line number Diff line number Diff line
@@ -1790,6 +1790,41 @@ typedef enum
#define IVAS_LIMITER_THRESHOLD                  32729           /* -0.01 dBFS */
#define IVAS_LIMITER_ATTACK_SECONDS             0.005f

#ifdef ENHANCED_STEREO_DMX
/*----------------------------------------------------------------------------------*
 * Stereo downmix EVS constants
 *----------------------------------------------------------------------------------*/

#define STEREO_DMX_EVS_PHA_LEN_16 48
#define STEREO_DMX_EVS_FAD_LEN_16 160
#define STEREO_DMX_EVS_PHA_LEN_32 96
#define STEREO_DMX_EVS_FAD_LEN_32 320
#define STEREO_DMX_EVS_PHA_LEN_48 96
#define STEREO_DMX_EVS_FAD_LEN_48 480

#define STEREO_DMX_EVS_SUBBAND_SIZE 2
#define STEREO_DMX_EVS_NB_SUBBAND_MAX (L_FRAME48k / (2 * STEREO_DMX_EVS_SUBBAND_SIZE))

#define STEREO_DMX_EVS_PHA_LEN_MAX 96 /* Max of PHA_LEN */
#define STEREO_DMX_EVS_FAD_LEN_MAX 480 /* Max of FAD_LEN */

#define STEREO_DMX_EVS_DATA_LEN_MAX (STEREO_DMX_EVS_PHA_LEN_MAX + L_FRAME48k)

typedef enum
{
    STEREO_DMX_EVS_PHA_IPD,
    STEREO_DMX_EVS_PHA_IPD2,
    STEREO_DMX_EVS_NO_PHA

} STEREO_DMX_EVS_PHA;

typedef enum
{
    STEREO_DMX_EVS_PRC_POC,
    STEREO_DMX_EVS_PRC_PHA,

} STEREO_DMX_EVS_PRC;
#endif

#endif
/* clang-format on */
Loading