Commit a6425dc8 authored by stoutjesdijk's avatar stoutjesdijk 🎧
Browse files

Merge remote-tracking branch 'origin/main' into 196-refactor-renderer-output-configuration-cleanup

parents 202543a3 830ab066
Loading
Loading
Loading
Loading
+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" );
+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 */
+5 −0
Original line number Diff line number Diff line
@@ -61,7 +61,12 @@ void stereo_dmx_evs_enc(
    STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS,                    /* i/o: Stereo downmix for EVS encoder handle   */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
    int16_t data[CPE_CHANNELS * L_FRAME48k],                    /* i/o: input signal                            */
#ifdef BINAURAL_AUDIO_CMDLINE
    const int16_t n_samples,                                    /* i  : number of input samples                 */
    const bool is_binaural                                      /* i  : indication that input is binaural audio */
#else
    const int16_t n_samples                                     /* i  : number of input samples                 */
#endif
);

/*! r: number of channels to be analysed */

lib_com/options.h

100644 → 100755
+4 −0
Original line number Diff line number Diff line
@@ -234,6 +234,10 @@
#define FIX_TODO_NON_DIEGETIC_PAN_NOT_IMPLELENTED_IN_RENDERER /* ..\apps\renderer.c(240):  .... (todo: implementation)",*/
#define REMOVE_OBS_CODE                                 /* FhG: Remove unnecessary assignement after LFE cleanup (Issue #451)*/

#define ENHANCED_STEREO_DMX                             /* Orange : Contribution 48 - Enhanced stereo downmix. */

#define BINAURAL_AUDIO_CMDLINE

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */

+44 −0
Original line number Diff line number Diff line
@@ -1009,9 +1009,50 @@ typedef struct stereo_dmx_evs_phase_only_correlation_structure

} STEREO_DMX_EVS_POC_DATA, *STEREO_DMX_EVS_POC_HANDLE;

#ifdef ENHANCED_STEREO_DMX
typedef struct stereo_dmx_evs_correlation_filter_structure
{
    int16_t init_frmCntr;
    float isd_rate_s;
    float iccr_s;
    float ipd_ff[STEREO_DMX_EVS_NB_SUBBAND_MAX];
    float Pr[STEREO_DMX_EVS_NB_SUBBAND_MAX];
    float Pi[STEREO_DMX_EVS_NB_SUBBAND_MAX];
    float rfft_ipd_coef[L_FRAME48k / 2 + 1];

    int16_t pha_len;
    int16_t fad_len;

    float win[STEREO_DMX_EVS_PHA_LEN_MAX];
    float fad_g[STEREO_DMX_EVS_FAD_LEN_MAX];
    float *p_prev_taps[CPE_CHANNELS], prev_taps[CPE_CHANNELS][STEREO_DMX_EVS_PHA_LEN_MAX];
    float *p_curr_taps[CPE_CHANNELS], curr_taps[CPE_CHANNELS][STEREO_DMX_EVS_PHA_LEN_MAX];

    float data_mem[CPE_CHANNELS][STEREO_DMX_EVS_PHA_LEN_MAX];

    STEREO_DMX_EVS_PHA curr_pha;
    STEREO_DMX_EVS_PHA prev_pha;
    int16_t pha_hys_cnt;

    int16_t prc_thres;
    STEREO_DMX_EVS_PRC curr_prc;
    STEREO_DMX_EVS_PRC prev_prc;
    int16_t prc_hys_cnt;
    float fad_g_prc[L_FRAME48k];
    int16_t fad_len_prc;

    float trns_aux_energy[CPE_CHANNELS];
    float crst_fctr;

} STEREO_DMX_EVS_PHA_DATA, *STEREO_DMX_EVS_PHA_HANDLE;

#endif
typedef struct stereo_dmx_evs_enc_data_structure
{
    STEREO_DMX_EVS_POC_HANDLE hPOC;
#ifdef ENHANCED_STEREO_DMX
    STEREO_DMX_EVS_PHA_HANDLE hPHA;
#endif

    float itd;

@@ -1055,6 +1096,9 @@ typedef struct encoder_config_structure
    int16_t nchan_inp;                              /* number of input audio channels */
    int16_t max_bwidth;                             /* maximum encoded bandwidth */
    IVAS_FORMAT ivas_format;                        /* IVAS format */
#ifdef BINAURAL_AUDIO_CMDLINE
	bool is_binaural;                               /* flag indicating if input is binaural audio */
#endif

    int16_t element_mode_init;                      /* element mode used at initialization */
    int16_t stereo_dmx_evs;                         /* flag to indicate that stereo downmix for EVS encoder */
Loading