Commit b904d3fe authored by eichenseer's avatar eichenseer
Browse files

Merge branch 'main' into 549-paramism-output-too-quiet

parents dbdb3028 8ef87da1
Loading
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -1225,16 +1225,6 @@ 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++;
@@ -1312,6 +1302,13 @@ static bool parseCmdlIVAS_enc(
            }
#endif /* DEBUGGING */
        }
#ifdef BINAURAL_AUDIO_CMDLINE
        else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
        {
            arg->is_binaural = true;
            i++;
        }
#endif
        else if ( strcmp( argv_to_upper, "-ISM" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_ISM;
@@ -1703,9 +1700,6 @@ 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" );
@@ -1737,6 +1731,9 @@ static void usage_enc( void )
    fprintf( stdout, "                      alternatively, B can be a text file where each line contains \"nb_frames B\"\n" );
    fprintf( stdout, "-no_delay_cmp       : Turn off delay compensation\n" );
    fprintf( stdout, "-stereo_dmx_evs     : Activate stereo downmix function for EVS.\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, "-mime               : Mime output bitstream file format\n" );
    fprintf( stdout, "                      The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" );
    fprintf( stdout, "                      default output bitstream file format is G.192\n" );
+14 −0
Original line number Diff line number Diff line
@@ -336,7 +336,12 @@ typedef enum

#define ISM_NB_BITS_METADATA_NOMINAL            ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */

#ifdef FIX_532_ISM_MD_INACTIVE
#define ISM_METADATA_MD_FLAG_BITS               1 /* flag to distinguish between NULL metadata and low-rate ISM_NO_META class */
#define ISM_METADATA_INACTIVE_FLAG_BITS         1 /* flag to signal whether MD are sent in low-rate inactive frame */
#else
#define ISM_METADATA_VAD_FLAG_BITS              1
#endif
#define ISM_METADATA_FLAG_BITS                  2

#define ISM_NO_META                             0
@@ -390,6 +395,9 @@ typedef enum
#define ISM_Q_STEP_LOW                          (ISM_Q_STEP * 2)
#define ISM_Q_STEP_BORDER_LOW                   (ISM_Q_STEP_BORDER * 2)

#ifdef FIX_532_ISM_MD_INACTIVE
#define BRATE_ISM_INACTIVE                      2450 /* CoreCoder bitrate in ISM inactive frames */
#endif

typedef enum 
{
@@ -406,8 +414,14 @@ enum
    IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
    IND_ISM_EXTENDED_NDP_FLAG, 
    IND_ISM_METADATA_FLAG,
#ifdef FIX_532_ISM_MD_INACTIVE
    IND_ISM_MD_NULL_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_MD_INACTIVE_FLAG = IND_ISM_MD_NULL_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_MD_INACTIVE_FLAG + MAX_NUM_OBJECTS,
#else
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
#endif
    IND_ISM_SCE_ID_DTX,
    IND_ISM_DTX_COH_SCA,

+2 −0
Original line number Diff line number Diff line
@@ -49,7 +49,9 @@

static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t **pActive_bins_abs, const int16_t **pStart_offset, const int16_t **pStart_offset_ab, const int32_t sampling_rate );
static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate );
#ifndef FIX_383_CLEAN_UP
static int16_t ivas_fb_mixer_get_band_diff_non48k( const int32_t sampling_rate, const float delay_ms );
#endif
static const float *ivas_get_cheby_ramp( const int16_t delay );
static void ivas_get_hanning_win( const int16_t len, float *pH_win );
static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate );
+73 −5
Original line number Diff line number Diff line
@@ -49,10 +49,14 @@
 * Local constants
 *-----------------------------------------------------------------------*/

#ifdef FIX_532_ISM_MD_INACTIVE
#define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC )
#else
#define FRMS_PER_SECOND ( 1000000000 / FRAME_SIZE_NS )

#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM inactive frames */
#define BITS_ISM_INACTIVE  ( BRATE_ISM_INACTIVE / FRMS_PER_SECOND )
#endif

#define BETA_ISM_LOW_IMP    0.6f
#define BETA_ISM_MEDIUM_IMP 0.8f
@@ -74,7 +78,11 @@ static void bitbudget_to_brate(

    for ( i = 0; i < N; i++ )
    {
#ifdef FIX_532_ISM_MD_INACTIVE
        y[i] = FRAMES_PER_SEC * x[i];
#else
        y[i] = FRMS_PER_SECOND * x[i];
#endif
    }

    return;
@@ -93,7 +101,11 @@ ivas_error ivas_ism_config(
    const int16_t nchan_ism,                  /* i  : number of objects              */
    ISM_METADATA_HANDLE hIsmMeta[],           /* i/o: ISM metadata handles           */
    const int16_t ism_extended_metadata_flag, /* i  : extended metadata flag         */
#ifdef FIX_532_ISM_MD_INACTIVE
    const int16_t null_metadata_flag[MAX_NUM_OBJECTS], /* i  : NULL MD flag                   */
#else
    const int16_t localVAD[MAX_NUM_OBJECTS], /* i  : local VAD flag                 */
#endif
    const int16_t ism_imp[],   /* i  : ISM importance flags           */
    int32_t element_brate[],   /* o  : element bitrate per object     */
    int32_t total_brate[],     /* o  : total bitrate per object       */
@@ -120,12 +132,20 @@ ivas_error ivas_ism_config(
    {
        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef FIX_532_ISM_MD_INACTIVE
            ism_metadata_flag_global |= ism_imp[ch];
#else
            ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag;
#endif
        }
    }

    /* decision about bitrates per channel - constant during the session (at one ivas_total_brate) */
#ifdef FIX_532_ISM_MD_INACTIVE
    bits_ism = (int16_t) ( ism_total_brate / FRAMES_PER_SEC );
#else
    bits_ism = (int16_t) ( ism_total_brate / FRMS_PER_SECOND );
#endif
    set_s( bits_element, bits_ism / n_ISms, n_ISms );
    bits_element[n_ISms - 1] += bits_ism % n_ISms;
    bitbudget_to_brate( bits_element, element_brate, n_ISms );
@@ -146,10 +166,26 @@ ivas_error ivas_ism_config(

        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef FIX_532_ISM_MD_INACTIVE
            if ( null_metadata_flag[ch] )
            {
                nb_bits_metadata[0] += ISM_METADATA_MD_FLAG_BITS;
                nb_bits_metadata[0] += ISM_METADATA_FLAG_BITS;
            }
            else
            {
                if ( ism_imp[ch] == ISM_NO_META )
                {
                    nb_bits_metadata[0] += ISM_METADATA_MD_FLAG_BITS;
                    nb_bits_metadata[0] += ISM_METADATA_INACTIVE_FLAG_BITS;
                }
            }
#else
            if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
            {
                nb_bits_metadata[0] += ISM_METADATA_VAD_FLAG_BITS;
            }
#endif
        }
    }

@@ -175,7 +211,11 @@ ivas_error ivas_ism_config(
        diff = 0;
        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef FIX_532_ISM_MD_INACTIVE
            if ( ism_imp[ch] == ISM_NO_META )
#else
            if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 )
#endif
            {
                diff += bits_CoreCoder[ch] - BITS_ISM_INACTIVE;
                bits_CoreCoder[ch] = BITS_ISM_INACTIVE;
@@ -212,18 +252,34 @@ ivas_error ivas_ism_config(
        {
            int16_t limit;

#ifdef FIX_532_ISM_MD_INACTIVE
            limit = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC;
#else
            limit = MIN_BRATE_SWB_BWE / FRMS_PER_SECOND;
#endif
            if ( element_brate[ch] < MIN_BRATE_SWB_STEREO ) /* replicate function set_bw() -> check the coded audio band-width */
            {
#ifdef FIX_532_ISM_MD_INACTIVE
                limit = MIN_BRATE_WB_BWE / FRAMES_PER_SEC;
#else
                limit = MIN_BRATE_WB_BWE / FRMS_PER_SECOND;
#endif
            }
            else if ( element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */
            {
                /*limit = SCE_CORE_16k_LOW_LIMIT;*/
#ifdef FIX_532_ISM_MD_INACTIVE
                limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRAMES_PER_SEC;
#else
                limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRMS_PER_SECOND;
#endif
            }

#ifdef FIX_532_ISM_MD_INACTIVE
            if ( ism_imp[ch] == ISM_NO_META )
#else
            if ( ism_imp[ch] == ISM_NO_META && localVAD[ch] == 0 )
#endif
            {
                tmp = BITS_ISM_INACTIVE;
            }
@@ -270,10 +326,18 @@ ivas_error ivas_ism_config(
        diff = 0;
        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef FIX_532_ISM_MD_INACTIVE
            limit_high = IVAS_512k / FRAMES_PER_SEC;
#else
            limit_high = IVAS_512k / FRMS_PER_SECOND;
#endif
            if ( element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */
            {
#ifdef FIX_532_ISM_MD_INACTIVE
                limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC;
#else
                limit_high = ACELP_12k8_HIGH_LIMIT / FRMS_PER_SECOND;
#endif
            }

            tmp = (int16_t) min( bits_CoreCoder[ch], limit_high );
@@ -316,7 +380,11 @@ ivas_error ivas_ism_config(
    if ( nb_bits_metadata != NULL )
    {
        int32_t tmpL;
#ifdef FIX_532_ISM_MD_INACTIVE
        tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRAMES_PER_SEC;
#else
        tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND;
#endif
        if ( sum_l( element_brate, n_ISms ) != tmpL )
        {
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISM bit-budget distribution. Exiting!\n" );
+4 −0
Original line number Diff line number Diff line
@@ -873,7 +873,11 @@ ivas_error ivas_ism_config(
    const int16_t nchan_ism,                                    /* i  : number of objects                           */
    ISM_METADATA_HANDLE hIsmMeta[],                             /* i/o: ISM metadata handles                        */
    const int16_t ism_extended_metadata_flag,                   /* i  : extended metadata flag                      */
#ifdef FIX_532_ISM_MD_INACTIVE
    const int16_t null_metadata_flag[MAX_NUM_OBJECTS],          /* i  : NULL MD flag                                */
#else
    const int16_t localVAD[MAX_NUM_OBJECTS],                    /* i  : local VAD flag                              */
#endif
    const int16_t ism_imp[],                                    /* i  : ISM importance flags                        */
    int32_t element_brate[],                                    /* o  : element bitrate per object                  */
    int32_t total_brate[],                                      /* o  : total bitrate per object                    */
Loading