Commit a22cdcc1 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'main' into 1154-add-rtpdump-support-apply-acoustic-env

parents 6a733f97 7b36c742
Loading
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -159,6 +159,9 @@ typedef struct
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
    bool objEditEnabled;
    char *objEditFileName;
#ifdef FIX_1419_MONO_STEREO_UMX
    bool evsMode;
#endif

} DecArguments;

@@ -1041,6 +1044,9 @@ static bool parseCmdlIVAS_dec(
    arg->output_Fs = IVAS_MAX_SAMPLING_RATE;
    arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
    arg->decMode = IVAS_DEC_MODE_IVAS;
#ifdef FIX_1419_MONO_STEREO_UMX
    arg->evsMode = false;
#endif
    arg->quietModeEnabled = false;
    arg->delayCompensationEnabled = true;
    arg->voipMode = false;
@@ -1594,6 +1600,14 @@ static bool parseCmdlIVAS_dec(
            }
            i++;
        }
#ifdef FIX_1419_MONO_STEREO_UMX
        else if ( strcmp( argv_to_upper, "-EVS" ) == 0 )
        {
            arg->evsMode = true;
            arg->decMode = IVAS_DEC_MODE_EVS;
            i++;
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1644,6 +1658,14 @@ static bool parseCmdlIVAS_dec(
            usage_dec();
            return false;
        }
#ifdef FIX_1419_MONO_STEREO_UMX
        else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->evsMode )
        {
            fprintf( stderr, "Error: Both non-diegetic panning and stereo output specified!\n\n" );
            usage_dec();
            return false;
        }
#endif

        if ( arg->outputMdFilename != NULL && arg->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
@@ -1736,6 +1758,9 @@ static bool parseCmdlIVAS_dec(
static void usage_dec( void )
{
    fprintf( stdout, "Usage for EVS:   IVAS_dec.exe [Options] Fs bitstream_file output_file\n" );
#ifdef FIX_1419_MONO_STEREO_UMX
    fprintf( stdout, "                 OR usage for IVAS (below) with -evs option and OutputConf\n" );
#endif
    fprintf( stdout, "Usage for IVAS:  IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file\n\n" );

    fprintf( stdout, "Mandatory parameters:\n" );
@@ -1752,6 +1777,9 @@ static void usage_dec( void )

    fprintf( stdout, "Options:\n" );
    fprintf( stdout, "--------\n" );
#ifdef FIX_1419_MONO_STEREO_UMX
    fprintf( stdout, "-evs                : Specify that the supplied bitstream is an EVS bitstream\n" );
#endif
    fprintf( stdout, "-VOIP               : VoIP mode: RTP in G192\n" );
    fprintf( stdout, "-VOIP_hf_only=0     : VoIP mode: EVS RTP Payload Format hf_only=0 in rtpdump\n" );
#ifdef IVAS_RTPDUMP
+14 −0
Original line number Diff line number Diff line
@@ -177,6 +177,12 @@ typedef enum
#define MAX_SPAR_INTERNAL_CHANNELS              IVAS_SPAR_MAX_CH
#define MAX_CLDFB_DIGEST_CHANNELS               3                           /* == maximum of ParamISM TCs and ParamMC TCs */

#ifdef FIX_GAIN_EDIT_LIMITS
#define EDIT_GAIN_MIN                           0.0630957f                     /* Minimum allowed gain edit with parametric modes: -24 dB */
#define EDIT_GAIN_MAX                           3.9810719f                     /* Maximum allowed gain edit: +12 dB */
#endif


typedef enum
{
    TC_BUFFER_MODE_RENDERER,
@@ -1251,7 +1257,11 @@ typedef enum
 *----------------------------------------------------------------------------------*/

#define MC_LS_SETUP_BITS                        3                           /* number of bits for writing the MC LS configuration */
#ifdef FIX_1419_MONO_STEREO_UMX
#define LS_SETUP_CONVERSION_NUM_MAPPINGS        41                          /* number of mappings for LS setup conversion         */
#else
#define LS_SETUP_CONVERSION_NUM_MAPPINGS        35                          /* number of mappings for LS setup conversion         */
#endif

typedef enum
{
@@ -1483,6 +1493,10 @@ typedef enum

#define VBAP_NUM_SEARCH_SECTORS                 4

#ifdef NONBE_FIX_1426_STEREO_PANNING_BETWEEN_OPT_LEVEL
#define LS_ANGLE_RAD_30_DEG                     0.52359879f                /* 30.0f * PI_OVER_180 */
#define INV_TAN_LS_ANGLE_RAD_30_DEG             1.7320507f                 /* 1.0f/tanf(30.0f * PI_OVER_180) */
#endif

/*----------------------------------------------------------------------------------*
 * Binaural Rendering Constants
+6 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define RENDERER_MD_SYNC_DELAY_TO_INTEGER               /* FhG: change data type of metadata sync delay in ext renderer to int16_t for better BASOP portability (and nicer code) */
#define FIX_1419_MONO_STEREO_UMX                        /* FhG: fix for issue 1419 : support upmix to all output formats for mono and stereo */


/* #################### End BE switches ################################## */
@@ -193,6 +194,11 @@
#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP               /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#define FIX_1330_JBM_MEMORY_FIX                         /* VA: basop issue: 2179 fix non-BE difference in FIX_1330_JBM_MEMORY */
#define NONBE_1380_OMASA_BUILD_DIFF                     /* Nokia: Fix for issue #1380: Large differences in OMASA output between Debug and Release builds */
#define NONBE_FIX_1426_STEREO_PANNING_BETWEEN_OPT_LEVEL /* Nokia: Adjustments in remaining stereo panning functions to make them BE between Debug and Release */
#define FIX_GAIN_EDIT_LIMITS                                 /* Harmonize gain edit limits for all opertation points. For all modes, limit to max +12dB. For parametric modes, limit to min -24dB. */


#define FIX_1430_EVS_STEREO_DMX_CHANNEL_DISAPPEARING    /* Orange: Fix for basop issue 2184 - to prevent one channel from becoming inaudible in the mono downmix output */

/* ##################### End NON-BE switches ########################### */

+36 −1
Original line number Diff line number Diff line
@@ -1279,7 +1279,15 @@ ivas_error ivas_init_decoder(

    if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
    {
#ifdef FIX_1419_MONO_STEREO_UMX
        if ( st_ivas->ivas_format == MONO_FORMAT )
        {
            hDecoderConfig->nchan_out = 1;
        }
        else if ( st_ivas->ivas_format == STEREO_FORMAT )
#else
        if ( st_ivas->ivas_format == STEREO_FORMAT )
#endif
        {
            hDecoderConfig->nchan_out = CPE_CHANNELS;
        }
@@ -1332,6 +1340,13 @@ ivas_error ivas_init_decoder(
        st_ivas->hOutSetup.output_config = st_ivas->intern_config;
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
    }
#ifdef FIX_1419_MONO_STEREO_UMX

    if ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT )
    {
        st_ivas->transport_config = ( st_ivas->ivas_format == MONO_FORMAT ) ? IVAS_AUDIO_CONFIG_MONO : IVAS_AUDIO_CONFIG_STEREO;
    }
#endif

    /* Only initialize transport setup if it is used */
    if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID )
@@ -1414,7 +1429,9 @@ ivas_error ivas_init_decoder(
    else if ( st_ivas->ivas_format == STEREO_FORMAT )
    {
        st_ivas->nchan_transport = CPE_CHANNELS;
#ifndef FIX_1419_MONO_STEREO_UMX /* already set now by renderer_select() */
        st_ivas->intern_config = IVAS_AUDIO_CONFIG_STEREO;
#endif

        st_ivas->nSCE = 0;
        st_ivas->nCPE = 1; /* in stereo, there is always only one CPE */
@@ -2308,7 +2325,8 @@ ivas_error ivas_init_decoder(
    }

    /*-----------------------------------------------------------------*
     * LFE handles for rendering after rendering to adjust LFE delay to filter delay
     * LFE handles for rendering after rendering to adjust LFE delay to
     * filter delay
     *-----------------------------------------------------------------*/

    if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
@@ -3153,6 +3171,7 @@ static ivas_error doSanityChecks_IVAS(
        return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Non-diegetic panning not supported in this IVAS format" );
    }

#ifndef FIX_1419_MONO_STEREO_UMX /* we now support basically everything for stereo */
    /* Verify stereo output configuration */
    if ( st_ivas->ivas_format == STEREO_FORMAT )
    {
@@ -3165,10 +3184,26 @@ static ivas_error doSanityChecks_IVAS(
    else
    {
        if ( output_config == IVAS_AUDIO_CONFIG_INVALID )
#else /* exclude invalid configs instead of matching valid ones */
    if ( output_config == IVAS_AUDIO_CONFIG_INVALID ||
         output_config == IVAS_AUDIO_CONFIG_ISM1 ||
         output_config == IVAS_AUDIO_CONFIG_ISM2 ||
         output_config == IVAS_AUDIO_CONFIG_ISM3 ||
         output_config == IVAS_AUDIO_CONFIG_ISM4 ||
         output_config == IVAS_AUDIO_CONFIG_MASA1 ||
         output_config == IVAS_AUDIO_CONFIG_MASA2 )
#endif
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" );
        }
        if ( ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT ) &&
             ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" );
        }
#ifndef FIX_1419_MONO_STEREO_UMX
    }
#endif

    if ( ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && output_Fs != 48000 )
    {
+14 −0
Original line number Diff line number Diff line
@@ -301,7 +301,9 @@ void ivas_ism_get_stereo_gains(
{
    float aziRad, eleRad;
    float y, mappedX, aziRadMapped, A, A2, A3;
#ifndef NONBE_FIX_1426_STEREO_PANNING_BETWEEN_OPT_LEVEL
    const float LsAngleRad = 30.0f * PI_OVER_180;
#endif

    /* Convert azi and ele to an azi value of the cone of confusion */
    aziRad = azimuth * PI_OVER_180;
@@ -311,19 +313,31 @@ void ivas_ism_get_stereo_gains(
    aziRadMapped = atan2f( y, mappedX );

    /* Determine the amplitude panning gains */
#ifdef NONBE_FIX_1426_STEREO_PANNING_BETWEEN_OPT_LEVEL
    if ( aziRadMapped >= LS_ANGLE_RAD_30_DEG )
#else
    if ( aziRadMapped >= LsAngleRad )
#endif
    { /* Left side */
        *left_gain = 1.0f;
        *right_gain = 0.0f;
    }
#ifdef NONBE_FIX_1426_STEREO_PANNING_BETWEEN_OPT_LEVEL
    else if ( aziRadMapped <= -LS_ANGLE_RAD_30_DEG )
#else
    else if ( aziRadMapped <= -LsAngleRad )
#endif
    { /* Right side */
        *left_gain = 0.0f;
        *right_gain = 1.0f;
    }
    else /* Tangent panning law */
    {
#ifdef NONBE_FIX_1426_STEREO_PANNING_BETWEEN_OPT_LEVEL
        A = tanf( aziRadMapped ) * INV_TAN_LS_ANGLE_RAD_30_DEG;
#else
        A = tanf( aziRadMapped ) / tanf( LsAngleRad );
#endif
        A2 = ( A - 1.0f ) / max( 0.001f, A + 1.0f );
        A3 = 1.0f / ( A2 * A2 + 1.0f );
        *left_gain = sqrtf( A3 );
Loading