Commit dd1d9e9a authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_MEM_REALLOC_IND_LIST

parent 49298f94
Loading
Loading
Loading
Loading
+0 −59
Original line number Diff line number Diff line
@@ -169,7 +169,6 @@ Word16 rate2EVSmode(
 * Re-allocate the list of indices
 *-------------------------------------------------------------------*/

#ifdef FIX_MEM_REALLOC_IND_LIST
ivas_error ind_list_realloc(
    INDICE_HANDLE old_ind_list,    /* i  : pointer to the beginning of the old buffer of indices */
    const int16_t max_num_indices, /* i  : new maximum number of allowed indices in the list */
@@ -292,56 +291,6 @@ ivas_error ind_list_realloc(
    return IVAS_ERR_OK;
}

#else

ivas_error ind_list_realloc(
    BSTR_ENC_HANDLE hBstr,        /* i/o: encoder bitstream handle                          */
    const int16_t max_num_indices /* i  : new maximum number of allowed indices in the list */
)
{
    int16_t i, ind_list_pos;
    INDICE_HANDLE new_ind_list;

    /* allocate new buffer of indices */
    if ( ( new_ind_list = (INDICE_HANDLE) malloc( max_num_indices * sizeof( Indice ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for buffer of indices!\n" ) );
    }

    /* move indices from the old list to the new list */
    for ( i = 0; i < min( max_num_indices, *( hBstr->ivas_max_num_indices ) ); i++ )
    {
        if ( ( *hBstr->ivas_ind_list_zero )[i].nb_bits > -1 )
        {
            new_ind_list[i].id = ( *hBstr->ivas_ind_list_zero )[i].id;
            new_ind_list[i].value = ( *hBstr->ivas_ind_list_zero )[i].value;
        }
        new_ind_list[i].nb_bits = ( *hBstr->ivas_ind_list_zero )[i].nb_bits;
    }

    /* reset nb_bits of all other indices to -1 */
    for ( ; i < max_num_indices; i++ )
    {
        new_ind_list[i].nb_bits = -1;
    }

    /* get the current position inside the old list */
    ind_list_pos = (int16_t) ( hBstr->ind_list - ( *hBstr->ivas_ind_list_zero ) );

    /* free the old list */
    free( ( *hBstr->ivas_ind_list_zero ) );

    /* set pointers in the new list */
    hBstr->ind_list = &new_ind_list[ind_list_pos];
    *( hBstr->ivas_ind_list_zero ) = new_ind_list;

    /* set the new maximum number of indices */
    *( hBstr->ivas_max_num_indices ) = max_num_indices;

    return IVAS_ERR_OK;
}

#endif


/*-----------------------------------------------------------------------*
@@ -1088,11 +1037,7 @@ ivas_error check_ind_list_limits(
#endif

        /* reallocate the buffer of indices with increased limit */
#ifdef FIX_MEM_REALLOC_IND_LIST
        if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -1120,11 +1065,7 @@ ivas_error check_ind_list_limits(
#endif

                /* no available empty slot -> need to re-allocate the buffer */
#ifdef FIX_MEM_REALLOC_IND_LIST
                if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
+0 −1
Original line number Diff line number Diff line
@@ -151,7 +151,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */


#define FIX_MEM_REALLOC_IND_LIST                        /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/
#define FIX_1720_HRTF_FASTCONV                          /* Dlb : Binaural and Binaural room format RAM saving in SBA mode */
#define JBM_PARAMUPMIX                                  /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */
#define FIX_194_LFE_DELAY_EXTREND                       /* FhG: Issue 194: Fix delay alignment of LFE in external renderer */
+0 −7
Original line number Diff line number Diff line
@@ -538,18 +538,11 @@ int16_t get_ivas_max_num_indices_metadata(
    const int32_t ivas_total_brate /* i  : IVAS total bitrate       */
);

#ifdef FIX_MEM_REALLOC_IND_LIST
ivas_error ind_list_realloc(
    INDICE_HANDLE old_ind_list,    /* i  : pointer to the beginning of the old buffer of indices */
    const int16_t max_num_indices, /* i  : new maximum number of allowed indices in the list */
    Encoder_Struct *st_ivas        /* i  : IVAS encoder structure                  */
);
#else
ivas_error ind_list_realloc(
    BSTR_ENC_HANDLE hBstr,        /* i/o: encoder bitstream handle  */
    const int16_t max_num_indices /* i  : new maximum number of allowed indices in the list */
);
#endif

ivas_error check_ind_list_limits(
    BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle                    */
+0 −2
Original line number Diff line number Diff line
@@ -126,9 +126,7 @@ ivas_error init_encoder(
        st->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices;
        st->hBstr->nb_ind_tot = 0;
        st->hBstr->nb_bits_tot = 0;
#ifdef FIX_MEM_REALLOC_IND_LIST
        st->hBstr->st_ivas = st_ivas;
#endif
    }
    else
    {
+0 −2
Original line number Diff line number Diff line
@@ -482,9 +482,7 @@ ivas_error ivas_corecoder_enc_reconfig(
                st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata;
                st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot = 0;
                st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_bits_tot = 0;
#ifdef FIX_MEM_REALLOC_IND_LIST
                st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->st_ivas = st_ivas;
#endif
            }

            reset_indices_enc( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot );
Loading