/* shift indices, if the new id is to be written somewhere inside the list */
if(i<hBstr->nb_ind_tot)
{
#ifdef DEBUG_IND_LIST_OUT_OF_ORDER
printf("Indice ID=%d is written before the last indice with ID=%d!\n",id,hBstr->ind_list[hBstr->nb_ind_tot-1].id);
#endif
for(j=hBstr->nb_ind_tot;j>i;j--)
{
hBstr->ind_list[j].id=hBstr->ind_list[j-1].id;
@@ -648,9 +639,6 @@ ivas_error push_indice(
/* updates */
#ifdef IND_LIST_DYN
hBstr->nb_ind_tot++;
#ifdef DEBUG_IND_LIST
assert((hBstr->nb_ind_tot<hBstr->max_num_indices)&&"Maximum number of indices has been exceeded!");
#endif
#else
hBstr->next_ind=i+1;
hBstr->last_ind=id;
@@ -707,9 +695,7 @@ ivas_error push_next_indice(
{
returnIVAS_ERROR(IVAS_ERR_INTERNAL_FATAL,"Total number of indices exceeded: %d !\n",MAX_NUM_INDICES);
}
#endif
#ifndef IND_LIST_DYN
if(hBstr->ind_list[hBstr->next_ind].nb_bits>0)
{
returnIVAS_ERROR(IVAS_ERR_INTERNAL_FATAL,"Indice with value %d is trying to re-write an existing indice (frame %d) !\n",value,frame);
@@ -717,6 +703,22 @@ ivas_error push_next_indice(
#endif
#endif
#ifdef IND_LIST_DYN
/* check, if the maximum number of indices has been reached and re-allocate the buffer */
/* the re-allocation can be avoided by increasing the limits in get_max_num_indices() and get_max_num_indices_metadata() */
if(hBstr->nb_ind_tot>=hBstr->max_num_indices)
{
#ifdef DEBUGGING
DEBUG_LINE(1)
printf("Warning: Maximum number of indices %d has been exceeded (frame %d)! Increase the limits in get_max_num_indices() or get_max_num_indices_metadata().\n",hBstr->max_num_indices,frame);
#endif
/* reallocate the buffer of indices with increased limit */
/* get the id of the previous indice -> it will be re-used */
if(hBstr->nb_ind_tot>0)
@@ -742,14 +744,9 @@ ivas_error push_next_indice(
/* updates */
#ifdef IND_LIST_DYN
hBstr->nb_ind_tot++;
#ifdef DEBUG_IND_LIST
assert((hBstr->nb_ind_tot<hBstr->max_num_indices)&&"Maximum number of indices has been exceeded!");
#endif
#else
hBstr->next_ind++;
#endif
hBstr->nb_bits_tot+=nb_bits;
returnerror;
@@ -785,6 +782,7 @@ void push_next_bits(
#ifdef DEBUG_BS_READ_WRITE
printf("%s: %d: %d\n",func,line,nb_bits);
#endif
#ifdef IND_LIST_DYN
ptr=&hBstr->ind_list[hBstr->nb_ind_tot];
@@ -814,12 +812,24 @@ void push_next_bits(
#ifdef IND_LIST_DYN
ptr->id=prev_id;
hBstr->nb_ind_tot++;
#ifdef DEBUG_IND_LIST
assert((hBstr->nb_ind_tot<hBstr->max_num_indices)&&"Maximum number of indices has been exceeded!");
#endif
#ifdef IND_LIST_DYN
/* check, if the maximum number of indices has been reached and re-allocate the buffer */
/* the re-allocation can be avoided by increasing the limits in get_max_num_indices() and get_max_num_indices_metadata() */
if(hBstr->nb_ind_tot>=hBstr->max_num_indices)
{
#ifdef DEBUGGING
DEBUG_LINE(1)
printf("Warning: Maximum number of indices %d has been exceeded (frame %d)! Increase the limits in get_max_num_indices() or get_max_num_indices_metadata().\n",hBstr->max_num_indices,frame);
#endif
++ptr;
/* reallocate the buffer of indices with increased limit */
assert((hBstr->nb_ind_tot<hBstr->max_num_indices)&&"Maximum number of indices has been exceeded!");
#endif
#ifdef IND_LIST_DYN
/* check, if the maximum number of indices has been reached and re-allocate the buffer */
/* the re-allocation can be avoided by increasing the limits in get_max_num_indices() and get_max_num_indices_metadata() */
if(hBstr->nb_ind_tot>=hBstr->max_num_indices)
{
#ifdef DEBUGGING
DEBUG_LINE(1)
printf("Warning: Maximum number of indices %d has been exceeded (frame %d)! Increase the limits in get_max_num_indices() or get_max_num_indices_metadata().\n",hBstr->max_num_indices,frame);
#endif
/* reallocate the buffer of indices with increased limit */