Commit 3e78c239 authored by malenov's avatar malenov
Browse files

re-integrate IND_LIST_DYN

parent 880f9a20
Loading
Loading
Loading
Loading
Loading
+544 −8
Original line number Diff line number Diff line
@@ -62,6 +62,11 @@
FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */
#endif

#ifdef IND_LIST_DYN
#define STEP_MAX_NUM_INDICES 20 /* increase the maximum number of allowed indices in the list by this amount */
#endif

#ifndef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * pack_bit()
 *
@@ -115,6 +120,7 @@ static Word16 unpack_bit(

    return bit;
}
#endif

/*-------------------------------------------------------------------*
 * rate2AMRWB_IOmode()
@@ -214,6 +220,238 @@ Word16 rate2EVSmode(
    return rate2AMRWB_IOmode( brate );
}

#ifdef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * ind_list_realloc()
 *
 * Re-allocate the list of indices as the maximum number of allowed indices has changed
 *-------------------------------------------------------------------*/

ivas_error ind_list_realloc(
    BSTR_ENC_HANDLE hBstr,  /* i/o: encoder bitstream handle  */
    int16_t max_num_indices /* i  : new maximum number of allowed indices in the list */
)
{
    int16_t i;
    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 */
    i = 0;
    while ( hBstr->ind_list[i].nb_bits > 0 )
    {
        new_ind_list[i].id = hBstr->ind_list[i].id;
        new_ind_list[i].value = hBstr->ind_list[i].value;
        new_ind_list[i].nb_bits = hBstr->ind_list[i].nb_bits;
        i++;
    }

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

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

    /* set pointer to the new list */
    hBstr->ind_list = new_ind_list;

    /* set the new maximum for the allowed number of indices */
    hBstr->max_num_indices = max_num_indices;

    return IVAS_ERR_OK;
}


/*-----------------------------------------------------------------------*
 * get_max_num_indices()
 *
 * Set the maximum allowed number of indices in the list
 *-----------------------------------------------------------------------*/

int16_t get_max_num_indices(                                /* o  : maximum number of indices */
                             const IVAS_FORMAT ivas_format, /* i  : IVAS format               */
                             const int32_t total_brate      /* i  : total bitrate             */
)
{
    /* set the maximum required number of indices */
    if ( ivas_format == MONO_FORMAT )
    {
        if ( total_brate < IVAS_24k4 )
        {
            return 450;
        }
        else
        {
            return 450;
        }
    }
    else if ( ivas_format == STEREO_FORMAT )
    {
        if ( total_brate < IVAS_24k4 )
        {
            return 250;
        }
        else if ( total_brate < IVAS_128k )
        {
            return 450;
        }
        else
        {
            return 550;
        }
    }
    else if ( ivas_format == ISM_FORMAT )
    {
        if ( total_brate < IVAS_24k4 )
        {
            return 250;
        }
        else if ( total_brate < IVAS_128k )
        {
            return 450;
        }
        else
        {
            return 700;
        }
    }
    else if ( ivas_format == SBA_FORMAT )
    {
        if ( total_brate < IVAS_24k4 )
        {
            return 250;
        }
        else if ( total_brate < IVAS_128k )
        {
            return 450;
        }
        else
        {
            return 700;
        }
    }
    else if ( ivas_format == MASA_FORMAT )
    {
        if ( total_brate < IVAS_24k4 )
        {
            return 250;
        }
        else if ( total_brate < IVAS_160k )
        {
            return 450;
        }
        else
        {
            return 700;
        }
    }
    else if ( ivas_format == MC_FORMAT )
    {
        if ( total_brate < IVAS_24k4 )
        {
            return 450;
        }
        else
        {
            return 1050;
        }
    }

    return 1050;
}

#ifdef IND_LIST_DYN
/*-----------------------------------------------------------------------*
 * set_max_set_max_num_indices_metadatanum_indices()
 *
 * Set the maximum allowed number of metadata indices in the list
 *-----------------------------------------------------------------------*/

int16_t get_max_num_indices_metadata(                                /* o  : maximum number of indices */
                                      const IVAS_FORMAT ivas_format, /* i  : IVAS format               */
                                      const int32_t ivas_total_brate /* i  : IVAS total bitrate       */
)
{
    /* set the maximum required number of metadata indices */
    if ( ivas_format == MONO_FORMAT )
    {
        return 0;
    }
    else if ( ivas_format == STEREO_FORMAT )
    {
        return 80;
    }
    else if ( ivas_format == ISM_FORMAT )
    {
        return 60;
    }
    else if ( ivas_format == SBA_FORMAT )
    {
        if ( ivas_total_brate < IVAS_24k4 )
        {
            return 80;
        }
        else if ( ivas_total_brate < IVAS_48k )
        {
            return 670;
        }
        else
        {
            return 1060;
        }
    }
    else if ( ivas_format == MASA_FORMAT )
    {
        if ( ivas_total_brate < IVAS_32k )
        {
            return 90;
        }
        else if ( ivas_total_brate < IVAS_48k )
        {
            return 130;
        }
        else if ( ivas_total_brate < IVAS_192k )
        {
            return 330;
        }
        else if ( ivas_total_brate < IVAS_384k )
        {
            return 1000;
        }
        else
        {
            return 1950;
        }
    }
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate == IVAS_32k || ivas_total_brate == IVAS_48k || ivas_total_brate == IVAS_64k )
        {
            return 300;
        }
        if ( ivas_total_brate == IVAS_80k || ivas_total_brate == IVAS_96k )
        {
            return 170;
        }
        else
        {
            return 90;
        }
    }

    return 1050;
}
#endif
#endif

/*-------------------------------------------------------------------*
 * push_indice()
 *
@@ -237,6 +475,9 @@ ivas_error push_indice(
)
{
    int16_t i;
#ifdef IND_LIST_DYN
    int16_t j;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -263,12 +504,48 @@ ivas_error push_indice(
        return IVAS_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 )
    {
        return IVAS_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 */
        ind_list_realloc( hBstr, hBstr->nb_ind_tot + STEP_MAX_NUM_INDICES );
    }
#endif

#ifdef IND_LIST_DYN
    /* find the location in the list of indices */
    i = hBstr->nb_ind_tot;
    while ( i > 0 && id < hBstr->ind_list[i - 1].id )
    {
        i--;
    }

    /* shift indices, if the new id is to be written somewhere inside the list */
    if ( i < hBstr->nb_ind_tot )
    {
        for ( j = hBstr->nb_ind_tot; j > i; j-- )
        {
            hBstr->ind_list[j].id = hBstr->ind_list[j - 1].id;
            hBstr->ind_list[j].nb_bits = hBstr->ind_list[j - 1].nb_bits;
            hBstr->ind_list[j].value = hBstr->ind_list[j - 1].value;
        }
    }
#else
    if ( hBstr->last_ind == id )
    {
        /* indice with the same name as the previous one */
@@ -283,21 +560,31 @@ ivas_error push_indice(
            i++;
        }
    }
#endif

#ifndef IND_LIST_DYN
#ifdef DEBUGGING
    if ( hBstr->ind_list[i].nb_bits > 0 )
    {
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice ID = %d with value %d is trying to re-write an existing indice (frame %d) !\n", id, value, frame );
    }
#endif
#endif

    /* store the new indice in the list */
#ifdef IND_LIST_DYN
    hBstr->ind_list[i].id = id;
#endif
    hBstr->ind_list[i].value = value;
    hBstr->ind_list[i].nb_bits = nb_bits;

    /* updates */
#ifdef IND_LIST_DYN
    hBstr->nb_ind_tot++;
#else
    hBstr->next_ind = i + 1;
    hBstr->last_ind = id;
#endif
    hBstr->nb_bits_tot += nb_bits;

    return error;
@@ -324,6 +611,9 @@ ivas_error push_next_indice(
#endif
)
{
#ifdef IND_LIST_DYN
    int16_t prev_id;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -342,6 +632,7 @@ ivas_error push_next_indice(
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice with value %d is trying to allocate %d bits which exceeds 16 bits !\n", value, nb_bits );
    }

#ifndef IND_LIST_DYN
    if ( hBstr->next_ind >= MAX_NUM_INDICES )
    {
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Total number of indices exceeded: %d !\n", MAX_NUM_INDICES );
@@ -352,16 +643,54 @@ ivas_error push_next_indice(
        return IVAS_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 */
        ind_list_realloc( hBstr, hBstr->nb_ind_tot + STEP_MAX_NUM_INDICES );
    }
#endif


#ifdef IND_LIST_DYN
    /* get the id of the previous indice -> it will be re-used */
    if ( hBstr->nb_ind_tot > 0 )
    {
        prev_id = hBstr->ind_list[hBstr->nb_ind_tot - 1].id;
    }
    else
    {
        prev_id = 0;
    }
#endif

    /* store the values in the list */
#ifdef IND_LIST_DYN
    hBstr->ind_list[hBstr->nb_ind_tot].id = prev_id;
    hBstr->ind_list[hBstr->nb_ind_tot].value = value;
    hBstr->ind_list[hBstr->nb_ind_tot].nb_bits = nb_bits;
#else
    hBstr->ind_list[hBstr->next_ind].value = value;
    hBstr->ind_list[hBstr->next_ind].nb_bits = nb_bits;
    hBstr->next_ind++;
#endif

    /* 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;


    return error;
}

@@ -389,10 +718,28 @@ void push_next_bits(
    uint16_t code;
    int16_t i, nb_bits_m15;
    Indice *ptr;
#ifdef IND_LIST_DYN
    int16_t prev_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 */
            ind_list_realloc( hBstr, hBstr->nb_ind_tot + STEP_MAX_NUM_INDICES );
        }
#endif

        ++ptr;
    }

    for ( ; i < nb_bits; ++i )
    {
        ptr->value = bits[i];
@@ -413,15 +781,118 @@ void push_next_bits(
        printf( "value: %d\n", ptr->value );
#endif
        ptr->nb_bits = 1;
#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 */
            ind_list_realloc( hBstr, hBstr->nb_ind_tot + STEP_MAX_NUM_INDICES );
        }
#endif

        ++ptr;
    }

#ifndef IND_LIST_DYN
    hBstr->next_ind = (int16_t) ( ptr - hBstr->ind_list );
#endif
    hBstr->nb_bits_tot = hBstr->nb_bits_tot + nb_bits;

    return;
}


#ifdef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * find_indice()
 *
 * Find indice based on its id
 *-------------------------------------------------------------------*/

/*! r: result: index of the indice in the list, -1 if not found */
int16_t find_indice(
    BSTR_ENC_HANDLE hBstr, /* i  : encoder bitstream handle                    */
    int16_t id,            /* i  : ID of the indice                            */
    uint16_t *value,       /* o  : value of the quantized indice               */
    int16_t *nb_bits       /* o  : number of bits used to quantize the indice  */
)
{
    int16_t i;

    for ( i = 0; i < hBstr->nb_ind_tot; i++ )
    {
        if ( hBstr->ind_list[i].id == id && hBstr->ind_list[i].nb_bits > 0 )
        {
            *value = hBstr->ind_list[i].value;
            *nb_bits = hBstr->ind_list[i].nb_bits;
            return i;
        }
    }

    return -1;
}

/*-------------------------------------------------------------------*
 * delete_indice()
 *
 * Delete indice based on its id (note, that nb_ind_tot and nb_bits_tot are updated)
 *-------------------------------------------------------------------*/

/*! r: number of deleted indices */
uint16_t delete_indice(
    BSTR_ENC_HANDLE hBstr, /* i  : encoder bitstream handle                    */
    int16_t id             /* i  : ID of the indice                            */
)
{
    int16_t i, j;

    j = 0;
    for ( i = 0; i < hBstr->nb_ind_tot; i++ )
    {
        if ( hBstr->ind_list[i].id == id )
        {
            hBstr->nb_bits_tot -= hBstr->ind_list[i].nb_bits;
            continue;
        }

        if ( j < i )
        {
            /* shift the indice left */
            hBstr->ind_list[j].id = hBstr->ind_list[i].id;
            hBstr->ind_list[j].value = hBstr->ind_list[i].value;
            hBstr->ind_list[j].nb_bits = hBstr->ind_list[i].nb_bits;
        }

        j++;
    }

    hBstr->nb_ind_tot = j;
#ifndef IND_LIST_DYN
    hBstr->next_ind = j;
#endif

    for ( ; j < i; j++ )
    {
        /* reset the shifted indices at the end of the list */
        hBstr->ind_list[j].nb_bits = -1;
    }

    return i - j;
}
#endif


/*-------------------------------------------------------------------*
 * get_next_indice()
 *
@@ -638,8 +1109,14 @@ void reset_indices_enc(
    int16_t i;

    hBstr->nb_bits_tot = 0;
#ifdef IND_LIST_DYN
    hBstr->nb_ind_tot = 0;
#else
    hBstr->next_ind = 0;
#endif
#ifndef IND_LIST_DYN
    hBstr->last_ind = -1;
#endif

    for ( i = 0; i < max_num_indices; i++ )
    {
@@ -670,7 +1147,11 @@ void reset_indices_dec(
 *-------------------------------------------------------------------*/

static int16_t write_indices_to_stream(
#ifdef IND_LIST_DYN
    Indice *ind_list,
#else
    Indice *ind_list_metadata,
#endif
    uint16_t **pt_stream,
    const int16_t inc,
    const int16_t num_indices )
@@ -684,8 +1165,13 @@ static int16_t write_indices_to_stream(

    for ( i = 0; i < num_indices; i++ )
    {
#ifdef IND_LIST_DYN
        value = ind_list[i].value;
        nb_bits = ind_list[i].nb_bits;
#else
        value = ind_list_metadata[i].value;
        nb_bits = ind_list_metadata[i].nb_bits;
#endif

        if ( nb_bits > 0 )
        {
@@ -717,6 +1203,10 @@ static int16_t write_indices_to_stream(
        {
            /* fprintf( stderr, "Warning: %s: nb_bits == 0!\n", __func__ ); */
        }
        else
        {
            /* fprintf( stderr, "Warning: %s: nb_bits == %d!\n", __func__, nb_bits ); */
        }
#endif
    }
#ifdef ENABLE_BITRATE_VERIFICATION
@@ -745,6 +1235,10 @@ static ivas_error write_indices_element(
    uint16_t *pt_stream_backup;
    uint16_t *pt_stream_end;
    int16_t nb_bits_tot_metadata;
#ifdef IND_LIST_DYN
    int16_t nb_ind_tot_metadata;
#endif

    Indice *ind_list_metadata;
    int16_t n, n_channels;
#ifdef ENABLE_BITRATE_VERIFICATION
@@ -755,6 +1249,9 @@ static ivas_error write_indices_element(
    error = IVAS_ERR_OK;

    ind_list_metadata = NULL;
#ifdef IND_LIST_DYN
    nb_ind_tot_metadata = 0;
#endif

    if ( st_ivas->hEncoderConfig->ivas_format == MONO_FORMAT )
    {
@@ -772,6 +1269,9 @@ static ivas_error write_indices_element(
            {
                nb_bits_tot_metadata = st_ivas->hSCE[element_id]->hMetaData->nb_bits_tot;
                ind_list_metadata = st_ivas->hSCE[element_id]->hMetaData->ind_list;
#ifdef IND_LIST_DYN
                nb_ind_tot_metadata = st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot;
#endif
            }
        }
        else if ( !is_SCE && st_ivas->hCPE[element_id] != NULL )
@@ -782,6 +1282,9 @@ static ivas_error write_indices_element(
            {
                nb_bits_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_bits_tot;
                ind_list_metadata = st_ivas->hCPE[element_id]->hMetaData->ind_list;
#ifdef IND_LIST_DYN
                nb_ind_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot;
#endif
            }
        }
#ifdef DEBUGGING
@@ -822,7 +1325,13 @@ static ivas_error write_indices_element(
#ifdef ENABLE_BITRATE_VERIFICATION
            total_nb_bits =
#endif
                write_indices_to_stream( ind_list_metadata, &pt_stream_loc, -1, MAX_BITS_METADATA );
                write_indices_to_stream( ind_list_metadata, &pt_stream_loc, -1,
#ifdef IND_LIST_DYN
                                         nb_ind_tot_metadata
#else
                                     MAX_BITS_METADATA
#endif
                );

#ifdef ENABLE_BITRATE_VERIFICATION
            if ( total_nb_bits != nb_bits_tot_metadata )
@@ -842,7 +1351,13 @@ static ivas_error write_indices_element(
#ifdef ENABLE_BITRATE_VERIFICATION
        total_nb_bits =
#endif
            write_indices_to_stream( sts[n]->hBstr->ind_list, &pt_stream_loc, 1, MAX_NUM_INDICES );
            write_indices_to_stream( sts[n]->hBstr->ind_list, &pt_stream_loc, 1,
#ifdef IND_LIST_DYN
                                     sts[n]->hBstr->nb_ind_tot
#else
                                 MAX_NUM_INDICES
#endif
            );

#ifdef ENABLE_BITRATE_VERIFICATION
        if ( total_nb_bits != sts[n]->hBstr->nb_bits_tot )
@@ -865,21 +1380,41 @@ static ivas_error write_indices_element(
    {
        if ( st_ivas->hSCE[element_id]->hMetaData != NULL )
        {
#ifdef IND_LIST_DYN
            reset_indices_enc( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->max_num_indices );
#else
            reset_indices_enc( st_ivas->hSCE[element_id]->hMetaData, MAX_BITS_METADATA );
#endif
        }

        reset_indices_enc( sts[0]->hBstr, MAX_NUM_INDICES );
        reset_indices_enc( sts[0]->hBstr,
#ifdef IND_LIST_DYN
                           sts[0]->hBstr->max_num_indices
#else
                           MAX_NUM_INDICES
#endif
        );
    }
    else
    {
        if ( st_ivas->hCPE[element_id]->hMetaData != NULL )
        {
#ifdef IND_LIST_DYN
            reset_indices_enc( st_ivas->hCPE[element_id]->hMetaData, st_ivas->hCPE[element_id]->hMetaData->max_num_indices );
#else
            reset_indices_enc( st_ivas->hCPE[element_id]->hMetaData, MAX_BITS_METADATA );
#endif
        }

        for ( n = 0; n < n_channels; n++ )
        {
            reset_indices_enc( sts[n]->hBstr, MAX_NUM_INDICES );
            reset_indices_enc( sts[n]->hBstr,
#ifdef IND_LIST_DYN
                               sts[n]->hBstr->max_num_indices
#else
                               MAX_NUM_INDICES
#endif
            );
        }
    }

@@ -975,7 +1510,7 @@ ivas_error write_indices_ivas(
    return error;
}


#ifndef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * indices_to_serial_generic()
 *
@@ -1025,6 +1560,7 @@ void indices_to_serial_generic(

    return;
}
#endif

/*---------------------------------------------------------------------*
 * convertSerialToBytestream( )
+2 −0
Original line number Diff line number Diff line
@@ -449,7 +449,9 @@ enum
    IND_STEREO_2ND_CODER_T,

    IND_UNUSED,
#ifndef IND_LIST_DYN
    MAX_NUM_INDICES = IND_UNUSED + 772 /* Total 2640 in line with MAX_BITS_METADATA */
#endif
};

/*----------------------------------------------------------------------------------*
+5 −1
Original line number Diff line number Diff line
@@ -176,8 +176,12 @@ typedef enum
#define MAX_CPE                                 ( MAX_TRANSPORT_CHANNELS / CPE_CHANNELS )    /* max. number of CPEs */

#define MAX_BITS_METADATA                       2640                        /* max. bit-budget of metadata, one channel */ /* IVAS_fmToDo: to be confirmed for final value once mature */
#ifndef IND_LIST_DYN
#define MAX_NUM_METADATA                        max( 2, MAX_NUM_OBJECTS )   /* number of max. metadata (now only 2 for DirAC) */

#endif
#ifdef IND_LIST_DYN
#define MAX_NUM_IND_TEMP_LIST                   10                          /* maximum number of indices in the temporary list */
#endif

#define IVAS_ENC_DELAY_NS                       ACELP_LOOK_NS
#define IVAS_DEC_DELAY_NS                       3250000L                    /* 3.25 ms: IVAS decoder delay (without renderer delay) */
+10 −3
Original line number Diff line number Diff line
@@ -262,9 +262,11 @@ void ivas_initialize_handles_enc(
);

ivas_error ivas_init_encoder(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    Indice ind_list[][MAX_NUM_INDICES],                         /* i  : indices list                            */
    Indice ind_list_metadata[][MAX_BITS_METADATA]               /* i  : indices list metadata                   */
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
#ifndef IND_LIST_DYN
    ,Indice ind_list[][MAX_NUM_INDICES]                         /* i  : indices list                            */
    ,Indice ind_list_metadata[][MAX_BITS_METADATA]               /* i  : indices list metadata                   */
#endif
);

void destroy_core_enc(
@@ -2092,6 +2094,9 @@ void InternalTCXDecoder(

void stereo_mdct_core_enc(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
#ifdef IND_LIST_DYN
    const int16_t ivas_format,                                  /* i  : IVAS format               */ 
#endif
    float new_samples[CPE_CHANNELS][L_INP],                     /* i  : new samples                             */
    float old_wsp[CPE_CHANNELS][L_WSP],                         /* i  : 12.8kHz weighted speech (for LTP        */
    float pitch_buf[CPE_CHANNELS][NB_SUBFR16k]                  /* o  : floating pitch for each subframe        */
@@ -3037,7 +3042,9 @@ void ivas_qmetadata_close(
void restore_metadata_buffer(
    BSTR_ENC_HANDLE hMetaData,
    const int16_t next_ind_start,
#ifndef IND_LIST_DYN
    const int16_t last_ind_start,
#endif
    const int16_t bit_pos_start 
);

+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@
/* ################# Start DEVELOPMENT switches ######################## */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
#define BITSTREAM_INDICES_MEMORY                        /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */
#define IND_LIST_DYN                                    /* VA: Issue 18: Dynamic allocation of ind_list[] and ind_list_metadata[] based on # of transport channels */

#define LSF_RE_USE_SECONDARY_CHANNEL                    /* TD stereo Secondary channel LSF Q improvement */
#ifdef LSF_RE_USE_SECONDARY_CHANNEL
Loading