returnIVAS_ERROR(IVAS_ERR_INTERNAL_FATAL,"Indice ID = %d with value %d is trying to allocate %d bits which exceeds 16 bits (frame %d) !\n",id,value,nb_bits,frame);
}
#ifndef IND_LIST_DYN
if(id>=MAX_NUM_INDICES)
{
returnIVAS_ERROR(IVAS_ERR_INTERNAL_FATAL,"Indice ID = %d exceeds the total number of indices: %d (frame %d) !\n",id,MAX_NUM_INDICES,frame);
}
#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 */
returnIVAS_ERROR(IVAS_ERR_INTERNAL_FATAL,"Indice with value %d is trying to re-write an existing indice (frame %d) !\n",value,frame);
}
#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 */
/* update the total number of bits already written */
/* updates */
#ifdef IND_LIST_DYN
hBstr->nb_ind_tot++;
#else
hBstr->next_ind++;
#endif
hBstr->nb_bits_tot+=nb_bits;
returnerror;
}
@@ -389,10 +718,28 @@ void push_next_bits(
uint16_tcode;
int16_ti,nb_bits_m15;
Indice*ptr;
#ifdef IND_LIST_DYN
int16_tprev_id;
#endif
#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];
/* get the id of the previous indice -> will be re-used here as well */
if(hBstr->nb_ind_tot>0)
{
prev_id=hBstr->ind_list[hBstr->nb_ind_tot-1].id;
}
else
{
prev_id=0;
}
#else
ptr=&hBstr->ind_list[hBstr->next_ind];
#endif
nb_bits_m15=nb_bits-15;
for(i=0;i<nb_bits_m15;i+=16)
@@ -404,8 +751,29 @@ void push_next_bits(
printf("code: %d\n",code);
#endif
ptr->nb_bits=16;
#ifdef IND_LIST_DYN
ptr->id=prev_id;
hBstr->nb_ind_tot++;
#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 */
/* 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 */