Commit 4e7b6b6b authored by multrus's avatar multrus
Browse files

[cleanup] accept NONBE_FIX_1065_ISM_MD_HANDLE

parent 131210c8
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -999,20 +999,14 @@ ivas_error ivas_ism_metadata_enc_create(

ivas_error ivas_ism_metadata_dec_create(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                      */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
    const int16_t n_ISms,                                       /* i  : number of separately coded objects          */
#else
    const int16_t n_ISms,                                       /* i  : number of objects                           */
#endif
    int32_t element_brate_tmp[]                                 /* o  : element bitrate per object                  */
);

#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
void ivas_ism_reset_metadata_handle_dec(
    ISM_METADATA_HANDLE hIsmMeta                                /* i/o: ISM metadata handle                         */
);

#endif
ivas_error ivas_ism_enc(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                      */
    float *data[],                                             /* i  : input signal [channels][samples]            */
+0 −1
Original line number Diff line number Diff line
@@ -184,7 +184,6 @@
#define FIX_1053_REVERB_RECONFIGURATION                 /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define NONBE_FIX_SBA_SIGNALING_BITS_B                  /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
#define NONBE_FIX_984_OMASA_EXT_OUTPUT                  /* Nok: issue 1497 - porting OMASA EXT MR   */
#define NONBE_FIX_1065_ISM_MD_HANDLE                    /* VA: issue 1065: Allocate only the necessary number of ISM MD decoder handles. */
#define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP               /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */

/* #################### End BASOP porting switches ############################ */
+0 −8
Original line number Diff line number Diff line
@@ -1272,11 +1272,7 @@ ivas_error ivas_init_decoder(
            }
        }

#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
        if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -1607,7 +1603,6 @@ ivas_error ivas_init_decoder(
            }

            reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] );
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
            if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
                if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
@@ -1617,14 +1612,11 @@ ivas_error ivas_init_decoder(
            }
            else
            {
#endif
                if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
            }
#endif
        }
        else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
        {
+0 −36
Original line number Diff line number Diff line
@@ -642,7 +642,6 @@ ivas_error ivas_ism_metadata_dec(
    return IVAS_ERR_OK;
}

#ifdef NONBE_FIX_1065_ISM_MD_HANDLE

/*-------------------------------------------------------------------*
 * ivas_ism_reset_metadata_handle_dec()
@@ -675,7 +674,6 @@ void ivas_ism_reset_metadata_handle_dec(
    return;
}

#endif

/*-------------------------------------------------------------------------
 * ivas_ism_metadata_dec_create()
@@ -685,11 +683,7 @@ void ivas_ism_reset_metadata_handle_dec(

ivas_error ivas_ism_metadata_dec_create(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure      */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
    const int16_t n_ISms, /* i  : number of separately coded objects  */
#else
    const int16_t n_ISms, /* i  : number of objects           */
#endif
    int32_t element_brate_tmp[] /* o  : element bitrate per object  */
)
{
@@ -697,48 +691,19 @@ ivas_error ivas_ism_metadata_dec_create(
    ivas_error error;

    /* allocate ISM metadata handles */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
    for ( ch = 0; ch < n_ISms; ch++ )
#else
    for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ )
#endif
    {
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
        if ( st_ivas->hIsmMetaData[ch] == NULL ) /* note: the handle can be allocated in OMASA bitrate switching from ISM_MASA_MODE_xxx_ONE_OBJ to ISM_MASA_MODE_DISC mode for 'ch==0' */
        {
#endif
            if ( ( st_ivas->hIsmMetaData[ch] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) );
            }
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
        }
#endif

#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
        ivas_ism_reset_metadata_handle_dec( st_ivas->hIsmMetaData[ch] );
#else
        st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0;
        st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0;
        st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 );
        st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0;
        st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 );
        st_ivas->hIsmMetaData[ch]->last_radius_idx = 8; /* Init to radius 1.0 */

        st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0;
        st_ivas->hIsmMetaData[ch]->last_true_elevation = 0;
        st_ivas->hIsmMetaData[ch]->last_azimuth = 0;
        st_ivas->hIsmMetaData[ch]->last_elevation = 0;

        st_ivas->hIsmMetaData[ch]->ism_imp = -1;
        st_ivas->hIsmMetaData[ch]->ism_md_null_flag = 0;
        st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = 0;

        ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] );
#endif
    }

#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
    /* sanity freeing - it can happen only in reconfiguration when a smaller number of handles than before is requested */
    for ( ; ch < MAX_NUM_OBJECTS; ch++ )
    {
@@ -749,7 +714,6 @@ ivas_error ivas_ism_metadata_dec_create(
        }
    }

#endif
    if ( element_brate_tmp != NULL )
    {
        if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK )
+0 −17
Original line number Diff line number Diff line
@@ -297,7 +297,6 @@ ivas_error ivas_omasa_dec_config(
        if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
            /* the full number of hIsmMetaData are needed for EXT output */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
            if ( st_ivas->hIsmMetaData[0] == NULL )
            {
                if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
@@ -312,16 +311,6 @@ ivas_error ivas_omasa_dec_config(
                    ivas_ism_reset_metadata_handle_dec( st_ivas->hIsmMetaData[k] );
                }
            }
#else
            n_MD = st_ivas->nchan_ism;
            ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
            if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD );
#endif
        }
        else
        {
@@ -336,21 +325,15 @@ ivas_error ivas_omasa_dec_config(
                        return error;
                    }
                }
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
                else
                {
                    ivas_ism_reset_metadata_handle_dec( st_ivas->hIsmMetaData[0] );
                }
#endif
            }
            else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
            {
                n_MD = st_ivas->nchan_ism;

#ifndef NONBE_FIX_1065_ISM_MD_HANDLE

                ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
#endif
                if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
                {
                    return error;