Commit 09c33620 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch 'main' into 1378_conformance_script_isar

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

} DecArguments;

@@ -971,6 +974,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;
@@ -1524,6 +1530,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
@@ -1574,6 +1588,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 )
        {
@@ -1666,6 +1688,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" );
@@ -1682,6 +1707,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
+4 −0
Original line number Diff line number Diff line
@@ -1251,7 +1251,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
{
+1 −0
Original line number Diff line number Diff line
@@ -171,6 +171,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 ################################## */
+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 )
@@ -3140,6 +3158,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 )
    {
@@ -3152,10 +3171,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 )
    {
+38 −0
Original line number Diff line number Diff line
@@ -937,14 +937,44 @@ ivas_error ivas_jbm_dec_render(
    {
        ivas_jbm_dec_tc_buffer_playout( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output );
    }
#ifdef FIX_1419_MONO_STEREO_UMX
    else if ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT )
#else
    else if ( st_ivas->ivas_format == STEREO_FORMAT )
#endif
    {
#ifdef FIX_1419_MONO_STEREO_UMX
        *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal );
#endif

        /* Rendering */
        if ( st_ivas->renderer_type == RENDERER_MC )
        {
#ifndef FIX_1419_MONO_STEREO_UMX
            *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal );
#endif
            ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output );
        }
#ifdef FIX_1419_MONO_STEREO_UMX
        else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC )
        {
            if ( st_ivas->ivas_format == MONO_FORMAT )
            {
                /* routed to W */
                ivas_jbm_dec_tc_buffer_playout( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output );
            }
            else if ( st_ivas->ivas_format == STEREO_FORMAT )
            {
                for ( n = 0; n < *nSamplesRendered; n++ )
                {
                    float tmp;
                    tmp = p_output[0][n];
                    p_output[0][n] = 0.5f * ( tmp + p_output[1][n] ); /* W = 0.5 * ( L + R ) */
                    p_output[1][n] = 0.5f * ( tmp - p_output[1][n] ); /* Y = 0.5 * ( L - R ) */
                }
            }
        }
#endif /* FIX_1419_MONO_STEREO_UMX */
    }
    else if ( st_ivas->ivas_format == ISM_FORMAT )
    {
@@ -1931,11 +1961,15 @@ int16_t ivas_jbm_dec_get_num_tc_channels(

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;

#ifndef FIX_1419_MONO_STEREO_UMX /* since we support more output formats for mono, this is no longer sensible; leave it at the default from above */
    if ( st_ivas->ivas_format == MONO_FORMAT )
    {
        num_tc = st_ivas->hDecoderConfig->nchan_out;
    }
    else if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 )
#else
    if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 )
#endif
    {
        num_tc = 1;
    }
@@ -2803,7 +2837,11 @@ void ivas_dec_prepare_renderer(
            ivas_omasa_gain_masa_tc( st_ivas->hTcBuffer->tc, st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->nchan_ism, st_ivas->hTcBuffer->n_samples_available );
        }
    }
#ifdef FIX_1419_MONO_STEREO_UMX
    else if ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT )
#else
    else if ( st_ivas->ivas_format == STEREO_FORMAT )
#endif
    {
        ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
    }
Loading