diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c old mode 100755 new mode 100644 index a95775590a740d50d02277933e91bac77938a6ec..25d388aed19ff1a5b7cacbaef8fbefa0b42e5696 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -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( ) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index cee56f7d426453c9463a3b0a48a4e5d2f2443d45..e1362b0d759ea2fc1762f11aa305f3290c3a8218 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -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 }; /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3f5065e6bffb98a8f77f81629a1fec60575adc09..c43692ea91768f9c409e3151706a85f31ee22e31 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -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, diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index b95de4327a976db15d8f73ce5952f14de85b9403..a94a92c548785667f9cff7d72d53bf681d57ea4a 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -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 ); diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index b959e01c6f28b364ff3625a8de7ee0fff082f326..d57f65850075efe85f046d284776e0cbd1cc3ef0 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -49,14 +49,7 @@ * Local constants *-----------------------------------------------------------------------*/ -#ifdef FIX_532_ISM_MD_INACTIVE #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC ) -#else -#define FRMS_PER_SECOND ( 1000000000 / FRAME_SIZE_NS ) - -#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM inactive frames */ -#define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRMS_PER_SECOND ) -#endif #define BETA_ISM_LOW_IMP 0.6f #define BETA_ISM_MEDIUM_IMP 0.8f @@ -82,11 +75,7 @@ static void bitbudget_to_brate( for ( i = 0; i < N; i++ ) { -#ifdef FIX_532_ISM_MD_INACTIVE y[i] = FRAMES_PER_SEC * x[i]; -#else - y[i] = FRMS_PER_SECOND * x[i]; -#endif } return; @@ -100,20 +89,16 @@ static void bitbudget_to_brate( *-------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISM total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nchan_ism, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ -#ifdef FIX_532_ISM_MD_INACTIVE + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ const int16_t null_metadata_flag[MAX_NUM_OBJECTS], /* i : NULL MD flag */ -#else - const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ -#endif - const int16_t ism_imp[], /* i : ISM importance flags */ - int32_t element_brate[], /* o : element bitrate per object */ - int32_t total_brate[], /* o : total bitrate per object */ - int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ + const int16_t ism_imp[], /* i : ISM importance flags */ + int32_t element_brate[], /* o : element bitrate per object */ + int32_t total_brate[], /* o : total bitrate per object */ + int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ ) { int16_t ch; @@ -136,20 +121,12 @@ ivas_error ivas_ism_config( { for ( ch = 0; ch < n_ISms; ch++ ) { -#ifdef FIX_532_ISM_MD_INACTIVE ism_metadata_flag_global |= ism_imp[ch]; -#else - ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; -#endif } } /* decision about bitrates per channel - constant during the session (at one ivas_total_brate) */ -#ifdef FIX_532_ISM_MD_INACTIVE bits_ism = (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); -#else - bits_ism = (int16_t) ( ism_total_brate / FRMS_PER_SECOND ); -#endif set_s( bits_element, bits_ism / n_ISms, n_ISms ); bits_element[n_ISms - 1] += bits_ism % n_ISms; bitbudget_to_brate( bits_element, element_brate, n_ISms ); @@ -170,7 +147,6 @@ ivas_error ivas_ism_config( for ( ch = 0; ch < n_ISms; ch++ ) { -#ifdef FIX_532_ISM_MD_INACTIVE if ( null_metadata_flag[ch] ) { nb_bits_metadata[0] += ISM_METADATA_MD_FLAG_BITS; @@ -184,12 +160,6 @@ ivas_error ivas_ism_config( nb_bits_metadata[0] += ISM_METADATA_INACTIVE_FLAG_BITS; } } -#else - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) - { - nb_bits_metadata[0] += ISM_METADATA_VAD_FLAG_BITS; - } -#endif } } @@ -215,11 +185,7 @@ ivas_error ivas_ism_config( diff = 0; for ( ch = 0; ch < n_ISms; ch++ ) { -#ifdef FIX_532_ISM_MD_INACTIVE if ( ism_imp[ch] == ISM_NO_META ) -#else - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 ) -#endif { diff += bits_CoreCoder[ch] - BITS_ISM_INACTIVE; bits_CoreCoder[ch] = BITS_ISM_INACTIVE; @@ -256,34 +222,18 @@ ivas_error ivas_ism_config( { int16_t limit; -#ifdef FIX_532_ISM_MD_INACTIVE limit = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC; -#else - limit = MIN_BRATE_SWB_BWE / FRMS_PER_SECOND; -#endif if ( element_brate[ch] < MIN_BRATE_SWB_STEREO ) /* replicate function set_bw() -> check the coded audio band-width */ { -#ifdef FIX_532_ISM_MD_INACTIVE limit = MIN_BRATE_WB_BWE / FRAMES_PER_SEC; -#else - limit = MIN_BRATE_WB_BWE / FRMS_PER_SECOND; -#endif } else if ( element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ { /*limit = SCE_CORE_16k_LOW_LIMIT;*/ -#ifdef FIX_532_ISM_MD_INACTIVE limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRAMES_PER_SEC; -#else - limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRMS_PER_SECOND; -#endif } -#ifdef FIX_532_ISM_MD_INACTIVE if ( ism_imp[ch] == ISM_NO_META ) -#else - if ( ism_imp[ch] == ISM_NO_META && localVAD[ch] == 0 ) -#endif { tmp = BITS_ISM_INACTIVE; } @@ -330,18 +280,10 @@ ivas_error ivas_ism_config( diff = 0; for ( ch = 0; ch < n_ISms; ch++ ) { -#ifdef FIX_532_ISM_MD_INACTIVE limit_high = IVAS_512k / FRAMES_PER_SEC; -#else - limit_high = IVAS_512k / FRMS_PER_SECOND; -#endif if ( element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ { -#ifdef FIX_532_ISM_MD_INACTIVE limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; -#else - limit_high = ACELP_12k8_HIGH_LIMIT / FRMS_PER_SECOND; -#endif } tmp = (int16_t) min( bits_CoreCoder[ch], limit_high ); @@ -401,11 +343,7 @@ ivas_error ivas_ism_config( if ( nb_bits_metadata != NULL ) { int32_t tmpL; -#ifdef FIX_532_ISM_MD_INACTIVE tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRAMES_PER_SEC; -#else - tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND; -#endif if ( sum_l( element_brate, n_ISms ) != tmpL ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISM bit-budget distribution. Exiting!\n" ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ba48326231950e68ded7fda43eadec34f782e4c3..34226e640c82a0d89915786df6cc81b000f7297b 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -209,9 +209,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ -#ifdef FIX_529_BWD_ISSUE const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -280,10 +278,6 @@ void ivas_initialize_handles_enc( ivas_error ivas_init_encoder( 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( @@ -893,11 +887,7 @@ ivas_error ivas_ism_config( const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ -#ifdef FIX_532_ISM_MD_INACTIVE const int16_t null_metadata_flag[MAX_NUM_OBJECTS], /* i : NULL MD flag */ -#else - const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ -#endif const int16_t ism_imp[], /* i : ISM importance flags */ int32_t element_brate[], /* o : element bitrate per object */ int32_t total_brate[], /* o : total bitrate per object */ @@ -3198,9 +3188,6 @@ 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 ); diff --git a/lib_com/ivas_stereo_dft_com.c b/lib_com/ivas_stereo_dft_com.c index 1b7f0101efec5b88bfef9aeda897fb03c2423187..ae6b772a30f99050ce1311d5c45a52c92e4a41a2 100644 --- a/lib_com/ivas_stereo_dft_com.c +++ b/lib_com/ivas_stereo_dft_com.c @@ -142,11 +142,7 @@ void stereo_dft_config( *bits_frame_nominal = ACELP_24k40 / FRAMES_PER_SEC; if ( hConfig != NULL ) { -#ifdef DISABLE_ADAP_RES_COD_TMP - hConfig->ada_wb_res_cod_mode = 0; -#else hConfig->ada_wb_res_cod_mode = 1; -#endif #ifdef DEBUG_MODE_DFT hConfig->itd_mode = 1; hConfig->gipd_mode = 1; diff --git a/lib_com/options.h b/lib_com/options.h index 6d89e62aab87bdf08ce1a1884d290a8ff2ac5f07..8ac9057763a92d03dcaed02b0147d29305cd8a0c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -137,42 +137,19 @@ /* ################# Start DEVELOPMENT switches ######################## */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ -#define IND_LIST_DYN /* VA: Issue 18: Dynamic allocation of ind_list[] and ind_list_metadata[] based on # of transport channels */ - -#ifndef IND_LIST_DYN -#define BITSTREAM_INDICES_MEMORY /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */ -#endif - -/*#define DISABLE_ADAP_RES_COD_TMP*/ /* temporary fix for IVAS-403, disables adaptive residual coding */ -#define ADAP_OPT /* Issue 69: optimized the adap algorithm */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#ifdef IND_LIST_DYN -#define FIX_545_ASSERT /* VA: fix issue 545, replace assert() with warning message when hitting memory limit in the buffer of indices */ -#endif -#define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ -#define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ -#define FIX_547_NAN_IGF_DEC /* FhG: issue 547: fix possible nan in IGF decoder */ -#define FIX_529_BWD_ISSUE /* VA: issue 529: fix Bandwidth Detector not working reliably for Music and Generic Audio */ -#define FIX_557_CRASH_IN_ISM_DTX /* VA issue 557: fix crash in 1ISM 48 kbps DTX */ #define FIX_563_PARAMMC_LIMITER /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set */ - #define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ - -#define IGF_TUNING_96 /* FhG: Issue 546: slight tuning of IGF config used in 96 kbps stereo, 128 kbps SBA and others */ #define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ -#define FIX_522_ISM_FIRST_SID /* VA: fix ISM decoder crash if first received frame is an SID */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ #define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ - #define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ - - #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ diff --git a/lib_com/prot.h b/lib_com/prot.h index f49582849863e45d1ba4b92b4b9233e416046d62..592d0253d3c96bd051a055a394a9f7b23beb6c3b 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -501,17 +501,9 @@ ivas_error push_next_indice( #ifdef DEBUG_BS_READ_WRITE #define push_next_bits( ... ) push_next_bits_( __VA_ARGS__, __LINE__, __func__ ) -#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 */ @@ -523,7 +515,6 @@ void push_next_bits( #endif ); -#ifdef IND_LIST_DYN /*! r: maximum number of indices */ int16_t get_ivas_max_num_indices( const IVAS_FORMAT ivas_format, /* i : IVAS format */ @@ -556,11 +547,7 @@ ivas_error check_ind_list_limits( BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ ); -#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 */ @@ -579,7 +566,6 @@ uint16_t delete_indice( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t id /* i : ID of the indice */ ); -#endif /*! r: value of the indice */ #ifdef DEBUG_BS_READ_WRITE @@ -679,15 +665,6 @@ Decoder_State **reset_elements( ); -#ifndef IND_LIST_DYN -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 /* o : size of the binary encoded access unit [bits] */ -); -#endif - void convertSerialToBytestream( const uint16_t *const serial, /* i : input serial bitstream with values 0 and 1 */ const uint16_t num_bits, /* i : number of bits in the input bitstream */ @@ -2289,10 +2266,8 @@ void read_next_force( #endif ivas_error init_encoder( - Encoder_State *st, /* i/o: state structure */ -#ifdef IND_LIST_DYN - Encoder_Struct *st_ivas, /* i/o: encoder state structure */ -#endif + Encoder_State *st, /* i/o: state structure */ + Encoder_Struct *st_ivas, /* i/o: encoder state structure */ const int16_t idchan, /* i : channel ID */ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ @@ -3887,14 +3862,12 @@ int16_t wb_vad( ); void bw_detect( - Encoder_State *st, /* i/o: Encoder State */ - const float signal_in[], /* i : input signal */ - float *spectrum, /* i : MDCT spectrum */ - const float *enerBuffer, /* i : energy buffer */ -#ifdef FIX_529_BWD_ISSUE + Encoder_State *st, /* i/o: Encoder State */ + const float signal_in[], /* i : input signal */ + float *spectrum, /* i : MDCT spectrum */ + const float *enerBuffer, /* i : energy buffer */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif - const int16_t mct_on /* i : flag MCT mode */ + const int16_t mct_on /* i : flag MCT mode */ ); void set_bw( diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index a1a74598851d0eb9322c015df2d15d1a348f6a3c..1e63eda4804791bcbb69de49d45b597417dcc734 100755 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -21632,22 +21632,14 @@ const int16_t igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2*IGF_MAX_TILES+1] = { { 3, 1, 0, 2, 40, 3, 80 }, /* 48000 SWB (stereo TCX10) */ { 4, 2, 80, 4, 128, 6, 144, 7, 212 }, /* 64000 SWB (stereo) */ { 2, 2, 212, 4, 280 }, /* 80000 SWB (stereo) */ -#ifdef IGF_TUNING_96 { 1, 3, 200}, /* 96000 SWB (stereo) */ -#else - { 1, 3, 320}, /* 96000 SWB (stereo) */ -#endif { 9, 1, 0, 2, 32, 3, 72, 4, 120, 5, 48, 6, 112, 7, 64, 8, 0, 9, 80 }, /* 24400 FB (stereo) */ {10, 1, 0, 2, 28, 3, 64, 4, 104, 5, 32, 6, 80, 7, 136, 8, 64, 9, 0, 10, 80 }, /* 32000 FB (stereo) */ { 7, 1, 120, 2, 152, 3, 184, 4, 224, 5, 140, 6, 192, 8, 140}, /* 48000 FB (stereo) */ { 4, 1, 0, 2, 40, 3, 80, 4, 140 }, /* 48000 FB (stereo TCX10) */ { 5, 2, 80, 4, 128, 6, 144, 7, 212, 9, 160 }, /* 64000 FB (stereo) */ { 3, 2, 212, 4, 280, 6, 200 }, /* 80000 FB (stereo) */ -#ifdef IGF_TUNING_96 { 2, 3, 200, 5, 240}, /* 96000 FB (stereo) */ -#else - { 2, 3, 320, 5, 240}, /* 96000 FB (stereo) */ -#endif { 1, 2, 416} /*128000 FB (stereo) */ }; diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index b9049241b9dadea62d3cde01358fcee132459965..ee116ee86fff2b58984e6b8bcdf121f860c0209a 100755 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -165,9 +165,7 @@ static void IGF_replaceTCXNoise_2_new( } } -#ifdef FIX_547_NAN_IGF_DEC rE = max( rE, 1.f ); -#endif if ( n_noise_bands_tile ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3c0370c8801e60052171394187e2f1ac1ef7423e..22942030530dd939ed9d9fc5d666c1b78fef11e7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -283,7 +283,6 @@ ivas_error ivas_dec_setup( } } -#ifdef FIX_522_ISM_FIRST_SID if ( st_ivas->ini_frame == 0 && st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ @@ -312,7 +311,6 @@ ivas_error ivas_dec_setup( return error; } } -#endif } /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e6c9951b482b8cb789c5b5de18de74bb9f0f3211..86c43f0ffdf909a046ba02ff5b7015c4ce7b2786 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -168,12 +168,8 @@ ivas_error ivas_ism_metadata_dec( uint16_t i, bstr_meta[MAX_BITS_METADATA], *bstr_orig; ISM_METADATA_HANDLE hIsmMetaData; int16_t nchan_transport_prev, ism_metadata_flag_global; -#ifdef FIX_532_ISM_MD_INACTIVE int16_t null_metadata_flag[MAX_NUM_OBJECTS]; int16_t lowrate_metadata_flag[MAX_NUM_OBJECTS]; -#else - int16_t localVAD[MAX_NUM_OBJECTS]; -#endif int16_t ism_imp[MAX_NUM_OBJECTS]; int16_t nbands, nblocks; int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -192,10 +188,8 @@ ivas_error ivas_ism_metadata_dec( st0->next_bit_pos = 0; ism_extmeta_bitstream = 0; non_diegetic_flag_global = 0; -#ifdef FIX_532_ISM_MD_INACTIVE set_s( null_metadata_flag, 0, nchan_ism ); set_s( lowrate_metadata_flag, 0, nchan_ism ); -#endif /* reverse the bitstream for easier reading of indices */ for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) @@ -281,7 +275,6 @@ ivas_error ivas_ism_metadata_dec( ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } -#ifdef FIX_532_ISM_MD_INACTIVE /* read ISM_NO_META class signalling */ if ( ism_mode == ISM_MODE_DISC ) { @@ -313,20 +306,6 @@ ivas_error ivas_ism_metadata_dec( } } } -#else - /* read VAD flag */ - for ( ch = 0; ch < *nchan_transport; ch++ ) - { - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) - { - localVAD[ch] = get_next_indice( st0, ISM_METADATA_VAD_FLAG_BITS ); - } - else - { - localVAD[ch] = 1; - } - } -#endif if ( ism_metadata_flag_global ) { @@ -353,11 +332,7 @@ ivas_error ivas_ism_metadata_dec( flag_abs_orientation = 0; flag_abs_radius = 0; -#ifdef FIX_532_ISM_MD_INACTIVE if ( hIsmMeta[ch]->ism_metadata_flag || lowrate_metadata_flag[ch] ) -#else - if ( hIsmMeta[ch]->ism_metadata_flag ) -#endif { if ( non_diegetic_flag_global ) { @@ -525,11 +500,7 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { -#ifdef FIX_532_ISM_MD_INACTIVE if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -541,15 +512,11 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_532_ISM_MD_INACTIVE #ifdef FIX_562_ISM2_64KBPS if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) || ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) ) #else if ( ism_imp[ch] == ISM_NO_META && total_brate[ch] < ACELP_8k00 ) -#endif -#else - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) #endif { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; @@ -639,10 +606,8 @@ ivas_error ivas_ism_metadata_dec_create( st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; st_ivas->hIsmMetaData[ch]->last_true_elevation = 0; -#ifdef FIX_522_ISM_FIRST_SID st_ivas->hIsmMetaData[ch]->last_azimuth = 0; st_ivas->hIsmMetaData[ch]->last_elevation = 0; -#endif ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } diff --git a/lib_enc/acelp_core_switch_enc.c b/lib_enc/acelp_core_switch_enc.c index 0fa3ba313061ef4ef7b4df962e3a2f7d1f6f50f4..0d65ed6087c4df0d44d22fa051d5a55043c88710 100644 --- a/lib_enc/acelp_core_switch_enc.c +++ b/lib_enc/acelp_core_switch_enc.c @@ -73,10 +73,8 @@ void acelp_core_switch_enc( const float *inp; int32_t cbrate; float Aq[2 * ( M + 1 )]; -#ifdef IND_LIST_DYN uint16_t value; int16_t nb_bits; -#endif BSTR_ENC_HANDLE hBstr = st->hBstr; /* initializations */ @@ -163,7 +161,6 @@ void acelp_core_switch_enc( * Manipulate ACELP subframe indices (move them to their proper place) *----------------------------------------------------------------*/ -#ifdef IND_LIST_DYN i = find_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START, &value, &nb_bits ); #ifdef DEBUGGING assert( i >= 0 && "Internal error in ACELP core switching - unable to find ACELP subframe indices!" ); @@ -174,14 +171,6 @@ void acelp_core_switch_enc( i++; } delete_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START ); -#else - for ( i = 0; i < 20; i++ ) - { - hBstr->ind_list[IND_CORE_SWITCHING_CELP_SUBFRAME + i].value = hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].value; - hBstr->ind_list[IND_CORE_SWITCHING_CELP_SUBFRAME + i].nb_bits = hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].nb_bits; - hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].nb_bits = -1; - } -#endif /*----------------------------------------------------------------* * BWE encoding diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index bf7ad3808a310694606c6d7c09fa9ad1ddee1127..e921698e5aaa5270cd4aa4be7ebf0d70ad09e115 100644 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -342,11 +342,7 @@ void amr_wb_enc( * WB, SWB and FB bandwidth detector *----------------------------------------------------------------*/ -#ifdef FIX_529_BWD_ISSUE bw_detect( st, st->input, NULL, NULL, MONO_FORMAT, 0 ); -#else - bw_detect( st, st->input, NULL, NULL, 0 ); -#endif /* in AMR_WB IO, limit the maximum band-width to WB */ if ( st->bwidth > WB ) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 4c4df2fe948af04f77735512fa872e4bc34d9e76..e1e068ab2ca2a284939a38bb711d882866ca11e6 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -52,12 +52,10 @@ * Local constants *-------------------------------------------------------------------*/ -#ifdef FIX_529_BWD_ISSUE #define BWD_MIN_BRATE_WIDER_BW_MDCT IVAS_48k #define BWD_MIN_BRATE_WIDER_BW_ISM IVAS_32k #define BWD_MAX_BRATE_WIDER_BW_MDCT IVAS_80k #define BWD_MAX_BRATE_WIDER_BW_ISM IVAS_64k -#endif #define ALPHA_BWD 0.75f #define BWD_LT_THRESH 0.6f @@ -75,14 +73,12 @@ *-------------------------------------------------------------------*/ void bw_detect( - Encoder_State *st, /* i/o: Encoder State */ - const float signal_in[], /* i : input signal */ - float *spectrum, /* i : MDCT spectrum */ - const float *enerBuffer, /* i : energy buffer */ -#ifdef FIX_529_BWD_ISSUE + Encoder_State *st, /* i/o: Encoder State */ + const float signal_in[], /* i : input signal */ + float *spectrum, /* i : MDCT spectrum */ + const float *enerBuffer, /* i : energy buffer */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif - const int16_t mct_on /* i : flag MCT mode */ + const int16_t mct_on /* i : flag MCT mode */ ) { int16_t i, j, k, bw_max, bin_width, n_bins; @@ -95,12 +91,8 @@ void bw_detect( int16_t bwd_count_wider_bw, l_frame; bwd_count_wider_bw = BWD_COUNT_WIDER_BW; -#ifdef FIX_529_BWD_ISSUE if ( st->ini_frame > 0 && ( ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate >= BWD_MIN_BRATE_WIDER_BW_MDCT || mct_on ) ) || ( ivas_format == ISM_FORMAT && st->element_brate >= BWD_MIN_BRATE_WIDER_BW_ISM ) ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) ) -#endif { bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; } @@ -596,12 +588,10 @@ void set_bw( { st->bwidth = SWB; } -#ifdef FIX_529_BWD_ISSUE else if ( element_brate > BWD_MAX_BRATE_WIDER_BW_ISM ) { st->bwidth = st->max_bwidth; } -#endif } /* element_mode == EVS_MONO */ else if ( total_brate <= ACELP_9k60 && st->bwidth > WB ) @@ -659,15 +649,12 @@ void set_bw_stereo( { Encoder_State **sts = hCPE->hCoreCoder; -#ifdef FIX_529_BWD_ISSUE if ( hCPE->element_brate > BWD_MAX_BRATE_WIDER_BW_MDCT ) { sts[0]->bwidth = sts[0]->max_bwidth; sts[1]->bwidth = sts[1]->max_bwidth; } - else -#endif - if ( hCPE->element_mode == IVAS_CPE_MDCT ) + else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { /* ensure that both CPE channels have the same audio band-width */ if ( sts[0]->input_bwidth == sts[1]->input_bwidth ) @@ -721,7 +708,6 @@ int16_t set_bw_mct( } } -#ifdef FIX_529_BWD_ISSUE for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { if ( hCPE[cpe_id]->element_brate > BWD_MAX_BRATE_WIDER_BW_MDCT ) @@ -729,7 +715,6 @@ int16_t set_bw_mct( mct_bwidth = max( mct_bwidth, hCPE[cpe_id]->hCoreCoder[0]->max_bwidth ); } } -#endif bw_changed = 0; if ( mct_bwidth != last_mct_bwidth ) diff --git a/lib_enc/cng_enc.c b/lib_enc/cng_enc.c index 6d49d9c8863d9c98ded4ccaf0ffeffcd4e9e0c84..d99e05395cdf31327fa0fe282053cf6444d59770 100644 --- a/lib_enc/cng_enc.c +++ b/lib_enc/cng_enc.c @@ -881,12 +881,7 @@ void swb_CNG_enc( else if ( st->element_mode == IVAS_CPE_DFT && st->core_brate == SID_2k40 ) { /* LF-boost not used in DFT-stereo, instead the bandwidth is transmitted */ -#ifdef IND_LIST_DYN delete_indice( st->hBstr, IND_CNG_ENV1 ); -#else - st->hBstr->nb_bits_tot = st->hBstr->nb_bits_tot - st->hBstr->ind_list[IND_CNG_ENV1].nb_bits; - st->hBstr->ind_list[IND_CNG_ENV1].nb_bits = -1; -#endif push_indice( st->hBstr, IND_BWIDTH, st->bwidth, 2 ); push_indice( st->hBstr, IND_UNUSED, 0, 4 ); push_indice( st->hBstr, IND_SID_BW, 1, 1 ); @@ -962,12 +957,7 @@ static void shb_CNG_encod( push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener, 4 ); push_indice( hBstr, IND_SID_BW, 1, 1 ); -#ifdef IND_LIST_DYN delete_indice( hBstr, IND_CNG_ENV1 ); -#else - hBstr->nb_bits_tot = hBstr->nb_bits_tot - hBstr->ind_list[IND_CNG_ENV1].nb_bits; - hBstr->ind_list[IND_CNG_ENV1].nb_bits = -1; -#endif if ( st->element_mode == IVAS_CPE_DFT ) { push_indice( st->hBstr, IND_BWIDTH, st->bwidth, 2 ); diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index 8357dd3a82c2dedcf99d2b534d1ae36b5c7e12b8..34f250742f21f5b6d5fefda0aa778610cea67022 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -256,12 +256,7 @@ void dtx( if ( st->element_mode != IVAS_CPE_MDCT && st->hBstr != NULL ) { reset_indices_enc( st->hBstr, -#ifdef IND_LIST_DYN - st->hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + st->hBstr->nb_ind_tot ); } } diff --git a/lib_enc/enc_ppp.c b/lib_enc/enc_ppp.c index 328c1d5b5215d500452fcb61e3e6a76f71597a95..25e5124eed80fb82ddae4eb96437256b5db96c3a 100644 --- a/lib_enc/enc_ppp.c +++ b/lib_enc/enc_ppp.c @@ -170,12 +170,7 @@ ivas_error encod_ppp( /* delete previous indices */ reset_indices_enc( hBstr, -#ifdef IND_LIST_DYN - hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + hBstr->nb_ind_tot ); /* signaling matrix (writing of signaling bits) */ diff --git a/lib_enc/eval_pit_contr.c b/lib_enc/eval_pit_contr.c index 76bf54b0254641fe7d8ce3aa6c3761c991cd6835..6779afe2af48506c87b82f9814b84bed0cda7f6b 100644 --- a/lib_enc/eval_pit_contr.c +++ b/lib_enc/eval_pit_contr.c @@ -326,26 +326,10 @@ int16_t Pit_exc_contribution_len( /* pitch contribution useless - delete all previously written indices belonging to pitch contribution */ for ( i = TAG_ACELP_SUBFR_LOOP_START; i < TAG_ACELP_SUBFR_LOOP_END; i++ ) { -#ifdef IND_LIST_DYN delete_indice( hBstr, i ); -#else - if ( hBstr->ind_list[i].nb_bits != -1 ) - { - hBstr->nb_bits_tot -= hBstr->ind_list[i].nb_bits; - hBstr->ind_list[i].nb_bits = -1; - } -#endif } -#ifdef IND_LIST_DYN delete_indice( hBstr, IND_ES_PRED ); -#else - if ( hBstr->ind_list[IND_ES_PRED].nb_bits != -1 ) - { - hBstr->nb_bits_tot -= hBstr->ind_list[IND_ES_PRED].nb_bits; - hBstr->ind_list[IND_ES_PRED].nb_bits = -1; - } -#endif } if ( st->core_brate < CFREQ_BITRATE ) diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index b460f1ea3235c087138731f375d45937d8db8885..eb35d9629b7cf46250322748a8476cfca7ca5034 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -924,20 +924,10 @@ void stereoFdCngCoherence( { /* case: no VAD for both channels -> INACTIVE FRAME */ 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 ); reset_indices_enc( sts[1]->hBstr, -#ifdef IND_LIST_DYN - sts[1]->hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + sts[1]->hBstr->nb_ind_tot ); /* synchronize SID sending for variable SID rate */ if ( sts[0]->core_brate != sts[1]->core_brate ) @@ -1189,14 +1179,6 @@ void FdCngEncodeMDCTStereoSID( /* ---- Write SID bitstream ---- */ -#ifndef IND_LIST_DYN - /* side info */ - push_indice( sts[0]->hBstr, IND_SID_TYPE, 1, 1 ); - push_indice( sts[0]->hBstr, IND_BWIDTH, sts[0]->bwidth, 2 ); - push_indice( sts[0]->hBstr, IND_ACELP_16KHZ, sts[0]->L_frame == L_FRAME16k ? 1 : 0, 1 ); - push_indice( sts[1]->hBstr, IND_SID_TYPE, coh_idx, 4 ); - push_indice( sts[1]->hBstr, IND_SID_TYPE, no_side_flag, 1 ); -#endif /* noise shapes and channel gains */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) @@ -1204,23 +1186,19 @@ void FdCngEncodeMDCTStereoSID( if ( ch ) { stages = FD_CNG_JOINT_stages_25bits; -#ifdef IND_LIST_DYN sts[ch]->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; /* side info */ push_indice( sts[ch]->hBstr, IND_SID_TYPE, coh_idx, 4 ); push_indice( sts[ch]->hBstr, IND_SID_TYPE, no_side_flag, 1 ); -#endif } else { stages = FD_CNG_stages_37bits; -#ifdef IND_LIST_DYN /* side info */ push_indice( sts[ch]->hBstr, IND_SID_TYPE, 1, 1 ); push_indice( sts[ch]->hBstr, IND_BWIDTH, sts[0]->bwidth, 2 ); push_indice( sts[ch]->hBstr, IND_ACELP_16KHZ, sts[0]->L_frame == L_FRAME16k ? 1 : 0, 1 ); -#endif } for ( int16_t i = 0; i < stages; i++ ) diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index 677bc1639e39dca3ff9e3686b0d156ab99eaa31f..05faa0fac49dca4dd4c6f1e592818eefad4b4dd3 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -1707,7 +1707,6 @@ void IGFEncSetMode( return; } -#ifdef IND_LIST_DYN /*-------------------------------------------------------------------* * pack_bit() @@ -1741,7 +1740,6 @@ static void pack_bit( return; } -#endif /*-------------------------------------------------------------------* * IGFEncConcatenateBitstream() @@ -1757,21 +1755,15 @@ void IGFEncConcatenateBitstream( { int16_t i; IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData; -#ifdef IND_LIST_DYN Indice *ind_list; uint8_t *pFrame; /* byte array with bit packet and byte aligned coded speech data */ int16_t *pFrame_size; /* number of bits in the binary encoded access unit [bits] */ int16_t k, nb_bits_written; int32_t imask; uint8_t omask; -#endif hPrivateData = &hIGFEnc->igfData; -#ifndef IND_LIST_DYN - hBstr->next_ind -= bsBits; -#endif -#ifdef IND_LIST_DYN ind_list = &hBstr->ind_list[hBstr->nb_ind_tot - bsBits]; /* here, we assume that each bit has been written as a single indice */ pFrame = hPrivateData->igfBitstream; pFrame_size = &hPrivateData->igfBitstreamBits; @@ -1806,17 +1798,6 @@ void IGFEncConcatenateBitstream( /* update list of indices */ hBstr->nb_ind_tot -= bsBits; hBstr->nb_bits_tot -= nb_bits_written; -#else - indices_to_serial_generic( &hBstr->ind_list[hBstr->next_ind], bsBits, hPrivateData->igfBitstream, &hPrivateData->igfBitstreamBits ); - - /* make sure there are no leftovers from the temporary bitstream writing */ - for ( i = 0; i < bsBits; i++ ) - { - hBstr->ind_list[i + ( hBstr->next_ind )].nb_bits = -1; - } - - hBstr->nb_bits_tot -= hIGFEnc->infoTotalBitsPerFrameWritten; -#endif return; } diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 73bb369232d0191dd8ecd73b6b66a93f4c0daa24..8cde5b838b1bf871b845a745fbc6f8d80a424659 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -54,10 +54,8 @@ *-----------------------------------------------------------------------*/ ivas_error init_encoder( - Encoder_State *st, /* i/o: state structure */ -#ifdef IND_LIST_DYN - Encoder_Struct *st_ivas, /* i/o: encoder state structure */ -#endif + Encoder_State *st, /* i/o: state structure */ + Encoder_Struct *st_ivas, /* i/o: encoder state structure */ const int16_t idchan, /* i : channel ID */ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ @@ -122,14 +120,12 @@ ivas_error init_encoder( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); } -#ifdef IND_LIST_DYN /* set pointer to the buffer of indices */ st->hBstr->ind_list = st_ivas->ind_list; st->hBstr->ivas_ind_list_zero = &st_ivas->ind_list; st->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices; st->hBstr->nb_ind_tot = 0; st->hBstr->nb_bits_tot = 0; -#endif } else { diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 982967b71264350617328d2c05217aa9590e544a..7ff583a6d244e59ab05987986fe86f4510adc73d 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -103,9 +103,7 @@ ivas_error ivas_core_enc( int16_t last_element_mode, tdm_Pitch_reuse_flag; int32_t element_brate, last_element_brate, input_Fs; ivas_error error; -#ifdef IND_LIST_DYN int16_t max_num_indices_BWE; -#endif push_wmops( "ivas_core_enc" ); @@ -198,7 +196,6 @@ ivas_error ivas_core_enc( { st = sts[n]; -#ifdef IND_LIST_DYN /* update pointer to the buffer of indices of the second channel */ if ( n == 1 && st->element_mode == IVAS_CPE_TD ) { @@ -213,7 +210,6 @@ ivas_error ivas_core_enc( reset_indices_enc( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); } -#endif /*---------------------------------------------------------------------* * Write signaling info into the bitstream diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index e64e0ecc3f675723b8ae80e70d1c3da92bb18248..07a32c868ac484705cfa02291e3533b479d1a9ed 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -129,11 +129,7 @@ ivas_error pre_proc_ivas( { st->L_frame = L_FRAME32k; } -#ifdef FIX_557_CRASH_IN_ISM_DTX else if ( st->bwidth >= SWB && st->total_brate > MAX_ACELP_BRATE_ISM && st->total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && st->is_ism_format && st->tcxonly && st->core_brate != SID_2k40 ) -#else - else if ( st->bwidth >= SWB && st->total_brate > MAX_ACELP_BRATE_ISM && st->total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && st->is_ism_format && st->tcxonly ) -#endif { st->L_frame = L_FRAME25_6k; } diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 879062ff3de40ae66f0245c78f5f023a7f191160..20c2f164523ae396f77e29b1dab86b5eac69c8d2 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -107,10 +107,8 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ -#ifdef FIX_529_BWD_ISSUE - const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif - const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ ) { float *inp_12k8, *new_inp_12k8; /* pointers to current frame and new data */ @@ -489,11 +487,7 @@ ivas_error pre_proc_front_ivas( if ( st->idchan == 0 && element_mode != IVAS_CPE_MDCT ) { -#ifdef FIX_529_BWD_ISSUE bw_detect( st, st->input, NULL, enerBuffer, ivas_format, 0 ); -#else - bw_detect( st, st->input, NULL, enerBuffer, 0 ); -#endif } if ( element_mode != IVAS_CPE_MDCT ) /* in MDCT stereo, set_bw_stereo() is used instead */ diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index 439a0f6c63916f60cdb25a74be7b84768ea6c9bc..10c627c91b153da841292af1cf6055fb3920a790 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -61,22 +61,9 @@ ivas_error ivas_corecoder_enc_reconfig( int16_t len_inp_memory, n_CoreCoder_existing, nSCE_existing, nCPE_existing; float input_buff[MCT_MAX_BLOCKS][L_FRAME48k + NS2SA( 48000, IVAS_FB_ENC_DELAY_NS )]; BSTR_ENC_HANDLE hBstr; -#ifndef IND_LIST_DYN - Indice *ind_list; -#endif -#ifndef IND_LIST_DYN - Indice *ind_list_metadata; - BSTR_ENC_HANDLE hMetaData; -#endif -#ifdef IND_LIST_DYN int16_t i, nb_bits; Indice temp_ind_list[MAX_NUM_IND_TEMP_LIST]; -#endif int16_t nb_bits_tot; -#ifndef IND_LIST_DYN - int16_t last_ind; - int16_t next_ind; -#endif ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; @@ -147,29 +134,16 @@ ivas_error ivas_corecoder_enc_reconfig( } /* something in transport changes */ -#ifndef IND_LIST_DYN - ind_list = NULL; - ind_list_metadata = NULL; -#endif hBstr = NULL; -#ifndef IND_LIST_DYN - hMetaData = NULL; -#endif /* get the index list pointers */ if ( nSCE_old ) { hBstr = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr; -#ifndef IND_LIST_DYN - hMetaData = st_ivas->hSCE[0]->hMetaData; -#endif } else if ( nCPE_old ) { hBstr = st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; -#ifndef IND_LIST_DYN - hMetaData = st_ivas->hCPE[nCPE_old - 1]->hMetaData; -#endif } #ifdef DEBUGGING else @@ -180,12 +154,6 @@ ivas_error ivas_corecoder_enc_reconfig( /* save bitstream information */ nb_bits_tot = hBstr->nb_bits_tot; -#ifndef IND_LIST_DYN - ind_list = hBstr->ind_list; /* pointer to the beginning of the global list */ - next_ind = hBstr->next_ind; - last_ind = hBstr->last_ind; -#endif -#ifdef IND_LIST_DYN i = 0; nb_bits = 0; while ( nb_bits < nb_bits_tot && i < MAX_NUM_IND_TEMP_LIST ) @@ -214,10 +182,6 @@ ivas_error ivas_corecoder_enc_reconfig( #ifdef DEBUGGING assert( ( nb_bits == nb_bits_tot ) && "Error saving bitstream information during core-coder reconfiguration!\n" ); #endif -#endif -#ifndef IND_LIST_DYN - ind_list_metadata = hMetaData->ind_list; /* pointer to the beginning of the global list */ -#endif if ( hEncoderConfig->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && st_ivas->mc_mode == MC_MODE_MCMASA ) { @@ -312,35 +276,16 @@ ivas_error ivas_corecoder_enc_reconfig( mvr2r( input_buff[sce_id], st_ivas->hSCE[sce_id]->hCoreCoder[0]->input_buff, len_inp_memory ); } -#ifndef IND_LIST_DYN - /* allocate buffer of indices */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; -#endif /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ if ( sce_id > 0 ) { reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, -#ifdef IND_LIST_DYN - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->nb_ind_tot ); } else { -#ifndef IND_LIST_DYN - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->nb_bits_tot = nb_bits_tot; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->last_ind = last_ind; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->next_ind = next_ind; -#endif } - -#ifndef IND_LIST_DYN - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); -#endif } } @@ -358,26 +303,13 @@ ivas_error ivas_corecoder_enc_reconfig( copy_encoder_config( st_ivas, st_ivas->hCPE[cpe_id]->hCoreCoder[n], 0 ); st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ -#ifndef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n + st_ivas->nSCE ) * MAX_NUM_INDICES; -#endif if ( cpe_id * CPE_CHANNELS + n > 0 || ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) ) { reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, -#ifdef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot ); } else { -#ifndef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_bits_tot = nb_bits_tot; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->last_ind = last_ind; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->next_ind = next_ind; -#endif } } } @@ -405,27 +337,14 @@ ivas_error ivas_corecoder_enc_reconfig( for ( n = 0; n < CPE_CHANNELS; n++ ) { -#ifndef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n + st_ivas->nSCE ) * MAX_NUM_INDICES; -#endif /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ if ( cpe_id * CPE_CHANNELS + n > 0 || ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) ) { reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, -#ifdef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot ); } else { -#ifndef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_bits_tot = nb_bits_tot; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->last_ind = last_ind; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->next_ind = next_ind; -#endif } if ( hEncoderConfig->Opt_DTX_ON ) @@ -436,7 +355,6 @@ ivas_error ivas_corecoder_enc_reconfig( } } -#ifdef IND_LIST_DYN /* restore bitstream - IVAS format bits should be written in the first core channel of the first SCE/CPE */ i = 0; nb_bits = 0; @@ -478,7 +396,6 @@ ivas_error ivas_corecoder_enc_reconfig( #ifdef DEBUGGING assert( ( nb_bits == nb_bits_tot ) && "Error restoring bitstream information during core-coder reconfiguration!\n" ); #endif -#endif if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -545,22 +462,15 @@ ivas_error ivas_corecoder_enc_reconfig( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MetaData structure\n" ) ); } -#ifdef IND_LIST_DYN /* set pointer to the buffer of metadata indices */ st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->ind_list = st_ivas->ind_list_metadata; st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; 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; -#endif } -#ifdef IND_LIST_DYN reset_indices_enc( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot ); -#else - st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->ind_list = ind_list_metadata + st_ivas->nSCE * MAX_NUM_INDICES; - reset_indices_enc( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, MAX_BITS_METADATA ); -#endif for ( cpe_id = 0; cpe_id < st_ivas->nCPE - 1; cpe_id++ ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 9887372ee7877be4e07b01a08a557782106bca94..325b21456a8182d689b888237c74485ba7018dcc 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -434,9 +434,7 @@ ivas_error ivas_cpe_enc( &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, -#ifdef FIX_529_BWD_ISSUE ivas_format, -#endif ivas_total_brate ); if ( error != IVAS_ERR_OK ) { @@ -811,13 +809,11 @@ ivas_error create_cpe_enc( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MetaData structure\n" ) ); } -#ifdef IND_LIST_DYN /* set pointer to the buffer of metadata indices */ hCPE->hMetaData->ind_list = st_ivas->ind_list_metadata; hCPE->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; hCPE->hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata; reset_indices_enc( hCPE->hMetaData, st_ivas->ivas_max_num_indices_metadata ); -#endif } /*-----------------------------------------------------------------* @@ -835,9 +831,7 @@ ivas_error create_cpe_enc( st->total_brate = hCPE->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; if ( ( error = init_encoder( st, -#ifdef IND_LIST_DYN st_ivas, -#endif n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index da553657a975a9ae4872831483f55b102fc7aa44..6a8debd0cec8507300956ee8769f86c286e46c0f 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -346,9 +346,7 @@ ivas_error ivas_enc( return error; } -#ifdef IND_LIST_DYN st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list + st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_ind_tot; -#endif if ( ( error = ivas_cpe_enc( st_ivas, 0, data_f[0], data_f[1], input_frame, hMetaData->nb_bits_tot ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index a69cc2d9fce58bb57181ef8dbe7f22e163e4cd97..270c8d5710b0fe341b35fae5bf09b6e6d416c917 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -326,12 +326,6 @@ void ivas_initialize_handles_enc( ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -#ifndef IND_LIST_DYN - , - Indice ind_list[][MAX_NUM_INDICES] /* o : bitstream indices */ - , - Indice ind_list_metadata[][MAX_BITS_METADATA] /* o : bitstream indices metadata */ -#endif ) { int16_t i, n; @@ -360,7 +354,6 @@ ivas_error ivas_init_encoder( st_ivas->nchan_transport = -1; -#ifdef IND_LIST_DYN /*-----------------------------------------------------------------* * Allocate and initialize buffer of indices *-----------------------------------------------------------------*/ @@ -401,7 +394,6 @@ ivas_error ivas_init_encoder( { st_ivas->ind_list_metadata = NULL; } -#endif /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles @@ -419,10 +411,6 @@ ivas_error ivas_init_encoder( return error; } -#ifndef IND_LIST_DYN - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); -#endif /* prepare stereo downmix for EVS */ if ( hEncoderConfig->stereo_dmx_evs == 1 ) @@ -444,19 +432,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - /* allocate buffer of indices */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[n]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } - - /* MetaData for DFT stereo */ - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[0]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); -#endif } else if ( ivas_format == ISM_FORMAT ) { @@ -475,15 +450,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - /* MetaData for ISMs */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); -#endif } if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -539,14 +505,6 @@ ivas_error ivas_init_encoder( return error; } -#ifndef IND_LIST_DYN - /* MetaData for SBA */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); -#endif if ( ivas_format == SBA_FORMAT && st_ivas->hEncoderConfig->Opt_DTX_ON ) { @@ -563,25 +521,12 @@ ivas_error ivas_init_encoder( for ( n = 0; n < CPE_CHANNELS; n++ ) { -#ifndef IND_LIST_DYN - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); -#endif if ( hEncoderConfig->Opt_DTX_ON ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; } } - -#ifndef IND_LIST_DYN - /* Metadata only initialized for the last CPE index */ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } -#endif } if ( st_ivas->nCPE > 1 ) @@ -609,24 +554,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - /* allocate buffer of indices */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - /* we need the correct bitstream also for the LFE channel since it might become a proper coded channel when - switching to ParamMC and ind_list is only visible here, can't be done later */ - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } - - /* Metadata only initialized for the last CPE index*/ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } -#endif } if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) @@ -658,22 +585,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - /* we need the correct bitstream also for the LFE channel since it might become a proper coded channel when - switching to ParamMC and ind_list is only visible here, can't be done later */ - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } - /* Metadata only initialized for the last CPE index*/ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } -#endif } if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) @@ -699,22 +610,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - /* allocate buffer of indices */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } - - /* Metadata only initialized for the last CPE index*/ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } -#endif } if ( st_ivas->nCPE > 1 ) @@ -754,15 +649,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - /* allocate buffer of indices */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); -#endif } for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -773,22 +659,6 @@ ivas_error ivas_init_encoder( { return error; } - -#ifndef IND_LIST_DYN - /* allocate buffer of indices */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n + st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } - - /* Metadata only initialized for the last CPE index*/ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } -#endif } } } @@ -842,9 +712,7 @@ void destroy_core_enc( ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ) { -#ifdef IND_LIST_DYN int16_t i; -#endif destroy_cldfb_encoder( hCoreCoder ); @@ -856,13 +724,11 @@ void destroy_core_enc( if ( hCoreCoder->hBstr != NULL ) { -#ifdef IND_LIST_DYN /* reset buffer of indices */ for ( i = 0; i < hCoreCoder->hBstr->nb_ind_tot; i++ ) { hCoreCoder->hBstr->ind_list[i].nb_bits = -1; } -#endif free( hCoreCoder->hBstr ); hCoreCoder->hBstr = NULL; } @@ -1097,7 +963,6 @@ void ivas_destroy_enc( st_ivas->hEncoderConfig = NULL; } -#ifdef IND_LIST_DYN /* Buffer of indices */ if ( st_ivas->ind_list != NULL ) { @@ -1108,7 +973,6 @@ void ivas_destroy_enc( { free( st_ivas->ind_list_metadata ); } -#endif /* main IVAS handle */ free( st_ivas ); diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 907997cf988a94f7ad4408080fbc2bd3fd0d27a7..b9272ad2453a67d0d8928ecc269bbca03acbbd1b 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -169,12 +169,7 @@ int16_t ivas_ism_dtx_enc( /* reset the bitstream (IVAS format signaling was already written) */ reset_indices_enc( hSCE[0]->hCoreCoder[0]->hBstr, -#ifdef IND_LIST_DYN - hSCE[0]->hCoreCoder[0]->hBstr->nb_ind_tot -#else - MAX_NUM_INDICES -#endif - ); + hSCE[0]->hCoreCoder[0]->hBstr->nb_ind_tot ); } /*------------------------------------------------------------------* diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3fe362d0ba2ccd20ecbbbd50fb6b9d6f5bcba0e1..91ccdcbe0f5270d30022d28489709e337b5c5f36 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -87,9 +87,7 @@ ivas_error ivas_ism_enc( int16_t localVAD_HE_SAD[1]; /* local HE VAD */ int16_t nchan_ism, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; -#ifdef IND_LIST_DYN Encoder_State *prev_st = NULL; -#endif ivas_error error; push_wmops( "ivas_ism_enc" ); @@ -165,9 +163,7 @@ ivas_error ivas_ism_enc( &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, -#ifdef FIX_529_BWD_ISSUE ISM_FORMAT, -#endif st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) @@ -258,13 +254,11 @@ ivas_error ivas_ism_enc( hSCE = st_ivas->hSCE[sce_id]; st = hSCE->hCoreCoder[0]; -#ifdef IND_LIST_DYN /* update pointer to the buffer of indices of the next channel */ if ( sce_id > 0 ) { st->hBstr->ind_list = prev_st->hBstr->ind_list + prev_st->hBstr->nb_ind_tot; } -#endif if ( st->low_rate_mode ) { @@ -314,9 +308,7 @@ ivas_error ivas_ism_enc( /* Store previous attack detection flag */ st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; -#ifdef IND_LIST_DYN prev_st = st; -#endif } if ( dtx_flag ) @@ -416,11 +408,7 @@ ivas_error ivas_ism_enc_config( st_ivas->nSCE = st_ivas->nchan_transport; st_ivas->nCPE = 0; -#ifdef FIX_532_ISM_MD_INACTIVEaa - if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 003676c56b715f530a0f1b77df59e33cf14e1cb0..cbf3d945de498f5c3825081f70336b0cbd2f6109 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -114,13 +114,11 @@ ivas_error ivas_set_ism_metadata( *-------------------------------------------------------------------------*/ static void rate_ism_importance( - const int16_t nchan_transport, /* i : number of transported channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ -#ifdef FIX_532_ISM_MD_INACTIVE + const int16_t nchan_transport, /* i : number of transported channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ const int16_t lowrate_metadata_flag[MAX_NUM_OBJECTS], /* i : low-rate MD flag */ -#endif - int16_t ism_imp[] /* o : ISM importance flags */ + int16_t ism_imp[] /* o : ISM importance flags */ ) { int16_t ch, ctype; @@ -141,11 +139,7 @@ static void rate_ism_importance( } } -#ifdef FIX_532_ISM_MD_INACTIVE if ( ( hIsmMeta[ch]->ism_metadata_flag == 0 || lowrate_metadata_flag[ch] == 1 ) && hSCE[ch]->hCoreCoder[0]->localVAD == 0 ) -#else - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) -#endif { ism_imp[ch] = ISM_NO_META; } @@ -201,10 +195,8 @@ ivas_error ivas_ism_metadata_enc( int16_t ism_metadata_flag_global; int16_t non_diegetic_flag_global; int16_t ism_imp[MAX_NUM_OBJECTS]; -#ifdef FIX_532_ISM_MD_INACTIVE int16_t null_metadata_flag[MAX_NUM_OBJECTS]; int16_t lowrate_metadata_flag[MAX_NUM_OBJECTS]; -#endif int16_t nbands, nblocks; ivas_error error; @@ -221,10 +213,8 @@ ivas_error ivas_ism_metadata_enc( set_s( flag_abs_yaw, 0, nchan_ism ); set_s( flag_abs_pitch, 0, nchan_ism ); set_s( flag_abs_radius, 0, nchan_ism ); -#ifdef FIX_532_ISM_MD_INACTIVE set_s( null_metadata_flag, 0, nchan_ism ); set_s( lowrate_metadata_flag, 0, nchan_ism ); -#endif /*----------------------------------------------------------------* * Set Metadata presence / importance flag @@ -238,9 +228,7 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_532_ISM_MD_INACTIVE null_metadata_flag[ch] = !hIsmMeta[ch]->ism_metadata_flag; -#endif if ( hIsmMeta[ch]->ism_metadata_flag == 1 ) { @@ -253,20 +241,12 @@ ivas_error ivas_ism_metadata_enc( if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) || ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) || ( fabsf( hIsmMeta[ch]->radius - hIsmMeta[ch]->last_true_radius ) > ISM_MD_RAD_FEC_DIFF ) ) { -#ifdef FIX_532_ISM_MD_INACTIVE lowrate_metadata_flag[ch] = 1; -#else - hIsmMeta[ch]->ism_metadata_flag = 1; -#endif hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; } else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ) { -#ifdef FIX_532_ISM_MD_INACTIVE lowrate_metadata_flag[ch] = 1; -#else - hIsmMeta[ch]->ism_metadata_flag = 1; -#endif if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 ) { @@ -279,11 +259,7 @@ ivas_error ivas_ism_metadata_enc( } else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) { -#ifdef FIX_532_ISM_MD_INACTIVE lowrate_metadata_flag[ch] = 1; -#else - hIsmMeta[ch]->ism_metadata_flag = 1; -#endif hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } } @@ -295,11 +271,7 @@ ivas_error ivas_ism_metadata_enc( * Rate importance of particular ISM streams *----------------------------------------------------------------*/ -#ifdef FIX_532_ISM_MD_INACTIVE rate_ism_importance( nchan_transport, hIsmMeta, hSCE, lowrate_metadata_flag, ism_imp ); -#else - rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); -#endif /*----------------------------------------------------------------* * Write ISM common signaling @@ -315,9 +287,7 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_ism; ch++ ) { ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; -#ifdef FIX_532_ISM_MD_INACTIVE ism_metadata_flag_global |= lowrate_metadata_flag[ch]; -#endif non_diegetic_flag_global |= hIsmMeta[ch]->non_diegetic_flag; } @@ -333,7 +303,6 @@ ivas_error ivas_ism_metadata_enc( } } -#ifdef FIX_532_ISM_MD_INACTIVE /* write ISM metadata flag (one per object) */ for ( ch = 0; ch < nchan_transport; ch++ ) { @@ -361,26 +330,6 @@ ivas_error ivas_ism_metadata_enc( } } -#else - /* write ISM metadata flag (one per object) */ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); - } - - if ( ism_mode == ISM_MODE_DISC ) - { - /* write VAD flag */ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) - { - /* this flag distinguishes between coding of inactive frame and active frame w/o. metadata */ - push_indice( hBstr, IND_ISM_VAD_FLAG, vad_flag[ch], ISM_METADATA_VAD_FLAG_BITS ); - } - } - } -#endif if ( ism_metadata_flag_global ) { @@ -405,11 +354,7 @@ ivas_error ivas_ism_metadata_enc( nb_bits_start = hBstr->nb_bits_tot; } -#ifdef FIX_532_ISM_MD_INACTIVE if ( hIsmMeta[ch]->ism_metadata_flag || lowrate_metadata_flag[ch] ) -#else - if ( hIsmMeta[ch]->ism_metadata_flag ) -#endif { /*----------------------------------------------------------------* * Quantize and encode azimuth and elevation @@ -605,11 +550,7 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ -#ifdef FIX_532_ISM_MD_INACTIVE if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, vad_flag, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -635,15 +576,11 @@ ivas_error ivas_ism_metadata_enc( hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_532_ISM_MD_INACTIVE #ifdef FIX_562_ISM2_64KBPS if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) || ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) ) #else if ( ism_imp[ch] == ISM_NO_META && total_brate[ch] < ACELP_8k00 ) -#endif -#else - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && vad_flag[ch] == 0 && ism_metadata_flag_global ) #endif { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; @@ -656,11 +593,7 @@ ivas_error ivas_ism_metadata_enc( /* write metadata only in active frames */ if ( hSCE[0]->hCoreCoder[0]->core_brate > SID_2k40 ) { -#ifdef IND_LIST_DYN reset_indices_enc( hSCE[ch]->hMetaData, hSCE[ch]->hMetaData->nb_ind_tot ); -#else - reset_indices_enc( hSCE[ch]->hMetaData, MAX_BITS_METADATA ); -#endif } } @@ -1150,19 +1083,11 @@ void ivas_ism_metadata_sid_enc( { if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_532_ISM_MD_INACTIVE push_indice( hBstr, IND_ISM_MD_INACTIVE_FLAG, 0, 1 ); -#else - push_indice( hBstr, IND_ISM_VAD_FLAG, 0, 1 ); -#endif } else { -#ifdef FIX_532_ISM_MD_INACTIVE push_indice( hBstr, IND_ISM_MD_INACTIVE_FLAG, 1, 1 ); -#else - push_indice( hBstr, IND_ISM_VAD_FLAG, 1, 1 ); -#endif } if ( ism_mode == ISM_MODE_PARAM ) diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index a76c31cdc5fd96f9542547cf45d25dd17c15e8fc..0a6bed8ca6cf36e1bd35cc35d2cd97ab453563d2 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -98,11 +98,7 @@ static void ivas_lfe_enc_quant( BSTR_ENC_HANDLE hBstr ) { int16_t bits_written; -#ifdef IND_LIST_DYN int16_t nb_ind_tot; -#else - int16_t next_ind_pos; -#endif uint16_t quant_strategy, write_bit; int16_t num_quant_strategies; int16_t shift_bits; @@ -121,11 +117,7 @@ static void ivas_lfe_enc_quant( num_quant_strategies = IVAS_MAX_NUM_QUANT_STRATS; shift_bits = IVAS_LFE_SHIFT_BITS; bits_written = hBstr->nb_bits_tot; -#ifdef IND_LIST_DYN nb_ind_tot = hBstr->nb_ind_tot; -#else - next_ind_pos = hBstr->next_ind; -#endif for ( quant_strategy = 0; quant_strategy < num_quant_strategies; quant_strategy++ ) @@ -251,11 +243,7 @@ static void ivas_lfe_enc_quant( } bits_written_arith_enc = hBstr->nb_bits_tot; -#ifdef IND_LIST_DYN next_ind_pos_arith_enc = hBstr->nb_ind_tot; -#else - next_ind_pos_arith_enc = hBstr->next_ind; -#endif push_next_indice( hBstr, coding_strategy, 1 ); base2_num_bits_tot = hBstr->nb_bits_tot - bits_written; @@ -271,24 +259,13 @@ static void ivas_lfe_enc_quant( { if ( quant_strategy == ( num_quant_strategies - 1 ) || ( ( target_bits + IVAS_LFE_ID_BITS ) >= base2_num_bits_tot ) ) { -#ifdef IND_LIST_DYN /* reset bits buffer and code the indices with base 2 coding */ for ( j = hBstr->nb_ind_tot - 1; j >= next_ind_pos_arith_enc; j-- ) { hBstr->ind_list[j].nb_bits = -1; } hBstr->nb_ind_tot = next_ind_pos_arith_enc; -#else - /* reset bits buffer and code the indices with base 2 coding */ - for ( j = hBstr->next_ind - 1; j >= next_ind_pos_arith_enc; j-- ) - { - hBstr->ind_list[j].nb_bits = -1; - } -#endif hBstr->nb_bits_tot = bits_written_arith_enc; -#ifndef IND_LIST_DYN - hBstr->next_ind = next_ind_pos_arith_enc; -#endif coding_strategy = 1; push_next_indice( hBstr, coding_strategy, 1 ); @@ -320,21 +297,13 @@ static void ivas_lfe_enc_quant( { if ( quant_strategy < ( num_quant_strategies - 1 ) ) { -#ifdef IND_LIST_DYN for ( j = hBstr->nb_ind_tot - 1; j >= nb_ind_tot; j-- ) -#else - for ( j = hBstr->next_ind - 1; j >= next_ind_pos; j-- ) -#endif { hBstr->ind_list[j].nb_bits = -1; } hBstr->nb_bits_tot = bits_written; -#ifdef IND_LIST_DYN hBstr->nb_ind_tot = nb_ind_tot; -#else - hBstr->next_ind = next_ind_pos; -#endif } } } diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 94f61730929db46de54270304839d180a63edfa1..0c98f82d056c14fdccb22168f313ba6963a80b52 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -414,13 +414,11 @@ void ivas_mct_core_enc( { st = sts[ch]; -#ifdef IND_LIST_DYN /* update the pointer to the buffer of indices of the second channel */ if ( ch > 0 ) { st->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 89ddfd0ceb11457370c40be8e3cc60f694a63f91..0f20a03768afff45a63526cb801d5a628a481722 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -244,12 +244,10 @@ ivas_error ivas_mct_enc( { hCPE = st_ivas->hCPE[cpe_id]; -#ifdef IND_LIST_DYN if ( cpe_id > 0 ) { hCPE->hCoreCoder[0]->hBstr->ind_list = st_ivas->hCPE[cpe_id - 1]->hCoreCoder[1]->hBstr->ind_list + st_ivas->hCPE[cpe_id - 1]->hCoreCoder[1]->hBstr->nb_ind_tot; } -#endif ivas_mdct_quant_coder( hCPE, hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); /* update input samples buffer (as done in ivas_cpe_enc() for other than MCT coding) */ diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index 08ed294a56fc4c30fd649a2f5d011e7b3b42fa50..842007dd939be096ab6e2bc8c30b5ecd9ded5a3f 100755 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -852,7 +852,6 @@ void mctStereoIGF_enc( p_st[0] = sts[ch1]; p_st[1] = sts[ch2]; -#ifdef IND_LIST_DYN if ( ch1 > 0 ) { sts[ch1]->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; @@ -862,7 +861,6 @@ void mctStereoIGF_enc( { sts[ch2]->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif p_powerSpec[0] = powerSpec[ch1]; p_powerSpec[1] = powerSpec[ch2]; @@ -913,12 +911,10 @@ void mctStereoIGF_enc( continue; } -#ifdef IND_LIST_DYN if ( ch > 0 ) { st->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif nSubframes = st->hTcxEnc->tcxMode == TCX_20 ? 1 : NB_DIV; for ( n = 0; n < nSubframes; n++ ) diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 87d330f2f0f7037ba65bd058977a3cc3b63e3c63..d0e844d5307cda1ca49be5b1ab933d78d6030da9 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -685,11 +685,7 @@ void ivas_mdct_core_whitening_enc( for ( n = 0; n < nSubframes; n++ ) { -#ifdef FIX_529_BWD_ISSUE bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL, MC_FORMAT /*just cannot be ISM_FORMAT*/, mct_on ); -#else - bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL, mct_on ); -#endif if ( nSubframes == NB_DIV && n == 0 ) { @@ -1316,13 +1312,11 @@ void ivas_mdct_quant_coder( { st = sts[ch]; -#ifdef IND_LIST_DYN /* update the pointer to the buffer of indices of the second channel */ if ( ch > 0 ) { st->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { /*Enable appropriate upadte of tcx_curr_overlap_mode even for uncoded channel index 1*/ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 6d44723dc7006439f08af7f53f40a96000a4ae35..bd7cf87bcf2fe8ff200ecf83df98b774f2483fb0 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -144,9 +144,6 @@ ivas_error ivas_qmetadata_enc_encode( { int16_t i, bit_pos_start, bit_pos_start_coh; int16_t next_ind_start; -#ifndef IND_LIST_DYN - int16_t last_ind_start; -#endif uint16_t diffuseness_index_max_ec_frame; uint16_t diffuseness_index_max_ec_frame_pre[QMETADATA_MAX_NO_DIRECTIONS]; int16_t bits_dir_raw_pre[QMETADATA_MAX_NO_DIRECTIONS]; @@ -424,12 +421,7 @@ ivas_error ivas_qmetadata_enc_encode( /* Save state of metadata bitstream buffer after writing energy ratios, number of dirs and save space for coherence*/ bit_pos_start = hMetaData->nb_bits_tot; -#ifdef IND_LIST_DYN next_ind_start = hMetaData->nb_ind_tot; -#else - next_ind_start = hMetaData->next_ind; - last_ind_start = hMetaData->last_ind; -#endif /* Encode quantized directions with EC frame-wise*/ if ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) @@ -438,11 +430,7 @@ ivas_error ivas_qmetadata_enc_encode( bits_signaling[d]++; } -#ifdef IND_LIST_DYN next_ind_raw_flag = hMetaData->nb_ind_tot; -#else - next_ind_raw_flag = hMetaData->next_ind; -#endif push_next_indice( hMetaData, 0, 1 ); /* Raw coding flag*/ bits_dir_bands[0] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, q_direction->cfg.nbands, q_direction->cfg.start_band ); @@ -474,9 +462,6 @@ ivas_error ivas_qmetadata_enc_encode( if ( ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signaling[d] > total_bits_1dir ) && q_direction->cfg.nblocks > 1 ) { restore_metadata_buffer( hMetaData, next_ind_start, -#ifndef IND_LIST_DYN - last_ind_start, -#endif bit_pos_start ); /* Write signaling */ @@ -485,11 +470,7 @@ ivas_error ivas_qmetadata_enc_encode( bits_signaling[d] = 3; /* Write raw flags */ -#ifdef IND_LIST_DYN next_ind_raw_flag = hMetaData->nb_ind_tot; -#else - next_ind_raw_flag = hMetaData->next_ind; -#endif for ( i = start_band; i < nbands; i++ ) { push_next_indice( hMetaData, 0, 1 ); /* Raw coding flag*/ @@ -559,9 +540,6 @@ ivas_error ivas_qmetadata_enc_encode( extra_bits = 0; restore_metadata_buffer( hMetaData, next_ind_start, -#ifndef IND_LIST_DYN - last_ind_start, -#endif bit_pos_start ); push_next_indice( hMetaData, 1, 1 ); /*Write 1 bit to signal no EC frame-wise (EC1)*/ @@ -1214,9 +1192,7 @@ void reset_metadata_spatial( ) { int16_t i, next_ind_sid, last_ind_sid; -#ifdef IND_LIST_DYN int16_t j; -#endif int16_t metadata_sid_bits; if ( core_brate == SID_2k40 || core_brate == FRAME_NO_DATA ) @@ -1238,22 +1214,14 @@ void reset_metadata_spatial( else { /* Reset metadata and keep only SID metadata*/ -#ifdef IND_LIST_DYN last_ind_sid = hMetaData->nb_ind_tot; next_ind_sid = hMetaData->nb_ind_tot; -#else - last_ind_sid = hMetaData->next_ind; - next_ind_sid = hMetaData->next_ind; -#endif while ( hMetaData->nb_bits_tot > nb_bits_metadata ) { next_ind_sid--; hMetaData->nb_bits_tot -= hMetaData->ind_list[next_ind_sid].nb_bits; } -#ifndef IND_LIST_DYN - hMetaData->next_ind = 0; -#endif hMetaData->nb_bits_tot = 0; for ( i = 0; i < next_ind_sid; i++ ) @@ -1261,7 +1229,6 @@ void reset_metadata_spatial( hMetaData->ind_list[i].nb_bits = -1; } -#ifdef IND_LIST_DYN for ( j = 0, i = next_ind_sid; i < last_ind_sid; i++, j++ ) { hMetaData->ind_list[j].value = hMetaData->ind_list[i].value; @@ -1271,18 +1238,6 @@ void reset_metadata_spatial( } hMetaData->nb_ind_tot = j; -#else - for ( i = next_ind_sid; i < last_ind_sid; i++ ) - { - hMetaData->ind_list[hMetaData->next_ind].value = hMetaData->ind_list[i].value; - hMetaData->ind_list[hMetaData->next_ind].nb_bits = hMetaData->ind_list[i].nb_bits; - hMetaData->nb_bits_tot += hMetaData->ind_list[hMetaData->next_ind].nb_bits; - hMetaData->next_ind++; - hMetaData->ind_list[i].nb_bits = -1; - } - - hMetaData->last_ind = hMetaData->next_ind; -#endif #ifdef DEBUGGING assert( ( hMetaData->nb_bits_tot == ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) && "Problem of SID metadata in SCE" ); #endif @@ -1291,17 +1246,7 @@ void reset_metadata_spatial( else { /*Reset metadata*/ -#ifdef IND_LIST_DYN reset_indices_enc( hMetaData, hMetaData->nb_ind_tot ); -#else - for ( i = 0; i < hMetaData->next_ind; i++ ) - { - hMetaData->ind_list[i].nb_bits = -1; - } - hMetaData->nb_bits_tot = 0; - hMetaData->next_ind = 0; - hMetaData->last_ind = 0; -#endif } *total_brate = element_brate; @@ -1311,21 +1256,12 @@ void reset_metadata_spatial( /* Reset SID metadata bits*/ while ( hMetaData->nb_bits_tot > nb_bits_metadata ) { -#ifdef IND_LIST_DYN hMetaData->nb_ind_tot--; hMetaData->nb_bits_tot -= hMetaData->ind_list[hMetaData->nb_ind_tot].nb_bits; hMetaData->ind_list[hMetaData->nb_ind_tot].nb_bits = -1; -#else - hMetaData->next_ind--; - hMetaData->nb_bits_tot -= hMetaData->ind_list[hMetaData->next_ind].nb_bits; - hMetaData->ind_list[hMetaData->next_ind].nb_bits = -1; -#endif } #ifdef DEBUGGING assert( hMetaData->nb_bits_tot == nb_bits_metadata && "Problem in metadata for SCE" ); -#endif -#ifndef IND_LIST_DYN - hMetaData->last_ind = hMetaData->next_ind; #endif } @@ -2179,28 +2115,16 @@ static int16_t ivas_qmetadata_entropy_encode_df_ratio( 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 ) { int16_t i; -#ifdef IND_LIST_DYN for ( i = next_ind_start; i < hMetaData->nb_ind_tot; i++ ) -#else - for ( i = next_ind_start; i <= hMetaData->next_ind; i++ ) -#endif { hMetaData->ind_list[i].nb_bits = -1; } hMetaData->nb_bits_tot = bit_pos_start; -#ifdef IND_LIST_DYN hMetaData->nb_ind_tot = next_ind_start; -#else - hMetaData->next_ind = next_ind_start; - hMetaData->last_ind = last_ind_start; -#endif return; } @@ -5748,11 +5672,7 @@ static int16_t ivas_qmetadata_quantize_coherence( else { /* write dummy data now and save the position */ -#ifdef IND_LIST_DYN *indice_coherence = hMetaData->nb_ind_tot; -#else - *indice_coherence = hMetaData->next_ind; -#endif k = nbits; while ( k > 0 ) { diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index a0134ca8495953c8b82e954d7ba25995d2ceed58..0a16109e6ad359e16ef66d7f2812cbd91d43f665 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -185,9 +185,7 @@ ivas_error ivas_sce_enc( &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, -#ifdef FIX_529_BWD_ISSUE ivas_format, -#endif st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { @@ -316,13 +314,11 @@ ivas_error create_sce_enc( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MetaData structure\n" ) ); } -#ifdef IND_LIST_DYN /* set pointer to the buffer of metadata indices */ hSCE->hMetaData->ind_list = st_ivas->ind_list_metadata; hSCE->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; hSCE->hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata; reset_indices_enc( hSCE->hMetaData, st_ivas->ivas_max_num_indices_metadata ); -#endif } else { @@ -344,9 +340,7 @@ ivas_error create_sce_enc( st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; if ( ( error = init_encoder( st, -#ifdef IND_LIST_DYN st_ivas, -#endif 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 436a649f46a4456a81b379149112eb5a8a4338cc..444d613e299510e7309aac5a42db96742302bc3c 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -226,9 +226,7 @@ ivas_error ivas_spar_enc_open( hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; if ( ( error = init_encoder( hSpar->hCoreCoderVAD, -#ifdef IND_LIST_DYN st_ivas, -#endif 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index dbca3809ccfc5988867a0ae38ccda187a4ec880b..3a93f3d0a1af139357d6fe7d6152c3f66b662851 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -69,9 +69,6 @@ typedef enum ivas_strats_t static void ivas_band_mixer( float *cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t num_ch, int16_t *num_bands, int16_t red_band_fact ); -#ifndef FIX_383_CLEAN_UP -static void ivas_get_band_differential_index( ivas_band_coeffs_ind_t *pBand_idx, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const int16_t complex_cov, const int16_t dim, const ivas_coeffs_type_t coeff_type ); -#endif static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); static int16_t ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); @@ -519,29 +516,17 @@ static void write_metadata_buffer( BSTR_ENC_HANDLE hMetaData_tmp, BSTR_ENC_HANDLE hMetaData, const int16_t bit_pos_start, - const int16_t next_ind_start -#ifndef IND_LIST_DYN - , - const int16_t last_ind_start -#endif -) + const int16_t next_ind_start ) { int16_t i; if ( hMetaData->nb_bits_tot > 0 ) { restore_metadata_buffer( hMetaData, next_ind_start, -#ifndef IND_LIST_DYN - last_ind_start, -#endif bit_pos_start ); } -#ifdef IND_LIST_DYN for ( i = 0; i < hMetaData_tmp->nb_ind_tot; i++ ) -#else - for ( i = 0; i < hMetaData_tmp->next_ind; i++ ) -#endif { push_next_indice( hMetaData, hMetaData_tmp->ind_list[i].value, hMetaData_tmp->ind_list[i].nb_bits ); } @@ -579,15 +564,10 @@ ivas_error ivas_spar_md_enc_process( ivas_strats_t cs[MAX_CODING_STRATS]; int16_t code_strat; int16_t bit_pos_start, next_ind_start; -#ifndef IND_LIST_DYN - int16_t last_ind_start; -#endif BSTR_ENC_DATA hMetaData_tmp; Indice *ind_list_tmp; int16_t md_indices_allocated; -#ifdef IND_LIST_DYN int16_t max_num_indices_tmp; -#endif float Wscale[IVAS_MAX_NUM_BANDS]; /*extra 16 bits for arithmetic coder as overshoot check is after a symbol is written*/ @@ -644,20 +624,13 @@ ivas_error ivas_spar_md_enc_process( hMetaData_tmp.ind_list = ind_list_tmp; hMetaData_tmp.nb_bits_tot = 0; -#ifdef IND_LIST_DYN max_num_indices_tmp = MAX_BITS_METADATA; hMetaData_tmp.ivas_max_num_indices = &max_num_indices_tmp; hMetaData_tmp.ivas_ind_list_zero = (Indice **) ( &hMetaData_tmp.ind_list ); -#endif /* Save state of metadata bitstream buffer */ bit_pos_start = hMetaData->nb_bits_tot; -#ifdef IND_LIST_DYN next_ind_start = hMetaData->nb_ind_tot; -#else - next_ind_start = hMetaData->next_ind; - last_ind_start = hMetaData->last_ind; -#endif dmx_switch = 0; @@ -971,12 +944,7 @@ ivas_error ivas_spar_md_enc_process( { if ( hMetaData->nb_bits_tot == bit_pos_start || hMetaData_tmp.nb_bits_tot < ( hMetaData->nb_bits_tot - bit_pos_start ) ) { - write_metadata_buffer( &hMetaData_tmp, hMetaData, bit_pos_start, next_ind_start -#ifndef IND_LIST_DYN - , - last_ind_start -#endif - ); + write_metadata_buffer( &hMetaData_tmp, hMetaData, bit_pos_start, next_ind_start ); code_strat = strat; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index b3a6e6c16b3d39ea81ffc08991bd66a4c4185b8d..3210721265d5eddfeef6c172101fd1d97e4d5926 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -256,9 +256,7 @@ typedef struct stereo_dft_enc_data_struct float res_cod_NRG_S[STEREO_DFT_BAND_MAX]; float res_cod_SNR_M[STEREO_DFT_BAND_MAX]; float old_snr; -#ifdef ADAP_OPT int16_t first_frm_flag; /* ADAP first frame flag */ -#endif /* flags and data for adaptive wideband residual coding */ float res_dmx_ratio_lt; /* long term energy ratio between RES and DMX */ @@ -320,11 +318,9 @@ typedef struct stereo_mdct_enc_data_structure typedef struct stereo_td_enc_data_structure { -#ifdef IND_LIST_DYN BSTR_ENC_DATA tdm_hBstr_tmp; /* temporary bitstream structure holding TD stereo spatial parameters */ Indice tdm_ind_list_tmp[MAX_IND_TDM_TMP]; /* temporary list of indices holding TD stereo spatial parameters */ int16_t max_ind_tdm_tmp; /* maximum number of indices in the temporary list of indices holding TD stereo spatial parameters */ -#endif int16_t tdm_lp_reuse_flag; /* Flag that indicate if it is possible to reuse the LP coefficient from the primary channel or not */ int16_t tdm_low_rate_mode; /* secondary channel low rate mode flag */ @@ -1133,12 +1129,10 @@ typedef struct { ENCODER_CONFIG_HANDLE hEncoderConfig; /* Encoder configuration structure */ -#ifdef IND_LIST_DYN Indice *ind_list; /* List of indices */ int16_t ivas_max_num_indices; /* Maximum allowed number of indices in the list */ Indice *ind_list_metadata; /* List of indices for metadata */ int16_t ivas_max_num_indices_metadata; /* Maximum allowed number of indices in the list of metadata */ -#endif /* high-level encoder parameters */ int16_t nchan_transport; /* number of transport channels */ diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index dfa4118b09614a077ce944fd0dfcdc13fe3d9369..eb2bc5a3ae6594b0cf55d37ebfc9ef2115296138 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -508,9 +508,7 @@ void stereo_dft_enc_reset( hStereoDft->hItd->prev_itd1 = 0; hStereoDft->hItd->prev_itd2 = 0; -#ifdef ADAP_OPT hStereoDft->first_frm_flag = 1; -#endif #ifdef DEBUG_MODE_DFT hStereoDft->verbose = 1; @@ -1652,11 +1650,7 @@ void stereo_dft_enc_process( { stereo_dft_enc_get_res_cod_mode_flag( hStereoDft, res_nrg_all_curr, dmx_nrg_all_curr, &res_dmx_ratio, &frame_nrg_ratio ); -#ifdef ADAP_OPT if ( hStereoDft->res_cod_sw_flag ) -#else - if ( hStereoDft->res_cod_mode[k_offset] == STEREO_DFT_RES_COD_OFF || hStereoDft->res_cod_sw_flag ) -#endif { int16_t res_cod_band_max; @@ -1757,7 +1751,6 @@ static void stereo_dft_enc_get_res_cod_mode_flag( } /* Calculate long term energy ratio between residual signal and downmix signal */ -#ifdef ADAP_OPT if ( fast_update_flag ) { hStereoDft->res_dmx_ratio_lt = *res_dmx_ratio * 0.2f + hStereoDft->res_dmx_ratio_lt * 0.8f; @@ -1766,23 +1759,9 @@ static void stereo_dft_enc_get_res_cod_mode_flag( { hStereoDft->res_dmx_ratio_lt = *res_dmx_ratio * 0.05f + hStereoDft->res_dmx_ratio_lt * 0.95f; } -#else - if ( fast_update_flag ) - { - hStereoDft->res_dmx_ratio_lt = *res_dmx_ratio * 0.5f + hStereoDft->res_dmx_ratio_lt * 0.5f; - } - else - { - hStereoDft->res_dmx_ratio_lt = *res_dmx_ratio * 0.1f + hStereoDft->res_dmx_ratio_lt * 0.9f; - } -#endif /*Get the residual signal coding initial flag */ -#ifdef ADAP_OPT if ( hStereoDft->res_dmx_ratio_lt > 0.01f ) -#else - if ( hStereoDft->res_dmx_ratio_lt > 0.075f ) -#endif { res_cod_mode_flag = 1; } @@ -1792,7 +1771,6 @@ static void stereo_dft_enc_get_res_cod_mode_flag( } /* Get the residual signal coding flag */ -#ifdef ADAP_OPT if ( hStereoDft->first_frm_flag ) { prev_res_cod_mode_flag = res_cod_mode_flag; @@ -1802,18 +1780,11 @@ static void stereo_dft_enc_get_res_cod_mode_flag( { prev_res_cod_mode_flag = hStereoDft->res_cod_mode[STEREO_DFT_OFFSET - 1]; } -#else - prev_res_cod_mode_flag = hStereoDft->res_cod_mode[STEREO_DFT_OFFSET - 1]; -#endif if ( res_cod_mode_flag != prev_res_cod_mode_flag ) { if ( prev_res_cod_mode_flag == 1 ) { -#ifdef ADAP_OPT if ( hStereoDft->hangover_cnt0 < 5 && hStereoDft->last_res_cod_mode_modify_flag == 0 && fast_update_flag == 0 ) -#else - if ( hStereoDft->hangover_cnt0 < 3 && hStereoDft->last_res_cod_mode_modify_flag == 0 && fast_update_flag == 0 ) -#endif { res_cod_mode_flag = prev_res_cod_mode_flag; hStereoDft->hangover_cnt0++; @@ -1833,11 +1804,7 @@ static void stereo_dft_enc_get_res_cod_mode_flag( } else { -#ifdef ADAP_OPT if ( hStereoDft->hangover_cnt1 < 5 ) -#else - if ( hStereoDft->hangover_cnt1 < 3 ) -#endif { res_cod_mode_flag = prev_res_cod_mode_flag; hStereoDft->hangover_cnt1++; diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 46bc5fbf9a8a9739f2ab1869316b033620e2158e..16970d31db8915cdedbca914fab51b691e6ccdfb 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -362,13 +362,11 @@ void stereo_mdct_core_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifdef IND_LIST_DYN /* update the pointer to the buffer of indices of the second channel */ if ( ch == 1 ) { st->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif ProcessIGF( st, st->hTcxEnc->spectrum[n], orig_spectrum[ch][n], &powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); } } @@ -380,13 +378,11 @@ void stereo_mdct_core_enc( { st = sts[ch]; -#ifdef IND_LIST_DYN /* update the pointer to the buffer of indices of the second channel */ if ( ch == 1 ) { st->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; if ( st->igf ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 2357e307c56bb49cd1b862f7dd57ee15b8220433..3f8fe558097f065547ef36a7dce5788895dfa12f 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -124,13 +124,11 @@ void stereo_td_init_enc( hStereoTD->tdm_prev_desired_idx = LRTD_STEREO_LEFT_IS_PRIM; } -#ifdef IND_LIST_DYN hStereoTD->tdm_hBstr_tmp.ind_list = hStereoTD->tdm_ind_list_tmp; hStereoTD->tdm_hBstr_tmp.ivas_ind_list_zero = (Indice **) ( &hStereoTD->tdm_hBstr_tmp.ind_list ); hStereoTD->max_ind_tdm_tmp = MAX_IND_TDM_TMP; hStereoTD->tdm_hBstr_tmp.ivas_max_num_indices = &hStereoTD->max_ind_tdm_tmp; reset_indices_enc( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); -#endif return; } @@ -322,16 +320,10 @@ void tdm_configure_enc( int16_t tdm_ratio_bit_alloc_idx, mod_ct; STEREO_TD_ENC_DATA_HANDLE hStereoTD; Encoder_State **sts; -#ifndef IND_LIST_DYN - BSTR_ENC_HANDLE hBstr; -#endif int16_t loc_coder_tyape_raw0; hStereoTD = hCPE->hStereoTD; sts = hCPE->hCoreCoder; -#ifndef IND_LIST_DYN - hBstr = sts[1]->hBstr; -#endif loc_coder_tyape_raw0 = sts[0]->coder_type_raw; /*----------------------------------------------------------------* @@ -487,7 +479,6 @@ void tdm_configure_enc( * Bitstream writing *----------------------------------------------------------------*/ -#ifdef IND_LIST_DYN /* transmit the ratio index */ if ( tdm_SM_or_LRTD_Pri && hStereoTD->tdm_LRTD_flag == 0 ) { @@ -526,46 +517,6 @@ void tdm_configure_enc( push_indice( &hStereoTD->tdm_hBstr_tmp, IND_STEREO_CORRSTATS, hCPE->hStereoTCA->indx_ica_NCShift, STEREO_BITS_TCA_CORRSTATS ); push_indice( &hStereoTD->tdm_hBstr_tmp, IND_STEREO_GD, hCPE->hStereoTCA->indx_ica_gD, STEREO_BITS_TCA_GD ); } -#else - /* transmit the ratio index */ - if ( tdm_SM_or_LRTD_Pri && hStereoTD->tdm_LRTD_flag == 0 ) - { - push_indice( hBstr, IND_STEREO_TD_ALPHA, tdm_ratio_idx_SM, TDM_RATIO_BITS ); - } - else - { - if ( hStereoTD->tdm_LRTD_flag == 1 ) - { - push_indice( hBstr, IND_STEREO_TD_ALPHA, hStereoTD->tdm_inst_ratio_idx, TDM_RATIO_BITS ); - } - else - { - push_indice( hBstr, IND_STEREO_TD_ALPHA, tdm_ratio_idx, TDM_RATIO_BITS ); - } - } - - /* LPC reuse flag */ - if ( sts[1]->coder_type == INACTIVE && tdm_ratio_idx < 29 && tdm_ratio_idx > 1 ) - { - /* normal TD, tdm_lp_reuse_flag always on, tdm_use_IAWB_Ave_lpc varies tdm_ratio_idx<29 && tdm_ratio_idx> 1*/ - push_indice( hBstr, IND_STEREO_LPC_REUSE, hStereoTD->tdm_use_IAWB_Ave_lpc, TDM_LP_REUSE_BITS ); - } - else - { - push_indice( hBstr, IND_STEREO_LPC_REUSE, hStereoTD->tdm_lp_reuse_flag, TDM_LP_REUSE_BITS ); - } - - /* LRTD flag */ - push_indice( hBstr, IND_STEREO_LRTD_FLAG, hStereoTD->tdm_LRTD_flag, TDM_LR_CONTENT_BITS ); - - /* Stereo ICA parameters */ - if ( hStereoTD->tdm_LRTD_flag == 0 ) - { - push_indice( hBstr, IND_STEREO_REFCHAN, hCPE->hStereoTCA->refChanIndx, STEREO_BITS_TCA_CHAN ); - push_indice( hBstr, IND_STEREO_CORRSTATS, hCPE->hStereoTCA->indx_ica_NCShift, STEREO_BITS_TCA_CORRSTATS ); - push_indice( hBstr, IND_STEREO_GD, hCPE->hStereoTCA->indx_ica_gD, STEREO_BITS_TCA_GD ); - } -#endif #ifdef DEBUG_MODE_TD dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode" ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index b0e9b6724fd5d32cde85c45c2fa8fc466c058b73..58a010ff7e6f0af108e55ad8bf9f1008dcf34bf4 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -50,10 +50,6 @@ struct IVAS_ENC { Encoder_Struct *st_ivas; -#ifndef IND_LIST_DYN - Indice ind_list[MAX_NUM_DATA][MAX_NUM_INDICES]; /* list of indices */ - Indice ind_list_metadata[MAX_NUM_METADATA][MAX_BITS_METADATA]; /* list of indices for metadata */ -#endif ENC_CORE_HANDLE hCoreCoder; bool isConfigured; #ifdef DEBUGGING @@ -104,9 +100,6 @@ ivas_error IVAS_ENC_Open( ) { Encoder_Struct *st_ivas; -#ifndef IND_LIST_DYN - int16_t i, j; -#endif if ( phIvasEnc == NULL ) { @@ -141,27 +134,6 @@ ivas_error IVAS_ENC_Open( * Initialize indices *-----------------------------------------------------------------*/ -#ifndef IND_LIST_DYN - for ( i = 0; i < MAX_NUM_DATA; ++i ) - { - for ( j = 0; j < MAX_NUM_INDICES; ++j ) - { - ( *phIvasEnc )->ind_list[i][j].nb_bits = 0; - ( *phIvasEnc )->ind_list[i][j].value = 0; - } - } -#endif - -#ifndef IND_LIST_DYN - for ( i = 0; i < MAX_NUM_METADATA; ++i ) - { - for ( j = 0; j < MAX_BITS_METADATA; ++j ) - { - ( *phIvasEnc )->ind_list_metadata[i][j].nb_bits = 0; - ( *phIvasEnc )->ind_list_metadata[i][j].value = 0; - } - } -#endif /*-----------------------------------------------------------------* * Allocate IVAS-codec encoder state @@ -189,10 +161,8 @@ ivas_error IVAS_ENC_Open( /* initialize pointers to handles to NULL */ ivas_initialize_handles_enc( st_ivas ); -#ifdef IND_LIST_DYN st_ivas->ind_list = NULL; st_ivas->ind_list_metadata = NULL; -#endif /* set high-level parameters */ st_ivas->mc_mode = MC_MODE_NONE; @@ -929,13 +899,7 @@ static ivas_error configureEncoder( * Finalize initialization *-----------------------------------------------------------------*/ - if ( ( error = ivas_init_encoder( st_ivas -#ifndef IND_LIST_DYN - , - hIvasEnc->ind_list, - hIvasEnc->ind_list_metadata -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_init_encoder( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1076,9 +1040,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( ENCODER_CONFIG_HANDLE hEncoderConfig; ENC_CORE_HANDLE hCoreCoder; int16_t i; -#ifdef IND_LIST_DYN int16_t n, ch; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -1146,7 +1108,6 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( hIvasEnc->switchingActive = true; } -#ifdef IND_LIST_DYN /*-----------------------------------------------------------------* * Re-allocate and re-initialize buffer of indices if IVAS total bitrate has changed *-----------------------------------------------------------------*/ @@ -1227,7 +1188,6 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } } } -#endif if ( hIvasEnc->switchingActive && hEncoderConfig->ivas_format == MONO_FORMAT ) { diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index cd492b8d4c393a6f9ced1351f5db10d3f9b7f4fa..4a11f1b61f1d60360db9540f603d63b03c5b9b97 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -219,11 +219,7 @@ void pre_proc( * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ -#ifdef FIX_529_BWD_ISSUE bw_detect( st, st->input, NULL, enerBuffer, MONO_FORMAT, 0 ); -#else - bw_detect( st, st->input, NULL, enerBuffer, 0 ); -#endif /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h old mode 100755 new mode 100644 index 69877d91ace3a3fa496ab47bbcdec5627f39c46b..4a47761f9c49f7da8551edcaf925993bc6b2b7a0 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -51,20 +51,12 @@ * Indice *------------------------------------------------------------------------------------------*/ -#ifdef IND_LIST_DYN typedef struct { int16_t id; /* id of the indice */ uint16_t value; /* value of the quantized indice */ int16_t nb_bits; /* number of bits used for the quantization of the indice */ } Indice, *INDICE_HANDLE; -#else -typedef struct -{ - uint16_t value; /* value of the quantized indice */ - int16_t nb_bits; /* number of bits used for the quantization of the indice */ -} Indice; -#endif /*----------------------------------------------------------------------------------* * Bitstream structure @@ -72,19 +64,11 @@ typedef struct typedef struct bitstream_enc_data_structure { -#ifdef IND_LIST_DYN - int16_t nb_ind_tot; /* total number of indices already written */ -#endif - int16_t nb_bits_tot; /* total number of bits already written */ - Indice *ind_list; /* list of indices */ -#ifndef IND_LIST_DYN - int16_t next_ind; /* pointer to the next empty slot in the list of indices */ - int16_t last_ind; /* last written indice */ -#endif -#ifdef IND_LIST_DYN + int16_t nb_ind_tot; /* total number of indices already written */ + int16_t nb_bits_tot; /* total number of bits already written */ + Indice *ind_list; /* list of indices */ int16_t *ivas_max_num_indices; /* maximum total number of indices in the list */ Indice **ivas_ind_list_zero; /* beginning of the buffer of indices */ -#endif } BSTR_ENC_DATA, *BSTR_ENC_HANDLE; /*----------------------------------------------------------------------------------* diff --git a/lib_enc/tcx_utils_enc.c b/lib_enc/tcx_utils_enc.c index 8099b8cb073c000dc45f5458f172bde8db18e26b..b3459bd9c10db7ef635c2d586e2d3444ded288c1 100644 --- a/lib_enc/tcx_utils_enc.c +++ b/lib_enc/tcx_utils_enc.c @@ -1486,19 +1486,11 @@ void ProcessIGF( } else { -#ifdef IND_LIST_DYN pBsStart = hBstr->nb_ind_tot; -#else - pBsStart = hBstr->next_ind; -#endif IGFEncWriteBitstream( hIGFEnc, hBstr, &hIGFEnc->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); -#ifdef IND_LIST_DYN bsBits = hBstr->nb_ind_tot - pBsStart; -#else - bsBits = hBstr->next_ind - pBsStart; -#endif IGFEncConcatenateBitstream( hIGFEnc, bsBits, hBstr ); } @@ -1578,24 +1570,14 @@ void ProcessStereoIGF( else { hBstr = sts[ch]->hBstr; -#ifdef IND_LIST_DYN pBsStart = hBstr->nb_ind_tot; -#else - pBsStart = hBstr->next_ind; -#endif -#ifdef IND_LIST_DYN if ( ch > 0 ) { hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } -#endif IGFEncWriteBitstream( hIGFEnc[ch], hBstr, &hIGFEnc[ch]->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); -#ifdef IND_LIST_DYN bsBits = hBstr->nb_ind_tot - pBsStart; -#else - bsBits = hBstr->next_ind - pBsStart; -#endif IGFEncConcatenateBitstream( hIGFEnc[ch], bsBits, hBstr ); } }