Commit 0dc368b7 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 387-ism-metadata-discontinuity-in-fec

parents 290c8f04 f3b4ed31
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -675,7 +675,11 @@ int main(
    }

    /* === Configure === */
#ifdef FIX_392_LATE_REVERB
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error in Renderer Config Init\n" );
        exit( -1 );
@@ -967,7 +971,12 @@ int main(
        }
        else
        {
#ifdef FIX_379_EXT_METADATA
            error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL );
            if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
#else
            if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
#endif
            {
                fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
+2 −1
Original line number Diff line number Diff line
@@ -833,12 +833,13 @@ static ivas_error write_indices_element(
            /* restore previous pointer position */
            pt_stream_loc = pt_stream_backup;
        }

#ifndef ISSUE_24_CLEANUP_MCT_LFE
        /* TODO implemented only for MCT for now */
        if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) )
        {
            continue;
        }
#endif
#ifdef ENABLE_BITRATE_VERIFICATION
        total_nb_bits =
#endif
+28 −6
Original line number Diff line number Diff line
@@ -249,14 +249,19 @@ int16_t getResq(
int16_t getTnsAllowed(
    const int32_t total_brate, /* i  : total bitrate               */
    const int16_t igf,         /* i  : flag indicating IGF activity*/
    const int16_t element_mode,       /* i  : IVAS element mode           */
    const int16_t element_mode /* i  : IVAS element mode           */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    ,
    const MCT_CHAN_MODE mct_chan_mode /* i  : MCT channel mode            */
#endif
)
{
    int16_t tnsAllowed = 0;

#ifndef ISSUE_24_CLEANUP_MCT_LFE
    if ( mct_chan_mode != MCT_CHAN_MODE_LFE )
    {
#endif
        if ( igf )
        {
            if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) )
@@ -268,7 +273,9 @@ int16_t getTnsAllowed(
        {
            tnsAllowed = 1;
        }
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    }
#endif

    return tnsAllowed;
}
@@ -411,16 +418,21 @@ int16_t getIgfPresent(
    const int16_t element_mode, /* i  : IVAS element mode           */
    const int32_t total_brate,  /* i  : total bitrate               */
    const int16_t bwidth,       /* i  : audio bandwidth             */
    const int16_t rf_mode,      /* i  : flag to signal the RF mode  */
    const int16_t rf_mode       /* i  : flag to signal the RF mode  */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    ,
    const int16_t mct_chan_mode /* i  : MCT channel mode            */
#endif
)
{
    int16_t igfPresent = 0;

#ifndef ISSUE_24_CLEANUP_MCT_LFE
    if ( mct_chan_mode == MCT_CHAN_MODE_LFE )
    {
        return igfPresent;
    }
#endif

    if ( bwidth == SWB )
    {
@@ -808,8 +820,11 @@ void init_tcx_cfg(
    const int16_t infoIGFStopFreq,
    const int16_t element_mode,
    const int16_t ini_frame,
    const int16_t MCT_flag,
    const int16_t MCT_flag
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    ,
    const MCT_CHAN_MODE mct_chan_mode /* i  : MDCT channel mode     */
#endif
)
{
    int16_t i;
@@ -840,13 +855,20 @@ void init_tcx_cfg(
    /* set number of coded lines */
    hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );

#ifndef ISSUE_24_CLEANUP_MCT_LFE
    if ( mct_chan_mode == MCT_CHAN_MODE_LFE )
    {
        hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE;
    }
#endif
    /* TNS in TCX */
    hTcxCfg->pCurrentTnsConfig = NULL;
    hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode, mct_chan_mode );
    hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode
#ifndef ISSUE_24_CLEANUP_MCT_LFE
                                            ,
                                            mct_chan_mode
#endif
    );

    if ( hTcxCfg->fIsTNSAllowed )
    {
+22 −7
Original line number Diff line number Diff line
@@ -325,6 +325,9 @@ typedef enum
#define ISM_RADIUS_DELTA                        0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */
#define ISM_EXTENDED_METADATA_BRATE             IVAS_64k
#define ISM_EXTENDED_METADATA_BITS              1
#ifdef FIX_379_EXT_METADATA                                     
#define ISM_METADATA_RS_MAX_FRAMES              5 /* Number of frames with opposite extended metadata flags before switching */
#endif

/* Parametric ISM */
#define MAX_PARAM_ISM_NBANDS                    11
@@ -373,7 +376,11 @@ enum
{
    IND_ISM_NUM_OBJECTS,
    IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
#ifdef FIX_379_EXT_METADATA
    IND_ISM_METADATA_FLAG,
#else
    IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISM? */
#endif
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
#ifdef DISCRETE_ISM_DTX_CNG
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
@@ -1276,18 +1283,26 @@ typedef enum
#define NBBITS_MCT_RATIO                        4
#define BITRATE_MCT_RATIO_RANGE                 ( 1 << NBBITS_MCT_RATIO )   /* Range of the coded bitrate distribution ratio */

#ifndef ISSUE_24_CLEANUP_MCT_LFE
#define LFE_BITS                                180

#define MCT_LFE_MAX_LINE                        24
#endif
#define MCT_NUM_BLOCK_DATA_BITS                 4

#ifndef ISSUE_24_CLEANUP_MCT_LFE
typedef enum
{
    MCT_CHAN_MODE_REGULAR,
    MCT_CHAN_MODE_LFE,
    MCT_CHAN_MODE_IGNORE
} MCT_CHAN_MODE;

#else
typedef enum
{
    MCT_CHAN_MODE_REGULAR,
    MCT_CHAN_MODE_IGNORE
} MCT_CHAN_MODE;
#endif

/*----------------------------------------------------------------------------------*
 * Parametric MC Constants
+19 −4
Original line number Diff line number Diff line
@@ -66,11 +66,13 @@ void splitAvailableBitsMCT(
    int16_t min_chan_bits[MCT_MAX_CHANNELS], min_bits_tot, remaining_bits;
    int16_t core[MCT_MAX_CHANNELS];
    MCT_CHAN_MODE mct_chan_mode[MCT_MAX_CHANNELS];
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    int16_t num_lfe;
    int16_t lfe_channel;

    num_lfe = 0;
    lfe_channel = -1;
#endif
    min_bits_tot = 0;

    for ( i = 0; i < nchan; i++ )
@@ -85,18 +87,23 @@ void splitAvailableBitsMCT(
            mct_chan_mode[i] = ( (Decoder_State *) sts[i] )->mct_chan_mode;
            core[i] = ( (Decoder_State *) sts[i] )->core;
        }

#ifndef ISSUE_24_CLEANUP_MCT_LFE
        if ( mct_chan_mode[i] == MCT_CHAN_MODE_LFE )
        {
            num_lfe++;
            lfe_channel = i;
            assert( lfe_channel == LFE_CHANNEL );
        }
#endif
    }

    for ( i = 0; i < nchan; i++ )
    {
        if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        if (
#ifndef ISSUE_24_CLEANUP_MCT_LFE
            mct_chan_mode[i] != MCT_CHAN_MODE_LFE &&
#endif
            mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        {
            min_chan_bits[i] = 0;

@@ -128,7 +135,11 @@ void splitAvailableBitsMCT(
            bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel;
        }

        if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        if (
#ifndef ISSUE_24_CLEANUP_MCT_LFE
            mct_chan_mode[i] != MCT_CHAN_MODE_LFE &&
#endif
            mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        {
            assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE );
            *bits_frame_channel = split_ratio[i] * remaining_bits / BITRATE_MCT_RATIO_RANGE + min_chan_bits[i];
@@ -162,7 +173,11 @@ void splitAvailableBitsMCT(
                bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel;
            }

            if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
            if (
#ifndef ISSUE_24_CLEANUP_MCT_LFE
                mct_chan_mode[i] != MCT_CHAN_MODE_LFE &&
#endif
                mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
            {
                *bits_frame_channel -= diff * split_ratio[i] / BITRATE_MCT_RATIO_RANGE;
                *bits_frame_channel = max( min_chan_bits[i], *bits_frame_channel );
Loading