Commit ed57f99c authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into sba-ext-fix

parents 64cdc572 8431ddc1
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1292,10 +1292,14 @@ typedef enum
#define LFE_CHANNEL                             3

#define MIN_LFE_NRG                             0.5f
#define MCT_MAX_CHANNELS                        MAX_TRANSPORT_CHANNELS
#ifdef ADJUST_MCT_CHANNELS_MAX   
#define MCT_MAX_CHANNELS                        11                          /* == 7.1.4 LS channels without the LFE channel */
#define MCT_MAX_BLOCKS                          ( ( MCT_MAX_CHANNELS + 1 ) / CPE_CHANNELS )    /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
#else
#define MCT_MAX_CHANNELS                        12
#define MCT_MAX_BLOCKS                          ( MCT_MAX_CHANNELS / CPE_CHANNELS )    /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/

#define MAX_NUM_DATA                            max( MCT_MAX_CHANNELS, 4 )
#endif

#define NBBITS_MCT_RATIO                        4
#define BITRATE_MCT_RATIO_RANGE                 ( 1 << NBBITS_MCT_RATIO )   /* Range of the coded bitrate distribution ratio */
+3 −1
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@
#define FIX_1053_AEID_FILE_TEST                         /* Philips: Tests for the -aeid file and fix for memory error */
#define FIX_1121_MASA_DESCRIPTOR                        /* VA: issue 1121: Define 'ivasmasaFormatDescriptor' at one common place */
#define FIX_1113_CLDFB_REND_IN_ISAR                     /* issue 1113: fix the use of CLDFB renderer in split-rendering at the external renderer */
#define ADJUST_MCT_CHANNELS_MAX                         /* FhG: set correct max mct channels constant*/

/* #################### End BE switches ################################## */

@@ -175,6 +176,7 @@

#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING             /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */
#define NONBE_1131_ACELP_OOB                                  /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */
#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER                  /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
#define NONBE_FIX_1052_SBA_EXT_FIX                            /* VA: SBA external output support fix - do not overwrite "output_config" parameter */


+39 −42
Original line number Diff line number Diff line
@@ -54,18 +54,25 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r

static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const int16_t sba_order );
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
/*-------------------------------------------------------------------*
 * ivas_set_audio_config_from_sba_order()
 *
 *
 *-------------------------------------------------------------------*/

/*! r: audio configuration */
static AUDIO_CONFIG ivas_set_audio_config_from_sba_order(
    const int16_t sba_order /* i  : Ambisonic (SBA) order           */
)
#else
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order );
#endif


#ifndef NONBE_FIX_1052_SBA_EXT_FIX
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order )
{
    AUDIO_CONFIG output_config;

    output_config = IVAS_AUDIO_CONFIG_HOA3;

    switch ( sba_order )
    {
        case SBA_FOA_ORDER:
@@ -78,11 +85,17 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_ord
            output_config = IVAS_AUDIO_CONFIG_HOA3;
            break;
        default:
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            output_config = IVAS_AUDIO_CONFIG_INVALID;
            break;
#else
            assert( 0 );
#endif
    }

    return output_config;
}
#endif


/*-------------------------------------------------------------------*
 * ivas_dec_setup()
@@ -165,7 +178,11 @@ ivas_error ivas_dec_setup(
#ifndef NONBE_FIX_1052_SBA_EXT_FIX
            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
                st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
#else
                st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
#endif
                st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
            }
#endif
@@ -411,7 +428,11 @@ ivas_error ivas_dec_setup(
#ifndef NONBE_FIX_1052_SBA_EXT_FIX
        if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
#else
            st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
#endif
            st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
        }
#endif
@@ -956,7 +977,11 @@ ivas_error ivas_init_decoder(
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#endif
        {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) );
#else
            hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
#endif
            hDecoderConfig->nchan_out += st_ivas->nchan_ism;
        }
        else if ( st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
@@ -982,8 +1007,12 @@ ivas_error ivas_init_decoder(
        ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config );
        st_ivas->intern_config = st_ivas->transport_config;
    }
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == SBA_FORMAT )
    else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) )
#else
    else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == SBA_ISM_FORMAT )
#endif
    {
        st_ivas->intern_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
        ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->intern_config );
@@ -1002,6 +1031,7 @@ ivas_error ivas_init_decoder(
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
    }

#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
    {
        st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
@@ -1010,6 +1040,7 @@ ivas_error ivas_init_decoder(
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
    }

#endif
    /* Only initialize transport setup if it is used */
    if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID )
    {
@@ -2941,37 +2972,3 @@ static ivas_error doSanityChecks_IVAS(

    return IVAS_ERR_OK;
}


#ifdef NONBE_FIX_1052_SBA_EXT_FIX
/*-------------------------------------------------------------------*
 * ivas_set_audio_config_from_sba_order()
 *
 *
 *-------------------------------------------------------------------*/

/*! r: audio configuration */
static AUDIO_CONFIG ivas_set_audio_config_from_sba_order(
    const int16_t sba_order /* i  : Ambisonic (SBA) order   */
)
{
    AUDIO_CONFIG audio_config;

    switch ( sba_order )
    {
        case SBA_FOA_ORDER:
            audio_config = IVAS_AUDIO_CONFIG_FOA;
            break;
        case SBA_HOA2_ORDER:
            audio_config = IVAS_AUDIO_CONFIG_HOA2;
            break;
        case SBA_HOA3_ORDER:
            audio_config = IVAS_AUDIO_CONFIG_HOA3;
            break;
        default:
            audio_config = IVAS_AUDIO_CONFIG_INVALID;
    }

    return audio_config;
}
#endif
+21 −4
Original line number Diff line number Diff line
@@ -77,8 +77,15 @@ void ivas_mct_side_bits(
    {
        for ( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
#ifdef ADJUST_MCT_CHANNELS_MAX
            if ( i < MCT_MAX_CHANNELS )
            {
#endif
                sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
                i++;
#ifdef ADJUST_MCT_CHANNELS_MAX
            }
#endif
        }
    }

@@ -194,11 +201,20 @@ void ivas_mct_core_dec(
    {
        for ( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
#ifdef ADJUST_MCT_CHANNELS_MAX
            if ( i < MCT_MAX_CHANNELS )
            {
#endif
                sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
                i++;
#ifdef ADJUST_MCT_CHANNELS_MAX
            }
#endif
        }
    }

#ifndef ADJUST_MCT_CHANNELS_MAX
    /*seems like obsolete code*/
    for ( ch = 0, i = 0; ch < nChannels; ch++ )
    {
        if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
@@ -208,6 +224,7 @@ void ivas_mct_core_dec(
        i++;
    }

#endif
    bfi = sts[0]->bfi;

    for ( ch = 0; ch < nChannels; ch++ )
+5 −1
Original line number Diff line number Diff line
@@ -334,7 +334,11 @@ void ivas_renderer_select(
            {
                *internal_config = IVAS_AUDIO_CONFIG_FOA;
            }
            else
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
            if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#endif
            {
                *internal_config = IVAS_AUDIO_CONFIG_HOA3;
            }
Loading