Commit 1b0cf878 authored by multrus's avatar multrus
Browse files

Merge branch 'cleanup__20230621' into 'main'

Cleanup  20230621

See merge request !777
parents a804dc7d 3735ccb0
Loading
Loading
Loading
Loading
Loading

lib_com/bitstream.c

100755 → 100644
+4 −329
Original line number Diff line number Diff line
@@ -62,65 +62,8 @@
FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */
#endif

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

#ifndef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * pack_bit()
 *
 * insert a bit into packed octet
 *-------------------------------------------------------------------*/

static void pack_bit(
    const Word16 bit, /* i  : bit to be packed */
    UWord8 **pt,      /* i/o: pointer to octet array into which bit will be placed */
    UWord8 *omask     /* i/o: output mask to indicate where in the octet the bit is to be written */
)
{
    if ( *omask == 0x80 )
    {
        **pt = 0;
    }
    if ( bit != 0 )
    {
        **pt = **pt | *omask;
    }
    *omask >>= 1;
    if ( *omask == 0 )
    {
        *omask = 0x80;
        ( *pt )++;
    }

    return;
}

/*-------------------------------------------------------------------*
 * unpack_bit()
 *
 * unpack a bit from packed octet
 *-------------------------------------------------------------------*/

static Word16 unpack_bit(
    UWord8 **pt, /* i/o: pointer to octet array from which bit will be read */
    UWord8 *mask /* i/o: mask to indicate the bit in the octet */
)
{
    Word16 bit;

    bit = ( **pt & *mask ) != 0;
    *mask >>= 1;
    if ( *mask == 0 )
    {
        *mask = 0x80;
        ( *pt )++;
    }

    return bit;
}
#endif

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

#ifdef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * ind_list_realloc()
 *
@@ -863,22 +805,13 @@ int16_t get_ivas_max_num_indices_metadata(
 * Move indices inside the buffer or among two buffers
 *-------------------------------------------------------------------*/

#ifdef FIX_545_ASSERT
void move_indices(
#else
ivas_error move_indices(
#endif
    INDICE_HANDLE old_ind_list, /* i/o: old location of indices */
    INDICE_HANDLE new_ind_list, /* i/o: new location of indices */
    const int16_t nb_indices    /* i  : number of moved indices */
)
{
    int16_t i;
#ifndef FIX_545_ASSERT
    ivas_error error;

    error = IVAS_ERR_OK;
#endif

    if ( new_ind_list < old_ind_list )
    {
@@ -903,16 +836,10 @@ ivas_error move_indices(
        }
    }

#ifdef FIX_545_ASSERT
    return;
#else
    return error;
#endif
}

#endif

#ifdef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * check_ind_list_limits()
 *
@@ -935,24 +862,14 @@ ivas_error check_ind_list_limits(
    if ( ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ) >= *( hBstr->ivas_max_num_indices ) )
    {
#ifdef DEBUGGING
#ifdef FIX_545_ASSERT
        fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#else
        /* TODO: replace with the warning message below before the finalization of the IVAS codec */
        /* fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); */
        assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#endif
#endif

        /* reallocate the buffer of indices with increased limit */
#ifdef FIX_545_ASSERT
        if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
        ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES );
#endif
    }

    /* check, if we will not overwrite an existing indice */
@@ -973,24 +890,14 @@ ivas_error check_ind_list_limits(
            if ( hBstr->ind_list >= ivas_ind_list_last )
            {
#ifdef DEBUGGING
#ifdef FIX_545_ASSERT
                fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#else
                /* TODO: replace with the warning message below before the finalization of the IVAS codec */
                /* fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); */
                assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#endif
#endif

                /* no available empty slot -> need to re-allocate the buffer */
#ifdef FIX_545_ASSERT
                if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#else
                ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES );
#endif
            }
        }
        else
@@ -1001,7 +908,6 @@ ivas_error check_ind_list_limits(

    return error;
}
#endif


/*-------------------------------------------------------------------*
@@ -1027,9 +933,7 @@ ivas_error push_indice(
)
{
    int16_t i;
#ifdef IND_LIST_DYN
    int16_t j;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -1043,42 +947,19 @@ ivas_error push_indice(
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice ID = %d with value %d exceeds the range of %d bits (frame %d) !\n", id, value, nb_bits, frame );
    }

#ifndef IND_LIST_DYN
#if 0
    /* mul, 2020-11-19: to be de-activated until proper solution found */
    if ( nb_bits < 1 )
    {
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, " Trying to push indice ID = %d with value %d that has %d bits (frame %d) !\n", id, value, nb_bits, frame );
    }
    else
#endif
#endif
    if ( nb_bits > 16 )
    {
        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 the limits of the list of indices */
#ifdef FIX_545_ASSERT
    if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
    {
        return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame );
    }
#else
    error = check_ind_list_limits( hBstr );
#endif
#endif

#ifdef IND_LIST_DYN
    /* find the location in the list of indices based on ID */
    i = hBstr->nb_ind_tot;
    while ( i > 0 && id < hBstr->ind_list[i - 1].id )
@@ -1096,46 +977,15 @@ ivas_error push_indice(
            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 */
        i = hBstr->next_ind;
    }
    else
    {
        /* new indice - find an empty slot in the list */
        i = id;
        while ( hBstr->ind_list[i].nb_bits != -1 )
        {
            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;
@@ -1162,9 +1012,7 @@ ivas_error push_next_indice(
#endif
)
{
#ifdef IND_LIST_DYN
    int16_t prev_id;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -1183,32 +1031,14 @@ 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 );
    }

    if ( hBstr->ind_list[hBstr->next_ind].nb_bits > 0 )
    {
        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 the limits of the list of indices */
#ifdef FIX_545_ASSERT
    if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    error = check_ind_list_limits( hBstr );
#endif
#endif

#ifdef IND_LIST_DYN
    /* get the id of the previous indice -> it will be re-used */
    if ( hBstr->nb_ind_tot > 0 )
    {
@@ -1218,24 +1048,14 @@ ivas_error push_next_indice(
    {
        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;
#endif

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

    return error;
@@ -1248,17 +1068,9 @@ ivas_error push_next_indice(
 *-------------------------------------------------------------------*/

#ifdef DEBUG_BS_READ_WRITE
#ifdef FIX_545_ASSERT
ivas_error push_next_bits_(
#else
void push_next_bits_(
#endif
#else
#ifdef FIX_545_ASSERT
ivas_error push_next_bits(
#else
void push_next_bits(
#endif
#endif
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle                     */
    const uint16_t bits[], /* i  : bit buffer to pack, sequence of single bits  */
@@ -1273,19 +1085,14 @@ void push_next_bits(
    uint16_t code;
    int16_t i, nb_bits_m15;
    Indice *ptr;
#ifdef IND_LIST_DYN
    int16_t prev_id;
#ifdef FIX_545_ASSERT
    ivas_error error;

    error = IVAS_ERR_OK;
#endif
#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 */
@@ -1297,81 +1104,54 @@ void push_next_bits(
    {
        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 )
    {
        code = (uint16_t) ( ( bits[i] << 15 ) | ( ( bits[i + 1] << 14 ) | ( ( bits[i + 2] << 13 ) | ( ( bits[i + 3] << 12 ) | ( ( bits[i + 4] << 11 ) | ( ( bits[i + 5] << 10 ) | ( ( bits[i + 6] << 9 ) | ( ( bits[i + 7] << 8 ) | ( ( bits[i + 8] << 7 ) | ( ( bits[i + 9] << 6 ) | ( ( bits[i + 10] << 5 ) | ( ( bits[i + 11] << 4 ) | ( ( bits[i + 12] << 3 ) | ( ( bits[i + 13] << 2 ) | ( ( bits[i + 14] << 1 ) | bits[i + 15] ) ) ) ) ) ) ) ) ) ) ) ) ) ) );

#ifdef IND_LIST_DYN
        /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
        if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
        }
#else
        check_ind_list_limits( hBstr );
#endif
        ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
#endif

        ptr->value = code;
#ifdef DEBUG_BS_READ_WRITE
        printf( "code: %d\n", code );
#endif
        ptr->nb_bits = 16;
#ifdef IND_LIST_DYN
        ptr->id = prev_id;
        hBstr->nb_ind_tot++;
#endif
        ++ptr;
    }

    for ( ; i < nb_bits; ++i )
    {
#ifdef IND_LIST_DYN
        /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
        if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
        }
#else
        check_ind_list_limits( hBstr );
#endif
        ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
#endif

        ptr->value = bits[i];
#ifdef DEBUG_BS_READ_WRITE
        printf( "value: %d\n", ptr->value );
#endif
        ptr->nb_bits = 1;
#ifdef IND_LIST_DYN
        ptr->id = prev_id;
        hBstr->nb_ind_tot++;
#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;

#ifdef FIX_545_ASSERT
    return error;
#else
    return;
#endif
}


#ifdef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * find_indice()
 *
@@ -1437,9 +1217,6 @@ uint16_t delete_indice(
    }

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

    for ( ; j < i; j++ )
    {
@@ -1449,7 +1226,6 @@ uint16_t delete_indice(

    return i - j;
}
#endif


/*-------------------------------------------------------------------*
@@ -1670,12 +1446,7 @@ 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;
    hBstr->last_ind = -1;
#endif

    for ( i = 0; i < max_num_indices; i++ )
    {
@@ -1706,11 +1477,7 @@ 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 )
@@ -1724,13 +1491,8 @@ 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 )
        {
@@ -1794,9 +1556,7 @@ 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;
@@ -1808,9 +1568,7 @@ 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 )
    {
@@ -1828,9 +1586,7 @@ 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 )
@@ -1841,9 +1597,7 @@ 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
@@ -1885,12 +1639,7 @@ static ivas_error write_indices_element(
            total_nb_bits =
#endif
                write_indices_to_stream( ind_list_metadata, &pt_stream_loc, -1,
#ifdef IND_LIST_DYN
                                         nb_ind_tot_metadata
#else
                                     MAX_BITS_METADATA
#endif
                );
                                         nb_ind_tot_metadata );

#ifdef ENABLE_BITRATE_VERIFICATION
            if ( total_nb_bits != nb_bits_tot_metadata )
@@ -1905,12 +1654,7 @@ static ivas_error write_indices_element(
        total_nb_bits =
#endif
            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
            );
                                     sts[n]->hBstr->nb_ind_tot );

#ifdef ENABLE_BITRATE_VERIFICATION
        if ( total_nb_bits != sts[n]->hBstr->nb_bits_tot )
@@ -1933,41 +1677,23 @@ 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->nb_ind_tot );
#else
            reset_indices_enc( st_ivas->hSCE[element_id]->hMetaData, MAX_BITS_METADATA );
#endif
        }

        reset_indices_enc( sts[0]->hBstr,
#ifdef IND_LIST_DYN
                           sts[0]->hBstr->nb_ind_tot
#else
                           MAX_NUM_INDICES
#endif
        );
                           sts[0]->hBstr->nb_ind_tot );
    }
    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->nb_ind_tot );
#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,
#ifdef IND_LIST_DYN
                               sts[n]->hBstr->nb_ind_tot
#else
                               MAX_NUM_INDICES
#endif
            );
                               sts[n]->hBstr->nb_ind_tot );
        }
    }

@@ -2066,57 +1792,6 @@ ivas_error write_indices_ivas(
    return error;
}

#ifndef IND_LIST_DYN
/*-------------------------------------------------------------------*
 * indices_to_serial_generic()
 *
 * pack indices into serialized payload format
 *-------------------------------------------------------------------*/

void indices_to_serial_generic(
    const Indice *ind_list,   /* i  : indices list                                                  */
    const Word16 num_indices, /* i  : number of indices to write                                    */
    UWord8 *pFrame,           /* o  : byte array with bit packet and byte aligned coded speech data */
    Word16 *pFrame_size       /* i/o: number of bits in the binary encoded access unit [bits]       */
)
{
    Word16 i, k, j;
    Word32 mask;
    UWord8 omask;
    UWord8 *pt_pFrame = pFrame;
    Word16 nb_bits_tot = 0;

    omask = ( 0x80 >> ( *pFrame_size & 0x7 ) );
    pt_pFrame += *pFrame_size >> 3;

    /*----------------------------------------------------------------*
     * Bitstream packing (conversion of individual indices into a serial stream)
     *----------------------------------------------------------------*/

    j = 0;
    for ( i = 0; i < num_indices; i++ )
    {
        if ( ind_list[i].nb_bits > 0 )
        {
            /* mask from MSB to LSB */
            mask = 1 << ( ind_list[i].nb_bits - 1 );

            /* write bit by bit */
            for ( k = 0; k < ind_list[i].nb_bits; k++ )
            {
                pack_bit( ind_list[i].value & mask, &pt_pFrame, &omask );
                j++;
                mask >>= 1;
            }
            nb_bits_tot += ind_list[i].nb_bits;
        }
    }

    *pFrame_size += nb_bits_tot;

    return;
}
#endif

/*---------------------------------------------------------------------*
 * convertSerialToBytestream( )
+0 −3
Original line number Diff line number Diff line
@@ -447,9 +447,6 @@ 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
};

/*----------------------------------------------------------------------------------*
+0 −16
Original line number Diff line number Diff line
@@ -181,15 +181,10 @@ 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 MIN_NUM_IND                             10                          /* minimum number of indices in the core coder */
#define MAX_NUM_IND_LFE                         100                         /* maximum number of indices in the LFE encoder */
#define MAX_NUM_IND_TEMP_LIST                   10                          /* maximum number of indices in the temporary list */
#define MAX_IND_TDM_TMP                         10                          /* maximum number of indices in the temporary list of TD stereo spatial parameters */
#endif

#define IVAS_ENC_DELAY_NS                       ACELP_LOOK_NS
#define IVAS_DEC_DELAY_NS                       3250000L                    /* 3.25 ms: IVAS decoder delay (without renderer delay) */
@@ -335,12 +330,8 @@ typedef enum

#define ISM_NB_BITS_METADATA_NOMINAL            ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */

#ifdef FIX_532_ISM_MD_INACTIVE
#define ISM_METADATA_MD_FLAG_BITS               1 /* flag to distinguish between NULL metadata and low-rate ISM_NO_META class */
#define ISM_METADATA_INACTIVE_FLAG_BITS         1 /* flag to signal whether MD are sent in low-rate inactive frame */
#else
#define ISM_METADATA_VAD_FLAG_BITS              1
#endif
#define ISM_METADATA_FLAG_BITS                  2

#define ISM_NO_META                             0
@@ -394,9 +385,7 @@ typedef enum
#define ISM_Q_STEP_LOW                          (ISM_Q_STEP * 2)
#define ISM_Q_STEP_BORDER_LOW                   (ISM_Q_STEP_BORDER * 2)

#ifdef FIX_532_ISM_MD_INACTIVE
#define BRATE_ISM_INACTIVE                      2450 /* CoreCoder bitrate in ISM inactive frames */
#endif

typedef enum 
{
@@ -413,14 +402,9 @@ enum
    IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
    IND_ISM_EXTENDED_NDP_FLAG, 
    IND_ISM_METADATA_FLAG,
#ifdef FIX_532_ISM_MD_INACTIVE
    IND_ISM_MD_NULL_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_MD_INACTIVE_FLAG = IND_ISM_MD_NULL_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_MD_INACTIVE_FLAG + MAX_NUM_OBJECTS,
#else
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
#endif
    IND_ISM_SCE_ID_DTX,
    IND_ISM_DTX_COH_SCA,

+0 −3
Original line number Diff line number Diff line
@@ -49,9 +49,6 @@

static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t **pActive_bins_abs, const int16_t **pStart_offset, const int16_t **pStart_offset_ab, const int32_t sampling_rate );
static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate );
#ifndef FIX_383_CLEAN_UP
static int16_t ivas_fb_mixer_get_band_diff_non48k( const int32_t sampling_rate, const float delay_ms );
#endif
static const float *ivas_get_cheby_ramp( const int16_t delay );
static void ivas_get_hanning_win( const int16_t len, float *pH_win );
static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate );
+9 −71

File changed.

Preview size limit exceeded, changes collapsed.

Loading