diff --git a/apps/decoder.c b/apps/decoder.c index e7392477fa0ecbb51bc8dc120244e6e95fb1837c..22dc235fff728ec606d58391b20e72d04e625efc 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1353,24 +1353,15 @@ static ivas_error initOnFirstGoodFrame( /* If outputting MASA, open output file and write metadata for initial bad frames */ else if ( *pBsFormat == IVAS_DEC_BS_MASA ) { -#ifdef FIX_350_MASA_DELAY_COMP if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_open( arg.outputWavFilename, ppMasaWriter ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; } /* Duplicate good first frame metadata to fill the beginning of stream. */ -#ifdef FIX_350_MASA_DELAY_COMP MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#else - IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); return error; @@ -1378,11 +1369,7 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { -#ifdef FIX_350_MASA_DELAY_COMP if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, qMetadata ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; @@ -1429,11 +1416,7 @@ static ivas_error decodeG192( ivas_error error = IVAS_ERR_UNKNOWN; uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; -#ifdef FIX_406_IVAS_POSITION IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#else - IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -1646,23 +1629,14 @@ static ivas_error decodeG192( } else if ( bsFormat == IVAS_DEC_BS_MASA ) { -#ifdef FIX_350_MASA_DELAY_COMP MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#else - IVAS_MASA_QMETADATA_HANDLE qMetadata; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#ifdef FIX_350_MASA_DELAY_COMP if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index 82eaf89a34807d395b96825d80dfb21374d4b5c1..be23df8b988728a18f7b1cf1984545d4a7392150 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -536,11 +536,7 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; -#ifdef FIX_406_IVAS_POSITION IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#else - IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#endif #ifdef WMOPS reset_wmops(); @@ -649,9 +645,6 @@ int main( fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); exit( -1 ); } -#ifndef FIX_389_EXT_REND_PCM_SR - args.sampleRate = inFileSampleRate; -#endif break; default: fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); @@ -679,11 +672,7 @@ int main( } /* === Configure === */ -#ifdef FIX_392_LATE_REVERB if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_REND_InitConfig( hIvasRend, ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Error in Renderer Config Init\n" ); exit( -1 ); @@ -975,12 +964,8 @@ int main( } else { -#ifdef FIX_379_EXT_METADATA error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ); if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC -#else - if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC -#endif { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index f8e70061bfa51ca2f6915e002341c99736bfe67e..446cf8ca85f2533b4b2563e3098f95e4ae41acf3 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -833,13 +833,6 @@ static ivas_error write_indices_element( /* restore previous pointer position */ pt_stream_loc = pt_stream_backup; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /* TODO implemented only for MCT for now */ - if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) ) - { - continue; - } -#endif #ifdef ENABLE_BITRATE_VERIFICATION total_nb_bits = #endif diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 209f5d89636a5504502b068a9ee01a4e6e56d756..61c68eae5d5bc8ceeb717b7bd4a7b2cc1112575c 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -93,20 +93,9 @@ typedef struct float x, y, z; } IVAS_VECTOR3; -#ifndef FIX_406_IVAS_POSITION -typedef struct -{ - float x, y, z; - -} IVAS_POSITION; -#endif typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; -#ifdef FIX_350_MASA_DELAY_COMP typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE; -#else -typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; -#endif typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index d138fe1a1ed28c2dc77f12c855af07457a843319..7f9b385c3f3d38c569307a13f15032c0dcb62582 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -250,32 +250,21 @@ int16_t getTnsAllowed( const int32_t total_brate, /* i : total bitrate */ const int16_t igf, /* i : flag indicating IGF activity*/ const int16_t element_mode /* i : IVAS element mode */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ -#endif ) { int16_t tnsAllowed = 0; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( igf ) { -#endif - if ( igf ) - { - if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) ) - { - tnsAllowed = 1; - } - } - else if ( total_brate > HQ_32k ) + if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) ) { tnsAllowed = 1; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE } -#endif + else if ( total_brate > HQ_32k ) + { + tnsAllowed = 1; + } return tnsAllowed; } @@ -419,20 +408,10 @@ int16_t getIgfPresent( const int32_t total_brate, /* i : total bitrate */ const int16_t bwidth, /* i : audio bandwidth */ const int16_t rf_mode /* i : flag to signal the RF mode */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t mct_chan_mode /* i : MCT channel mode */ -#endif ) { int16_t igfPresent = 0; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - return igfPresent; - } -#endif if ( bwidth == SWB ) { @@ -820,12 +799,7 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t MCT_flag -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const MCT_CHAN_MODE mct_chan_mode /* i : MDCT channel mode */ -#endif -) + const int16_t MCT_flag ) { int16_t i; int16_t mdctWindowLength; @@ -855,20 +829,9 @@ void init_tcx_cfg( /* set number of coded lines */ hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; - } -#endif /* TNS in TCX */ hTcxCfg->pCurrentTnsConfig = NULL; - hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - mct_chan_mode -#endif - ); + hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode ); if ( hTcxCfg->fIsTNSAllowed ) { diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index b96798815e46592f6a4bf3194e248c1145b7bc30..5557a88606fc789954b3637e793bc0e101f4b89b 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -69,12 +69,10 @@ int32_t get_delay( { delay = IVAS_ENC_DELAY_NS; -#ifdef FIX_350_MASA_DELAY_COMP if ( ivas_format == MASA_FORMAT ) { delay = 0; /* All delay is compensated in the decoder with MASA */ } -#endif } if ( ivas_format == SBA_FORMAT ) @@ -107,12 +105,10 @@ int32_t get_delay( } -#ifdef FIX_350_MASA_DELAY_COMP if ( ivas_format == MASA_FORMAT ) { delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */ } -#endif } } diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0b326ba8a58421e11ac8d21f8ac332e27195955f..ec806148b2eafccca433fe927dcf2d57cc5dd703 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -325,9 +325,7 @@ typedef enum #define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ #define ISM_EXTENDED_METADATA_BRATE IVAS_64k #define ISM_EXTENDED_METADATA_BITS 1 -#ifdef FIX_379_EXT_METADATA #define ISM_METADATA_RS_MAX_FRAMES 5 /* Number of frames with opposite extended metadata flags before switching */ -#endif /* Parametric ISM */ #define MAX_PARAM_ISM_NBANDS 11 @@ -343,12 +341,7 @@ typedef enum #define PARAM_ISM_HYS_BUF_SIZE 10 /* ISM DTX */ -#ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_COH_SCA_BITS 4 -#else -#define PARAM_ISM_DTX_COH_SCA_BITS 4 -#endif -#ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_AZI_BITS_HIGH 8 #define ISM_DTX_ELE_BITS_HIGH 7 #define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) @@ -357,10 +350,6 @@ typedef enum #define ISM_DTX_ELE_BITS_LOW 5 #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) -#else -#define PARAM_ISM_DTX_AZI_BITS 5 -#define PARAM_ISM_DTX_ELE_BITS 4 -#endif typedef enum @@ -376,19 +365,10 @@ enum { IND_ISM_NUM_OBJECTS, IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, -#ifdef FIX_379_EXT_METADATA IND_ISM_METADATA_FLAG, -#else - IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISM? */ -#endif IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, -#ifdef DISCRETE_ISM_DTX_CNG IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, IND_ISM_SCE_ID_DTX, -#else - IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, - IND_ISM_NOISY_SPEECH_FLAG, -#endif IND_ISM_DTX_COH_SCA, /* ------------- loop for objects -------------- */ @@ -961,10 +941,8 @@ typedef enum #define DELAY_DIRAC_SPAR_ENC_CMP_NS 500000L /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/ #define DELAY_DIRAC_PARAM_DEC_SFR 2 /* Delay to be compensation for DirAC parameters in the decoder (subframes) */ -#ifdef FIX_350_MASA_DELAY_COMP #define DELAY_MASA_PARAM_DEC_SFR 2 /* Delay to be compensation for MASA parameters in the decoder (subframes) */ #define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ -#endif #define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */ #define DIRAC_SLOT_ENC_NS 5000000L @@ -1136,9 +1114,6 @@ enum #define MASA_MAXIMUM_DIRECTIONS 2 #define MASA_MAX_TRANSPORT_CHANNELS 2 -#ifndef FIX_350_MASA_DELAY_COMP -#define MASA_ENC_DELAY_SLOTS 7 -#endif #define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS 5 @@ -1211,13 +1186,11 @@ typedef enum MASA_STEREO_DOWNMIX } MASA_TRANSPORT_SIGNAL_TYPE; -#ifdef FIX_382_MASA_META_FRAMING_ASYNC typedef enum { MASA_FRAME_1SF, MASA_FRAME_4SF } MASA_FRAME_MODE; -#endif /*----------------------------------------------------------------------------------* * Multichannel format @@ -1283,26 +1256,13 @@ typedef enum #define NBBITS_MCT_RATIO 4 #define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE -#define LFE_BITS 180 -#define MCT_LFE_MAX_LINE 24 -#endif #define MCT_NUM_BLOCK_DATA_BITS 4 -#ifndef ISSUE_24_CLEANUP_MCT_LFE typedef enum { MCT_CHAN_MODE_REGULAR, - MCT_CHAN_MODE_LFE, MCT_CHAN_MODE_IGNORE } MCT_CHAN_MODE; -#else -typedef enum -{ - MCT_CHAN_MODE_REGULAR, - MCT_CHAN_MODE_IGNORE -} MCT_CHAN_MODE; -#endif /*----------------------------------------------------------------------------------* * Parametric MC Constants diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 297e2cfb45b3724438270d7fcf69bb85f52cb77b..38a34a15bdbe3e9a8ec053cd065508c7aaf6764a 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -455,22 +455,13 @@ float ism_dequant_meta( void ivas_param_ism_config( PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ -#ifdef NCHAN_ISM_PARAMETER , const int16_t nchan_obj /* i : number of ISM channels */ -#endif ) { -#ifdef NCHAN_ISM_PARAMETER int16_t i; hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; -#else - int16_t i, num_obj; - - hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; - num_obj = hParamIsm->num_obj; -#endif for ( i = 0; i < hParamIsm->nbands; i++ ) { @@ -478,11 +469,7 @@ void ivas_param_ism_config( } /* for elevation zero compute the max azi quantization indices */ -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < nchan_obj; i++ ) -#else - for ( i = 0; i < num_obj; i++ ) -#endif { hParamIsm->last_az_diff[i] = 0; hParamIsm->last_az_sgn[i] = 1; @@ -551,7 +538,6 @@ void ivas_ism_metadata_close( } -#ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* * update_last_metadata() * @@ -613,4 +599,3 @@ void ivas_get_ism_sid_quan_bitbudget( return; } -#endif diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 3a53b2c682446dd6d53e9b05cc8c16e24d7f0fc3..e576c725b21a3d8d9ebc5f6d338fe202ee7b1f30 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -314,10 +314,8 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : Sampling rate */ -#ifdef FIX_350_MASA_DELAY_COMP , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ -#endif ) { uint8_t band, sf; @@ -390,7 +388,6 @@ void masa_sample_rate_band_correction( hQMetaData->twoDirBands[band] = 0; } } -#ifdef FIX_350_MASA_DELAY_COMP if ( hExtOutMeta != NULL ) { /* in decoder, zero the EXT out MASA meta buffer */ @@ -411,7 +408,6 @@ void masa_sample_rate_band_correction( } } } -#endif return; } diff --git a/lib_com/ivas_mct_com.c b/lib_com/ivas_mct_com.c index 5a6eafed5be5d31471155dbc1311509a506c7a51..97c5f5dd8c982fda7ff0b57fc6507869fb957d94 100644 --- a/lib_com/ivas_mct_com.c +++ b/lib_com/ivas_mct_com.c @@ -66,13 +66,6 @@ void splitAvailableBitsMCT( int16_t min_chan_bits[MCT_MAX_CHANNELS], min_bits_tot, remaining_bits; int16_t core[MCT_MAX_CHANNELS]; MCT_CHAN_MODE mct_chan_mode[MCT_MAX_CHANNELS]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t num_lfe; - int16_t lfe_channel; - - num_lfe = 0; - lfe_channel = -1; -#endif min_bits_tot = 0; for ( i = 0; i < nchan; i++ ) @@ -87,22 +80,11 @@ void splitAvailableBitsMCT( mct_chan_mode[i] = ( (Decoder_State *) sts[i] )->mct_chan_mode; core[i] = ( (Decoder_State *) sts[i] )->core; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( mct_chan_mode[i] == MCT_CHAN_MODE_LFE ) - { - num_lfe++; - lfe_channel = i; - assert( lfe_channel == LFE_CHANNEL ); - } -#endif } for ( i = 0; i < nchan; i++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - mct_chan_mode[i] != MCT_CHAN_MODE_LFE && -#endif mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { min_chan_bits[i] = 0; @@ -136,9 +118,6 @@ void splitAvailableBitsMCT( } if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - mct_chan_mode[i] != MCT_CHAN_MODE_LFE && -#endif mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE ); @@ -174,9 +153,6 @@ void splitAvailableBitsMCT( } if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - mct_chan_mode[i] != MCT_CHAN_MODE_LFE && -#endif mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { *bits_frame_channel -= diff * split_ratio[i] / BITRATE_MCT_RATIO_RANGE; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d3e825b63eb88235013368a4022a37d49a4132b5..41d406ed1f2697ea600c8fb8c93943a499cf070e 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -501,9 +501,6 @@ void stereo_tcx_core_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ const int16_t nchan_out, /* i : number of output channels */ const IVAS_FORMAT ivas_format /* i : IVAS format */ -#ifndef DISCRETE_ISM_DTX_CNG - ,const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ -#endif ); void stereo_tcx_init_dec( @@ -813,9 +810,7 @@ ivas_error ivas_ism_enc( ivas_error ivas_ism_metadata_enc( const int32_t ism_total_brate, /* i : ISM total bitrate */ -#ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ -#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -829,25 +824,17 @@ ivas_error ivas_ism_metadata_enc( ivas_error ivas_ism_metadata_dec( const int32_t ism_total_brate, /* i : ISM total bitrate */ -#ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ -#endif int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ const int16_t bfi, /* i : bfi flag */ int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ -#ifdef DISCRETE_ISM_DTX_CNG ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ -#endif -#ifdef FIX_379_EXT_METADATA const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ int16_t *ism_extended_metadata_flag, /* i/o: Extended metadata active in renderer */ int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */ -#else - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ -#endif ); @@ -888,10 +875,8 @@ void ivas_param_ism_stereo_dmx( void ivas_param_ism_config( PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ -#ifdef NCHAN_ISM_PARAMETER , const int16_t nchan_ism /* i : number of ISM channels */ -#endif ); ivas_error ivas_ism_enc_config( @@ -900,13 +885,8 @@ ivas_error ivas_ism_enc_config( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef DISCRETE_ISM_DTX_CNG , const ISM_MODE last_ism_mode /* i/o: last ISM mode */ -#endif -#ifndef NCHAN_ISM_PARAMETER - ,const int16_t num_obj /* i : number of objects in the bitstream */ -#endif ); ivas_error ivas_param_ism_dec_open( @@ -936,7 +916,6 @@ ivas_error ivas_ism_dtx_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifdef DISCRETE_ISM_DTX_CNG /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ @@ -949,20 +928,12 @@ int16_t ivas_ism_dtx_enc( int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ ); -#else -/*! r: indication of DTX frame */ -int16_t ivas_ism_dtx_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - int16_t *sid_flag /* o : indication of SID frame */ -); -#endif ivas_error ivas_ism_dtx_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t *nb_bits_metadata /* o : number of metadata bits */ ); -#ifdef DISCRETE_ISM_DTX_CNG void ivas_ism_metadata_sid_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ const int16_t flag_noisy_speech, /* i : noisy speech flag */ @@ -975,19 +946,7 @@ void ivas_ism_metadata_sid_enc( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#else -void ivas_param_ism_metadata_dtx_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ -#ifdef NCHAN_ISM_PARAMETER - ,const int16_t nchan_ism /* i : number of ISM channels */ -#endif -); -#endif -#ifdef DISCRETE_ISM_DTX_CNG void ivas_ism_metadata_sid_dec( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int32_t ism_total_brate, /* i : ISms total bitrate */ @@ -1000,11 +959,6 @@ void ivas_ism_metadata_sid_dec( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#else -void ivas_param_ism_metadata_dtx_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif void ivas_ism_get_sce_id_dtx( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ @@ -1024,7 +978,6 @@ void ivas_ism_coh_estim_dtx_enc( const int16_t input_frame /* i : input frame length */ ); -#ifdef DISCRETE_ISM_DTX_CNG void update_last_metadata( const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -1040,7 +993,6 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); -#endif /*----------------------------------------------------------------------------------* @@ -1211,9 +1163,7 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ -#ifdef SBA2MONO const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ -#endif ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ @@ -2233,9 +2183,6 @@ void decoder_tcx_imdct( float synthFB[], const int16_t bfi, /* i : Bad frame indicator */ const int16_t frame_cnt, /* i : frame counter in the super frame */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t isLFE, /* i : is LFE */ -#endif const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); @@ -2800,9 +2747,6 @@ void ivas_mdct_core_whitening_enc( int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t *LFE_off, /* o : flag if LFE has content */ -#endif const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ const int16_t nChannels /* i : total number of coded channels */ ); @@ -2820,9 +2764,6 @@ void ivas_mct_core_enc( void ivas_mdct_quant_coder( CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE has content */ -#endif int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ @@ -2873,9 +2814,6 @@ void ivas_mdct_dec_side_bits_frame_channel( int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ Decoder_State *st0, /* i : pointer to bitstream handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t *LFE_off, /* o : flag if LFE has content */ -#endif int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ @@ -2895,9 +2833,6 @@ void ivas_mct_side_bits( void ivas_mdct_core_invQ( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE content */ -#endif int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ @@ -2915,18 +2850,12 @@ void ivas_mdct_core_reconstruct( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE content */ -#endif int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_core_tns_ns( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE has content */ -#endif int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ @@ -3248,11 +3177,9 @@ void ivas_sba_config( int16_t *element_mode /* o : element mode of the core coder */ ); -#ifdef FIX_386_CORECODER_RECONFIG void ivas_sba_set_cna_cng_flag( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -3330,11 +3257,9 @@ void ivas_sba_dirac_stereo_config( STEREO_DFT_CONFIG_DATA_HANDLE hConfig /* o : DFT stereo configuration */ ); -#ifdef SBA2MONO int16_t ivas_get_sba_dirac_stereo_flag( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: encoder DFT stereo handle */ @@ -3544,9 +3469,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport /* i : number of transport channels */ -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - , const int16_t index_slot -#endif ); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( @@ -3599,10 +3521,6 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - const int16_t direction_idx, /* i : index for direction (azi and ele) */ - const int16_t subframe_idx, /* i : subframe index */ -#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat /* i : rotation matrix */ @@ -4572,11 +4490,6 @@ ivas_error ivas_masa_enc_open( void ivas_masa_enc_close( MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ - #ifndef FIX_350_MASA_DELAY_COMP - , - const int16_t nchan_transport, /* i : Number of transport channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ - #endif ); void ivas_masa_enc_reconfigure( @@ -4658,9 +4571,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : sampling rate */ -#ifdef FIX_350_MASA_DELAY_COMP , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ -#endif ); void invdct4_transform( diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 041a589ee3895ad58bd43132559a1ff3e966d14d..7fceb7941f00f1fe9926765c7dc1eb69ff129550 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -43,7 +43,6 @@ /*----------------------------------------------------------------------------------* * Declaration of ISM common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ -#ifdef FIX_379_ANGLE typedef struct { int16_t last_angle1_idx; /* last frame index of coded azimuth/yaw */ @@ -51,16 +50,6 @@ typedef struct int16_t last_angle2_idx; /* last frame index of coded elevation/pitch */ int16_t angle2_diff_cnt; /* FEC counter of consecutive differentially elevation/pitch coded frames */ } ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; -#else -typedef struct -{ - int16_t last_azimuth_idx; /* last frame index of coded azimuth */ - int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */ - int16_t last_elevation_idx; /* last frame index of coded elevation */ - int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ - -} ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; -#endif /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct { @@ -70,23 +59,17 @@ typedef struct float azimuth; /* azimuth value read from the input metadata file */ float elevation; /* azimuth value read from the input metadata file */ float radius; - float yaw; /* azimuth orientation value read from the input metadata file */ - float pitch; /* elevation orientation value read from the input metadata file */ -#ifdef FIX_379_ANGLE + float yaw; /* azimuth orientation value read from the input metadata file */ + float pitch; /* elevation orientation value read from the input metadata file */ ISM_METADATA_ANGLE position_angle; /* Angle structs for azimuth and elevation */ ISM_METADATA_ANGLE orientation_angle; /* Angle structs for yaw and pitch */ -#else - ISM_METADATA_ANGLE angle[2]; /* Angle structs for [0] azimuth/elevation and [1] yaw/pitch */ -#endif - int16_t last_radius_idx; /* last frame index of coded radius */ - int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ + int16_t last_radius_idx; /* last frame index of coded radius */ + int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ -#ifdef DISCRETE_ISM_DTX_CNG float last_azimuth; /* MD smoothing in DTX- last Q azimuth value */ float last_elevation; /* MD smoothing in DTX - last Q elevation value */ float last_true_azimuth; /* MD smoothing in DTX- last true Q azimuth value */ float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */ -#endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; @@ -160,9 +143,6 @@ typedef struct ivas_param_ism_data_structure int16_t nbands; int16_t nblocks[MAX_PARAM_ISM_NBANDS]; int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1]; -#ifndef NCHAN_ISM_PARAMETER - int16_t num_obj; -#endif int16_t azi_index[MAX_NUM_OBJECTS]; int16_t ele_index[MAX_NUM_OBJECTS]; diff --git a/lib_com/options.h b/lib_com/options.h index c823c9c7925d35a5e2ee8b9f173380edf7268443..c4ecc904db78e4daa5dd10e0d0ab357b7d82a925 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -139,36 +139,10 @@ /*#define LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE */ /* switch to isolate the reuse mode case */ #endif #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ -/*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_103_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ -/*#define SBA_HPF_TUNING_DEC*/ - -#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ -#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ -#define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ -#define FIX_386_CORECODER_RECONFIG /* VA: Issue 386: Resolve ToDo comments in CoreCoder reconfig. */ - -#define SBA2MONO /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */ -#define FIX_379_EXT_METADATA /* Eri: Extended metadata issues */ -#define FIX_379_ANGLE /* Eri: Extended metadata issues related to angle structure */ - -#define NOKIA_PARAMBIN_REQULARIZATION /* Nokia: Contribution - Configured reqularization factor for parametric binauralizer. */ -#define NOKIA_ADAPTIVE_BINAURAL_PROTOS /* Nokia: Contribution 28: Adaptive binaural prototypes */ -#define NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT /* Nokia: enable adaptive binaural prototype complexity optimizations */ - -#define FIX_389_EXT_REND_PCM_SR /* Nokia: Issue 389: Fix assignment of sample rate with PCM input. */ -#define FIX_390_EXT_REND_MASA_META_COPY /* Nokia: Issue 390: Fixes MASA metadata copying to renderer. */ -#define FIX_392_LATE_REVERB /* DLB : Issue 392: keep late reverb by default off when output config is not BINAURAL_ROOM*/ - -#define FIX_ISM_DTX_CLICKS /* FhG: fix for clicks in ISM DTX for inactive to active TCX transitions */ -#define ISSUE_24_CLEANUP_MCT_LFE /* Issue 24: Cleanup LFE path withing MCT */ -#define FIX_398_MASA_DIRECTION_ALIGNMENT /* Nokia: Issue 398: in 2dir MASA, dynamically adjust directions to be consistent */ -#define FIX_401_DIRAC_RENDERER_META_READ_INDICES /* Nokia: Issue 401: Fix metadata reading indices in DirAC renderer. */ -#define FIX_406_IVAS_POSITION /* Eri: Issue 406: Unify IVAS_POSITION to use IVAS_VECTOR3 instead */ + +#define FIX_398_MASA_DIRECTION_ALIGNMENT /* Nokia: Issue 398: in 2dir MASA, dynamically adjust directions to be consistent */ #define REND_DEBUGGING_REVISION /* VA: encapsulate rendering debugging options with DEBUGGING */ #define FIX_419_ISM_MD_FIX /* VA: Issue 419: fix the upper value limitation for parameter angle1_diff_cnt */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 65846708efb7b3d9dfb6e7fb2c665299a3a223ad..65f821e5fb362754de317f4fec5c3618c1aa4c3e 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3823,10 +3823,8 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ -#ifdef FIX_MDCT_BASED_BWD , const int16_t mct_on /* i : flag MCT mode */ -#endif ); @@ -5856,13 +5854,11 @@ void core_switching_post_enc( ); ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ -#ifdef FIX_ISM_DTX_CLICKS - const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ @@ -7154,10 +7150,6 @@ void WindowSignal( float out[], /* o : output windowed signal */ const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ const int16_t fullband /* i : fullband flag */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe /* i : LFE flag */ -#endif ); void HBAutocorrelation( @@ -7311,10 +7303,6 @@ void tcx_get_windows( int16_t *right_overlap, /* o : right overlap length */ const float **right_win, /* o : right overlap window */ const int16_t fullband /* i : fullband flag */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe /* i : LFE flag */ -#endif ); void tcx_windowing_analysis( @@ -9505,10 +9493,6 @@ void TonalMDCTConceal_Detect( const float pitchLag, /*IN */ int16_t *umIndices, /*OUT*/ const PsychoacousticParameters *psychParamsCurrent /*IN*/ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe -#endif ); void TonalMDCTConceal_Apply( @@ -9644,10 +9628,6 @@ int16_t getTnsAllowed( const int32_t total_brate, /* i : total bitrate */ const int16_t igf, /* i : flag indicating IGF activity*/ const int16_t element_mode /* i : IVAS element mode */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ -#endif ); int16_t getCtxHm( @@ -9690,10 +9670,6 @@ int16_t getIgfPresent( const int32_t total_brate, /* i : total bitrate */ const int16_t bwidth, /* i : audio bandwidth */ const int16_t rf_mode /* i : flag to signal the RF mode */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t mct_chan_mode /* i : MCT channel mode */ -#endif ); int16_t getCnaPresent( @@ -9991,8 +9967,4 @@ void init_tcx_cfg( const int16_t element_mode, const int16_t ini_frame, const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ -#endif ); diff --git a/lib_com/tcx_utils.c b/lib_com/tcx_utils.c index 7eede5ae650d3c9033968ca70034a6c1e38ce3ca..ec219456b089e0c7a44d09f42e2f1a6a8498f980 100644 --- a/lib_com/tcx_utils.c +++ b/lib_com/tcx_utils.c @@ -60,19 +60,8 @@ void tcx_get_windows( int16_t *right_overlap, /* o : right overlap length */ const float **right_win, /* o : right overlap window */ const int16_t fullband /* i : fullband flag */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe /* i : LFE flag */ -#endif ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /* LFE is only FULL_OVERLAP*/ - if ( isLfe ) - { - assert( left_mode == FULL_OVERLAP && right_mode == FULL_OVERLAP ); - } -#endif if ( !fullband ) { /* Left part */ @@ -95,20 +84,8 @@ void tcx_get_windows( } else if ( left_mode == FULL_OVERLAP ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( isLfe ) - { - *left_overlap = hTcxCfg->tcx_mdct_window_length; - *left_win = hTcxCfg->tcx_mdct_window; - } - else - { -#endif - *left_overlap = hTcxCfg->tcx_mdct_window_length; - *left_win = hTcxCfg->tcx_aldo_window_1_trunc; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + *left_overlap = hTcxCfg->tcx_mdct_window_length; + *left_win = hTcxCfg->tcx_aldo_window_1_trunc; } else { @@ -129,20 +106,8 @@ void tcx_get_windows( } else if ( right_mode == FULL_OVERLAP ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( isLfe ) - { - *right_overlap = hTcxCfg->tcx_mdct_window_length; - *right_win = hTcxCfg->tcx_mdct_window; - } - else - { -#endif - *right_overlap = hTcxCfg->tcx_mdct_window_delay; - *right_win = hTcxCfg->tcx_aldo_window_2; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + *right_overlap = hTcxCfg->tcx_mdct_window_delay; + *right_win = hTcxCfg->tcx_aldo_window_2; } else { @@ -176,20 +141,8 @@ void tcx_get_windows( } else if ( left_mode == FULL_OVERLAP ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( isLfe ) - { - *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; - *left_win = hTcxCfg->tcx_mdct_windowFB; - } - else - { -#endif - *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; - *left_win = hTcxCfg->tcx_aldo_window_1_FB_trunc; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; + *left_win = hTcxCfg->tcx_aldo_window_1_FB_trunc; } else { @@ -215,20 +168,8 @@ void tcx_get_windows( } else if ( right_mode == FULL_OVERLAP ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( isLfe ) - { - *right_overlap = hTcxCfg->tcx_mdct_window_lengthFB; - *right_win = hTcxCfg->tcx_mdct_windowFB; - } - else - { -#endif - *right_overlap = hTcxCfg->tcx_mdct_window_delayFB; - *right_win = hTcxCfg->tcx_aldo_window_2_FB; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + *right_overlap = hTcxCfg->tcx_mdct_window_delayFB; + *right_win = hTcxCfg->tcx_aldo_window_2_FB; } else { @@ -297,10 +238,6 @@ void WindowSignal( float out[], /* o : output windowed signal */ const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ const int16_t fullband /* i : fullband flag */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe /* i : LFE flag */ -#endif ) { int16_t l, r; @@ -311,12 +248,7 @@ void WindowSignal( * Init * *-----------------------------------------------------------*/ - tcx_get_windows( hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - isLfe -#endif - ); + tcx_get_windows( hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband ); /* Init lengths */ @@ -342,11 +274,7 @@ void WindowSignal( tcx_windowing_analysis( in - l / 2 + offset, *L_frame, l, left_win, r, right_win, out ); - if ( left_overlap_mode == FULL_OVERLAP && truncate_aldo -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && !isLfe -#endif - ) + if ( left_overlap_mode == FULL_OVERLAP && truncate_aldo ) { /* fade truncated ALDO window to avoid discontinuities */ if ( !fullband ) diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 6d6ebeef86800182fbee4d5992066fd405956581..aa8f576cec3f5b277eaf4a1c8b980e6c96f0d167 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -190,12 +190,7 @@ void open_decoder_LPD( { if ( !is_init || st->element_mode != IVAS_CPE_MDCT ) { - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag ); } else { @@ -677,17 +672,9 @@ void open_decoder_LPD( st->second_last_core = -1; if ( st->hTcxCfg != NULL && -#ifndef ISSUE_24_CLEANUP_MCT_LFE - !MCT_flag && -#endif st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } if ( hTcxDec != NULL ) { diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index b02d0a78f5ae2ba639ec634ce3c99d389ec565af..ef0a12696f448598703f5635ee0b0510f49cec17 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -91,12 +91,7 @@ void mode_switch_decoder_LPD( switchWB = 1; /*force init when coming from MODE1*/ } - st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag ); if ( st->hIGFDec != NULL ) { @@ -145,12 +140,7 @@ void mode_switch_decoder_LPD( if ( st->hTcxCfg != NULL ) { st->hTcxCfg->pCurrentTnsConfig = NULL; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode ); } if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index fc331a2e9feddf5613d7087db069c065ce0e6b09..9ae8550e40faf6e4db9ed51c99c883ae38eac6f4 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -552,13 +552,11 @@ ivas_error core_switching_pre_dec( *---------------------------------------------------------------------*/ ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ -#ifdef FIX_ISM_DTX_CLICKS - const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ @@ -680,11 +678,7 @@ ivas_error core_switching_post_dec( synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta; } -#ifdef FIX_ISM_DTX_CLICKS if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) -#else - if ( st->element_mode == IVAS_CPE_MDCT && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) -#endif { /* smooth transitions to avoid pops in car noise items */ smoothTransitionDtxToTcx( synth, output_frame, delay_comp ); diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index fbdd150217ff246abdd3ca4cbe898278b5ef06d2..9896d1d8c024016b4b074c4b25a73a8e5dbe503f 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -108,9 +108,6 @@ void decoder_tcx( decoder_tcx_imdct( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x[0], &xn_buf[0], MDCT_IV, fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - 0, -#endif sba_dirac_stereo_flag ); return; @@ -339,11 +336,7 @@ void IMDCT( v_multc( old_syn_overl, hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, old_syn_overl, overlap ); } - if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || st->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) && + if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) ) { /* Mode decision in PLC @@ -363,9 +356,6 @@ void IMDCT( if ( ( !bfi && hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) || ( bfi && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); -#endif /* minimum or half overlap, two transforms, grouping into one window */ L_win = L_frame >> 1; L_ola = ( hTcxCfg->tcx_last_overlap_mode == MIN_OVERLAP ) ? tcx_mdct_window_min_length : tcx_mdct_window_half_length; @@ -403,11 +393,7 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); } - else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ) { /* special overlap attempt, two transforms, grouping into one window */ @@ -568,11 +554,7 @@ void IMDCT( /* Window and overlap-add past frame if past frame is TCX */ if ( ( frame_cnt != 0 ) || ( st->last_core_bfi > ACELP_CORE ) ) { - if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || st->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) && + if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) ) || ( hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ) { @@ -637,11 +619,7 @@ void IMDCT( } } - if ( !aldo && ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && frame_cnt > 0 ) || L_frameTCX != ( hTcxDec->L_frameTCX >> 1 ) ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( !aldo && ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && frame_cnt > 0 ) || L_frameTCX != ( hTcxDec->L_frameTCX >> 1 ) ) ) { /* Compute windowed synthesis in case of switching to ALDO windows in next frame */ mvr2r( xn_buf + L_frame - nz, old_out, nz + overlap ); @@ -1582,11 +1560,8 @@ void decoder_tcx_imdct( const int16_t fUseTns, /* i : flag that is set if TNS data is present */ float synth[], /* i/o: synth[-M..L_frame] */ float synthFB[], - const int16_t bfi, /* i : Bad frame indicator */ - const int16_t frame_cnt, /* i : frame counter in the super frame */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t isLFE, /* i : is LFE */ -#endif + const int16_t bfi, /* i : Bad frame indicator */ + const int16_t frame_cnt, /* i : frame counter in the super frame */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { @@ -1619,9 +1594,6 @@ void decoder_tcx_imdct( } if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - !isLFE && -#endif st->igf ) { proc = st->hIGFDec->flatteningTrigger; @@ -1721,16 +1693,8 @@ void decoder_tcx_imdct( if ( st->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) { IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_1_trunc, -#else hTcxCfg->tcx_aldo_window_1_trunc, -#endif -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_2, -#else hTcxCfg->tcx_aldo_window_2, -#endif hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_outLB, 0, st, 0, acelp_zir ); } @@ -1752,11 +1716,7 @@ void decoder_tcx_imdct( if ( st->element_mode != EVS_MONO ) { IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_1_FB_trunc, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_2_FB, -#else hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, -#endif hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); } diff --git a/lib_dec/er_util.c b/lib_dec/er_util.c index 75f553f1e83602560ac49cbedfb048e4710b23d9..5326f28e904ef627af30b8f7a4aa926f4a857320 100644 --- a/lib_dec/er_util.c +++ b/lib_dec/er_util.c @@ -318,12 +318,7 @@ int16_t GetPLCModeDecision( { TonalMDCTConceal_Detect( st->hTonalMDCTConc, ( hTcxDec->tcxltp_last_gain_unmodified > 0 ) ? st->old_fpitch : 0, &numIndices, - ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ); + ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ) ); if ( ( numIndices > 10 ) || ( ( numIndices > 5 ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) || ( ( numIndices > 0 ) && ( ( st->last_good <= UNVOICED_TRANSITION ) || ( hTcxDec->tcxltp_last_gain_unmodified <= 0.4f ) ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) ) { diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 0dbc0feafc07ebb98963d8314b762d5e20de0e76..a2f1f8504c339a5ee4c8c06c612f53b175c1487e 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -276,11 +276,7 @@ ivas_error evs_dec( * Postprocessing for ACELP/MDCT core switching *---------------------------------------------------------------------*/ -#ifdef FIX_ISM_DTX_CLICKS if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, MONO_FORMAT, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) -#else - if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index ab9465a93a246c2251e998f544b2b28f501cc084..c75bc60f8e8fb8d114074cf6d00d3fc95c8431e7 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -420,17 +420,6 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ -#ifndef DISCRETE_ISM_DTX_CNG - if ( concealWholeFrame == 0 && - ( timeDomainInput == NULL || - ( *timeDomainInput( -FLT_MAX ) && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD ) && - !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || - ( st->element_mode == IVAS_CPE_TD ) ) && - ( !st->BER_detect ) ) -#else if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -440,7 +429,6 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) -#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 97aa4a0fc836bf20a7ed38cf339df8a1268d307e..7deed8ca38354a949090fb923a10cc55adcf7190 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -326,11 +326,7 @@ ivas_error init_decoder( set_f( st->old_synth_sw, 0.0f, NS2SA( 48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ) ); } - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE || st->element_mode == EVS_MONO ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE || st->element_mode == EVS_MONO ) ) { if ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) { @@ -523,21 +519,10 @@ ivas_error init_decoder( } /* open synthesis for output sampling rate */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - if ( ( error = openCldfb( &st->cldfbSyn, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } - else + if ( ( error = openCldfb( &st->cldfbSyn, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { - st->cldfbSyn = NULL; + return error; } -#endif st->cldfbSynHB = NULL; @@ -593,11 +578,7 @@ ivas_error init_decoder( *-----------------------------------------------------------------*/ /* TCX-LTP */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) { @@ -629,11 +610,7 @@ ivas_error init_decoder( } /* TCX config. data structure */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) { @@ -646,11 +623,7 @@ ivas_error init_decoder( } /* Tonal MDCT concealment data structure */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hTonalMDCTConc = (TonalMDCTConcealPtr) malloc( sizeof( TonalMDCTConceal_INSTANCE ) ) ) == NULL ) { @@ -666,11 +639,7 @@ ivas_error init_decoder( * IGF *-----------------------------------------------------------------*/ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) { @@ -764,9 +733,7 @@ ivas_error init_decoder( st->cng_sba_flag = 0; st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ -#ifdef DISCRETE_ISM_DTX_CNG st->is_ism_format = 0; -#endif return error; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 05c1f41727e87111757dd6ca304ae100226350cc..86442b8261ad28675a43aca615e9042aa463c834 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -341,12 +341,7 @@ ivas_error ivas_core_dec( if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT ) { /* TCX decoder */ - stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format -#ifndef DISCRETE_ISM_DTX_CNG - , - st_ivas == NULL ? 0 : st_ivas->ism_mode -#endif - ); + stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); } if ( st->core == HQ_CORE ) @@ -451,11 +446,7 @@ ivas_error ivas_core_dec( mvr2r( synth[n], hSCE->save_synth, output_frame ); } -#ifdef FIX_ISM_DTX_CLICKS if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) -#else - if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index d2cf408dce3bafcd1208a8aaa89c1e0692e1e2fb..9d15f1bdfc34b2e98ccff7f0b8595648f67f654a 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -87,13 +87,8 @@ ivas_error ivas_corecoder_dec_reconfig( *-----------------------------------------------------------------*/ /* remove dummy CPE element for DFT stereo-like upmix */ -#ifdef SBA2MONO if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) || ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) ) -#else - if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) || - ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) ) -#endif { st_ivas->hCPE[0]->hCoreCoder[0] = NULL; st_ivas->hCPE[0]->hCoreCoder[1] = NULL; @@ -151,7 +146,6 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ ) { -#ifdef SBA2MONO /* don't deallocate first CPE in case of mono/stereo output of 1 TC SBA, only deallocate core coder */ if ( cpe_id == 0 && st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old ) { @@ -167,7 +161,6 @@ ivas_error ivas_corecoder_dec_reconfig( } continue; } -#endif destroy_cpe_dec( st_ivas->hCPE[cpe_id] ); st_ivas->hCPE[cpe_id] = NULL; } @@ -207,13 +200,11 @@ ivas_error ivas_corecoder_dec_reconfig( return error; } } -#ifdef SBA2MONO if ( st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old && st_ivas->nchan_transport == 1 && nSCE_old == 0 ) { st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ st_ivas->hCPE[0]->hCoreCoder[1] = NULL; } -#endif for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) { @@ -293,7 +284,6 @@ ivas_error ivas_corecoder_dec_reconfig( if ( ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) ) { -#ifdef SBA2MONO /* if at least one CPE is already available, only allocate DFT Stereo struct */ if ( st_ivas->nCPE > 0 ) { @@ -310,12 +300,6 @@ ivas_error ivas_corecoder_dec_reconfig( return error; } } -#else - if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif set_f( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); @@ -345,45 +329,10 @@ ivas_error ivas_corecoder_dec_reconfig( * Set CNA/CNG flags *-----------------------------------------------------------------*/ -#ifdef FIX_386_CORECODER_RECONFIG if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { ivas_sba_set_cna_cng_flag( st_ivas ); } -#else - /// VE: this could be merged with part of ivas_init_decoder() - if ( st_ivas->ivas_format == SBA_FORMAT ) - { - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) - { - /* skip as done in init function */ - } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; - } - else if ( st_ivas->nchan_transport == 2 ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; - st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - else - { - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cna_dirac_flag = 0; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 0; - } - } - } - } -#endif /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */ if ( hDecoderConfig->last_ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE >= 1 ) @@ -563,11 +512,7 @@ ivas_error ivas_cldfb_dec_reconfig( } /* CLDFB Interpolation weights */ -#ifdef SBA2MONO if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) -#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100755 new mode 100644 index 5156aad08c16c209e9fab116858cf2b04d08e983..186d1c4c7daade77a393d4542142f78836852a11 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,11 +405,7 @@ ivas_error ivas_cpe_dec( } else { -#ifdef SBA2MONO stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 ); -#else - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0 ); -#endif } /* synthesis iFFT */ @@ -691,12 +687,6 @@ ivas_error create_cpe_dec( st->total_brate = hCPE->element_brate / ( 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; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) - { - st->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif if ( ( error = init_decoder( st, n, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { @@ -838,11 +828,7 @@ void destroy_cpe_dec( Decoder_State *st; /* make sure we deallocate a potential distinct hTcxCfg for a MCT LFE channel (can only happen in rs) */ /*TODO Check this again with LFE clean up!*/ - if ( hCPE->hCoreCoder[1] != NULL -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - && hCPE->hCoreCoder[1]->hTcxCfg != hCPE->hCoreCoder[0]->hTcxCfg ) + if ( hCPE->hCoreCoder[1] != NULL && hCPE->hCoreCoder[1]->hTcxCfg != hCPE->hCoreCoder[0]->hTcxCfg ) { hCPE->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 362942c52e963472083456e18f3a1fd2234e92bb..88e631908c16e05772fff2b8c0817033adf7fa9e 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -150,73 +150,17 @@ ivas_error ivas_dec( else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { // VE: call ivas_ism_metadata_dec() with 'st_ivas' - TBD -#ifdef DISCRETE_ISM_DTX_CNG -#ifdef NCHAN_ISM_PARAMETER -#ifdef FIX_379_EXT_METADATA if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_379_EXT_METADATA - if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) -#endif -#endif { return error; } -#else -#ifdef NCHAN_ISM_PARAMETER -#ifdef FIX_379_EXT_METADATA - ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); -#else - ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); -#endif -#else -#ifdef FIX_379_EXT_METADATA - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); -#else - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); -#endif -#endif -#endif } else /* ISM_MODE_DISC */ { -#ifdef DISCRETE_ISM_DTX_CNG -#ifdef NCHAN_ISM_PARAMETER -#ifdef FIX_379_EXT_METADATA if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_379_EXT_METADATA - if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) -#endif -#endif { return error; } -#else -#ifdef NCHAN_ISM_PARAMETER -#ifdef FIX_379_EXT_METADATA - ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); -#else - ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); -#endif -#else -#ifdef FIX_379_EXT_METADATA - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); -#else - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); -#endif -#endif -#endif } for ( n = 0; n < st_ivas->nchan_transport; n++ ) @@ -277,11 +221,7 @@ ivas_error ivas_dec( #endif { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ -#ifdef NCHAN_ISM_PARAMETER ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); -#else - ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_transport, output_frame, st_ivas->hIntSetup.ambisonics_order ); -#endif } /* Binaural rendering */ @@ -379,15 +319,10 @@ ivas_error ivas_dec( nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->sba_dirac_stereo_flag ) { -#ifdef SBA2MONO nchan_remapped = nchan_out; -#else - nchan_remapped = CPE_CHANNELS; -#endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { -#ifdef SBA2MONO ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); if ( st_ivas->hSpar->hPCA != NULL ) @@ -395,7 +330,6 @@ ivas_error ivas_dec( ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); } -#endif ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi ); } @@ -408,20 +342,7 @@ ivas_error ivas_dec( /* HP filtering */ #ifndef DEBUG_SPAR_BYPASS_EVS_CODEC -#ifdef SBA_HPF_TUNING_DEC - int16_t nchan_hp20; - if ( st_ivas->ivas_format == MASA_FORMAT ) - { - nchan_hp20 = nchan_remapped; - } - else - { - nchan_hp20 = getNumChanSynthesis( st_ivas ); - } - for ( n = 0; n < nchan_hp20; n++ ) -#else for ( n = 0; n < nchan_remapped; n++ ) -#endif { hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } @@ -469,11 +390,7 @@ ivas_error ivas_dec( ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); } } -#ifdef SBA2MONO else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) -#else - else if ( !st_ivas->sba_dirac_stereo_flag ) -#endif { ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } @@ -485,12 +402,6 @@ ivas_error ivas_dec( /* LFE channel decoder */ if ( st_ivas->mc_mode == MC_MODE_MCT ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg == NULL ) - { - st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; - } -#endif ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index baab5f9346f107fbbe5993dfaeb91539a467e329..dfeb946a02f4c84791e341f9f626c9d1ad8711a0 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -821,7 +821,6 @@ ivas_error ivas_dirac_dec_config( hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; -#ifdef FIX_350_MASA_DELAY_COMP if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; @@ -831,12 +830,6 @@ ivas_error ivas_dirac_dec_config( hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; } -#else - if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) - { - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - } -#endif else { int16_t num_slots_in_subfr; @@ -1715,7 +1708,6 @@ void ivas_qmetadata_to_dirac( if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { -#ifdef FIX_350_MASA_DELAY_COMP int16_t meta_write_index; band_mapping = hMasa->data.band_mapping; @@ -1752,45 +1744,10 @@ void ivas_qmetadata_to_dirac( } } } -#else - band_mapping = hMasa->data.band_mapping; - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) - { - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - hDirAC->azimuth[block][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation[block][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio1[block][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[block][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; - - if ( q_direction->coherence_band_data != NULL ) - { - hDirAC->spreadCoherence[block][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; - } - else - { - hDirAC->spreadCoherence[block][b] = 0.0f; - } - - if ( hQMetaData->surcoh_band_data != NULL ) - { - hDirAC->surroundingCoherence[block][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; - } - else - { - hDirAC->surroundingCoherence[block][b] = 0.0f; - } - } - } - } -#endif if ( hQMetaData->no_directions == 2 ) { q_direction = &( hQMetaData->q_direction[1] ); -#ifdef FIX_350_MASA_DELAY_COMP for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; @@ -1815,32 +1772,7 @@ void ivas_qmetadata_to_dirac( } } } -#else - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) - { - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - hDirAC->azimuth2[block][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation2[block][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio2[block][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[block][b] -= q_direction->band_data[band].energy_ratio[block]; - - if ( q_direction->coherence_band_data != NULL ) - { - hDirAC->spreadCoherence2[block][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; - } - else - { - hDirAC->spreadCoherence2[block][b] = 0.0f; - } - } - } - } -#endif } -#ifdef FIX_350_MASA_DELAY_COMP else if ( hDirAC->azimuth2 != NULL && hDirAC->elevation2 != NULL && hDirAC->energy_ratio2 != NULL && hDirAC->spreadCoherence2 != NULL ) { /* zero out old dir2 data */ @@ -1853,7 +1785,6 @@ void ivas_qmetadata_to_dirac( set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); } } -#endif } else /* SBA mode/SID/Zero frame*/ { @@ -2208,11 +2139,7 @@ void ivas_dirac_dec( for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; -#else - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[subframe_idx][i]; -#endif hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; @@ -2250,10 +2177,6 @@ void ivas_dirac_dec( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - subframe_idx, - subframe_idx, -#endif surCohRatio, st_ivas->hHeadTrackData->shd_rot_max_order, p_Rmat ); @@ -2263,10 +2186,6 @@ void ivas_dirac_dec( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - subframe_idx, - subframe_idx, -#endif surCohRatio, 0, 0 ); @@ -2564,12 +2483,7 @@ void ivas_dirac_dec( p_Rmat, st_ivas->hVBAPdata, hDirAC->hOutSetup, - nchan_transport -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - , - index_slot -#endif - ); + nchan_transport ); } else { @@ -2579,12 +2493,7 @@ void ivas_dirac_dec( 0, st_ivas->hVBAPdata, hDirAC->hOutSetup, - nchan_transport -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - , - index_slot -#endif - ); + nchan_transport ); } if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index d0dfe4a2948db84f50aaccd88515aab087df481f..362b63c04b3bba68812fa8b1209dd0f7672d774d 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -518,10 +518,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport /* i : number of transport channels*/ -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - , - const int16_t index_slot -#endif ) { int16_t num_freq_bands, num_channels_dir; @@ -560,10 +556,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - index_slot, - index_slot / MAX_PARAM_SPATIAL_SUBFRAMES, -#endif NULL, 2, p_Rmat ); @@ -1491,10 +1483,6 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ -#ifndef FIX_401_DIRAC_RENDERER_META_READ_INDICES - const int16_t direction_idx, /* i : index for direction (azi and ele), can slot index (>2TCs) or subrame index (<=2TCs) */ - const int16_t subframe_idx, /* i : subframe index */ -#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat /* i : rotation matrix */ @@ -1584,31 +1572,17 @@ void ivas_dirac_dec_compute_directional_responses( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#else - spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#endif /* Synthesize the second direction and combine the gains */ if ( hDirAC->numSimultaneousDirections == 2 ) { -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#else - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#endif /* Combine gains from the two directions */ -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON; directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect; directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect; -#else - totalDirect = hDirAC->energy_ratio1[subframe_idx][k] + hDirAC->energy_ratio2[subframe_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[subframe_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[subframe_idx][k] / totalDirect; -#endif for ( l = 0; l < num_channels_dir; l++ ) { @@ -1657,34 +1631,20 @@ void ivas_dirac_dec_compute_directional_responses( else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); -#else - spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); -#endif normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ if ( hDirAC->numSimultaneousDirections == 2 ) { -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); -#else - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); -#endif normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ -#ifdef FIX_401_DIRAC_RENDERER_META_READ_INDICES totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON; directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect; directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect; -#else - totalDirect = hDirAC->energy_ratio1[subframe_idx][k] + hDirAC->energy_ratio2[subframe_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[subframe_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[subframe_idx][k] / totalDirect; -#endif for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= directRatio[0]; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c old mode 100755 new mode 100644 index c0f073af4b1ffb4f3bdad13b712f84c37396aa5b..3f3080c8f8f10a825e15a1168a4bee8acb840e27 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -110,26 +110,12 @@ ivas_error ivas_dec_setup( k--; } -#ifdef NCHAN_ISM_PARAMETER st_ivas->nchan_ism = nchan_ism; -#endif -#ifdef DISCRETE_ISM_DTX_CNG -#ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nchan_ism ) ) != IVAS_ERR_OK ) -#endif { return error; } -#else -#ifdef NCHAN_ISM_PARAMETER - ivas_ism_dec_config( st_ivas ); -#else - ivas_ism_dec_config( st_ivas, nchan_ism ); -#endif -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -242,11 +228,9 @@ ivas_error ivas_dec_setup( case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; break; -#ifdef DISCRETE_ISM_DTX_CNG case SID_ISM: st_ivas->element_mode_init = IVAS_SCE; break; -#endif case SID_MASA_1TC: st_ivas->element_mode_init = IVAS_SCE; st_ivas->nchan_transport = 1; @@ -426,27 +410,6 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; -#ifndef DISCRETE_ISM_DTX_CNG - if ( st_ivas->ism_mode == ISM_MODE_DISC ) - { - ivas_ism_dec_config( st_ivas -#ifndef NCHAN_ISM_PARAMETER - , - 1 -#endif - ); /* currently DTX supported for 1 ISM when ISM Mode is DISC_ISM */ - } - - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - ivas_ism_dec_config( st_ivas -#ifndef NCHAN_ISM_PARAMETER - , - st_ivas->nSCE -#endif - ); /* for Param-ISM, we need to generate 2 TCs */ - } -#endif break; case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; @@ -532,28 +495,10 @@ int16_t getNumChanSynthesis( { n = CPE_CHANNELS; } -#ifdef SBA_HPF_TUNING_DEC - else if ( st_ivas->ivas_format == SBA_FORMAT ) - { - if ( st_ivas->sba_analysis_order > 1 ) - { - n = 0; - } - else - { - n = st_ivas->nchan_transport; - } - } - else if ( st_ivas->hMCT != NULL ) - { - n = st_ivas->nchan_transport; - } -#else else if ( st_ivas->hMCT != NULL || st_ivas->ivas_format == SBA_FORMAT ) { n = st_ivas->nchan_transport; } -#endif return n; } @@ -888,10 +833,8 @@ ivas_error ivas_init_decoder( st_ivas->nSCE = st_ivas->nchan_transport; /* "st_ivas->nchan_transport" is known from ivas_dec_setup */ st_ivas->nCPE = 0; -#ifdef FIX_379_EXT_METADATA st_ivas->ism_extmeta_active = -1; st_ivas->ism_extmeta_cnt = 0; -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { @@ -918,9 +861,7 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); -#ifdef DISCRETE_ISM_DTX_CNG st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; -#endif } if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -987,11 +928,7 @@ ivas_error ivas_init_decoder( ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO ); -#endif } else /* SBA_MODE_DIRAC */ { @@ -1000,11 +937,7 @@ ivas_error ivas_init_decoder( return error; } -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); -#endif } } @@ -1041,11 +974,7 @@ ivas_error ivas_init_decoder( } /* create CPE element for DFT Stereo like upmix */ -#ifdef SBA2MONO if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 ) -#else - if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) -#endif { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { @@ -1065,28 +994,7 @@ ivas_error ivas_init_decoder( } /* set CNA/CNG flags */ -#ifdef FIX_386_CORECODER_RECONFIG ivas_sba_set_cna_cng_flag( st_ivas ); -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; - } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; - } - else if ( st_ivas->nchan_transport == 2 ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; - } - } -#endif } else if ( st_ivas->ivas_format == MC_FORMAT ) { @@ -1178,11 +1086,7 @@ ivas_error ivas_init_decoder( return error; } -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); -#endif if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { @@ -1404,14 +1308,6 @@ ivas_error ivas_init_decoder( return error; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /* reuse core-coder buffers for LFE decoder */ - cpe_id = LFE_CHANNEL / CPE_CHANNELS; - n = LFE_CHANNEL % CPE_CHANNELS; - - st_ivas->hLFE->prevsynth_buf = &st_ivas->hCPE[cpe_id]->hCoreCoder[n]->old_synth_sw[0]; - st_ivas->hLFE->prior_out_buffer = &st_ivas->hCPE[cpe_id]->hCoreCoder[n]->previoussynth[0]; -#endif set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); } @@ -1447,11 +1343,7 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ -#ifdef SBA2MONO if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) -#else - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag ) -#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } @@ -1571,11 +1463,7 @@ void destroy_core_dec( hCoreCoder->hTcxDec = NULL; } - if ( hCoreCoder->hTcxCfg != NULL -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && hCoreCoder->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( hCoreCoder->hTcxCfg != NULL ) { free( hCoreCoder->hTcxCfg ); hCoreCoder->hTcxCfg = NULL; diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index e6571e83d9370369c73086286d6f7e0b145a9255..f50200e50f4ce8ee97ea1a8c3685f79a7f65ce13 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -50,10 +50,6 @@ static ivas_error ivas_ism_bitrate_switching( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode /* i : last ISM mode */ -#ifndef NCHAN_ISM_PARAMETER - , - const int16_t num_obj /* i : number of objects in the bitstream */ -#endif ) { ivas_error error; @@ -65,11 +61,7 @@ static ivas_error ivas_ism_bitrate_switching( nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; -#ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -242,20 +234,11 @@ static ivas_error ivas_ism_bitrate_switching( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef DISCRETE_ISM_DTX_CNG , const ISM_MODE last_ism_mode /* i/o: last ISM mode */ -#endif -#ifndef NCHAN_ISM_PARAMETER - , - const int16_t num_obj /* i : number of objects in the bitstream */ -#endif ) { int32_t ivas_total_brate; -#ifndef DISCRETE_ISM_DTX_CNG - ISM_MODE last_ism_mode; -#endif ivas_error error; int16_t nchan_transport_old; @@ -263,17 +246,9 @@ ivas_error ivas_ism_dec_config( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifndef DISCRETE_ISM_DTX_CNG - /* store last frame ISM mode */ - last_ism_mode = st_ivas->ism_mode; -#endif /* Assumes that num of input objects are constant */ -#ifdef NCHAN_ISM_PARAMETER nchan_transport_old = st_ivas->nchan_ism; -#else - nchan_transport_old = num_obj; -#endif if ( last_ism_mode == ISM_MODE_PARAM ) { @@ -283,42 +258,25 @@ ivas_error ivas_ism_dec_config( if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) { /* select ISM format mode */ -#ifdef NCHAN_ISM_PARAMETER st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate ); st_ivas->nchan_transport = st_ivas->nchan_ism; -#else - st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate ); - - st_ivas->nchan_transport = num_obj; -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { -#ifdef NCHAN_ISM_PARAMETER st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; -#else - st_ivas->hDecoderConfig->nchan_out = num_obj; -#endif } } if ( st_ivas->ini_active_frame != 0 ) { /* ISM bit-rate switching */ -#ifndef DISCRETE_ISM_DTX_CNG - if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA ) -#endif { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { -#ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -328,58 +286,27 @@ ivas_error ivas_ism_dec_config( } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { -#ifdef DISCRETE_ISM_DTX_CNG -#ifdef NCHAN_ISM_PARAMETER st_ivas->nchan_transport = st_ivas->nchan_ism; -#else - st_ivas->nchan_transport = num_obj; -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { -#ifdef NCHAN_ISM_PARAMETER st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; -#else - st_ivas->hDecoderConfig->nchan_out = num_obj; -#endif } } /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { -#ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) -#endif { return error; } } -#else - if ( last_ism_mode == ISM_MODE_PARAM ) - { - nchan_transport_old = MAX_PARAM_ISM_WAVE; - } - else - { -#ifdef NCHAN_ISM_PARAMETER - st_ivas->nchan_transport = st_ivas->nchan_ism; -#else - st_ivas->nchan_transport = num_obj; -#endif - } -#endif } -#ifdef NCHAN_ISM_PARAMETER switch ( st_ivas->nchan_ism ) -#else - switch ( num_obj ) -#endif { case 1: st_ivas->transport_config = AUDIO_CONFIG_ISM1; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index ef52c082b7330adf6f3b478ca4f0d98f8ef314a1..4e987c2920ff57cc97cd11f942bb756801ed81df 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -51,24 +51,14 @@ static void ivas_ism_preprocessing( const int16_t sce_id /* i : SCE # identifier */ ) { -#ifndef DISCRETE_ISM_DTX_CNG - int32_t ivas_total_brate; -#endif Decoder_State *st; st = st_ivas->hSCE[sce_id]->hCoreCoder[0]; -#ifndef DISCRETE_ISM_DTX_CNG - ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - - if ( ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) -#endif { /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; -#ifdef DISCRETE_ISM_DTX_CNG st->next_bit_pos = 0; /* note: needed in paramISM -> discISM switching */ -#endif if ( sce_id == st_ivas->hISMDTX.sce_id_dtx ) { @@ -81,12 +71,6 @@ static void ivas_ism_preprocessing( st->cng_ism_flag = 1; } -#ifndef DISCRETE_ISM_DTX_CNG - else - { - st->cng_ism_flag = 0; - } -#endif return; } @@ -105,36 +89,15 @@ ivas_error ivas_ism_dtx_dec( { int16_t ch, pos, nchan_ism, nchan_ism_prev; int32_t ivas_total_brate; -#ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; int16_t idx, flag_noisy_speech, sce_id_dtx; ISM_MODE last_ism_mode, ism_mode_bstr; ivas_error error; -#endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifndef DISCRETE_ISM_DTX_CNG - if ( st_ivas->nchan_transport == 1 ) - { - nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; - - return IVAS_ERR_OK; - } -#endif -#ifdef NCHAN_ISM_PARAMETER nchan_ism_prev = st_ivas->nchan_ism; -#else - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - nchan_ism_prev = st_ivas->hDirAC->hParamIsm->num_obj; - } - else /* ism_mode == ISM_MODE_DISC */ - { - nchan_ism_prev = st_ivas->nchan_transport; - } -#endif if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { @@ -147,12 +110,8 @@ ivas_error ivas_ism_dtx_dec( ( nchan_ism )++; pos--; } -#ifdef NCHAN_ISM_PARAMETER st_ivas->nchan_ism = nchan_ism; -#endif -#ifdef DISCRETE_ISM_DTX_CNG pos--; -#endif if ( nchan_ism != nchan_ism_prev ) { @@ -160,7 +119,6 @@ ivas_error ivas_ism_dtx_dec( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } -#ifdef DISCRETE_ISM_DTX_CNG last_ism_mode = st_ivas->ism_mode; /* read ism_mode */ @@ -173,34 +131,10 @@ ivas_error ivas_ism_dtx_dec( st_ivas->ism_mode = ism_mode_bstr; } -#ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nchan_ism ) ) != IVAS_ERR_OK ) -#endif { return error; } -#else -#ifdef NCHAN_ISM_PARAMETER - ivas_ism_dec_config( st_ivas ); -#else - ivas_ism_dec_config( st_ivas, nchan_ism ); -#endif - - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { -#ifdef NCHAN_ISM_PARAMETER - st_ivas->nchan_transport = 2; -#else - st_ivas->hDirAC->hParamIsm->num_obj = nchan_ism; -#endif - } - else /* ism_mode == ISM_MODE_DISC */ - { - st_ivas->nchan_transport = nchan_ism; - } -#endif } else { @@ -208,7 +142,6 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ -#ifdef DISCRETE_ISM_DTX_CNG ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, &flag_noisy_speech, &sce_id_dtx, st_ivas->hIsmMetaData, nb_bits_metadata ); @@ -221,11 +154,7 @@ ivas_error ivas_ism_dtx_dec( st_ivas->hISMDTX.sce_id_dtx = sce_id_dtx; } -#else - ivas_param_ism_metadata_dtx_dec( st_ivas ); -#endif -#ifdef DISCRETE_ISM_DTX_CNG set_s( md_diff_flag, 1, nchan_ism ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -240,25 +169,16 @@ ivas_error ivas_ism_dtx_dec( update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; -#endif if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { -#ifdef DISCRETE_ISM_DTX_CNG nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; -#else - nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; -#endif } } -#ifdef DISCRETE_ISM_DTX_CNG if ( !st_ivas->bfi ) -#else - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) -#endif { for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index feccbc9766a28230619be030a1710d57607d6613..d6bd362ef7ec4927b12188c7168bfd19f35319b7 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -37,9 +37,7 @@ #include "ivas_rom_com.h" #include "prot.h" #include "ivas_stat_enc.h" -#ifdef DISCRETE_ISM_DTX_CNG #include -#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -54,7 +52,6 @@ static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); -#ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------------*/ @@ -131,7 +128,6 @@ static void ism_metadata_smooth( return; } -#endif /*-------------------------------------------------------------------------* @@ -141,90 +137,43 @@ static void ism_metadata_smooth( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISM total bitrate */ -#ifdef NCHAN_ISM_PARAMETER - const int16_t nchan_ism, /* i : number of ISM channels */ -#endif - int16_t *nchan_transport, /* o : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ - const int16_t bfi, /* i : bfi flag */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ - ISM_MODE ism_mode, /* i : ISM mode */ -#ifdef DISCRETE_ISM_DTX_CNG - ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ -#endif -#ifdef FIX_379_EXT_METADATA + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_ism, /* i : number of ISM channels */ + int16_t *nchan_transport, /* o : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ + const int16_t bfi, /* i : bfi flag */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ + ISM_MODE ism_mode, /* i : ISM mode */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ int16_t *ism_extmeta_active, /* i/o: Extended metadata active in renderer*/ int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed*/ -#else - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ -#endif ) { int16_t ch, nb_bits_start = 0, last_bit_pos; int16_t idx_radius; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; DEC_CORE_HANDLE st0; -#ifdef FIX_379_EXT_METADATA int16_t ism_extmeta_bitstream; float yaw, pitch, radius; -#else - int16_t ism_extended_metadata_flag; -#endif int16_t flag_abs_radius; int16_t flag_abs_orientation; -#ifdef FIX_379_ANGLE int16_t flag_abs_position; int16_t idx_angle1; int16_t idx_angle2; -#else - int16_t idx_azimuth, flag_abs_azimuth; - int16_t idx_elevation; -#endif int16_t next_bit_pos_orig; uint16_t i, bstr_meta[MAX_BITS_METADATA], *bstr_orig; ISM_METADATA_HANDLE hIsmMetaData; int16_t nchan_transport_prev, ism_metadata_flag_global; int16_t localVAD[MAX_NUM_OBJECTS]; int16_t ism_imp[MAX_NUM_OBJECTS]; -#ifdef NCHAN_ISM_PARAMETER int16_t nbands, nblocks; -#else - int16_t nchan_ism = 0, nbands, nblocks; -#endif -#ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; -#endif ivas_error error; push_wmops( "ism_meta_dec" ); -#ifndef DISCRETE_ISM_DTX_CNG - if ( ism_total_brate == IVAS_SID_5k2 || ism_total_brate == FRAME_NO_DATA ) - { - /* no metadata decoding in CNG */ - for ( ch = 0; ch < *nchan_transport; ch++ ) - { - hIsmMeta[ch]->ism_metadata_flag = 0; - } - - /* set padding bits as metadata bits to keep later bitrate checks valid */ - nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; - -#ifdef DEBUGGING - /* sanity check */ - if ( *nchan_transport != 1 ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\n!!! Error: SID/CNG frame not expect for decoding more than 1 object. Exiting.\n\n" ); - } -#endif - - pop_wmops(); - return IVAS_ERR_OK; - } -#endif /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; @@ -235,11 +184,7 @@ ivas_error ivas_ism_metadata_dec( bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; st0->next_bit_pos = 0; -#ifdef FIX_379_EXT_METADATA ism_extmeta_bitstream = 0; -#else - ism_extended_metadata_flag = 0; -#endif /* reverse the bitstream for easier reading of indices */ for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) @@ -255,27 +200,14 @@ ivas_error ivas_ism_metadata_dec( * Read ISM common signaling *----------------------------------------------------------------*/ -#ifdef NCHAN_ISM_PARAMETER /* number of objects was read in ivas_dec_setup() */ st0->next_bit_pos += nchan_ism; -#else - /* read number of objects */ - nchan_ism = 1; - while ( get_next_indice( st0, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS ) - { - ( nchan_ism )++; - } -#endif ism_mode = ivas_ism_mode_select( nchan_ism, ism_total_brate ); if ( ism_mode == ISM_MODE_PARAM ) { -#ifdef NCHAN_ISM_PARAMETER *nchan_transport = MAX_PARAM_ISM_WAVE; -#else - hParamIsm->num_obj = nchan_ism; -#endif } else if ( ism_mode == ISM_MODE_DISC ) { @@ -291,13 +223,8 @@ ivas_error ivas_ism_metadata_dec( /* read extended metadata presence flag */ if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { -#ifdef FIX_379_EXT_METADATA ism_extmeta_bitstream = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); -#else - ism_extended_metadata_flag = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); -#endif } -#ifdef FIX_379_EXT_METADATA /* Apply hysteresis in case rate switching causes fluctuation in presence of extended metadata */ if ( *ism_extmeta_active == -1 || *ism_extmeta_active == ism_extmeta_bitstream ) /* If first frame or bitstream matches internal state */ { @@ -313,7 +240,6 @@ ivas_error ivas_ism_metadata_dec( *ism_extmeta_cnt = 0; } } -#endif /* Read ISM present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) @@ -372,109 +298,57 @@ ivas_error ivas_ism_metadata_dec( { nb_bits_start = st0->next_bit_pos; } -#ifdef FIX_379_ANGLE flag_abs_position = 0; -#else - flag_abs_azimuth = 0; -#endif flag_abs_orientation = 0; flag_abs_radius = 0; if ( hIsmMeta[ch]->ism_metadata_flag ) { -#ifdef FIX_379_ANGLE decode_angle_indices( st0, &( hIsmMetaData->position_angle ), &flag_abs_position ); idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; idx_angle2 = hIsmMetaData->position_angle.last_angle2_idx; -#else - decode_angle_indices( st0, &( hIsmMetaData->angle[0] ), &flag_abs_azimuth ); - idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx; - idx_elevation = hIsmMetaData->angle[0].last_elevation_idx; -#endif /* Azimuth/Elevation dequantization */ if ( ism_mode == ISM_MODE_PARAM ) { -#ifdef FIX_379_ANGLE hParamIsm->azi_index[ch] = idx_angle1; hParamIsm->ele_index[ch] = idx_angle2; -#else - hParamIsm->azi_index[ch] = idx_azimuth; - hParamIsm->ele_index[ch] = idx_elevation; -#endif } else /* ISM_MODE_DISC */ { -#ifdef FIX_379_ANGLE hIsmMetaData->azimuth = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hIsmMetaData->elevation = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#endif /* radius/raw/pitch dequantization */ -#ifdef FIX_379_EXT_METADATA if ( ism_extmeta_bitstream ) -#else - if ( ism_extended_metadata_flag ) -#endif { -#ifdef FIX_379_ANGLE decode_angle_indices( st0, &( hIsmMetaData->orientation_angle ), &flag_abs_orientation ); idx_angle1 = hIsmMetaData->orientation_angle.last_angle1_idx; idx_angle2 = hIsmMetaData->orientation_angle.last_angle2_idx; -#else - decode_angle_indices( st0, &( hIsmMetaData->angle[1] ), &flag_abs_orientation ); - idx_azimuth = hIsmMetaData->angle[1].last_azimuth_idx; - idx_elevation = hIsmMetaData->angle[1].last_elevation_idx; -#endif -#ifdef FIX_379_EXT_METADATA -#ifdef FIX_379_ANGLE yaw = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); pitch = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - yaw = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - pitch = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#endif -#else - hIsmMetaData->yaw = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - hIsmMetaData->pitch = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#endif idx_radius = decode_radius( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); -#ifdef FIX_379_EXT_METADATA radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); -#else - hIsmMetaData->radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); -#endif -#ifdef FIX_379_EXT_METADATA if ( *ism_extmeta_active == 1 ) { hIsmMetaData->yaw = yaw; hIsmMetaData->pitch = pitch; hIsmMetaData->radius = radius; } -#endif } else { -#ifdef FIX_379_EXT_METADATA if ( *ism_extmeta_active == 0 ) { hIsmMetaData->yaw = 0.0f; hIsmMetaData->pitch = 0.0f; hIsmMetaData->radius = 1.0f; } -#else - hIsmMetaData->radius = 1.0f; -#endif } } -#ifdef DISCRETE_ISM_DTX_CNG /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; -#endif } /* save number of metadata bits read */ @@ -537,17 +411,6 @@ ivas_error ivas_ism_metadata_dec( } else /* BFI */ { -#ifndef NCHAN_ISM_PARAMETER - /* "nchan_ism", "hIsmMeta->azimuth" and "hIsmMeta->elevation" are recycled from the last frame */ - if ( ism_mode == ISM_MODE_PARAM ) - { - nchan_ism = hParamIsm->num_obj; - } - else if ( ism_mode == ISM_MODE_DISC ) - { - nchan_ism = *nchan_transport; - } -#endif for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; @@ -561,24 +424,17 @@ ivas_error ivas_ism_metadata_dec( { hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; -#ifdef FIX_379_ANGLE hIsmMeta[ch]->position_angle.last_angle1_idx = hParamIsm->azi_index[ch]; hIsmMeta[ch]->position_angle.last_angle2_idx = hParamIsm->ele_index[ch]; -#else - hIsmMeta[ch]->angle[0].last_azimuth_idx = hParamIsm->azi_index[ch]; - hIsmMeta[ch]->angle[0].last_elevation_idx = hParamIsm->ele_index[ch]; -#endif } } } -#ifdef DISCRETE_ISM_DTX_CNG if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); hISMDTX.ism_dtx_hangover_cnt += 1; } -#endif /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel @@ -636,7 +492,6 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); } -#ifdef DISCRETE_ISM_DTX_CNG /*----------------------------------------------------------------* * Updates *----------------------------------------------------------------*/ @@ -644,7 +499,6 @@ ivas_error ivas_ism_metadata_dec( set_s( md_diff_flag, 1, nchan_ism ); update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); -#endif for ( ch = 0; ch < *nchan_transport; ch++ ) { @@ -681,23 +535,14 @@ ivas_error ivas_ism_metadata_dec_create( } st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; -#ifdef FIX_379_ANGLE st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0; st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0; st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); -#else - st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); - st_ivas->hIsmMetaData[ch]->angle[1].last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); -#endif st_ivas->hIsmMetaData[ch]->last_radius_idx = 8; /* Init to radius 1.0 */ -#ifdef DISCRETE_ISM_DTX_CNG st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; st_ivas->hIsmMetaData[ch]->last_true_elevation = 0; -#endif ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } @@ -707,9 +552,7 @@ ivas_error ivas_ism_metadata_dec_create( return error; } -#ifdef DISCRETE_ISM_DTX_CNG st_ivas->hISMDTX.ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; -#endif return IVAS_ERR_OK; } @@ -720,7 +563,6 @@ ivas_error ivas_ism_metadata_dec_create( * * Decoding of an angle *-------------------------------------------------------------------------*/ -#ifdef FIX_379_ANGLE static void decode_angle_indices( DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ @@ -861,149 +703,6 @@ static void decode_angle_indices( return; } -#else - -static void decode_angle_indices( - DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ - ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ - int16_t *flag_abs_azimuth /* o : Azimuth encoding mode */ -) -{ - int16_t idx_azimuth, nbits_diff_azimuth, diff, sgn; - int16_t idx_elevation, nbits_diff_elevation; - - /*----------------------------------------------------------------* - * Azimuth decoding and dequantization - *----------------------------------------------------------------*/ - - /* Decode azimuth index */ - if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ - { - idx_azimuth = get_next_indice( st0, ISM_AZIMUTH_NBITS ); - *flag_abs_azimuth = 1; - } - else - { - diff = 0; - sgn = 1; - - if ( get_next_indice( st0, 1 ) == 0 ) - { - nbits_diff_azimuth = 1; - } - else - { - nbits_diff_azimuth = 1; - - if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ - { - sgn = -1; - } - - nbits_diff_azimuth++; - - /* read until the stop bit */ - while ( ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice( st0, 1 ) == 1 ) ) - { - diff++; - nbits_diff_azimuth++; - } - - if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) - { - /* count stop bit */ - nbits_diff_azimuth++; - } - } - idx_azimuth = angle->last_azimuth_idx + sgn * diff; - } - - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ - } - else if ( idx_azimuth < 0 ) - { - idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ - } - - /* +180° == -180° */ - if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = 0; - } - - /* sanity check in case of FER or BER */ - if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = angle->last_azimuth_idx; - } - - /*----------------------------------------------------------------* - * Elevation decoding and dequantization - *----------------------------------------------------------------*/ - - /* Decode elevation index */ - if ( *flag_abs_azimuth == 0 && get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ - { - idx_elevation = get_next_indice( st0, ISM_ELEVATION_NBITS ); - } - else - { - diff = 0; - sgn = 1; - - if ( get_next_indice( st0, 1 ) == 0 ) - { - nbits_diff_elevation = 1; - } - else - { - nbits_diff_elevation = 1; - - if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ - { - sgn = -1; - } - - nbits_diff_elevation++; - - /* read until the stop bit */ - while ( ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) - { - diff++; - nbits_diff_elevation++; - } - - if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) - { - /* count stop bit */ - nbits_diff_elevation++; - } - } - - idx_elevation = angle->last_elevation_idx + sgn * diff; - } - - /* sanity check in case of FER or BER */ - if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) - { - idx_elevation = angle->last_elevation_idx; - } - - /*----------------------------------------------------------------* - * Final updates - *----------------------------------------------------------------*/ - - angle->last_azimuth_idx = idx_azimuth; - angle->last_elevation_idx = idx_elevation; - - return; -} - -#endif - /*------------------------------------------------------------------------- * decode_radius() @@ -1074,7 +773,6 @@ static int16_t decode_radius( } -#ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() * @@ -1221,24 +919,13 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef FIX_379_ANGLE hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#endif } else { -#ifdef FIX_379_ANGLE hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#else - hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); - -#endif } /* save for smoothing metadata evolution */ @@ -1260,4 +947,3 @@ void ivas_ism_metadata_sid_dec( return; } -#endif diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index f66323d8a4f038b0a054d6678302cc758603f7cd..244bf1f3987925f4b01f3876d3a578d598b9068f 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -51,10 +51,8 @@ static void ivas_param_ism_dec_dequant_DOA( DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ -#ifdef NCHAN_ISM_PARAMETER , const int16_t nchan_ism /* i : number of ISM channels */ -#endif ) { int16_t i; @@ -62,18 +60,10 @@ static void ivas_param_ism_dec_dequant_DOA( hParamIsm = hDirAC->hParamIsm; -#ifdef NCHAN_ISM_PARAMETER assert( nchan_ism <= MAX_NUM_OBJECTS ); -#else - assert( hParamIsm->num_obj <= MAX_NUM_OBJECTS ); -#endif /* Get the azimuth and elevation values */ -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 0; i < hParamIsm->num_obj; i++ ) -#endif { hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); @@ -169,9 +159,7 @@ static void ivas_ism_get_proto_matrix( static void ivas_param_ism_compute_mixing_matrix( -#ifdef NCHAN_ISM_PARAMETER - const int16_t nchan_ism, /* i : number of ISM channels */ -#endif + const int16_t nchan_ism, /* i : number of ISM channels */ DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -198,20 +186,12 @@ static void ivas_param_ism_compute_mixing_matrix( proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; -#ifdef NCHAN_ISM_PARAMETER assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); -#else - assert( ( hDirAC->hParamIsm->num_obj == 3 ) || ( hDirAC->hParamIsm->num_obj == 4 ) ); -#endif assert( nchan_transport == 2 ); if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { -#ifdef NCHAN_ISM_PARAMETER num_wave = nchan_ism; -#else - num_wave = hDirAC->hParamIsm->num_obj; -#endif } else { @@ -272,11 +252,7 @@ static void ivas_param_ism_compute_mixing_matrix( { if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { -#ifdef NCHAN_ISM_PARAMETER direct_power[w] = ( 1.0f / nchan_ism ) * ref_power; -#else - direct_power[w] = ( 1.0f / hDirAC->hParamIsm->num_obj ) * ref_power; -#endif } else { @@ -422,9 +398,6 @@ ivas_error ivas_param_ism_dec_open( IVAS_OUTPUT_SETUP hOutSetup; AUDIO_CONFIG output_config; int32_t output_Fs; -#ifndef NCHAN_ISM_PARAMETER - int16_t nchan_out; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -453,22 +426,8 @@ ivas_error ivas_param_ism_dec_open( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->nchan_ism ); -#else - nchan_out = st_ivas->hDecoderConfig->nchan_out; - - if ( output_config == AUDIO_CONFIG_EXTERNAL ) - { - hDirAC->hParamIsm->num_obj = nchan_out; - } - else - { - hDirAC->hParamIsm->num_obj = MAX_NUM_OBJECTS; - } - ivas_param_ism_config( hDirAC->hParamIsm ); -#endif /*-----------------------------------------------------------------* * set input parameters @@ -500,11 +459,7 @@ ivas_error ivas_param_ism_dec_open( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { /* nchan_out is essential for memory initialization for CLDFB Synthesis */ -#ifdef NCHAN_ISM_PARAMETER st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->nchan_ism; -#else - st_ivas->hIntSetup.nchan_out_woLFE = hDirAC->hParamIsm->num_obj; -#endif st_ivas->hIntSetup.is_loudspeaker_setup = 1; } @@ -875,11 +830,7 @@ void ivas_param_ism_dec( nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { -#ifdef NCHAN_ISM_PARAMETER nchan_out = st_ivas->nchan_ism; -#else - nchan_out = st_ivas->hDirAC->hParamIsm->num_obj; -#endif nchan_out_woLFE = nchan_out; st_ivas->hDecoderConfig->nchan_out = nchan_out; } @@ -899,11 +850,7 @@ void ivas_param_ism_dec( /* De-quantization */ if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); -#else - ivas_param_ism_dec_dequant_DOA( hDirAC ); -#endif ivas_param_ism_dec_dequant_powrat( hDirAC ); st_ivas->hISMDTX.dtx_flag = 0; } @@ -915,11 +862,7 @@ void ivas_param_ism_dec( /* obtain the direct response using EFAP */ if ( !( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) ) { -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < st_ivas->nchan_ism; i++ ) -#else - for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) -#endif { efap_determine_gains( st_ivas->hEFAPdata, direct_response[i], hDirAC->azimuth_values[i], hDirAC->elevation_values[i], EFAP_MODE_EFAP ); } @@ -928,11 +871,7 @@ void ivas_param_ism_dec( { int16_t j; -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < st_ivas->nchan_ism; i++ ) -#else - for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) -#endif { for ( j = 0; j < nchan_out_woLFE; j++ ) { @@ -981,11 +920,7 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); -#else - ivas_param_ism_compute_mixing_matrix( hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); -#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) @@ -1054,11 +989,7 @@ void ivas_param_ism_dec( ivas_param_ism_update_mixing_matrix( hDirAC, mixing_matrix, nchan_transport, nchan_out_woLFE ); /* store MetaData parameters */ -#ifdef NCHAN_ISM_PARAMETER for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) -#else - for ( ch = 0; ch < hDirAC->hParamIsm->num_obj; ch++ ) -#endif { if ( st_ivas->hDirAC->azimuth_values[ch] > 180.0f ) { @@ -1104,11 +1035,7 @@ void ivas_param_ism_params_to_masa_param_mapping( if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); -#else - ivas_param_ism_dec_dequant_DOA( hDirAC ); -#endif ivas_param_ism_dec_dequant_powrat( hDirAC ); st_ivas->hISMDTX.dtx_flag = 0; } @@ -1117,11 +1044,7 @@ void ivas_param_ism_params_to_masa_param_mapping( st_ivas->hISMDTX.dtx_flag = 1; } -#ifdef NCHAN_ISM_PARAMETER if ( st_ivas->nchan_ism > 1 ) -#else - if ( hDirAC->hParamIsm->num_obj > 1 ) -#endif { if ( st_ivas->hISMDTX.dtx_flag ) { @@ -1205,144 +1128,3 @@ void ivas_param_ism_params_to_masa_param_mapping( return; } - -#ifndef DISCRETE_ISM_DTX_CNG -static void ivas_param_ism_dec_dequantize_DOA_dtx( - int16_t azi_bits, - int16_t ele_bits, - int16_t azi_idx, - int16_t ele_idx, - float *azi_val, - float *ele_val ) -{ - int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha, tmp_alpha; - - /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ - nbits = min( azi_bits, ele_bits ); - - if ( nbits == ISM_ELEVATION_NBITS ) - { - angle_spacing = 5; - } - else - { - angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); - } - - npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); - - /* sanity check */ - if ( angle_spacing == 360 ) - { - assert( azi_idx == 0 ); - assert( ele_idx == 0 ); - - *azi_val = 0.f; - *ele_val = 0.f; - return; - } - - /* Get the azimuth and elevation values */ - ele_alpha = 2 * npoints - 1; - assert( ( 0 <= ele_idx ) && ( ele_idx < ele_alpha ) ); - *ele_val = (float) ( ( ele_idx - npoints ) * angle_spacing ); - - az_alpha = 4 * npoints - 1; - assert( ( 0 <= azi_idx ) && ( azi_idx < az_alpha ) ); - tmp_alpha = (int16_t) ( azi_idx * ( 360.f / az_alpha ) ); - - if ( tmp_alpha > 180.0f ) - { - *azi_val = ( (float) tmp_alpha ) - 360.0f; - } - else - { - *azi_val = (float) tmp_alpha; - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_param_ism_metadata_dtx_dec() - * - * - *-------------------------------------------------------------------------*/ - -void ivas_param_ism_metadata_dtx_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t azi_idx, ele_idx, i; - int16_t last_bit_pos, next_bit_pos_orig; - uint16_t bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; - DEC_CORE_HANDLE st0; - PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ - int16_t coh_idx; - - if ( st_ivas->hDecoderConfig->ivas_total_brate == FRAME_NO_DATA ) - { - return; - } - - st0 = st_ivas->hSCE[0]->hCoreCoder[0]; - hParamIsm = st_ivas->hDirAC->hParamIsm; - - last_bit_pos = (int16_t) ( ( st_ivas->hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); - bstr_orig = st0->bit_stream; - next_bit_pos_orig = st0->next_bit_pos; - st0->next_bit_pos = 0; - - /* reverse the bitstream for easier reading of indices */ - for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) - { - bstr_meta[i] = st0->bit_stream[last_bit_pos - i]; - } - st0->bit_stream = bstr_meta; - st0->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* needed for BER detection in get_next_indice() */ - - /* number of objects was already read in ivas_ism_get_dtx_dec() */ - /* update the position in the bitstream */ -#ifdef NCHAN_ISM_PARAMETER - st0->next_bit_pos += st_ivas->nchan_ism; -#else - st0->next_bit_pos += hParamIsm->num_obj; -#endif - - /* read sce id */ - st_ivas->hISMDTX.sce_id_dtx = get_next_indice( st0, 1 ); - - /* read the noisy speech flag */ - hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 ); - - /* decode the coherence */ - coh_idx = get_next_indice( st0, PARAM_ISM_DTX_COH_SCA_BITS ); - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( coh_idx ) / (float) ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ); - st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; - - /* get the DOA'S */ -#ifdef NCHAN_ISM_PARAMETER - for ( i = 0; i < st_ivas->nchan_ism; i++ ) -#else - for ( i = 0; i < hParamIsm->num_obj; i++ ) -#endif - { - /* read from bitstream and dequantize */ - azi_idx = get_next_indice( st0, PARAM_ISM_DTX_AZI_BITS ); - ele_idx = get_next_indice( st0, PARAM_ISM_DTX_ELE_BITS ); - - ivas_param_ism_dec_dequantize_DOA_dtx( PARAM_ISM_DTX_AZI_BITS, PARAM_ISM_DTX_ELE_BITS, azi_idx, ele_idx, &( st_ivas->hDirAC->azimuth_values[i] ), &( st_ivas->hDirAC->elevation_values[i] ) ); - } - - /* set the bitstream pointer to its original position */ - st0->bit_stream = bstr_orig; - st0->next_bit_pos = next_bit_pos_orig; - -#ifdef DEBUG_MODE_PARAM_ISM - dbgwrite( &( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence ), sizeof( float ), 1, 1, "./res/ParamISM_coh_dec.dat" ); -#endif - - return; -} -#endif diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index a5bdcc410046ad9acd629d86862610ac3b39714c..1e60143cb43e0249d3d146fbf6120be3de2d9656 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -111,11 +111,7 @@ void ivas_ism_render( int16_t azimuth, elevation; float Rmat[3][3]; -#ifdef NCHAN_ISM_PARAMETER nchan_ism = st_ivas->nchan_ism; -#else - nchan_ism = st_ivas->nchan_transport; -#endif nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; lfe_index = 0; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 3c7e490cbc1c18191c288d82d2f5eb6bef784878..9cadbcc4fc1b3464baeb49a21d7e1a8e2bcd1132 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -47,10 +47,8 @@ /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ -#define SPAR_META_DELAY_SUBFRAMES 2 /* Number of subframes to delay the SPAR metadata */ -#ifdef FIX_350_MASA_DELAY_COMP -#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ -#endif +#define SPAR_META_DELAY_SUBFRAMES 2 /* Number of subframes to delay the SPAR metadata */ +#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ /*-----------------------------------------------------------------------* * Local function prototypes @@ -60,9 +58,7 @@ static int16_t quantize_theta( float x, int16_t no_cb, float *xhat ); static uint16_t index_theta_phi_16( float theta, float phi, SPHERICAL_GRID_DATA *Sph_Grid16 ); static int16_t quantize_phi_masa( float phi, int16_t flag_delta, float *phi_hat, const int16_t n ); static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); -#ifdef FIX_350_MASA_DELAY_COMP static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const int16_t nchan_transport ); -#endif static void replicate_subframes( IVAS_QMETADATA_HANDLE hQMetaData ); @@ -308,12 +304,10 @@ ivas_error ivas_masa_decode( } } -#ifdef FIX_350_MASA_DELAY_COMP if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); } -#endif return error /* *nb_bits_read*/; } @@ -355,19 +349,15 @@ ivas_error ivas_masa_dec_open( } generate_gridEq( hMasa->data.sph_grid16 ); -#ifdef FIX_350_MASA_DELAY_COMP if ( ( hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } -#endif } else { hMasa->data.sph_grid16 = NULL; -#ifdef FIX_350_MASA_DELAY_COMP hMasa->data.extOutMeta = NULL; -#endif } if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -411,13 +401,11 @@ void ivas_masa_dec_close( hMasa->data.sph_grid16 = NULL; } -#ifdef FIX_350_MASA_DELAY_COMP if ( hMasa->data.extOutMeta != NULL ) { free( hMasa->data.extOutMeta ); hMasa->data.extOutMeta = NULL; } -#endif if ( hMasa->hMasaLfeSynth != NULL ) { @@ -501,7 +489,6 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); -#ifdef FIX_350_MASA_DELAY_COMP if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ @@ -511,9 +498,6 @@ static ivas_error ivas_masa_dec_config( { masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, NULL ); } -#else - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs ); -#endif return error; } @@ -1428,7 +1412,6 @@ static void compute_foa_cov_matrix( return; } -#ifdef FIX_350_MASA_DELAY_COMP static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, @@ -1560,4 +1543,3 @@ static void create_masa_ext_out_meta( return; } -#endif diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index d075bf61da999ff97a6a1b29b2b627b72780fa3d..0b375d40313ef21dcd72eb81c8e64159385d74b8 100755 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -76,11 +76,7 @@ ivas_error ivas_mcmasa_dec_reconfig( return error; } -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && st_ivas->hOutSetup.output_config == AUDIO_CONFIG_STEREO ); -#endif if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index 5222d39b6436c2c2e4ae3563eec0235a3fa968e6..6c5e6575a68a95f7771c605fdddc785335a3e4fc 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -70,11 +70,7 @@ void ivas_mct_side_bits( Decoder_State *st, *sts[MCT_MAX_CHANNELS]; nf_side_bits = 0; - nChannels = hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ; + nChannels = hMCT->nchan_out_woLFE; /*initializations */ for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ ) @@ -93,9 +89,6 @@ void ivas_mct_side_bits( { st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -123,9 +116,6 @@ void ivas_mct_side_bits( st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || -#endif st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { chBitRatios[ch] = 0; @@ -199,11 +189,7 @@ void ivas_mct_core_dec( * Initializations *--------------------------------------------------------------------------------*/ - nChannels = hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ; + nChannels = hMCT->nchan_out_woLFE; /*initializations */ for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ ) @@ -218,9 +204,6 @@ void ivas_mct_core_dec( for ( ch = 0, i = 0; ch < nChannels; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -251,9 +234,6 @@ void ivas_mct_core_dec( st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ { continue; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c old mode 100755 new mode 100644 index 4492968ad8e32902084ae90566a379fbfabf6ae1..1ad01239cb0aadb2976d61530feff1781c83c568 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -106,12 +106,6 @@ ivas_error ivas_mct_dec( } } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( !st_ivas->bfi ) - { - hMCT->LFE_off = 0; /* in case of PLC, stick to LFE_off of previous frame; otherwise, the update happens in ivas_mdct_dec_side_bits_frame_channel() */ - } -#endif for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -133,13 +127,8 @@ ivas_error ivas_mct_dec( if ( !st_ivas->bfi ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], &hMCT->LFE_off, nTnsBitsTCX10[cpe_id], param[cpe_id], 1, - ( ( cpe_id + 1 ) * CPE_CHANNELS > st_ivas->nchan_transport ) ); -#else ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, ( ( cpe_id + 1 ) * CPE_CHANNELS > hMCT->nchan_out_woLFE ) ); -#endif st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; @@ -163,12 +152,7 @@ ivas_error ivas_mct_dec( set_zero( x[n][1], L_FRAME48k / 2 ); } - ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id] -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - hMCT->LFE_off -#endif - , + ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); @@ -203,9 +187,6 @@ ivas_error ivas_mct_dec( } ivas_mdct_core_tns_ns( hCPE, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->LFE_off, -#endif fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); } @@ -242,9 +223,6 @@ ivas_error ivas_mct_dec( } ivas_mdct_core_reconstruct( hCPE, x, synth, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->LFE_off, -#endif fUseTns[cpe_id], 1 ); /*----------------------------------------------------------------* @@ -253,12 +231,6 @@ ivas_error ivas_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[n]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - break; - } -#endif if ( st_ivas->sba_dirac_stereo_flag ) { @@ -266,11 +238,7 @@ ivas_error ivas_mct_dec( } /* Postprocessing for ACELP/MDCT core switching and synchronization */ -#ifdef FIX_ISM_DTX_CLICKS if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -304,7 +272,6 @@ ivas_error ivas_mct_dec( } #endif } -#ifdef ISSUE_24_CLEANUP_MCT_LFE /* move channels after LFE to correct output for multi-channel MCT */ if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { @@ -320,7 +287,6 @@ ivas_error ivas_mct_dec( mvr2r( tmp, output[LFE_CHANNEL - 1], output_frame ); set_zero( output[LFE_CHANNEL], output_frame ); } -#endif #ifdef DEBUG_MODE_INFO for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) @@ -370,23 +336,6 @@ ivas_error create_mct_dec( *-----------------------------------------------------------------*/ /* Determine active channels */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) - { - hMCT->num_lfe = st_ivas->hTransSetup.num_lfe; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - hMCT->num_lfe; /* LFE channel is coded separately */ - } - else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - } - else if ( st_ivas->ivas_format == SBA_FORMAT ) - { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - } -#else if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = st_ivas->nchan_transport; @@ -395,7 +344,6 @@ ivas_error create_mct_dec( { hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; } -#endif else { assert( !"IVAS format currently not supported for MCT" ); @@ -409,20 +357,10 @@ ivas_error create_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) % + if ( ( hMCT->nchan_out_woLFE ) % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; @@ -503,23 +441,6 @@ ivas_error mct_dec_reconfigure( if ( b_nchan_change ) { /* Determine active channels */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) - { - hMCT->num_lfe = st_ivas->hTransSetup.num_lfe; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - hMCT->num_lfe; /* LFE channel is coded separately */ - } - else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - } - else if ( st_ivas->ivas_format == SBA_FORMAT ) - { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - } -#else if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = st_ivas->nchan_transport; @@ -528,7 +449,6 @@ ivas_error mct_dec_reconfigure( { hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; } -#endif else { assert( !"IVAS format currently not supported for MCT" ); @@ -541,21 +461,11 @@ ivas_error mct_dec_reconfigure( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) % + if ( ( hMCT->nchan_out_woLFE ) % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; @@ -574,18 +484,10 @@ ivas_error mct_dec_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; if ( !( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || -#endif ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); if ( st->igf ) { IGFDecSetMode( st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag ); @@ -796,11 +698,7 @@ static ivas_error ivas_mc_dec_reconfig( { nchan_hp20_old = nchan_transport_old; } -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = 0; /* needs to be after getNumChanSynthesis() */ -#endif /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; @@ -980,24 +878,8 @@ static ivas_error ivas_mc_dec_reconfig( } } - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); - } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) - { -#ifdef DEBUGGING - assert( st_ivas->hCPE[1] != NULL ); -#endif - st = st_ivas->hCPE[1]->hCoreCoder[1]; - st->mct_chan_mode = MCT_CHAN_MODE_LFE; - st->hTcxCfg->fIsTNSAllowed = 0; + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode ); } -#endif if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { uint8_t separateChannelEnabled; @@ -1080,11 +962,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /* reuse core-coder buffers for LFE decoder */ - st_ivas->hLFE->prevsynth_buf = &st_ivas->hCPE[1]->hCoreCoder[1]->old_synth_sw[0]; - st_ivas->hLFE->prior_out_buffer = &st_ivas->hCPE[1]->hCoreCoder[1]->previoussynth[0]; -#endif set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); diff --git a/lib_dec/ivas_mct_dec_mct.c b/lib_dec/ivas_mct_dec_mct.c index 68a846b876dea6667e43abe6365e0dfc60e4498b..987a9cc72f25a60b4e820972aeb8ae6c4fcb4b8e 100644 --- a/lib_dec/ivas_mct_dec_mct.c +++ b/lib_dec/ivas_mct_dec_mct.c @@ -49,12 +49,7 @@ static void indexToChannelPair( MCT_DEC_BLOCK_DATA_HANDLE hBlock, const int16_t nChannels, - const int16_t pairIdx -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - Decoder_State **sts /* i/o: decoder state structure */ -#endif -) + const int16_t pairIdx ) { int16_t ch1, ch2; int16_t tmpIdx = 0; @@ -63,12 +58,6 @@ static void indexToChannelPair( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[ch1]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch2]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - continue; - } -#endif if ( tmpIdx == pairIdx ) { @@ -111,9 +100,6 @@ void ivas_mct_dec_mct( for ( ch = 0; ch < nchan; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && -#endif hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { hMCT->mc_global_ild[ch] = get_next_indice( sts[0], SMDCT_GLOBAL_ILD_BITS ); @@ -129,9 +115,6 @@ void ivas_mct_dec_mct( for ( ch = 0; ch < nchan; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && -#endif sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { hMCT->lowE_ch[ch] = get_next_indice( sts[0], 1 ); @@ -142,9 +125,6 @@ void ivas_mct_dec_mct( for ( ch = 0; ch < nchan; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && -#endif sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nchan_active++; @@ -158,12 +138,7 @@ void ivas_mct_dec_mct( /*get channel pair index from BS*/ channelPairIndex = get_next_indice( sts[0], hMCT->bitsChannelPairIndex ); - indexToChannelPair( hBlock, nchan, channelPairIndex -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - sts -#endif - ); + indexToChannelPair( hBlock, nchan, channelPairIndex ); /*point to decoder states of actual channels to read block pair bits*/ p_st[0] = sts[hBlock->ch1]; @@ -192,11 +167,7 @@ static void applyGlobalILD( int16_t nSubframes, L_subframeTCX; float qratio; - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); ch++ ) { nSubframes = ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV; @@ -279,11 +250,7 @@ void mctStereoIGF_dec( float *p_x[CPE_CHANNELS][NB_DIV]; int16_t singleChEle[MCT_MAX_CHANNELS]; - set_s( singleChEle, 1, ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) ); + set_s( singleChEle, 1, ( hMCT->nchan_out_woLFE ) ); for ( b = 0; b < hMCT->currBlockDataCnt; b++ ) { @@ -336,17 +303,9 @@ void mctStereoIGF_dec( } - if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) ) != 0 ) + if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 ) { - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); ch++ ) { if ( singleChEle[ch] ) @@ -356,11 +315,7 @@ void mctStereoIGF_dec( { continue; } - if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || st->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 83aac5cbc1a915310f4603de74638960595879be..4c1611e6e6208ece77560c45efed5b27fa535d05 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -162,26 +162,11 @@ static void dec_prm_tcx_sidebits( getTCXWindowing( st->core, st->last_core, st->element_mode, st->hTcxCfg, st0 ); st->hTcxDec->kernel_type[0] = st->hTcxDec->kernel_type[1] = MDCT_IV; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->element_mode == IVAS_CPE_MDCT && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - st->hTcxDec->kernel_type[0] = get_next_indice( st0, st->last_core_from_bs != ACELP_CORE ? 2 : 1 ); - if ( st->core == TCX_10_CORE ) - { - st->hTcxDec->kernel_type[1] = 2 * ( st->hTcxDec->kernel_type[0] & 1 ) + get_next_indice( st0, 1 ); - } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } - - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + st->hTcxDec->kernel_type[0] = get_next_indice( st0, st->last_core_from_bs != ACELP_CORE ? 2 : 1 ); + if ( st->core == TCX_10_CORE ) { - st->hTcxCfg->tcx_curr_overlap_mode = FULL_OVERLAP; - st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; - st->hTcxCfg->last_aldo = 0; + st->hTcxDec->kernel_type[1] = 2 * ( st->hTcxDec->kernel_type[0] & 1 ) + get_next_indice( st0, 1 ); } -#endif if ( st->core == TCX_20_CORE ) { st->transform_type[0] = st->transform_type[1] = TCX_20; @@ -298,13 +283,10 @@ static void dec_prm_tcx_spec( *-----------------------------------------------------------------*/ void ivas_mdct_dec_side_bits_frame_channel( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ - Decoder_State *st0, /* i : pointer to bitstream handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t *LFE_off, /* o : flag if LFE has content */ -#endif + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ + Decoder_State *st0, /* i : pointer to bitstream handle */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ @@ -346,14 +328,7 @@ void ivas_mdct_dec_side_bits_frame_channel( continue; } st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - *LFE_off = get_next_indice( st0, 1 ); - } - else -#endif - if ( MCT_flag ) + if ( MCT_flag ) { tmp = get_next_indice( st0, 1 ); if ( tmp ) @@ -371,11 +346,7 @@ void ivas_mdct_dec_side_bits_frame_channel( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && *LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { sts[ch]->coder_type = INACTIVE; sts[ch]->side_bits_frame_channel = 0; @@ -403,11 +374,7 @@ void ivas_mdct_dec_side_bits_frame_channel( { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && *LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { skipped_first_channel = 1; continue; @@ -421,11 +388,7 @@ void ivas_mdct_dec_side_bits_frame_channel( param_lpc[0][0] = get_next_indice( st0, 1 ) << 1; /* read low br mode flag (if it is possible to be non-zero) */ - if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) ) + if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) { sns_low_br_mode = get_next_indice( st0, 1 ); } @@ -454,10 +417,7 @@ void ivas_mdct_dec_side_bits_frame_channel( *-----------------------------------------------------------------*/ void ivas_mdct_core_invQ( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE content */ -#endif + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ @@ -544,11 +504,7 @@ void ivas_mdct_core_invQ( { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { st->total_brate = st->bits_frame_channel; continue; @@ -602,13 +558,6 @@ void ivas_mdct_core_invQ( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ st->core = GetPLCModeDecision( st ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /*disable ACELP_PLC for LFE channel */ - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - st->core = st->last_core; - } -#endif } if ( ( !st->bfi || st->hTcxCfg->psychParamsCurrent == NULL ) && st->core > ACELP_CORE ) @@ -698,11 +647,7 @@ void ivas_mdct_core_invQ( { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { set_f( x[ch][0], 0.f, st->hTcxCfg->tcx_coded_lines ); /* usually set in decoder_tcx_invQ(), needed for concealment */ @@ -758,13 +703,6 @@ void ivas_mdct_core_invQ( decoder_tcx_noiseshaping_igf( st, L_spec[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x[ch][k], NULL, &tmp_concealment_method, bfi ); } } - -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) /*indicates LFE with no content*/ - { - set_f( &x[ch][0][MCT_LFE_MAX_LINE], 0.f, st->hTcxCfg->tcx_coded_lines - MCT_LFE_MAX_LINE ); - } -#endif } pop_wmops(); @@ -782,11 +720,8 @@ void ivas_mdct_core_reconstruct( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[][NB_DIV], /* i/o: synthesis @internal_FS */ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE content */ -#endif - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ) { int16_t ch, k, bfi; @@ -808,9 +743,6 @@ void ivas_mdct_core_reconstruct( int16_t pitch[CPE_CHANNELS][NB_SUBFR16k]; float pit_gain[CPE_CHANNELS][NB_SUBFR16k]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t isLFE; -#endif int16_t skip_decoding; set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); @@ -825,21 +757,10 @@ void ivas_mdct_core_reconstruct( st = sts[ch]; skip_decoding = 0; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { skip_decoding = 1; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - isLFE = 0; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - isLFE = 1; - } -#endif nSubframes[ch] = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; synth = synth_buf + st->hTcxDec->old_synth_len; @@ -866,9 +787,6 @@ void ivas_mdct_core_reconstruct( tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], &x[ch][k][0], xn_buf, ( ( hCPE->nchan_out == 1 && st->hTcxDec->kernel_type[k] == MDST_IV ) || st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ? MDCT_IV : st->hTcxDec->kernel_type[k], fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - isLFE, -#endif 0 ); } else @@ -1015,10 +933,7 @@ void ivas_mdct_core_reconstruct( *-----------------------------------------------------------------*/ void ivas_mdct_core_tns_ns( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE has content */ -#endif + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ @@ -1056,9 +971,6 @@ void ivas_mdct_core_tns_ns( L_spec[ch] = st->hTcxCfg->tcx_coded_lines / nSubframes[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || -#endif ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */ { if ( st->hTonalMDCTConc != NULL ) diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index b396fa415cd01ad0317602d5a58df9ce417d48b0..2fb04af8d78f3dda0f1b974a1215b51c46f4bebf 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -601,11 +601,7 @@ void ivas_ls_setup_conversion_process_mdct( dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && -#else chInIdx != LFE_CHANNEL && -#endif mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { /* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */ @@ -700,11 +696,7 @@ void ivas_ls_setup_conversion_process_mdct( for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && -#else chInIdx != LFE_CHANNEL && -#endif mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { if ( transform_type[chInIdx][0] == TCX_20 ) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index c005e95fab2c9df62ad9364af84a10d9c1c45e21..ff73e6aa49d76ad1ebc592efb99a47e3b0afaf15 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -303,11 +303,7 @@ void ivas_renderer_select( *renderer_type = RENDERER_DIRAC; if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && -#ifdef SBA2MONO ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) -#else - ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM ) ) -#endif { if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) { @@ -324,11 +320,7 @@ void ivas_renderer_select( st_ivas->renderer_type = RENDERER_SBA_LINEAR_DEC; } else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) || -#ifdef SBA2MONO ( st_ivas->ivas_format == SBA_FORMAT && ( output_config == AUDIO_CONFIG_STEREO || output_config == AUDIO_CONFIG_MONO ) ) ) -#else - ( st_ivas->ivas_format == SBA_FORMAT && output_config == AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 1 ) ) -#endif { *renderer_type = RENDERER_DISABLE; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5377ad9402f4e5362be22a3aaed0a35bcd1bcbc8..af7281a5786c4d7f1aaeb301e61fefbcd2d43544 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -47,7 +47,6 @@ #include "wmc_auto.h" -#ifdef FIX_386_CORECODER_RECONFIG /*-------------------------------------------------------------------* * ivas_sba_set_cna_cng_flag() * @@ -93,7 +92,6 @@ void ivas_sba_set_cna_cng_flag( return; } -#endif /*-------------------------------------------------------------------* @@ -132,20 +130,7 @@ ivas_error ivas_sba_dec_reconfigure( *-----------------------------------------------------------------*/ ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); -#ifndef SBA_HPF_TUNING_DEC nchan_hp20_old = getNumChanSynthesis( st_ivas ); -#else - int16_t analysis_order_old; - analysis_order_old = ivas_sba_get_analysis_order( last_ivas_total_brate, st_ivas->sba_order ); - if ( analysis_order_old > 1 ) - { - nchan_hp20_old = 0; - } - else - { - nchan_hp20_old = st_ivas->nchan_transport; - } -#endif nSCE_old = st_ivas->nSCE; nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; @@ -167,11 +152,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); -#endif } else { @@ -210,11 +191,7 @@ ivas_error ivas_sba_dec_reconfigure( } hSpar = st_ivas->hSpar; -#ifdef SBA2MONO st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#else - st_ivas->sba_dirac_stereo_flag = 0; -#endif } if ( st_ivas->nchan_transport == 1 ) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 82ccaceea92e266ab569af6a080a9cb4cebebf76..644a3dc5233175d009837eea080d2da63cd1bc50 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -45,7 +45,6 @@ #include "wmc_auto.h" -#ifdef SBA2MONO /*-------------------------------------------------------------------* * ivas_get_sba_dirac_stereo_flag() * @@ -82,7 +81,6 @@ int16_t ivas_get_sba_dirac_stereo_flag( return sba_dirac_stereo_flag; } -#endif /*-------------------------------------------------------------------* @@ -493,22 +491,17 @@ static void ivas_sba_dirac_stereo_upmix_hb( float hb_gain[NB_DIV], /* i : side gains for HB signal */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t mcmasa, /* i : McMASA flag */ -#ifdef SBA2MONO - const int16_t sba_mono_flag, /* i : flag for mono output */ - const int16_t bwidth, /* i : bandwidth of signal */ -#endif - const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ + const int16_t sba_mono_flag, /* i : flag for mono output */ + const int16_t bwidth, /* i : bandwidth of signal */ + const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ ) { int16_t i; -#ifdef SBA2MONO float gp, gm; float gain_fac; -#endif if ( !mcmasa ) { -#ifdef SBA2MONO gain_fac = ( bwidth == FB ) ? 0.25f : 0.33f; /* last matrix element not used for SWB, divide by 3 instead of 4*/ if ( sba_mono_flag ) { @@ -579,38 +572,6 @@ static void ivas_sba_dirac_stereo_upmix_hb( hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * gain_fac * gm; } } -#else - for ( i = 0; i < output_frame / 2; i++ ) - { - float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; - - float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; - - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; - } - for ( i = output_frame / 2; i < output_frame; i++ ) - { - float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; - - float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; - - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; - } -#endif } else { @@ -853,9 +814,7 @@ void ivas_sba_dirac_stereo_dec( ) { int16_t dtx_flag, fd_cng_flag; -#ifdef SBA2MONO int16_t sba_mono_flag; -#endif int16_t memOffset; float tmp_buf[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float tmp_synth[L_FRAME16k]; @@ -880,9 +839,7 @@ void ivas_sba_dirac_stereo_dec( dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); } -#ifdef SBA2MONO sba_mono_flag = ( st_ivas->hDecoderConfig->nchan_out == 1 ) ? 1 : 0; -#endif memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); @@ -921,39 +878,26 @@ void ivas_sba_dirac_stereo_dec( } /* DFT Stereo upmix */ -#ifdef SBA2MONO stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, -#else - stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1, /*st_ivas->sba_dirac_stereo_flag*/ -#endif ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : 0, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); -#ifdef SBA2MONO if ( !sba_mono_flag ) { stereo_dft_dec_synthesize( hCPE, DFT, 1, output[1], output_frame ); } -#else - stereo_dft_dec_synthesize( hCPE, DFT, 1, output[1], output_frame ); -#endif synchro_synthesis( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); /* output scaling */ -#ifdef SBA2MONO if ( !sba_mono_flag ) { v_multc( output[0], 0.5f, output[0], output_frame ); v_multc( output[1], 0.5f, output[1], output_frame ); } -#else - v_multc( output[0], 0.5f, output[0], output_frame ); - v_multc( output[1], 0.5f, output[1], output_frame ); -#endif /* delay HB synth */ if ( st_ivas->nchan_transport == 1 ) @@ -970,26 +914,18 @@ void ivas_sba_dirac_stereo_dec( ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, -#ifdef SBA2MONO ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); -#else - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), hStereoDft ); -#endif /* add HB to ACELP core */ v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); -#ifdef SBA2MONO if ( !sba_mono_flag ) { -#endif v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); /* apply TD Stereo Filling as is done in ICBWE */ ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); -#ifdef SBA2MONO } -#endif } return; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 064cdbb4e093afee49f03aec8b479615008039f5..ed172f414110d0d9bff9eda0521cd0b2b673ffef 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -77,11 +77,7 @@ ivas_error ivas_sce_dec( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; -#ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ivas_format == ISM_FORMAT ) -#else - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) -#endif { st->cng_type = FD_CNG; } @@ -100,21 +96,10 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } -#ifdef DISCRETE_ISM_DTX_CNG else if ( !st_ivas->bfi && st_ivas->ivas_format != ISM_FORMAT && last_ivas_total_brate <= IVAS_SID_5k2 ) { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } -#else - else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_5k2 ) ) - { - /* check if this is indeed needed? */ - if ( st_ivas->ivas_format != ISM_FORMAT ) - { - st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; - } - } -#endif /* read the bandwidth */ if ( st_ivas->bfi || st->total_brate <= SID_2k40 ) @@ -365,11 +350,7 @@ ivas_error create_sce_dec( return error; } -#ifdef SBA2MONO if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) ) -#else - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) -#endif { if ( ( error = openCldfb( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 8c27a09baf05bb2de82c968601beaceab2f45e17..4a17c75dda9f42d5fffbded309972d8817f92ff6 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -391,9 +391,7 @@ typedef struct int16_t dtx_flag; int16_t sce_id_dtx; -#ifdef DISCRETE_ISM_DTX_CNG int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ -#endif } ISM_DTX_DATA_DEC; @@ -953,14 +951,8 @@ typedef struct mct_dec_data_structure MCT_DEC_BLOCK_DATA_HANDLE hBlockData[MCT_MAX_BLOCKS]; int16_t chBitRatios[MCT_MAX_CHANNELS]; - int16_t lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t LFE_off; -#endif + int16_t lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ uint16_t mc_global_ild[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t num_lfe; -#endif } MCT_DEC_DATA, *MCT_DEC_HANDLE; @@ -976,15 +968,9 @@ typedef struct ivas_lfe_dec_data_structure int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; float lfe_block_delay_s; int16_t lfe_prior_buf_len; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - float *prior_out_buffer; - - float *prevsynth_buf; -#else float prior_out_buffer[L_FRAME48k]; float prevsynth_buf[LFE_PLC_BUFLEN]; -#endif float *lfe_delay_buf; int16_t lfe_addl_delay; int16_t bfi_count; @@ -1108,7 +1094,6 @@ typedef struct ivas_mcmasa_lfe_synth_struct } MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; -#ifdef FIX_350_MASA_DELAY_COMP typedef struct ivas_masa_decoder_ext_out_meta_struct { MASA_DECRIPTIVE_META descriptiveMeta; @@ -1121,16 +1106,13 @@ typedef struct ivas_masa_decoder_ext_out_meta_struct uint8_t diffuseToTotalRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; } MASA_DECODER_EXT_OUT_META; -#endif typedef struct ivas_masa_decoder_data_struct { int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; SPHERICAL_GRID_DATA *sph_grid16; -#ifdef FIX_350_MASA_DELAY_COMP MASA_DECODER_EXT_OUT_META *extOutMeta; -#endif float dir_decode_quality; } MASA_DECODER_DATA; @@ -1224,9 +1206,7 @@ typedef struct Decoder_Struct LFE_DEC_HANDLE hLFE; /* LFE handle */ ISM_MODE ism_mode; /* ISM format mode */ -#ifdef NCHAN_ISM_PARAMETER int16_t nchan_ism; /* number of ISM channels */ -#endif SBA_MODE sba_mode; /* SBA format mode */ MC_MODE mc_mode; /* MC format mode */ int16_t sba_order; /* Ambisonic (SBA) order */ @@ -1261,10 +1241,8 @@ typedef struct Decoder_Struct int32_t noClipping; /* number of clipped samples */ #endif int32_t last_active_ivas_total_brate; -#ifdef FIX_379_EXT_METADATA int16_t ism_extmeta_active; /* Extended metadata active in decoder */ int16_t ism_extmeta_cnt; /* Change frame counter for extended metadata */ -#endif } Decoder_Struct; diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 769f6016b487b16c2f1824ad302af50b9a6136ee..1fac575de9ca52f830685283633792f0785bea37 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1126,13 +1126,11 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ -#ifdef SBA2MONO - const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ -#endif - ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ - const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ - const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t nchan_transport /* i : number of transpor channels */ + const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ + ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs, /* i : Fs for delay calculation */ + const int16_t nchan_transport /* i : number of transpor channels */ ) { int16_t i, k, b, N_div, stop; @@ -1413,7 +1411,6 @@ void stereo_dft_dec( if ( nchan_transport == 1 ) { -#ifdef SBA2MONO if ( sba_mono_flag ) { if ( b == 0 ) @@ -1451,7 +1448,6 @@ void stereo_dft_dec( } else { -#endif if ( b == 0 ) { i = 0; @@ -1496,9 +1492,7 @@ void stereo_dft_dec( DFT_L[2 * i + 1] = DFT_W + DFT_Y; DFT_R[2 * i + 1] = DFT_W - DFT_Y; } -#ifdef SBA2MONO } -#endif } else if ( nchan_transport >= 2 ) { diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index ab8844c8e895bef1a7d5fe025b9e245b6cdee640..cbeaf2a1e516f0b4d2473fd8f8ca1ff406dd2c2c 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -222,9 +222,6 @@ void stereo_mdct_core_dec( if ( !bfi ) { ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], -#ifndef ISSUE_24_CLEANUP_MCT_LFE - NULL, -#endif nTnsBitsTCX10, param, 0, 0 ); if ( sts[0]->igf ) @@ -257,9 +254,6 @@ void stereo_mdct_core_dec( } ivas_mdct_core_invQ( hCPE, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - 0, -#endif nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); for ( ch = 0; ch < nChannels; ch++ ) @@ -354,9 +348,6 @@ void stereo_mdct_core_dec( } ivas_mdct_core_tns_ns( hCPE, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - 0, -#endif fUseTns, tnsData, x, Aq, 0 ); if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) @@ -372,9 +363,6 @@ void stereo_mdct_core_dec( } ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - 0, -#endif fUseTns, 0 ); mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 144f7950e976bf44af0a64acd3b43dd84ea68b74..0a436ec0d28eec23fc6ba6d080122ca92bbbed81 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -969,13 +969,6 @@ ivas_error stereo_memory_dec( for ( i = 0; i < CPE_CHANNELS; ++i ) { deleteFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /* deallocate CLDFB synthesis for LFE channel */ - if ( hCPE->hCoreCoder[i]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - deleteCldfb( &hCPE->hCoreCoder[i]->cldfbSyn ); - } -#endif } } else diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index b5dcfd2bbede473d6a2ee5b8e5bbf6742162a994..ab82fb4e07653b0d0900c75137aecd588738b608 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -95,25 +95,12 @@ void stereo_tcx_init_dec( st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag ); st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag, st->element_mode ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - !MCT_flag && -#endif st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } if ( hTcxLtpDec != NULL ) { @@ -176,10 +163,6 @@ void stereo_tcx_core_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ const int16_t nchan_out, /* i : number of output channels */ const IVAS_FORMAT ivas_format /* i : IVAS format */ -#ifndef DISCRETE_ISM_DTX_CNG - , - const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM)*/ -#endif ) { int16_t i, k; @@ -743,11 +726,7 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { -#ifndef DISCRETE_ISM_DTX_CNG - if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM ) -#else if ( ivas_format == ISM_FORMAT ) -#endif { float buffer[L_FRAME16k]; lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 6f385c5066552618edf44184581e03968c53ba42..ee315bf399d5b22f8ed7716a4d41e6fbe988cdec 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -825,17 +825,11 @@ ivas_error IVAS_DEC_GetObjectMetadata( { metadata->azimuth = 0.f; metadata->elevation = 0.f; -#ifdef FIX_379_EXT_METADATA metadata->radius = 1.f; metadata->spread = 0.f; metadata->gainFactor = 1.f; metadata->yaw = 0.f; metadata->pitch = 0.f; -#else - metadata->radius = 0.f; - metadata->spread = 0.f; - metadata->gainFactor = 1.f; -#endif } else { @@ -859,12 +853,8 @@ ivas_error IVAS_DEC_GetObjectMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef FIX_350_MASA_DELAY_COMP + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ -#else - IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ -#endif ) { if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -877,11 +867,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_WRONG_MODE; } -#ifdef FIX_350_MASA_DELAY_COMP *hMasaExtOutMeta = hIvasDec->st_ivas->hMasa->data.extOutMeta; -#else - *hMasaMetadata = hIvasDec->st_ivas->hQMetaData; -#endif return IVAS_ERR_OK; } @@ -895,11 +881,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ -#ifdef FIX_406_IVAS_POSITION - IVAS_VECTOR3 *Pos /* i : listener position */ -#else - IVAS_POSITION *Pos /* i : listener position */ -#endif + IVAS_VECTOR3 *Pos /* i : listener position */ ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 5fe89ad2d716781680b1467bc2bfe026e01f2a19..17af564295cca7d3e47b3affc9f5df7ec90d6fa4 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -166,22 +166,14 @@ ivas_error IVAS_DEC_GetObjectMetadata( /*! r: error code */ ivas_error IVAS_DEC_GetMasaMetadata( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef FIX_350_MASA_DELAY_COMP MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ -#else - IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ -#endif ); /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION *orientation, /* i : head-tracking data */ -#ifdef FIX_406_IVAS_POSITION IVAS_VECTOR3 *Pos /* i : listener position */ -#else - IVAS_POSITION *Pos /* i : listener position */ -#endif ); /*! r: error code */ diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 1a82d45587c8cd0ff656a4342d75b2a54735e592..7331693ad72faf4b1862b5066d0cae282af78535 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1347,9 +1347,7 @@ typedef struct Decoder_State int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ -#ifdef DISCRETE_ISM_DTX_CNG int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ -#endif } Decoder_State, *DEC_CORE_HANDLE; diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 81fa9fdf90606dad00025db95b6214a257b1259c..041e3a3d2fa493f5b9d66325cfc9baad7e59ef1a 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -386,24 +386,14 @@ static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const char type, const float *timeSignal, - float *mdxtOutput -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe -#endif -) + float *mdxtOutput ) { float windowedTimeSignal[L_FRAME_PLUS + 2 * L_MDCT_OVLP_MAX]; int16_t left_overlap, right_overlap; int16_t L_frame; L_frame = hTonalMDCTConc->nSamples; - WindowSignal( hTonalMDCTConc->tcx_cfg, hTonalMDCTConc->tcx_cfg->tcx_offsetFB, FULL_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, timeSignal, &L_frame, windowedTimeSignal, 1, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - isLfe -#endif - ); + WindowSignal( hTonalMDCTConc->tcx_cfg, hTonalMDCTConc->tcx_cfg->tcx_offsetFB, FULL_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, timeSignal, &L_frame, windowedTimeSignal, 1, 1 ); if ( type == 'S' ) { @@ -422,12 +412,7 @@ void TonalMDCTConceal_Detect( const TonalMDCTConcealPtr hTonalMDCTConc, const float pitchLag, int16_t *numIndices, - const PsychoacousticParameters *psychParamsCurrent -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - const int16_t isLfe -#endif -) + const PsychoacousticParameters *psychParamsCurrent ) { float secondLastMDST[L_FRAME_MAX]; /* 32 bits are required */ float secondLastMDCT[L_FRAME_MAX]; /* 32 bits are required */ @@ -444,18 +429,8 @@ void TonalMDCTConceal_Detect( { if ( !hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) { - CalcMDXT( hTonalMDCTConc, 'S', hTonalMDCTConc->secondLastPcmOut, secondLastMDST -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - isLfe -#endif - ); - CalcMDXT( hTonalMDCTConc, 'C', hTonalMDCTConc->secondLastPcmOut, secondLastMDCT -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - isLfe -#endif - ); + CalcMDXT( hTonalMDCTConc, 'S', hTonalMDCTConc->secondLastPcmOut, secondLastMDST ); + CalcMDXT( hTonalMDCTConc, 'C', hTonalMDCTConc->secondLastPcmOut, secondLastMDCT ); hTonalMDCTConc->nNonZeroSamples = 0; for ( i = 0; i < hTonalMDCTConc->nSamples; i++ ) { diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c old mode 100755 new mode 100644 index 88b3faa5d6c16ffafa834706a7631fd915cf44fa..c0c0b4f18e51df211b71704c96ec4d4c6772a236 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -342,12 +342,8 @@ void amr_wb_enc( * WB, SWB and FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect( st, st->input, NULL, NULL -#ifdef FIX_MDCT_BASED_BWD - , - 0 -#endif - ); + bw_detect( st, st->input, NULL, NULL, + 0 ); /* 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 old mode 100755 new mode 100644 index 810527e0ef2b6aab7f373d4fa5edbe02795c153a..6de35a211a50ba5e2461bb2f42041346828d5e30 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -55,11 +55,9 @@ #define ALPHA_BWD 0.75f #define BWD_LT_THRESH 0.6f -#define BWD_COUNT_MAX 100 -#define BWD_COUNT_WIDER_BW 10 -#ifdef FIX_MDCT_BASED_BWD +#define BWD_COUNT_MAX 100 +#define BWD_COUNT_WIDER_BW 10 #define BWD_COUNT_WIDER_BW_MDCT 0 -#endif #define CLDFB_ENER_OFFSET 1.6f @@ -74,10 +72,8 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ -#ifdef FIX_MDCT_BASED_BWD , const int16_t mct_on /* i : flag MCT mode */ -#endif ) { int16_t i, j, k, bw_max, bin_width, n_bins; @@ -87,7 +83,6 @@ void bw_detect( const float *pt, *pt1; float max_NB, max_WB, max_SWB, max_FB, mean_NB, mean_WB, mean_SWB, mean_FB; int16_t cldfb_bin_width = 4; -#ifdef FIX_MDCT_BASED_BWD int16_t bwd_count_wider_bw, l_frame; bwd_count_wider_bw = BWD_COUNT_WIDER_BW; @@ -95,7 +90,6 @@ void bw_detect( { bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; } -#endif if ( st->input_Fs > 8000 ) { @@ -189,10 +183,6 @@ void bw_detect( } else { -#ifndef FIX_MDCT_BASED_BWD - bin_width *= (int16_t) ( ( st->input_Fs / FRAMES_PER_SEC ) / BWD_TOTAL_WIDTH ); - mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / FRAMES_PER_SEC ) ); -#else l_frame = (int16_t) ( st->input_Fs / FRAMES_PER_SEC ); if ( st->core == TCX_10_CORE ) { @@ -201,7 +191,6 @@ void bw_detect( bin_width *= ( l_frame / BWD_TOTAL_WIDTH ); mvr2r( spectrum, spect, l_frame ); -#endif } /*---------------------------------------------------------------------* * compute energy per spectral bins @@ -419,29 +408,17 @@ void bw_detect( /* switching to a higher BW */ if ( st->last_input_bwidth == NB ) { -#ifdef FIX_MDCT_BASED_BWD if ( st->count_WB > bwd_count_wider_bw ) -#else - if ( st->count_WB > BWD_COUNT_WIDER_BW ) -#endif { st->input_bwidth = WB; st->count_WB = BWD_COUNT_MAX; -#ifdef FIX_MDCT_BASED_BWD if ( st->count_SWB > bwd_count_wider_bw ) -#else - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) -#endif { st->input_bwidth = SWB; st->count_SWB = BWD_COUNT_MAX; -#ifdef FIX_MDCT_BASED_BWD if ( st->count_FB > bwd_count_wider_bw ) -#else - if ( st->count_FB > BWD_COUNT_WIDER_BW ) -#endif { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; @@ -452,20 +429,12 @@ void bw_detect( if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) { -#ifdef FIX_MDCT_BASED_BWD if ( st->count_SWB > bwd_count_wider_bw ) -#else - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) -#endif { st->input_bwidth = SWB; st->count_SWB = BWD_COUNT_MAX; -#ifdef FIX_MDCT_BASED_BWD if ( st->count_FB > bwd_count_wider_bw ) -#else - if ( st->count_FB > BWD_COUNT_WIDER_BW ) -#endif { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; @@ -475,11 +444,7 @@ void bw_detect( if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) { -#ifdef FIX_MDCT_BASED_BWD if ( st->count_FB > bwd_count_wider_bw ) -#else - if ( st->count_FB > BWD_COUNT_WIDER_BW ) -#endif { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; @@ -671,28 +636,6 @@ void set_bw_stereo( if ( hCPE->element_mode == IVAS_CPE_MDCT ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - /* do not check bandwidth in LFE channel */ - if ( sts[0]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - sts[0]->bwidth = sts[0]->input_bwidth; - } - else if ( sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - sts[1]->bwidth = sts[1]->input_bwidth; - } - /* ensure that both CPE channels have the same audio band-width */ - else if ( sts[0]->input_bwidth == sts[1]->input_bwidth ) - { - sts[0]->bwidth = sts[0]->input_bwidth; - sts[1]->bwidth = sts[0]->input_bwidth; - } - else if ( sts[0]->input_bwidth != sts[1]->input_bwidth ) - { - sts[0]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); - sts[1]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); - } -#else /* ensure that both CPE channels have the same audio band-width */ if ( sts[0]->input_bwidth == sts[1]->input_bwidth ) { @@ -704,7 +647,6 @@ void set_bw_stereo( sts[0]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); sts[1]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); } -#endif } sts[0]->bwidth = max( sts[0]->bwidth, WB ); @@ -738,9 +680,6 @@ int16_t set_bw_mct( { st = hCPE[cpe_id]->hCoreCoder[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index ee948998a1ac48fdfdc95cd728a559b9cb27bd81..ac24d74bf2bf792fe34af0619f0c5fbd5186a946 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -73,12 +73,7 @@ void HBAutocorrelation( * Windowing * *-----------------------------------------------------------*/ - WindowSignal( hTcxCfg, hTcxCfg->tcx_offset, left_overlap_mode, right_overlap_mode, &left_overlap, &right_overlap, speech, &L_frame, xn_buf, 1, 0 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offset, left_overlap_mode, right_overlap_mode, &left_overlap, &right_overlap, speech, &L_frame, xn_buf, 1, 0 ); /*-----------------------------------------------------------* * Autocorrelation * @@ -139,11 +134,7 @@ void TNSAnalysisStereo( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { continue; } @@ -391,11 +382,7 @@ void TNSAnalysisStereo( /* individual decision for each channel */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) -#else if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { continue; } @@ -477,11 +464,7 @@ void TNSAnalysisStereo( /* we have the decision, set filter data accordingly */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) -#else if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { continue; } @@ -518,11 +501,7 @@ void TNSAnalysisStereo( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { continue; } @@ -992,12 +971,6 @@ void EstimateStereoTCXNoiseLevel( { fac_ns_q = param_core[ch] + n * NPRM_DIV + 1; maxNfCalcBw = min( noiseFillingBorder[ch][n], (int16_t) ( hTcxEnc->measuredBwRatio * (float) L_frame[ch][n] + 0.5f ) ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - maxNfCalcBw = min( maxNfCalcBw, MCT_LFE_MAX_LINE ); - } -#endif if ( ( total_brate >= HQ_96k && ( st->element_mode <= IVAS_SCE || st->bwidth < SWB ) ) || total_brate > IVAS_192k ) { fac_ns[ch][n] = 0.0f; @@ -2130,12 +2103,7 @@ void coder_tcx( if ( st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) { - WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, win, 1, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, win, 1, 1 ); /* Compute MDCT for xn_buf[] */ TCX_MDCT( win, spectrum, left_overlap, L_frame - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); @@ -2144,12 +2112,7 @@ void coder_tcx( { wtda( st->hTcxEnc->new_speech_TCX, win, NULL, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, L_frame ); - WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, winMDST, 1, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, winMDST, 1, 1 ); edct( win, spectrum, L_frame, st->element_mode ); diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index f89f4a132c0b38ba00ea4697e83dc151ab8e1970..774b1398c52a32bba57e2117744381bb9df33648 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -261,12 +261,7 @@ static void init_tcx( hTcxEnc->spectrum[0] = hTcxEnc->spectrum_long; hTcxEnc->spectrum[1] = hTcxEnc->spectrum_long + N_TCX10_MAX; - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag ); /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 1.0f; diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index 806afd273bcc1ab4ad4e9cceb7f2cf8b2b60c3ee..d6c866d4c56e56a671a6b8b857f98bd106d2333d 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -95,12 +95,7 @@ void core_coder_mode_switch( st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); /* switch IGF configuration */ if ( st->igf ) @@ -117,12 +112,7 @@ void core_coder_mode_switch( hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode ); st->hTcxCfg->tcxRateLoopOpt = ( st->hTcxCfg->resq && !st->tcxonly ) ? 1 : st->hTcxCfg->tcxRateLoopOpt; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode ); if ( st->hTcxCfg->fIsTNSAllowed ) { @@ -161,12 +151,7 @@ void core_coder_mode_switch( } else { - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); init_coder_ace_plus( st, last_total_brate, MCT_flag ); } diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index 44c34a2bd7a6942fc17bc938d5dca44f2c95f59f..38a8a2c65ac67125c5f31332ff22cab8d4ed0de3 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -686,12 +686,7 @@ static void configure_core_coder( } } - st->igf = getIgfPresent( 0, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( 0, st->total_brate, st->bwidth, st->rf_mode ); if ( st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA ) { diff --git a/lib_enc/ext_sig_ana.c b/lib_enc/ext_sig_ana.c index 0588f0ddf1638c2610c24dba5e8b954548120da0..80e652cf07c987e48b36c93a601650838efc12a3 100644 --- a/lib_enc/ext_sig_ana.c +++ b/lib_enc/ext_sig_ana.c @@ -215,48 +215,24 @@ void core_signal_analysis_high_bitrate( if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - wtda( hTcxEnc->new_speech_TCX, tcx20Win, NULL, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX ); + wtda( hTcxEnc->new_speech_TCX, tcx20Win, NULL, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX ); - if ( windowed_samples != NULL ) /* store overlap data for later */ - { - assert( frameno == 0 ); - windowed_samples[0] = (float) overlap_mode[frameno]; - windowed_samples[1] = (float) overlap_mode[frameno + 1]; - } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } - else + if ( windowed_samples != NULL ) /* store overlap data for later */ { - /* Windowing of the LFE Signal*/ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, - st->element_mode != IVAS_CPE_MDCT /* truncate_aldo */, - 1, 1 ); + assert( frameno == 0 ); + windowed_samples[0] = (float) overlap_mode[frameno]; + windowed_samples[1] = (float) overlap_mode[frameno + 1]; } -#endif if ( st->element_mode != IVAS_CPE_MDCT ) { /* Windowing of the 2xTCX5 subframes or 1xTCX10 or 1xTCX20 */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 1, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 1, 1 ); } } else { /* Windowing of the 2xTCX5 subframes or 1xTCX10 or 1xTCX20 */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT, 1 ); if ( windowed_samples != NULL ) /* save windowed speech_TCX samples */ { @@ -295,15 +271,7 @@ void core_signal_analysis_high_bitrate( for ( i = 0; i < 2; i++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); -#endif - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, tcx20Win + i * tcx5SizeFB, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, tcx20Win + i * tcx5SizeFB, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1 ); TCX_MDCT( tcx5Win, hTcxEnc->spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); @@ -318,11 +286,7 @@ void core_signal_analysis_high_bitrate( { assert( transform_type[frameno] == TCX_10 || transform_type[frameno] == TCX_20 ); - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { edct( tcx20Win, hTcxEnc->spectrum[frameno], L_subframe, st->element_mode ); @@ -347,13 +311,6 @@ void core_signal_analysis_high_bitrate( { v_multc( hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - set_f( &hTcxEnc->spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); - st->hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; - } -#endif if ( st->element_mode != IVAS_CPE_MDCT ) { @@ -370,23 +327,14 @@ void core_signal_analysis_high_bitrate( { L_subframe = L_frameTCX / nSubframes; - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { wtda_ext( hTcxEnc->new_speech_TCX, mdstWin, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX, 3 ); } else { /* Windowing for the MDST */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1 ); } if ( transform_type[frameno] == TCX_5 ) @@ -417,15 +365,7 @@ void core_signal_analysis_high_bitrate( for ( i = 0; i < 2; i++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); -#endif - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1 ); TCX_MDST( tcx5Win, mdst_spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); /* high-band gain control in case of BWS */ @@ -437,11 +377,7 @@ void core_signal_analysis_high_bitrate( } else /* transform_type[frameno] != TCX_5 */ { - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { edst( mdstWin, mdst_spectrum[frameno], L_subframe, st->element_mode ); @@ -466,12 +402,6 @@ void core_signal_analysis_high_bitrate( v_multc( mdst_spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, mdst_spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - set_f( &mdst_spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); - } -#endif } if ( st->element_mode != IVAS_CPE_MDCT ) diff --git a/lib_enc/hq_core_enc.c b/lib_enc/hq_core_enc.c index 43b5ebd68c7c377da7346e7ae6196ef414453108..3fb39b535a79f8da69a5188083fd2c870b3787a4 100644 --- a/lib_enc/hq_core_enc.c +++ b/lib_enc/hq_core_enc.c @@ -116,12 +116,7 @@ void hq_core_enc( left_overlap = -1; right_overlap = -1; - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1 ); TCX_MDCT( wtda_audio, t_audio, left_overlap, L_spec - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index d73434c15f54a1c9675d2b7e6d8b307ae8ee8225..9efd3c7f166be25a773de9962c4ace5d943ae60e 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -463,11 +463,7 @@ ivas_error init_encoder( * LP-CNG *-----------------------------------------------------------------*/ -#ifdef DISCRETE_ISM_DTX_CNG if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM || ism_mode == ISM_MODE_DISC ) ) -#else - if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM ) ) -#endif { if ( ( st->hTdCngEnc = (TD_CNG_ENC_HANDLE) malloc( sizeof( TD_CNG_ENC_DATA ) ) ) == NULL ) { @@ -731,11 +727,7 @@ ivas_error init_encoder( * IGF *-----------------------------------------------------------------*/ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) { @@ -755,12 +747,7 @@ ivas_error init_encoder( if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) { - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); } else { @@ -814,30 +801,19 @@ ivas_error init_encoder( /*-----------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------*/ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( st->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) { -#endif - if ( ( st->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); + } - if ( st->element_mode > EVS_MONO ) - { - InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), 0, st->hTranDet, 1 ); - } - else - { - InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); - } -#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( st->element_mode > EVS_MONO ) + { + InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), 0, st->hTranDet, 1 ); } else { - st->hTranDet = NULL; + InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); } -#endif /*-----------------------------------------------------------------* * IVAS parameters diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 0c85ca186dcafd0c1084465c8b6d34b350aaa028..cfadcbb6d2d63419cfda727790abf504e63587a7 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -260,14 +260,7 @@ ivas_error ivas_core_enc( { ivas_mdct_core_whitening_enc( hCPE, old_inp_16k, old_wsp, pitch_buf, hMCT->p_mdst_spectrum_long[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - &hMCT->LFE_off, -#endif - 1, hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + 1, hMCT->nchan_out_woLFE ); } else { diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c old mode 100755 new mode 100644 index 85eba72f006b477315f626931811aceb8c5443f3..cf23ddef539f2e2f7ceeba7997129b0f07829b9c --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -443,13 +443,6 @@ ivas_error pre_proc_front_ivas( st->vad_flag = wb_vad( st, fr_bands, &i, &i, &i, &snr_sum_he, &localVAD_HE_SAD, &( st->flag_noisy_speech_snr ), NULL, NULL, -1000.0f, -1000.0f ); -#ifdef ITD_WINNER_GAIN_MODIFY - /*Save the local_vad flag for the noise coherence calculation*/ - if ( element_mode == IVAS_CPE_DFT ) - { - hCPE->hStereoDft->local_vad = (short) ( st->vad_flag ); - } -#endif if ( force_front_vad == 1 || front_vad_flag == 1 ) { @@ -486,12 +479,8 @@ ivas_error pre_proc_front_ivas( if ( st->idchan == 0 && element_mode != IVAS_CPE_MDCT ) { - bw_detect( st, st->input, NULL, enerBuffer -#ifdef FIX_MDCT_BASED_BWD - , - 0 -#endif - ); + bw_detect( st, st->input, NULL, enerBuffer, + 0 ); } if ( element_mode != IVAS_CPE_MDCT ) /* in MDCT stereo, set_bw_stereo() is used instead */ @@ -834,34 +823,6 @@ ivas_error pre_proc_front_ivas( /* 2nd stage speech/music classification (ACELP/GSC/TCX core selection) */ ivas_smc_mode_selection( st, element_brate, smc_dec, *relE, Etot, attack_flag, inp_12k8, S_map, flag_spitch ); - -#ifdef ITD_WINNER_GAIN_MODIFY - if ( element_mode == IVAS_CPE_DFT ) - { - if ( hCPE->hStereoDft->mus_flag != smc_dec || hCPE->element_mode != hCPE->last_element_mode ) - { - hCPE->hStereoDft->noise_coherence = 0.0f; - set_zero( hCPE->hStereoDft->spd_L_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_R_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_L_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_R_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_L_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_R_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->winner_gain_L, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->winner_gain_R, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hCPE->hStereoDft->spd_L_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hCPE->hStereoDft->spd_R_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); - } - if ( smc_dec == MUSIC && st->vad_flag == 1 ) - { - hCPE->hStereoDft->mus_flag = 2; - } - else - { - hCPE->hStereoDft->mus_flag = 0; - } - } -#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index cbb48495bf6b7f34fcf079df5eebf284e4b0f4d7..080ecc20461198f9cea2cc1670053610499a3202 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -211,11 +211,7 @@ ivas_error ivas_corecoder_enc_reconfig( { if ( n_CoreCoder_existing > cpe_id * CPE_CHANNELS + n ) { -#ifdef FIX_386_CORECODER_RECONFIG mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); -#else - mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[0]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); /* TODO VoiceAge: Please check if this should be hCoreCoder[n] */ -#endif } } @@ -381,12 +377,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode -#endif - ); + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { @@ -453,12 +444,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode -#endif - ); + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 184a867cd1a13dda60a27833465f18b4cbc88334..72a737e64bc56b161413160ca26820f02fad947d 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -154,14 +154,10 @@ ivas_error ivas_cpe_enc( } mvr2r( data_f_ch0, sts[0]->input, input_frame ); -#ifdef ISSUE_24_CLEANUP_MCT_LFE if ( data_f_ch1 != NULL ) /*this may happen for cases with odd number of channels*/ { mvr2r( data_f_ch1, sts[1]->input, input_frame ); } -#else - mvr2r( data_f_ch1, sts[1]->input, input_frame ); -#endif /*----------------------------------------------------------------* * Stereo technology selection @@ -303,27 +299,14 @@ ivas_error ivas_cpe_enc( { if ( st_ivas->hMCT ) { -#ifdef ISSUE_24_CLEANUP_MCT_LFE int16_t lfe_bits; lfe_bits = ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ? st_ivas->hLFE->lfe_bits : 0 ); -#endif sts[n]->total_brate = hCPE->element_brate; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[n]->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - sts[n]->bits_frame_nominal = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); - sts[n]->bits_frame_channel = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC - -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( st_ivas->hMCT->num_lfe == FALSE ? 0 : LFE_BITS ) - -#else + sts[n]->bits_frame_nominal = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); + sts[n]->bits_frame_channel = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC - lfe_bits - -#endif - nb_bits_metadata ) / - st_ivas->hMCT->nchan_out_woLFE ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + nb_bits_metadata ) / + st_ivas->hMCT->nchan_out_woLFE ); } else { @@ -682,14 +665,7 @@ ivas_error ivas_cpe_enc( /* Store previous attack detection flag */ for ( n = 0; n < CPE_CHANNELS; n++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[n]->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; } #ifdef DEBUG_MODE_INFO @@ -853,12 +829,6 @@ ivas_error create_cpe_enc( copy_encoder_config( st_ivas, st, 1 ); 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; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) - { - st->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif if ( ( error = init_encoder( st, 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 535a1196abf8aaefbb6dda220bbfe4088bc98513..bc374f88e59c4cedddc78ceb8cf25ccbf98283d8 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -227,16 +227,11 @@ ivas_error ivas_enc( } else { -#ifdef FIX_382_MASA_META_FRAMING_ASYNC ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ -#endif if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#ifndef FIX_382_MASA_META_FRAMING_ASYNC - ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ -#endif if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index dfaa321605d550937e2f1b10a5389479a40037c1..d6f23d1c9b05db6754cc61202730c5456750e06e 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -431,11 +431,7 @@ ivas_error ivas_init_encoder( } } -#ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) -#else - if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) -#endif { if ( ( error = ivas_ism_dtx_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -946,11 +942,7 @@ void ivas_destroy_enc( ivas_spar_enc_close( &( st_ivas->hSpar ), st_ivas->hEncoderConfig->input_Fs, nchan_inp, 0 ); /* MASA handle */ -#ifdef FIX_350_MASA_DELAY_COMP ivas_masa_enc_close( &( st_ivas->hMasa ) ); -#else - ivas_masa_enc_close( &( st_ivas->hMasa ), st_ivas->nchan_transport, ivas_format ); -#endif /* MCT handle */ ivas_mct_enc_close( &( st_ivas->hMCT ) ); diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 3839a42a9df8518f01561990ac87dadefe70696f..aff8b9a0b6f421e0450d55c51c71dbf84f46af9e 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -42,14 +42,12 @@ #include "wmc_auto.h" -#ifdef DISCRETE_ISM_DTX_CNG /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ #define MD_MAX_DIFF_AZIMUTH 10 #define MD_MAX_DIFF_ELEVATION 10 -#endif /*-------------------------------------------------------------------* @@ -76,11 +74,7 @@ ivas_error ivas_ism_dtx_open( hISMDTX->dtx_flag = 0; hISMDTX->sce_id_dtx = 0; -#ifdef DISCRETE_ISM_DTX_CNG hISMDTX->cnt_SID_ISM = -1; -#else - set_s( hISMDTX->dtx_speech_buffer_enc, 0, PARAM_ISM_HYS_BUF_SIZE ); -#endif for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { @@ -95,7 +89,6 @@ ivas_error ivas_ism_dtx_open( } -#ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* * ivas_ism_get_dtx_enc() * @@ -297,142 +290,6 @@ int16_t ivas_ism_dtx_enc( return dtx_flag; } -#else -/*-------------------------------------------------------------------* - * ivas_ism_dtx_enc() - * - * Analysis and decision about DTX in ISM format - *-------------------------------------------------------------------*/ - -/*! r: indication of DTX frame */ -int16_t ivas_ism_dtx_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - int16_t *sid_flag /* o : indication of SID frame */ -) -{ - int16_t i, val, dtx_flag; - - dtx_flag = 0; - *sid_flag = 0; - - /* Move the DTX/CNG speech buffer */ - for ( i = 0; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ ) - { - st_ivas->hISMDTX->dtx_speech_buffer_enc[i] = st_ivas->hISMDTX->dtx_speech_buffer_enc[i + 1]; - } - - /* If both TCs are active frame, do not do any post processing */ - if ( !( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == -1 && st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == -1 ) ) - { - /* covers 3 cases - * case 1: ch0 -> Inactive Frame, ch 1 -> Inactive Frame -> do not do any post-processing (Activate DTX) - * case 2: ch0 -> Inactive Frame, ch 1 -> Active Frame - * case 3: ch0 -> Active Frame, ch 1 -> Inactive Frame - */ - - /* case 2 -> ch 0 is inactive, set it to active */ - if ( st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == -1 && ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hISMDTX->dtx_speech_buffer_enc[i] = 0; - } - - /* case 3 -> ch 1 is inactive, set it to active */ - if ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == -1 && ( st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hISMDTX->dtx_speech_buffer_enc[i] = 0; - } - - /* case 1: both TCs are inactive */ - if ( ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hISMDTX->dtx_speech_buffer_enc[i] = 1; - } - } - else - { - st_ivas->hISMDTX->dtx_speech_buffer_enc[i] = 0; - } - - /* Do a decision based on hysteresis */ - st_ivas->hISMDTX->dtx_flag = 1; - - for ( i = 1; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ ) - { - if ( ( st_ivas->hISMDTX->dtx_speech_buffer_enc[i + 1] == 1 ) && ( st_ivas->hISMDTX->dtx_speech_buffer_enc[i - 1] == 1 ) && ( st_ivas->hISMDTX->dtx_speech_buffer_enc[i] == 0 ) ) - { - st_ivas->hISMDTX->dtx_speech_buffer_enc[i] = 1; - } - } - - val = sum_s( st_ivas->hISMDTX->dtx_speech_buffer_enc, PARAM_ISM_HYS_BUF_SIZE ); - - if ( val < 7 ) - { - for ( i = 0; i < PARAM_ISM_HYS_BUF_SIZE; i++ ) - { - st_ivas->hISMDTX->dtx_flag = st_ivas->hISMDTX->dtx_flag && st_ivas->hISMDTX->dtx_speech_buffer_enc[i]; - } - } - - if ( st_ivas->hISMDTX->dtx_flag ) - { - /* case 1 */ - /* force FD-CNG */ - st_ivas->hSCE[0]->hCoreCoder[0]->cng_type = FD_CNG; - st_ivas->hSCE[1]->hCoreCoder[0]->cng_type = FD_CNG; - - /* synchronize the core bitrate */ - if ( ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == -1 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->last_core_brate == SID_2k40 || st_ivas->hSCE[0]->hCoreCoder[0]->last_core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = st_ivas->hSCE[0]->hCoreCoder[0]->last_core_brate; - reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - } - - st_ivas->hSCE[1]->hCoreCoder[0]->core_brate = st_ivas->hSCE[0]->hCoreCoder[0]->core_brate; - } - else - { - if ( ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = -1; - st_ivas->hSCE[1]->hCoreCoder[0]->core_brate = -1; - - /* since ch0 is detected as inactive frame and we are setting it as active frame, - we need to reset bitstream pointer and write the ivas_format once more */ - ivas_write_format( st_ivas ); - } - - /* case 3 -> ch 1 is inactive, set it to active */ - if ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == -1 && ( st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hSCE[1]->hCoreCoder[0]->core_brate = -1; - } - - /* case 2 -> ch 0 is inactive, set it to active */ - if ( st_ivas->hSCE[1]->hCoreCoder[0]->core_brate == -1 && ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = -1; - - /* since ch0 is detected as inactive frame and we are setting it as active frame, - we need to reset bitstream pointer and write the ivas_format once more */ - ivas_write_format( st_ivas ); - } - } - - if ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) - { - *sid_flag = 1; - dtx_flag = 1; - } - - if ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) - { - dtx_flag = 1; - } - - return dtx_flag; -} -#endif /*-------------------------------------------------------------------* * ivas_ism_get_sce_id_dtx() @@ -504,11 +361,7 @@ void ivas_ism_coh_estim_dtx_enc( { Encoder_State *st, *st_id0; int16_t sce_id, i; -#ifdef DISCRETE_ISM_DTX_CNG float acorr_ene[MAX_NUM_OBJECTS], xcorr_ene; -#else - float acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; -#endif if ( nchan_transport == 1 ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index f073609b8ab9c877cba22099bca0abc17ee8eb32..4a56252be876fa73e3a967c469b87caf11f2bd36 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -85,17 +85,8 @@ ivas_error ivas_ism_enc( float Etot_LR[1]; /* total energy; correlation shift */ float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ -#ifdef DISCRETE_ISM_DTX_CNG int16_t nchan_ism, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; -#else -#ifdef NCHAN_ISM_PARAMETER - int16_t nchan_ism, dtx_flag, sid_flag; -#else - int16_t dtx_flag, sid_flag, flag_noisy_speech; -#endif - int16_t i, nBits; -#endif ivas_error error; push_wmops( "ivas_ism_enc" ); @@ -108,24 +99,9 @@ ivas_error ivas_ism_enc( dtx_flag = 0; sid_flag = 0; -#if ( !defined NCHAN_ISM_PARAMETER || defined DISCRETE_ISM_DTX_CNG ) flag_noisy_speech = 0; -#endif -#ifdef NCHAN_ISM_PARAMETER nchan_ism = st_ivas->hEncoderConfig->nchan_ism; -#else -#ifdef DISCRETE_ISM_DTX_CNG - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - nchan_ism = st_ivas->hDirAC->hParamIsm->num_obj; - } - else /* ism_mode == ISM_MODE_DISC */ - { - nchan_ism = st_ivas->nchan_transport; - } -#endif -#endif set_s( md_diff_flag, 1, nchan_ism ); /*------------------------------------------------------------------* @@ -192,13 +168,11 @@ ivas_error ivas_ism_enc( return error; } -#ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) { vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; } else -#endif { vad_flag[sce_id] = st->vad_flag; } @@ -208,21 +182,13 @@ ivas_error ivas_ism_enc( * DTX analysis *-----------------------------------------------------------------*/ -#ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) -#else - if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) -#endif { /* compute the dominant sce_id using long term energy */ ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ -#ifdef DISCRETE_ISM_DTX_CNG dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#else - dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); -#endif if ( sid_flag ) { @@ -247,47 +213,28 @@ ivas_error ivas_ism_enc( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_param_ism_compute_noisy_speech_flag( st_ivas ); -#ifdef DISCRETE_ISM_DTX_CNG flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech; -#endif } if ( dtx_flag ) { -#ifdef DISCRETE_ISM_DTX_CNG ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); -#else - if ( sid_flag ) - { -#ifdef NCHAN_ISM_PARAMETER - ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, nchan_ism ); -#else - ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); -#endif - } -#endif } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { // VE: call ivas_ism_metadata_enc() with 'st_ivas' - TBD ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, -#ifdef NCHAN_ISM_PARAMETER nchan_ism, -#endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); } else /* ISM_MODE_DISC */ { ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, -#ifdef NCHAN_ISM_PARAMETER nchan_ism, -#endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); } -#ifdef DISCRETE_ISM_DTX_CNG update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); -#endif /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames @@ -295,27 +242,9 @@ ivas_error ivas_ism_enc( st = st_ivas->hSCE[0]->hCoreCoder[0]; -#ifdef DISCRETE_ISM_DTX_CNG if ( sid_flag ) -#else - if ( st->core_brate == SID_2k40 ) -#endif { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); - -#ifndef DISCRETE_ISM_DTX_CNG - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) - { - /* write unused bits */ - nBits = ( IVAS_SID_5k2 - SID_2k40 ) / 50 - SID_FORMAT_NBITS; - while ( nBits > 0 ) - { - i = min( nBits, 16 ); - push_indice( st->hBstr, IND_UNUSED, 0, i ); - nBits -= i; - } - } -#endif } /*------------------------------------------------------------------* @@ -389,7 +318,6 @@ ivas_error ivas_ism_enc( } } -#ifdef DISCRETE_ISM_DTX_CNG #ifdef DEBUG_MODE_INFO if ( dtx_flag ) { @@ -423,7 +351,6 @@ ivas_error ivas_ism_enc( } } } -#endif #endif pop_wmops(); diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index cfc66766836dea568ab98b5509890c4f3b698ad2..82a9fe4f8ac06431f661eab4850daf5c3e65ae66 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -64,11 +64,7 @@ * Local function declarations *-----------------------------------------------------------------------*/ -#ifdef FIX_379_ANGLE static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_angle1_abs, const int16_t idx_angle2_abs, int16_t *flag_abs_angle1, int16_t *flag_abs_angle2 ); -#else -static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_azimuth_abs, const int16_t idx_elevation_abs, int16_t *flag_abs_azimuth, int16_t *flag_abs_elevation ); -#endif static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); @@ -166,10 +162,8 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISM total bitrate */ -#ifdef NCHAN_ISM_PARAMETER - const int16_t nchan_ism, /* i : number of ISM channels */ -#endif + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_ism, /* i : number of ISM channels */ const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -182,71 +176,33 @@ ivas_error ivas_ism_metadata_enc( ) { int16_t i, ch, nb_bits_start = 0; -#ifdef FIX_379_ANGLE int16_t flag_abs_azimuth[MAX_NUM_OBJECTS]; int16_t flag_abs_elevation[MAX_NUM_OBJECTS]; int16_t idx_angle1_abs = 0; int16_t idx_angle2_abs = 0; int16_t flag_abs_yaw[MAX_NUM_OBJECTS]; int16_t flag_abs_pitch[MAX_NUM_OBJECTS]; -#else - int16_t idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS]; - int16_t idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS]; - int16_t flag_abs_azimuth_orientation[MAX_NUM_OBJECTS]; -#endif int16_t idx_radius_abs = 0, flag_abs_radius[MAX_NUM_OBJECTS]; float valQ; ISM_METADATA_HANDLE hIsmMetaData; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; int16_t ism_metadata_flag_global; int16_t ism_imp[MAX_NUM_OBJECTS]; -#ifdef NCHAN_ISM_PARAMETER int16_t nbands, nblocks; -#else - int16_t nchan_ism, nbands, nblocks; -#endif ivas_error error; error = IVAS_ERR_OK; push_wmops( "ism_meta_enc" ); -#ifndef NCHAN_ISM_PARAMETER - if ( ism_mode == ISM_MODE_PARAM ) - { - nchan_ism = hParamIsm->num_obj; - } - else if ( ism_mode == ISM_MODE_DISC ) - { - nchan_ism = nchan_transport; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); - } -#endif - -#ifndef DISCRETE_ISM_DTX_CNG - if ( nchan_ism == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) - { - /* no metadata encoding in CNG */ - pop_wmops(); - - return error; - } -#endif /* initialization */ ism_metadata_flag_global = 0; set_s( nb_bits_metadata, 0, nchan_transport ); set_s( flag_abs_azimuth, 0, nchan_ism ); set_s( flag_abs_elevation, 0, nchan_ism ); -#ifdef FIX_379_ANGLE set_s( flag_abs_yaw, 0, nchan_ism ); set_s( flag_abs_pitch, 0, nchan_ism ); -#else - set_s( flag_abs_azimuth_orientation, 0, nchan_ism ); -#endif set_s( flag_abs_radius, 0, nchan_ism ); /*----------------------------------------------------------------* @@ -261,15 +217,7 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { -#ifdef DISCRETE_ISM_DTX_CNG hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; -#else - /* In case of low level noise for low bitrate inactive frames, do not sent metadata */ - if ( localVAD[ch] == 0 && !( hSCE[ch]->hCoreCoder[0]->tcxonly ) && ( hSCE[ch]->hCoreCoder[0]->lp_noise <= 10 ) ) - { - hIsmMeta[ch]->ism_metadata_flag = 0; - } -#endif } } @@ -351,48 +299,25 @@ ivas_error ivas_ism_metadata_enc( if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_379_ANGLE idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#endif } else /* ISM_MODE_PARAM */ { -#ifdef FIX_379_ANGLE idx_angle1_abs = hParamIsm->azi_index[ch]; idx_angle2_abs = hParamIsm->ele_index[ch]; -#else - idx_azimuth_abs = hParamIsm->azi_index[ch]; - idx_elevation_abs = hParamIsm->ele_index[ch]; -#endif } -#ifdef FIX_379_ANGLE encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); -#else - encode_angle_indices( hBstr, &( hIsmMetaData->angle[0] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); -#endif /*----------------------------------------------------------------* * Quantize and encode radius, yaw, and pitch *----------------------------------------------------------------*/ if ( ism_mode == ISM_MODE_DISC && ism_extended_metadata_flag ) { -#ifdef FIX_379_ANGLE idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - idx_azimuth_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - idx_elevation_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#endif idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); -#ifdef FIX_379_ANGLE encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); -#else - encode_angle_indices( hBstr, &( hIsmMetaData->angle[1] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth_orientation[ch], &flag_abs_elevation[ch] ); -#endif encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } @@ -461,20 +386,12 @@ ivas_error ivas_ism_metadata_enc( if ( abs_next % ISM_NUM_PARAM == 0 ) { -#ifdef FIX_379_ANGLE hIsmMeta[ch]->position_angle.angle1_diff_cnt = abs_num - 1; -#else - hIsmMeta[ch]->angle[0].azimuth_diff_cnt = abs_num - 1; -#endif } if ( abs_next % ISM_NUM_PARAM == 1 ) { -#ifdef FIX_379_ANGLE hIsmMeta[ch]->position_angle.angle2_diff_cnt = abs_num - 1; -#else - hIsmMeta[ch]->angle[0].elevation_diff_cnt = abs_num - 1; -#endif /*hIsmMeta[ch]->elevation_diff_cnt = min( hIsmMeta[ch]->elevation_diff_cnt, ISM_FEC_MAX );*/ } @@ -609,7 +526,6 @@ ivas_error ivas_ism_metadata_enc_create( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } -#ifdef FIX_379_ANGLE st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0; st_ivas->hIsmMetaData[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 0; @@ -618,26 +534,14 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->orientation_angle.angle1_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 0; st_ivas->hIsmMetaData[ch]->orientation_angle.angle2_diff_cnt = ISM_FEC_MAX - 2; -#else - st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->angle[0].azimuth_diff_cnt = ISM_FEC_MAX; - st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 0; - st_ivas->hIsmMetaData[ch]->angle[0].elevation_diff_cnt = ISM_FEC_MAX - 1; - st_ivas->hIsmMetaData[ch]->angle[1].last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->angle[1].azimuth_diff_cnt = ISM_FEC_MAX - 2; - st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 0; - st_ivas->hIsmMetaData[ch]->angle[1].elevation_diff_cnt = ISM_FEC_MAX - 2; -#endif st_ivas->hIsmMetaData[ch]->last_radius_idx = 0; st_ivas->hIsmMetaData[ch]->radius_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); -#ifdef DISCRETE_ISM_DTX_CNG st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; -#endif } if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) @@ -757,7 +661,6 @@ static void encode_radius( * * Encoding of an angle *----------------------------------------------------------------*/ -#ifdef FIX_379_ANGLE static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ @@ -998,246 +901,7 @@ static void encode_angle_indices( return; } -#else - -static void encode_angle_indices( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ - const int16_t last_ism_metadata_flag, /* i : last frame ism_metadata_flag */ - const int16_t ini_frame, /* i : initialization frames counter */ - const int16_t idx_azimuth_abs, /* i : Azimuth index */ - const int16_t idx_elevation_abs, /* i : Elevation index */ - int16_t *flag_abs_azimuth, /* o : Azimuth encoding mode */ - int16_t *flag_abs_elevation /* o : Elevation encoding mode */ -) -{ - int16_t idx_azimuth, nbits_diff_azimuth, diff; - int16_t idx_elevation, nbits_diff_elevation; - - /*----------------------------------------------------------------* - * Azimuth index encoding - *----------------------------------------------------------------*/ - - idx_azimuth = idx_azimuth_abs; - - nbits_diff_azimuth = 0; - - *flag_abs_azimuth = 0; /* differential coding by default */ - if ( angle->azimuth_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ - ) - { - *flag_abs_azimuth = 1; - } - - /* try differential coding */ - if ( *flag_abs_azimuth == 0 ) - { - diff = idx_azimuth_abs - angle->last_azimuth_idx; - - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) - { - if ( diff > 0 ) - { - diff -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; - } - else - { - diff += ( 1 << ISM_AZIMUTH_NBITS ) - 1; - } - } - - if ( diff == 0 ) - { - idx_azimuth = 0; - nbits_diff_azimuth = 1; - } - else if ( ABSVAL( diff ) < ISM_MAX_AZIMUTH_DIFF_IDX ) /* when diff bits >= abs bits, prefer abs */ - { - idx_azimuth = 1 << 1; - nbits_diff_azimuth = 1; - - if ( diff < 0 ) - { - idx_azimuth += 1; /* negative sign */ - diff *= -1; - } - else - { - idx_azimuth += 0; /* positive sign */ - } - - idx_azimuth = idx_azimuth << diff; - nbits_diff_azimuth++; - - /* unary coding of "diff */ - idx_azimuth += ( ( 1 << diff ) - 1 ); - nbits_diff_azimuth += diff; - - if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) - { - /* add stop bit - only for codewords shorter than ISM_AZIMUTH_NBITS */ - idx_azimuth = idx_azimuth << 1; - nbits_diff_azimuth++; - } - } - else - { - *flag_abs_azimuth = 1; - } - } - - /* update counter */ - if ( *flag_abs_azimuth == 0 ) - { - angle->azimuth_diff_cnt++; - angle->elevation_diff_cnt = min( angle->elevation_diff_cnt, ISM_FEC_MAX ); - } - else - { - angle->azimuth_diff_cnt = 0; - } - - /* Write azimuth */ - push_indice( hBstr, IND_ISM_AZIMUTH_DIFF_FLAG, *flag_abs_azimuth, 1 ); - - if ( *flag_abs_azimuth ) - { - push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, ISM_AZIMUTH_NBITS ); - } - else - { - push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nbits_diff_azimuth ); - } - - /*----------------------------------------------------------------* - * Elevation index encoding - *----------------------------------------------------------------*/ - - idx_elevation = idx_elevation_abs; - nbits_diff_elevation = 0; - *flag_abs_elevation = 0; /* differential coding by default */ - if ( angle->elevation_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ - ) - { - *flag_abs_elevation = 1; - } - - /* note: elevation is coded starting from the second frame only (it is meaningless in the init_frame) */ - if ( ini_frame == 0 ) - { - *flag_abs_elevation = 1; - angle->last_elevation_idx = idx_elevation_abs; - } - - diff = idx_elevation_abs - angle->last_elevation_idx; - - /* avoid absolute coding of elevation if absolute coding was already used for azimuth */ - if ( *flag_abs_azimuth == 1 ) - { - int16_t diff_orig = diff; - - *flag_abs_elevation = 0; - - - if ( diff >= 0 ) - { - diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); - } - else - { - diff = -1 * min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ); - } - - if ( last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) - { - angle->elevation_diff_cnt = ISM_FEC_MAX - 1; - } - } - - /* try differential coding */ - if ( *flag_abs_elevation == 0 ) - { - if ( diff == 0 ) - { - idx_elevation = 0; - nbits_diff_elevation = 1; - } - else if ( ABSVAL( diff ) <= ISM_MAX_ELEVATION_DIFF_IDX ) - { - idx_elevation = 1 << 1; - nbits_diff_elevation = 1; - if ( diff < 0 ) - { - idx_elevation += 1; /* negative sign */ - diff *= -1; - } - else - { - idx_elevation += 0; /* positive sign */ - } - - idx_elevation = idx_elevation << diff; - nbits_diff_elevation++; - - /* unary coding of "diff */ - idx_elevation += ( ( 1 << diff ) - 1 ); - nbits_diff_elevation += diff; - - if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) - { - /* add stop bit */ - idx_elevation = idx_elevation << 1; - nbits_diff_elevation++; - } - } - else - { - *flag_abs_elevation = 1; - } - } - - /* update counter */ - if ( *flag_abs_elevation == 0 ) - { - angle->elevation_diff_cnt++; - angle->elevation_diff_cnt = min( angle->elevation_diff_cnt, ISM_FEC_MAX ); - } - else - { - angle->elevation_diff_cnt = 0; - } - - /* Write elevation */ - if ( *flag_abs_azimuth == 0 ) /* do not write "flag_abs_elevation" if "flag_abs_azimuth == 1" */ - { - push_indice( hBstr, IND_ISM_ELEVATION_DIFF_FLAG, *flag_abs_elevation, 1 ); - } - - if ( *flag_abs_elevation ) - { - push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, ISM_ELEVATION_NBITS ); - } - else - { - push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nbits_diff_elevation ); - } - - /*----------------------------------------------------------------* - * Updates - *----------------------------------------------------------------*/ - - angle->last_azimuth_idx = idx_azimuth_abs; - angle->last_elevation_idx = idx_elevation_abs; - - return; -} -#endif - -#ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_enc() * @@ -1355,24 +1019,13 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef FIX_379_ANGLE hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); - -#else - hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#endif } else { -#ifdef FIX_379_ANGLE hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#else - hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#endif } } } @@ -1391,4 +1044,3 @@ void ivas_ism_metadata_sid_enc( return; } -#endif diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 63c1fcea810af6c5d04f93a96e162cd5c0d94c7b..abe5842f70e8f0aed5279e3091e01a27e9a98bc2 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -47,27 +47,16 @@ static void ivas_param_ism_compute_obj_parameters( -#ifdef NCHAN_ISM_PARAMETER - const int16_t nchan_ism, /* i : number of ISM channels */ -#endif + const int16_t nchan_ism, /* i : number of ISM channels */ float reference_power_obj[MAX_NUM_OBJECTS][PARAM_ISM_MDFT_NO_SLOTS][DIRAC_NO_FB_BANDS_MAX], /* i : Reference power */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM Enc Handle */ ) { -#ifdef NCHAN_ISM_PARAMETER int16_t i, b, m, br, mr; -#else - int16_t i, b, m, br, mr, num_obj; -#endif int16_t brange_start, brange_end, mrange_start, mrange_end, time_merge_fac; float power_ratios_m[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS]; -#ifdef NCHAN_ISM_PARAMETER assert( nchan_ism == 3 || nchan_ism == 4 ); -#else - num_obj = hParamIsm->num_obj; - assert( num_obj == 3 || num_obj == 4 ); -#endif for ( b = 0; b < hParamIsm->nbands; b++ ) { @@ -92,11 +81,7 @@ static void ivas_param_ism_compute_obj_parameters( /* for each object, sum up reference power within current T/F tile */ -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 0; i < num_obj; i++ ) -#endif { for ( mr = mrange_start; mr < mrange_end; mr++ ) { @@ -119,11 +104,7 @@ static void ivas_param_ism_compute_obj_parameters( index_2 = 0; } -#ifdef NCHAN_ISM_PARAMETER for ( i = MAX_PARAM_ISM_WAVE; i < nchan_ism; i++ ) -#else - for ( i = MAX_PARAM_ISM_WAVE; i < num_obj; i++ ) -#endif { if ( ref_power_local[i] > ref_power_local[index_1] ) { @@ -169,30 +150,17 @@ static void ivas_param_ism_compute_obj_parameters( static void ivas_param_ism_enc_quantize_DOA( -#ifdef NCHAN_ISM_PARAMETER - const int16_t nchan_ism, /* i : number of ISM channels */ -#endif + const int16_t nchan_ism, /* i : number of ISM channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM encoder handle */ ) { -#ifdef NCHAN_ISM_PARAMETER int16_t i, azi_idx, ele_idx; -#else - int16_t i, azi_idx, ele_idx, num_obj; -#endif float valQ; -#ifndef NCHAN_ISM_PARAMETER - num_obj = hParamIsm->num_obj; -#endif /* Loop over objects */ -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 0; i < num_obj; i++ ) -#endif { /* Quantize the elevation and obtain quantized elevation value and index */ ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); @@ -224,11 +192,7 @@ void ivas_param_ism_stereo_dmx( const int16_t input_frame /* i : Length of input frame */ ) { -#ifdef NCHAN_ISM_PARAMETER int16_t i, j; -#else - int16_t i, j, num_obj; -#endif float alpha, azi_shift, tmp, tmp_1; float cardioid_left[MAX_NUM_OBJECTS], cardioid_right[MAX_NUM_OBJECTS]; float stereo_dmx[2][L_FRAME48k]; @@ -239,20 +203,13 @@ void ivas_param_ism_stereo_dmx( /*Initialization*/ alpha = 0.5; azi_shift = 0; -#ifndef NCHAN_ISM_PARAMETER - num_obj = st_ivas->hDirAC->hParamIsm->num_obj; -#endif /* Set the stereo dmx to zero */ set_zero( stereo_dmx[0], L_FRAME48k ); set_zero( stereo_dmx[1], L_FRAME48k ); /* Loop over all objects */ -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) -#else - for ( i = 0; i < num_obj; i++ ) -#endif { hIsmMetaData = st_ivas->hIsmMetaData[i]; @@ -314,10 +271,6 @@ ivas_error ivas_param_ism_enc_open( input_Fs = st_ivas->hEncoderConfig->input_Fs; -#ifndef NCHAN_ISM_PARAMETER - /* Assign the number of objects */ - hDirAC->hParamIsm->num_obj = st_ivas->hEncoderConfig->nchan_inp; -#endif /* set FB config. */ if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) @@ -331,11 +284,7 @@ ivas_error ivas_param_ism_enc_open( return error; } -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->hEncoderConfig->nchan_inp ); -#else - ivas_param_ism_config( hDirAC->hParamIsm ); -#endif /* Assign memories for Band and Block grouping */ hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -402,9 +351,7 @@ void ivas_param_ism_enc( ) { int16_t i, j, ts, l_ts; -#ifdef NCHAN_ISM_PARAMETER int16_t nchan_ism; -#endif int16_t num_time_slots; float *pcm_in[MAX_NUM_OBJECTS]; float fb_RealBuffer[MAX_NUM_OBJECTS][DIRAC_NO_FB_BANDS_MAX]; @@ -415,9 +362,7 @@ void ivas_param_ism_enc( DIRAC_ENC_HANDLE hDirAC; PARAM_ISM_CONFIG_HANDLE hParamIsm; -#ifdef NCHAN_ISM_PARAMETER nchan_ism = st_ivas->hEncoderConfig->nchan_ism; -#endif hDirAC = st_ivas->hDirAC; hParamIsm = hDirAC->hParamIsm; @@ -426,11 +371,7 @@ void ivas_param_ism_enc( l_ts = input_frame / PARAM_ISM_MDFT_NO_SLOTS; num_time_slots = PARAM_ISM_MDFT_NO_SLOTS; -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 0; i < hParamIsm->num_obj; i++ ) -#endif { pcm_in[i] = &data[i][0]; @@ -446,11 +387,7 @@ void ivas_param_ism_enc( ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts ); -#ifdef NCHAN_ISM_PARAMETER for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 0; i < hParamIsm->num_obj; i++ ) -#endif { pcm_in[i] += l_ts; for ( j = 0; j < DIRAC_NO_FB_BANDS_MAX; j++ ) @@ -461,163 +398,16 @@ void ivas_param_ism_enc( } /* Quantize DOAs */ -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_enc_quantize_DOA( nchan_ism, st_ivas->hIsmMetaData, hParamIsm ); -#else - ivas_param_ism_enc_quantize_DOA( st_ivas->hIsmMetaData, hParamIsm ); -#endif /* Compute object indices and power ratios */ -#ifdef NCHAN_ISM_PARAMETER ivas_param_ism_compute_obj_parameters( nchan_ism, reference_power_obj, hParamIsm ); -#else - ivas_param_ism_compute_obj_parameters( reference_power_obj, hParamIsm ); -#endif pop_wmops(); return; } -#ifndef DISCRETE_ISM_DTX_CNG -static void ivas_param_ism_enc_quantize_DOA_dtx( - float azimuth, - float elevation, - int16_t azi_bits, - int16_t ele_bits, - int16_t *azi_idx, - int16_t *ele_idx ) -{ - int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha; - float azi_val; - - /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ - nbits = min( azi_bits, ele_bits ); - - if ( nbits == ISM_ELEVATION_NBITS ) - { - angle_spacing = 5; - } - else - { - angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); - } - - npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); - - /* Step 2: Quantize Elevation */ - ele_alpha = 2 * npoints - 1; - *ele_idx = (int16_t) ( ( elevation / angle_spacing ) + 0.5f ) + npoints; - if ( *ele_idx >= ele_alpha ) - { - *ele_idx = ele_alpha - 1; - } - assert( ( 0 <= *ele_idx ) && ( *ele_idx < ele_alpha ) ); - - /* Step 3: Quantize Azimuth */ - az_alpha = 4 * npoints - 1; - - /* Convert azimuth in {-180,180} into {0,360} before quantization */ - if ( azimuth >= 0 ) - { - azi_val = azimuth; - } - else - { - azi_val = azimuth + 360.f; - } - - /* Obtain the index of quantized azimuth values */ - *azi_idx = (int16_t) ( ( ( azi_val / 360.f ) * az_alpha ) + 0.5f ); - if ( *azi_idx == az_alpha ) - { - /*wrap around the azimuth angle*/ - *azi_idx = 0; - } - assert( ( 0 <= *azi_idx ) && ( *azi_idx < az_alpha ) ); - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_param_ism_metadata_dtx_enc() - * - *-------------------------------------------------------------------------*/ - -void ivas_param_ism_metadata_dtx_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ -#ifdef NCHAN_ISM_PARAMETER - , - const int16_t nchan_ism /* i : number of ISM channels */ -#endif -) -{ - int16_t i, nBits, nBits_unused; - int16_t azi_idx, ele_idx; - int16_t coh_idx; - - nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; - nBits -= SID_FORMAT_NBITS; - - /* Transmit the metadata */ - /* write number of objects - unary coding */ -#ifdef NCHAN_ISM_PARAMETER - for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 1; i < hParamIsm->num_obj; i++ ) -#endif - { - push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); - } - push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); - - /* write sce id */ - push_indice( hBstr, IND_ISM_SCE_ID_DTX, hISMDTX->sce_id_dtx, 1 ); - - /* write noisy speech flag */ - push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, hParamIsm->flag_noisy_speech, 1 ); - - /* quantize and write coherence */ - coh_idx = (int16_t) ( hISMDTX->coh[0] * ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) + 0.5f ); - assert( ( coh_idx >= 0 ) && ( coh_idx <= ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) ) ); - push_indice( hBstr, IND_ISM_DTX_COH_SCA, coh_idx, PARAM_ISM_DTX_COH_SCA_BITS ); - -#ifdef NCHAN_ISM_PARAMETER - for ( i = 0; i < nchan_ism; i++ ) -#else - for ( i = 0; i < hParamIsm->num_obj; i++ ) -#endif - { - ivas_param_ism_enc_quantize_DOA_dtx( hIsmMeta[i]->azimuth, hIsmMeta[i]->elevation, PARAM_ISM_DTX_AZI_BITS, PARAM_ISM_DTX_ELE_BITS, &azi_idx, &ele_idx ); - push_indice( hBstr, IND_ISM_AZIMUTH, azi_idx, PARAM_ISM_DTX_AZI_BITS ); - push_indice( hBstr, IND_ISM_ELEVATION, ele_idx, PARAM_ISM_DTX_ELE_BITS ); - } - -#ifdef DEBUG_MODE_PARAM_ISM - dbgwrite( &( hParamIsm->coh ), sizeof( float ), 1, 1, "./res/ParamISM_coh_enc.dat" ); -#endif - - /* Write unused (padding) bits */ - nBits_unused = nBits - hBstr->nb_bits_tot; - while ( nBits_unused > 0 ) - { - i = min( nBits_unused, 16 ); - push_indice( hBstr, IND_UNUSED, 0, i ); - nBits_unused -= i; - } - -#ifdef DEBUGGING - assert( hBstr->nb_bits_tot == nBits ); -#endif - - return; -} -#endif - /*-------------------------------------------------------------------* * ivas_param_ism_compute_noisy_speech_flag() * diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 5c6e596cd240f2cbc532d021c1af815e2910aff0..2a21a667e941be7447a36cd81869bf394896a49e 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -61,7 +61,6 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); -#ifdef FIX_382_MASA_META_FRAMING_ASYNC static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); @@ -71,7 +70,6 @@ static void copy_masa_metadata( const MASA_METADATA_HANDLE hMetaFrom, MASA_METAD static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, const MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); -#endif #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT static void masa_metadata_direction_alignment( MASA_ENCODER_HANDLE hMasa ); @@ -135,16 +133,6 @@ ivas_error ivas_masa_enc_open( mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); -#ifndef FIX_350_MASA_DELAY_COMP - if ( hEncoderConfig->ivas_format == MASA_FORMAT ) - { - for ( i = 0; i < st_ivas->nchan_transport; i++ ) - { - hMasa->data.delay_buffer[i] = (float *) malloc( MASA_ENC_DELAY_SLOTS * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); - set_f( hMasa->data.delay_buffer[i], 0.0f, MASA_ENC_DELAY_SLOTS * CLDFB_NO_CHANNELS_MAX ); - } - } -#endif hMasa->data.onset_detector_1 = 0.0f; hMasa->data.onset_detector_2 = 0.0f; @@ -153,11 +141,9 @@ ivas_error ivas_masa_enc_open( hMasa->data.prevq_lfeToTotalEnergyRatio = 0.0f; hMasa->data.prevq_lfeIndex = 0; -#ifdef FIX_382_MASA_META_FRAMING_ASYNC hMasa->data.sync_state.prev_sim_stop = 0; hMasa->data.sync_state.prev_offset = 0; hMasa->data.sync_state.frame_mode = MASA_FRAME_4SF; -#endif #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT set_zero( hMasa->data.dir_align_state.previous_azi_dir1, MASA_FREQUENCY_BANDS ); @@ -180,11 +166,6 @@ ivas_error ivas_masa_enc_open( void ivas_masa_enc_close( MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ -#ifndef FIX_350_MASA_DELAY_COMP - , - const int16_t nchan_transport, /* i : Number of transport channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ -#endif ) { int16_t i; @@ -199,16 +180,6 @@ void ivas_masa_enc_close( deleteCldfb( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } -#ifndef FIX_350_MASA_DELAY_COMP - if ( ivas_format == MASA_FORMAT ) - { - for ( i = 0; i < nchan_transport; i++ ) - { - free( ( *hMasa )->data.delay_buffer[i] ); - ( *hMasa )->data.delay_buffer[i] = NULL; - } - } -#endif free( ( *hMasa ) ); ( *hMasa ) = NULL; @@ -444,27 +415,10 @@ void ivas_masa_estimate_energy( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { -#ifdef FIX_350_MASA_DELAY_COMP for ( i = 0; i < nchan_transport; i++ ) { cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); } -#else - if ( ts < MASA_ENC_DELAY_SLOTS ) - { - for ( i = 0; i < nchan_transport; i++ ) - { - cldfbAnalysis_ts( &( hMasa->data.delay_buffer[i][l_ts * ts] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); - } - } - else - { - for ( i = 0; i < nchan_transport; i++ ) - { - cldfbAnalysis_ts( &( data_f[i][l_ts * ( ts - MASA_ENC_DELAY_SLOTS )] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); - } - } -#endif for ( band_m_idx = 0; band_m_idx < MASA_FREQUENCY_BANDS; band_m_idx++ ) { @@ -492,12 +446,6 @@ void ivas_masa_estimate_energy( } } -#ifndef FIX_350_MASA_DELAY_COMP - for ( i = 0; i < nchan_transport; i++ ) - { - mvr2r( &data_f[i][input_frame - MASA_ENC_DELAY_SLOTS * maxBin], &( hMasa->data.delay_buffer[i][0] ), MASA_ENC_DELAY_SLOTS * maxBin ); - } -#endif return; } @@ -540,7 +488,6 @@ ivas_error ivas_masa_enc_config( masa_metadata_direction_alignment( hMasa ); #endif -#ifdef FIX_382_MASA_META_FRAMING_ASYNC detect_framing_async( hMasa ); /* detect the offset, set 1sf/4sf mode based on this. potentially also shift the metadata using a history buffer */ if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) @@ -548,7 +495,6 @@ ivas_error ivas_masa_enc_config( /* average over sub-frames */ average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy ); } -#endif /* Inspect metadata for parameter changes that affect coding. */ detect_metadata_composition( hMasa, &joinedSubframes, &coherencePresent, &isActualTwoDir ); @@ -639,11 +585,7 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); -#ifdef FIX_350_MASA_DELAY_COMP masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); -#else - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs ); -#endif /* Transmit stereo signals using a mono downmix at lowest bitrates */ if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) @@ -1137,18 +1079,12 @@ static void detect_metadata_composition( ) { MASA_METADATA_FRAME *hMeta; -#ifdef FIX_382_MASA_META_FRAMING_ASYNC int8_t sf, band, dir, numDir; -#else - int16_t sf, band, dir, numDir; -#endif int16_t nSubFrames; uint8_t dirValid[2] = { FALSE }; uint8_t cohPresent = FALSE; uint8_t sfDiffer = FALSE; -#ifdef FIX_382_MASA_META_FRAMING_ASYNC uint8_t sfSimilar; -#endif hMeta = &( hMasa->masaMetadata ); numDir = hMeta->descriptive_meta.numberOfDirections + 1; @@ -1213,7 +1149,6 @@ static void detect_metadata_composition( } /* Check if data over subframes is identical. Check is done by comparing to first subframe. */ -#ifdef FIX_382_MASA_META_FRAMING_ASYNC sfSimilar = TRUE; sf = 1; while ( ( sfSimilar == TRUE ) && ( sf < MAX_PARAM_SPATIAL_SUBFRAMES ) ) @@ -1222,54 +1157,6 @@ static void detect_metadata_composition( sf++; } sfDiffer = sfSimilar == TRUE ? FALSE : TRUE; -#else - dir = 0; - while ( sfDiffer == FALSE && dir < numDir ) - { - sf = 1; - while ( sfDiffer == FALSE && sf < MAX_PARAM_SPATIAL_SUBFRAMES ) - { - band = 0; - while ( sfDiffer == FALSE && band < MASA_FREQUENCY_BANDS ) - { - float aziDif; - aziDif = fabsf( hMeta->directional_meta[dir].azimuth[sf][band] - hMeta->directional_meta[dir].azimuth[0][band] ); - aziDif = aziDif > 180.0f ? aziDif - 360.0f : aziDif; - if ( aziDif > MASA_ANGLE_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( fabsf( hMeta->directional_meta[dir].elevation[sf][band] - hMeta->directional_meta[dir].elevation[0][band] ) > MASA_ANGLE_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( fabsf( hMeta->directional_meta[dir].energy_ratio[sf][band] - hMeta->directional_meta[dir].energy_ratio[0][band] ) > MASA_RATIO_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( fabsf( hMeta->directional_meta[dir].spread_coherence[sf][band] - hMeta->directional_meta[dir].spread_coherence[0][band] ) > MASA_COHERENCE_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( dir == 0 && fabsf( hMeta->common_meta.surround_coherence[sf][band] - hMeta->common_meta.surround_coherence[0][band] ) > MASA_COHERENCE_TOLERANCE ) - { - sfDiffer = TRUE; - } - band++; - } - sf++; - } - dir++; - } -#endif /* Further checks can be done with just one subframe if they are identical */ nSubFrames = sfDiffer == TRUE ? MAX_PARAM_SPATIAL_SUBFRAMES : 1; @@ -1815,7 +1702,6 @@ void ivas_masa_enc_reconfigure( } -#ifdef FIX_382_MASA_META_FRAMING_ASYNC /*-------------------------------------------------------------------* * average_masa_metadata() * @@ -2213,7 +2099,6 @@ static void detect_framing_async( return; } -#endif #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 866e4e176c9b0f915d58f87ff6d993486652c258..8151b33c668ff1a2d382d1747b179bb81c147416 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -450,11 +450,7 @@ ivas_error ivas_mcmasa_enc_reconfig( /* bitrate changed, may need to do something */ /* brute-force solution: close McMASA and re-instantiate with new settings */ -#ifdef FIX_350_MASA_DELAY_COMP ivas_masa_enc_close( &( st_ivas->hMasa ) ); -#else - ivas_masa_enc_close( &( st_ivas->hMasa ), st_ivas->nchan_transport, st_ivas->hEncoderConfig->ivas_format ); -#endif ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); /* Determine if to separate some channels from the analysis */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index c2c2e284c2ae200d2146122d403ad4acf6f7c1aa..900c5e1653c173f8e149130991e00b0e8b179432 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -51,9 +51,6 @@ *----------------------------------------------------------*/ static void FindChannelRatio( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ -#endif Encoder_State **sts, /* i/o: encoder state structure */ int16_t chBitRatios[MCT_MAX_CHANNELS], /* o : bit-disctribution channel ratios */ const int16_t nChannels /* i : number of channels to be coded */ @@ -71,11 +68,7 @@ static void FindChannelRatio( sum_nrg = 0; for ( i = 0; i < nChannels; i++ ) { - if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sum_nrg += nrg[i]; } @@ -84,11 +77,7 @@ static void FindChannelRatio( for ( i = 0; i < nChannels; i++ ) { - if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { chRatio = nrg[i] * sum_nrg; chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * chRatio + 0.5f ) ) ); @@ -97,13 +86,6 @@ static void FindChannelRatio( { chBitRatios[i] = 0; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - else if ( hMCT->num_lfe ) - { - assert( sts[i]->mct_chan_mode == MCT_CHAN_MODE_LFE ); - chBitRatios[i] = !hMCT->LFE_off; - } -#endif } #ifdef DEBUG_MODE_MDCT @@ -269,11 +251,7 @@ void ivas_mct_core_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { sts[i] = hCPE[cpe_id]->hCoreCoder[ch]; - if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { i++; continue; @@ -323,9 +301,6 @@ void ivas_mct_core_enc( st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || -#endif st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -355,9 +330,6 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -406,9 +378,6 @@ void ivas_mct_core_enc( { st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -442,9 +411,6 @@ void ivas_mct_core_enc( { st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -467,9 +433,6 @@ void ivas_mct_core_enc( { st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -484,9 +447,6 @@ void ivas_mct_core_enc( st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -503,9 +463,6 @@ void ivas_mct_core_enc( write_mct_bitstream( sts, hMCT, nChannels ); FindChannelRatio( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT, -#endif sts, chBitRatios, nChannels ); nAvailBits = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - NBITS_BWIDTH - hMCT->nBitsMCT - lfe_bits ); @@ -535,20 +492,13 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } nAvailBits -= NBBITS_MCT_RATIO; } - nAvailBits -= total_side_bits -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + ( hMCT->num_lfe ? 1 : 0 ) -#endif - + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ + nAvailBits -= total_side_bits + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ #ifdef DEBUG_MODE_MDCT dbgwrite( &nAvailBits, sizeof( int16_t ), 1, 1, "./res/availBits" ); @@ -563,9 +513,6 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || -#endif sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; @@ -589,17 +536,10 @@ void ivas_mct_core_enc( { continue; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) ) /* indicates LFE with no content */ - { -#endif - st->total_brate = ( st->bits_frame_channel + st->side_bits_frame_channel ) * FRAMES_PER_SEC; + st->total_brate = ( st->bits_frame_channel + st->side_bits_frame_channel ) * FRAMES_PER_SEC; #ifdef DEBUGGING - total_brate += st->total_brate; -#endif -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } + total_brate += st->total_brate; #endif } #ifdef DEBUGGING @@ -612,11 +552,7 @@ void ivas_mct_core_enc( #ifdef DEBUGGING format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_SBA + SBA_ORDER_BITS + SBA_PLANAR_BITS ); - mct_bits += hMCT->nBitsMCT -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + ( hMCT->num_lfe ? 1 : 0 ) -#endif - + hMCT->nchan_out_woLFE; + mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE; assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); #endif diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 75191d0a412361b4b8732f3472e12cec085a3ddc..f2f5d2346103c6856570ba8b5f66348e772720ef 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -101,7 +101,6 @@ static void set_mct_enc_params( * cpe_id 1: L=data[4] R=data[5] * cpe_id 2: L=data[2] (mid) R=NULL *-------------------------------------------------------------------*/ -#ifdef ISSUE_24_CLEANUP_MCT_LFE static void map_input_to_cpe_channels( const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ float *pdata[MAX_INPUT_CHANNELS], /* o: mapped input pointers */ @@ -144,7 +143,6 @@ static void map_input_to_cpe_channels( return; } -#endif /*-------------------------------------------------------------------* * ivas_mct_enc() * @@ -168,9 +166,7 @@ ivas_error ivas_mct_enc( int16_t max_bwidth; int32_t ivas_total_brate; ivas_error error; -#ifdef ISSUE_24_CLEANUP_MCT_LFE float *pdata[MAX_INPUT_CHANNELS]; -#endif error = IVAS_ERR_OK; @@ -200,7 +196,6 @@ ivas_error ivas_mct_enc( hMCT->p_orig_spectrum_long[cpe_id][n] = orig_spectrum_long[cpe_id][n]; hCPE->hCoreCoder[n]->input_bwidth = hCPE->hCoreCoder[n]->last_input_bwidth; /* updated in BWD */ hCPE->hCoreCoder[n]->bwidth = hCPE->hCoreCoder[n]->last_bwidth; /* updated in BWD */ -#ifdef ISSUE_24_CLEANUP_MCT_LFE /* reset channel mode from previous state*/ if ( ( hCPE->cpe_id * CPE_CHANNELS + n ) >= hMCT->nchan_out_woLFE ) { @@ -210,12 +205,8 @@ ivas_error ivas_mct_enc( { hCPE->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } -#endif } } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->LFE_off = 1; /* disable LFE coding by default for the moment */ -#endif /* reconfiguration in case of bitrate switching */ if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) { @@ -231,18 +222,12 @@ ivas_error ivas_mct_enc( /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); -#ifdef ISSUE_24_CLEANUP_MCT_LFE /*for MC and MCT remove pointer to LFE input that has been processed seperately */ map_input_to_cpe_channels( st_ivas, pdata, data ); -#endif /* pre-processing */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { -#ifdef ISSUE_24_CLEANUP_MCT_LFE if ( ( error = ivas_cpe_enc( st_ivas, cpe_id, pdata[cpe_id * CPE_CHANNELS], pdata[cpe_id * CPE_CHANNELS + 1], input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_cpe_enc( st_ivas, cpe_id, data[cpe_id * CPE_CHANNELS], data[cpe_id * CPE_CHANNELS + 1], input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -250,12 +235,7 @@ ivas_error ivas_mct_enc( /* joint MCT encoding */ ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->nchan_out_woLFE + hMCT->num_lfe -#else - hMCT->nchan_out_woLFE -#endif - , + hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); @@ -266,9 +246,6 @@ ivas_error ivas_mct_enc( hCPE = st_ivas->hCPE[cpe_id]; ivas_mdct_quant_coder( hCPE, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->LFE_off, -#endif 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) */ @@ -324,30 +301,18 @@ ivas_error create_mct_enc( if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->nchan_out_woLFE = st_ivas->hEncoderConfig->nchan_inp - 1; /* LFE channel is coded separately */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = TRUE; -#endif } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = ivas_get_sba_num_TCs( ivas_total_brate, st_ivas->sba_analysis_order ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = FALSE; -#endif } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) { hMCT->nchan_out_woLFE = ivas_param_mc_getNumTransportChannels( ivas_total_brate, st_ivas->hEncoderConfig->mc_input_setup ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = FALSE; -#endif } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = ivas_sba_get_nchan( st_ivas->sba_analysis_order, st_ivas->hEncoderConfig->sba_planar ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = FALSE; -#endif } else { @@ -361,21 +326,11 @@ ivas_error create_mct_enc( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) % + if ( ( hMCT->nchan_out_woLFE ) % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; @@ -462,23 +417,14 @@ ivas_error mct_enc_reconfigure( if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->nchan_out_woLFE = st_ivas->hEncoderConfig->nchan_inp - 1; /* LFE channel is coded separately */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = TRUE; -#endif } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) { hMCT->nchan_out_woLFE = ivas_param_mc_getNumTransportChannels( ivas_total_brate, st_ivas->hEncoderConfig->mc_input_setup ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = FALSE; -#endif } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = st_ivas->nchan_transport; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - hMCT->num_lfe = FALSE; -#endif } else { @@ -494,21 +440,11 @@ ivas_error mct_enc_reconfigure( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) % + if ( ( hMCT->nchan_out_woLFE ) % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; @@ -527,18 +463,10 @@ ivas_error mct_enc_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; if ( !( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || -#endif ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); if ( st->igf ) { IGFEncSetMode( st->hIGFEnc, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ); @@ -741,11 +669,7 @@ static ivas_error ivas_mc_enc_reconfig( /* De-allocate McMasa-related handles */ ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); -#ifdef FIX_350_MASA_DELAY_COMP ivas_masa_enc_close( &( st_ivas->hMasa ) ); -#else - ivas_masa_enc_close( &( st_ivas->hMasa ), nchan_transport_old, MC_FORMAT ); -#endif ivas_qmetadata_close( &st_ivas->hQMetaData ); } @@ -772,11 +696,7 @@ static ivas_error ivas_mc_enc_reconfig( if ( st_ivas->hMasa != NULL ) { -#ifdef FIX_350_MASA_DELAY_COMP ivas_masa_enc_close( &( st_ivas->hMasa ) ); -#else - ivas_masa_enc_close( &( st_ivas->hMasa ), nchan_transport_old, MC_FORMAT ); -#endif st_ivas->hMasa = NULL; } @@ -886,24 +806,10 @@ static ivas_error ivas_mc_enc_reconfig( } } - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); /* set last core to TCX20 */ st->last_core = TCX_20_CORE; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) - { -#ifdef DEBUGGING - assert( st_ivas->hCPE[1] != NULL ); -#endif - st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } -#endif if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index 9c0e43caa0291367f263909b8362439b0f5d4c60..7ab6206a29169407d4f8a3b2a6c57d7175684b36 100644 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -62,11 +62,7 @@ void getChannelEnergies( for ( ch = 0; ch < nchan; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && st->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframe = st->hTcxEnc->L_frameTCX / nSubframes; @@ -160,11 +156,7 @@ static void getCorrelationMatrix( int16_t ch1, ch2, n, nchan; float tmp; - nchan = hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ; + nchan = hMCT->nchan_out_woLFE; /* correlation */ for ( ch1 = 0; ch1 < nchan; ch1++ ) @@ -174,12 +166,7 @@ static void getCorrelationMatrix( xCorrMatrix[ch1][ch2] = 0; if ( sts[ch1]->core == sts[ch2]->core && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { int16_t nSubframes = ( sts[ch1]->core == TCX_20_CORE ? 1 : NB_DIV ); int16_t L_subframe = sts[ch1]->hTcxEnc->L_frameTCX / nSubframes; @@ -237,18 +224,10 @@ static void getBestCorrelation( *_ch2 = -1; *max_corr = 0.f; - for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE ); ch1++ ) { - for ( ch2 = ch1 + 1; ch2 < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch2 = ch1 + 1; ch2 < ( hMCT->nchan_out_woLFE ); ch2++ ) { if ( fabsf( *max_corr ) < fabsf( xCorrMatrix[ch1][ch2] ) ) @@ -330,27 +309,14 @@ static void updateCorrelationMatrix( int16_t ch1, ch2, n; /* correlation: */ - for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE ); ch1++ ) { - for ( ch2 = ch1; ch2 < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch2 = ch1; ch2 < ( hMCT->nchan_out_woLFE ); ch2++ ) { if ( sts[ch1]->core == sts[ch2]->core && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { int16_t nSubframes = ( sts[ch1]->core == TCX_20_CORE ? 1 : NB_DIV ); @@ -377,12 +343,7 @@ static void updateCorrelationMatrix( static int16_t channelPairToIndex( const int16_t chIdx1, const int16_t chIdx2, - const int16_t nChannels -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - Encoder_State **sts /* i/o: encoder state structure */ -#endif -) + const int16_t nChannels ) { int16_t ch1, ch2; int16_t pairIdx; @@ -393,12 +354,6 @@ static int16_t channelPairToIndex( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[ch1]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch2]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - continue; - } -#endif if ( ch1 == chIdx1 && ch2 == chIdx2 ) { return pairIdx; @@ -438,11 +393,7 @@ static void getGlobalILD( /*calculate total energy without LFE*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { meanE += nrg[ch]; cnt++; @@ -454,11 +405,7 @@ static void getGlobalILD( meanE = max( meanE / cnt, EPSILON ); for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframe = sts[ch]->hTcxEnc->L_frameTCX / nSubframes; @@ -531,19 +478,11 @@ void apply_MCT_enc( /*Determine active channels*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { count_active_ch++; } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#else else -#endif { hMCT->mc_global_ild[ch] = 0; } @@ -564,16 +503,8 @@ void apply_MCT_enc( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { - if ( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sumCorrDiff += fabsf( hMCT->lastxCorrMatrix[ch1][ch2] - xCorrMatrix[ch1][ch2] ); } @@ -664,12 +595,7 @@ void apply_MCT_enc( } /* calculate all related values: */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ); -#else assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ); -#endif getBlockValues( sts, ch1, ch2, hMCT->hBlockData[currBlockDataCnt], mdst_spectrum, inv_spectrum, inv_mdst_spectrum ); @@ -754,11 +680,7 @@ void apply_MCT_enc( for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { if ( ( !cpEle[ch] ) || hMCT->currBlockDataCnt == 0 ) { @@ -844,9 +766,6 @@ void write_mct_bitstream( for ( ch = 0; ch < nchan; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && -#endif hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, hMCT->mc_global_ild[ch], SMDCT_GLOBAL_ILD_BITS ); @@ -858,9 +777,6 @@ void write_mct_bitstream( for ( ch = 0; ch < nchan; ch++ ) { if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && -#endif sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, hMCT->lowE_ch[ch], 1 ); @@ -874,12 +790,7 @@ void write_mct_bitstream( hBlock = hMCT->hBlockData[pair]; /*calculate channel pair index and write it to BS*/ - channelPairIndex = channelPairToIndex( hBlock->ch1, hBlock->ch2, nchan -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - sts -#endif - ); + channelPairIndex = channelPairToIndex( hBlock->ch1, hBlock->ch2, nchan ); push_next_indice( hBstr, channelPairIndex, hMCT->bitsChannelPairIndex ); /*point to encoder states of actual channels to write block pair bits*/ @@ -923,11 +834,7 @@ void mctStereoIGF_enc( int16_t singleChEle[MCT_MAX_CHANNELS]; L_subframeTCX = 0; /* to avoid compilation warning */ - set_s( singleChEle, 1, hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + set_s( singleChEle, 1, hMCT->nchan_out_woLFE ); for ( b = 0; b < hMCT->currBlockDataCnt; b++ ) { @@ -978,17 +885,9 @@ void mctStereoIGF_enc( } /* channel elements that are coded separately detected */ - if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ) ) != 0 ) + if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 ) { - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - + hMCT->num_lfe -#endif - ); + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); ch++ ) { if ( singleChEle[ch] ) @@ -996,9 +895,6 @@ void mctStereoIGF_enc( st = sts[ch]; if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode == MCT_CHAN_MODE_LFE || -#endif st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c old mode 100755 new mode 100644 index 62223d9005a36bf4c4b827bd5ce1cab72dc9c556..128a4c9b4ccc07e754b32421fba64d2c573d7462 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -88,19 +88,12 @@ static void enc_prm_pre_mdct( { writeTCXWindowing( hBstr, st->hTcxCfg->tcx_last_overlap_mode ); } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->element_mode == IVAS_CPE_MDCT && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + push_next_indice( hBstr, st->hTcxEnc->kernel_type[0], st->last_core != ACELP_CORE ? 2 : 1 ); + if ( st->core == TCX_10_CORE ) { -#endif - push_next_indice( hBstr, st->hTcxEnc->kernel_type[0], st->last_core != ACELP_CORE ? 2 : 1 ); - if ( st->core == TCX_10_CORE ) - { - assert( ( st->hTcxEnc->kernel_type[0] & 1 ) == ( st->hTcxEnc->kernel_type[1] >> 1 ) ); - push_next_indice( hBstr, st->hTcxEnc->kernel_type[1] & 1, 1 ); - } -#ifndef ISSUE_24_CLEANUP_MCT_LFE + assert( ( st->hTcxEnc->kernel_type[0] & 1 ) == ( st->hTcxEnc->kernel_type[1] >> 1 ) ); + push_next_indice( hBstr, st->hTcxEnc->kernel_type[1] & 1, 1 ); } -#endif st->glr_reset = 0; #ifdef DEBUG_PLOT_BITS @@ -291,12 +284,7 @@ static void kernel_switch_update_transforms( int16_t i, leftOverlap = 0, rightOverlap = 0; const float *left_win, *right_win; - tcx_get_windows( hTcxCfg, (int16_t) windowedTimeSignal[0], (int16_t) windowedTimeSignal[1], &leftOverlap, &left_win, &rightOverlap, &right_win, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + tcx_get_windows( hTcxCfg, (int16_t) windowedTimeSignal[0], (int16_t) windowedTimeSignal[1], &leftOverlap, &left_win, &rightOverlap, &right_win, 1 ); if ( speech_TCX != NULL && tcxTransType != TCX_20 && (int16_t) windowedTimeSignal[0] == FULL_OVERLAP && s - leftOverlap > minWindowLen ) { for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ @@ -319,12 +307,7 @@ static void kernel_switch_update_transforms( s = hTcxCfg->tcx5SizeFB; /* obtain 1st TCX5 again */ nSubframes *= 2; - WindowSignal( hTcxCfg, leftOverlap / 2, RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal + 2, &s, tcx5Win, 0, 1 -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - 0 -#endif - ); + WindowSignal( hTcxCfg, leftOverlap / 2, RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal + 2, &s, tcx5Win, 0, 1 ); kernel_switch_trafo( tcx5Win, sigR, leftOverlap, s /* L_subfr. */ - ( leftOverlap + rightOverlap ) / 2, rightOverlap, kernelType ); if ( kernelType & 1 ) /* 2nd TCX5 is kernelType 3 */ @@ -589,11 +572,8 @@ void ivas_mdct_core_whitening_enc( int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : number of tns parameters put into prm */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to the parameter table */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t *LFE_off, /* o : flag if LFE has zero content */ -#endif - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ - const int16_t nChannels /* i : total number of coded channels */ + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t nChannels /* i : total number of coded channels */ ) { int16_t n, ch, nSubframes, L_subframe, L_subframeTCX, tcx_subframe_coded_lines; @@ -627,14 +607,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - stereo_tcx_init_enc( sts[ch] ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + stereo_tcx_init_enc( sts[ch] ); set_s( tnsSize[ch], 0, 2 ); set_s( tnsBits[ch], 0, 2 ); @@ -674,14 +647,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { -#endif - SetTCXModeInfo( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#ifndef ISSUE_24_CLEANUP_MCT_LFE - } -#endif + SetTCXModeInfo( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); } } @@ -695,11 +661,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) -#else if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) -#endif { continue; } @@ -711,24 +673,7 @@ void ivas_mdct_core_whitening_enc( core_signal_analysis_high_bitrate( new_samples[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, mdst_spectrum[ch], tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0 ); /* BWD in MDCT domain */ -#ifndef FIX_MDCT_BASED_BWD - if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) - { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) -#else - if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) -#endif - { - bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL ); - } - } -#else -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) -#else if ( st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) -#endif { nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; @@ -742,7 +687,6 @@ void ivas_mdct_core_whitening_enc( } } } -#endif if ( st->last_core == ACELP_CORE ) /* reset past kernel info */ { @@ -853,11 +797,7 @@ void ivas_mdct_core_whitening_enc( { TCX_ENC_HANDLE hTcxEncCh = sts[ch]->hTcxEnc; - if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) { hTcxEncCh->kernel_symmetry_past = hTcxEncCh->kernel_type[0] = 0; @@ -886,11 +826,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) { continue; } @@ -936,9 +872,6 @@ void ivas_mdct_core_whitening_enc( /* MCT: detect whether there are silent channels and set mct_chan_mode accordingly */ if ( -#ifndef ISSUE_24_CLEANUP_MCT_LFE - st->mct_chan_mode != MCT_CHAN_MODE_LFE && -#endif mct_on ) { chE_tot = sum_f( chE, NB_DIV ); @@ -956,11 +889,7 @@ void ivas_mdct_core_whitening_enc( } /* set low br mode, if possible. Can later be discarded, depending on the stereo mode used for SNS parameter decoding */ - if ( hCPE->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) ) + if ( hCPE->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) { sns_low_br_mode = !sts[0]->sp_aud_decision0; } @@ -987,11 +916,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { param_lpc[ch][0] = ch; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -1014,11 +939,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -1046,11 +967,7 @@ void ivas_mdct_core_whitening_enc( /* first deinterleave once more */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -1071,11 +988,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -1097,9 +1010,6 @@ void ivas_mdct_core_whitening_enc( } } } -#ifndef ISSUE_24_CLEANUP_MCT_LFE -/*check whether LFE channel is active*/ -#endif for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { /*no need to write last channel bit in case of odd channels*/ @@ -1112,15 +1022,7 @@ void ivas_mdct_core_whitening_enc( if ( mct_on ) /* signal bits should be written only for MCT*/ { -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - assert( *LFE_off == 1 ); - push_next_indice( hBstr, *LFE_off, 1 ); - } - else -#endif - if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, 1, 1 ); } @@ -1137,11 +1039,7 @@ void ivas_mdct_core_whitening_enc( { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { st->side_bits_frame_channel = 0; /*dummy initialization to prevent range coder crashing in case all channels are silent and bits are distributed to channel 0 */ @@ -1186,11 +1084,7 @@ void ivas_mdct_core_whitening_enc( { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { skipped_first_channel = 1; continue; @@ -1204,11 +1098,7 @@ void ivas_mdct_core_whitening_enc( { push_next_indice( hBstr, param_lpc[0][0] >> 1, 1 ); - if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) -#ifndef ISSUE_24_CLEANUP_MCT_LFE - || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE -#endif - ) ) + if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) { /* write classifier decision to signal low br mode for SNS encoding, for all other configs, low_br mode is not possible */ push_next_indice( hBstr, sns_low_br_mode, 1 ); @@ -1223,11 +1113,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { continue; } @@ -1253,10 +1139,7 @@ void ivas_mdct_core_whitening_enc( *---------------------------------------------------------------*/ void ivas_mdct_quant_coder( - CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - const int16_t LFE_off, /* i : flag if LFE is inactive */ -#endif + CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ @@ -1302,11 +1185,7 @@ void ivas_mdct_quant_coder( st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { ignore_chan[ch] = 1; continue; @@ -1366,11 +1245,7 @@ void ivas_mdct_quant_coder( { st = sts[ch]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { /*Enable appropriate upadte of tcx_curr_overlap_mode even for uncoded channel index 1*/ L_frameTCX[ch][0] = ( st->core == TCX_10_CORE ) ? st->hTcxEnc->L_frameTCX >> 1 : st->hTcxEnc->L_frameTCX; @@ -1397,11 +1272,7 @@ void ivas_mdct_quant_coder( * Generate Bitstream *---------------------------------------------------------------*/ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) -#else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) -#endif { continue; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 424e6b0c02b328f817a350663ac671e3684585a5..2e094c6a873bc30c53105e6a0c15d455c572ee46 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -219,22 +219,6 @@ typedef struct stereo_dft_enc_data_struct float voicing_lt; -#ifdef ITD_WINNER_GAIN_MODIFY - float noise_coherence; - int16_t local_vad; - int16_t mus_flag; - float spd_L_noise[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of spectral power density of noise in the left channel*/ - float spd_R_noise[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of spectral power density of noise in the right channel*/ - float spd_L_noise_min[STEREO_DFT_N_32k_ENC / 2]; - float spd_R_noise_min[STEREO_DFT_N_32k_ENC / 2]; - float spd_L_noise_max[STEREO_DFT_N_32k_ENC / 2]; - float spd_R_noise_max[STEREO_DFT_N_32k_ENC / 2]; - float winner_gain_L[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of the Winner gain of the left channel*/ - float winner_gain_R[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of the Winner gain of the right channel*/ - float spd_L_smooth_new[STEREO_DFT_N_32k_ENC / 2]; - float spd_R_smooth_new[STEREO_DFT_N_32k_ENC / 2]; - -#endif int16_t currentNumUpdates; int16_t expectedNumUpdates; /* Expected number of frames before use of ITD estimate */ @@ -559,11 +543,7 @@ typedef struct int16_t dtx_flag; int16_t sce_id_dtx; -#ifdef DISCRETE_ISM_DTX_CNG int16_t cnt_SID_ISM; -#else - int16_t dtx_speech_buffer_enc[PARAM_ISM_HYS_BUF_SIZE]; -#endif float long_term_energy_stereo_dmx_enc[MAX_NUM_OBJECTS][PARAM_ISM_HYS_BUF_SIZE]; float coh[MAX_NUM_OBJECTS]; @@ -752,7 +732,6 @@ typedef struct ivas_masa_dir_align_struct } MASA_DIR_ALIGN_STATE, *MASA_DIR_ALIGN_HANDLE; #endif -#ifdef FIX_382_MASA_META_FRAMING_ASYNC /* structure storing MASA framing sync detection and compensation data */ typedef struct ivas_masa_sync_struct { @@ -762,16 +741,12 @@ typedef struct ivas_masa_sync_struct MASA_FRAME_MODE frame_mode; } MASA_SYNC_STATE, *MASA_SYNC_HANDLE; -#endif typedef struct ivas_masa_encoder_data_struct { float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_ENC_CLDFB_INSTANCES]; -#ifndef FIX_350_MASA_DELAY_COMP - float *delay_buffer[MASA_MAX_TRANSPORT_CHANNELS]; -#endif int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; uint8_t twoDirBands[MASA_FREQUENCY_BANDS]; float importanceWeight[MASA_FREQUENCY_BANDS]; @@ -783,9 +758,7 @@ typedef struct ivas_masa_encoder_data_struct float onset_detector_1; float onset_detector_2; -#ifdef FIX_382_MASA_META_FRAMING_ASYNC MASA_SYNC_STATE sync_state; -#endif #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT MASA_DIR_ALIGN_STATE dir_align_state; @@ -959,14 +932,8 @@ typedef struct mct_enc_data_structure float lastxCorrMatrix[MCT_MAX_CHANNELS][MCT_MAX_CHANNELS]; int16_t lowE_ch[MCT_MAX_CHANNELS]; -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t LFE_off; -#endif uint16_t mc_global_ild[MCT_MAX_CHANNELS]; int16_t nBitsMCT; /* number of bits spent on mct side info */ -#ifndef ISSUE_24_CLEANUP_MCT_LFE - int16_t num_lfe; -#endif /* pointers to local buffers */ float *p_mdst_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS]; float *p_orig_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS]; @@ -1049,9 +1016,7 @@ typedef struct encoder_config_structure int16_t element_mode_init; /* element mode used at initialization */ int16_t stereo_dmx_evs; /* flag to indicate that stereo downmix for EVS encoder */ -#ifdef NCHAN_ISM_PARAMETER int16_t nchan_ism; /* number of ISM channels */ -#endif int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index ab4844ab944067f4a519135e05b06574f6d460f5..43546261a41b954622c9bdaa07ef0bee191c2072 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -416,21 +416,6 @@ void stereo_dft_enc_reset( ) { int16_t i; -#ifdef ITD_WINNER_GAIN_MODIFY - hStereoDft->noise_coherence = 0.0f; - hStereoDft->local_vad = 0; - hStereoDft->mus_flag = 2; - set_zero( hStereoDft->spd_L_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_R_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_L_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_R_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_L_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_R_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->winner_gain_L, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->winner_gain_R, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hStereoDft->spd_L_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hStereoDft->spd_R_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); -#endif /*reset parameters*/ set_zero( hStereoDft->side_gain, STEREO_DFT_ENC_DFT_NB * STEREO_DFT_BAND_MAX ); set_s( hStereoDft->side_gain_index_EC, 15, STEREO_DFT_BAND_MAX ); diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index f52d67a47a328fe47fcdc6ccf4d2c167dc7564f4..d2c0bc7fe1ec78ae00051af7f280b97fe93c1d2a 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -82,135 +82,6 @@ #define ITD_MAX_MDCT 80 -#ifdef ITD_WINNER_GAIN_MODIFY -/*------------------------------------------------------------------------- - * stereo_dft_frame_coherence() - * Calculate the frame coherence of the stereo signal - * - *-------------------------------------------------------------------------*/ - -static void stereo_dft_frame_coherence( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, - float *xcorr, - float *Spd_L, - float *Spd_R, - float *frame_coherence ) -{ - float spd_xcorr_real, spd_xcorr_imag, spd_LR; - int16_t i, NFFT; - - NFFT = min( STEREO_DFT_N_32k_ENC, hStereoDft->NFFT ); - spd_xcorr_real = 0.0f; - spd_xcorr_imag = 0.0f; - spd_LR = 0.0f; - *frame_coherence = 0.0f; - - for ( i = 1; i < NFFT / 2; i++ ) - { - spd_xcorr_real += (float) xcorr[i * 2]; - spd_xcorr_imag += (float) xcorr[i * 2 + 1]; - spd_LR += (float) sqrt( Spd_L[i] ) * sqrt( Spd_R[i] ); - } - - *frame_coherence = (float) ( sqrt( spd_xcorr_real * spd_xcorr_real + spd_xcorr_imag * spd_xcorr_imag ) / spd_LR ); - - return; -} - - -/*------------------------------------------------------------------------- - * stereo_dft_itd_winner_gain() - * Estimate the spectral power density of noise in the stereo signal and - * calculate the winner gain for the ITD estimation - *-------------------------------------------------------------------------*/ - -static void stereo_dft_itd_winner_gain( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, - float *Spd_L, - float *Spd_R ) -{ - int16_t i; - float alpha1 = 0.05f; - float alpha2 = 0.95f; - float trackingfactor = 0.5f; - float ratio = 2.75f; - - for ( i = 0; i < STEREO_DFT_N_16k_ENC / 2; i++ ) - { - if ( hStereoDft->spd_L_noise_min[i] > Spd_L[i] ) - { - hStereoDft->spd_L_noise_min[i] = ( 1 - 0.15 ) * hStereoDft->spd_L_noise_min[i] + 0.15 * Spd_L[i]; - } - else - { - hStereoDft->spd_L_noise_min[i] = hStereoDft->spd_L_noise_min[i] + alpha1 * ( Spd_L[i] - hStereoDft->spd_L_noise_min[i] ); - } - if ( hStereoDft->spd_R_noise[i] > Spd_R[i] ) - { - hStereoDft->spd_R_noise_min[i] = ( 1 - 0.15 ) * hStereoDft->spd_R_noise_min[i] + 0.15 * Spd_R[i]; - } - else - { - hStereoDft->spd_R_noise_min[i] = hStereoDft->spd_R_noise_min[i] + alpha1 * ( Spd_R[i] - hStereoDft->spd_R_noise_min[i] ); - } - if ( hStereoDft->spd_L_noise_max[i] < Spd_L[i] ) - { - hStereoDft->spd_L_noise_max[i] = Spd_L[i]; - } - else - { - hStereoDft->spd_L_noise_max[i] = hStereoDft->spd_L_noise_max[i] + alpha2 * ( Spd_L[i] - hStereoDft->spd_L_noise_max[i] ); - } - if ( hStereoDft->spd_R_noise_max[i] < Spd_R[i] ) - { - hStereoDft->spd_R_noise_max[i] = Spd_R[i]; - } - else - { - hStereoDft->spd_R_noise_max[i] = hStereoDft->spd_R_noise_max[i] + alpha2 * ( Spd_R[i] - hStereoDft->spd_R_noise_max[i] ); - } - if ( hStereoDft->spd_L_noise_max[i] > ratio * hStereoDft->spd_L_noise_min[i] ) - { - hStereoDft->spd_L_noise[i] = hStereoDft->spd_L_noise[i]; - hStereoDft->winner_gain_L[i] = ( Spd_L[i] - hStereoDft->spd_L_noise[i] ) / Spd_L[i]; - } - else - { - hStereoDft->spd_L_noise[i] = hStereoDft->spd_L_noise[i] + trackingfactor * ( Spd_L[i] - hStereoDft->spd_L_noise[i] ); - hStereoDft->winner_gain_L[i] = ( Spd_L[i] - hStereoDft->spd_L_noise[i] ) / Spd_L[i]; - } - if ( hStereoDft->spd_R_noise_max[i] > ratio * hStereoDft->spd_R_noise_min[i] ) - { - hStereoDft->spd_R_noise[i] = hStereoDft->spd_R_noise[i]; - hStereoDft->winner_gain_R[i] = ( Spd_R[i] - hStereoDft->spd_R_noise[i] ) / Spd_R[i]; - } - else - { - hStereoDft->spd_R_noise[i] = hStereoDft->spd_R_noise[i] + trackingfactor * ( Spd_R[i] - hStereoDft->spd_R_noise[i] ); - hStereoDft->winner_gain_R[i] = ( Spd_R[i] - hStereoDft->spd_R_noise[i] ) / Spd_R[i]; - } - } - - for ( i = 0; i < STEREO_DFT_N_16k_ENC / 2; i++ ) - { - hStereoDft->winner_gain_L[i] = max( hStereoDft->winner_gain_L[i], 0.01f ); - hStereoDft->winner_gain_R[i] = max( hStereoDft->winner_gain_R[i], 0.01f ); - hStereoDft->winner_gain_L[i] = min( hStereoDft->winner_gain_L[i], 1.0f ); - hStereoDft->winner_gain_R[i] = min( hStereoDft->winner_gain_R[i], 1.0f ); - if ( hStereoDft->winner_gain_L[i] >= 0.80f ) - hStereoDft->winner_gain_L[i] = 1.0f; - else - hStereoDft->winner_gain_L[i] = 0.01f; - if ( hStereoDft->winner_gain_R[i] >= 0.80f ) - hStereoDft->winner_gain_R[i] = 1.0f; - else - hStereoDft->winner_gain_R[i] = 0.01f; - } - - return; -} -#endif - /*------------------------------------------------------------------------- * set_band_limits() * @@ -741,9 +612,6 @@ void stereo_dft_enc_compute_itd( int16_t itd, itd_td; float xcorr_itd[STEREO_DFT_N_32k_ENC]; float tmpf1, tmpf2, tmpf3; -#ifdef ITD_WINNER_GAIN_MODIFY - float frame_coherence, tmpf4; -#endif float thres, alpha; int16_t index; float xcorr_max, sum_nrg_L_lb, par_L[XCORR_LB_NUM_BANDS], par_L_avrg, sum_nrg_L_tmp; @@ -984,32 +852,6 @@ void stereo_dft_enc_compute_itd( xcorr[0] = sign( hItd->xcorr_smooth[0] ); xcorr[1] = sign( hItd->xcorr_smooth[1] ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - stereo_dft_frame_coherence( hStereoDft, xcorr, Spd_L, Spd_R, &frame_coherence ); - if ( hStereoDft->local_vad == 0 ) - { - hStereoDft->noise_coherence = 0.9f * hStereoDft->noise_coherence + ( 1.0 - 0.9f ) * frame_coherence; - } - else - { - hStereoDft->noise_coherence = hStereoDft->noise_coherence; - } - stereo_dft_itd_winner_gain( hStereoDft, Spd_L, Spd_R ); - - if ( hStereoDft->noise_coherence > 0.25f ) - { - for ( i = 1; i < NFFT / 2; i++ ) - { - xcorr[2 * i] = ( hStereoDft->winner_gain_L[i] * hStereoDft->winner_gain_R[i] ) * xcorr[2 * i]; - xcorr[2 * i + 1] = ( hStereoDft->winner_gain_L[i] * hStereoDft->winner_gain_R[i] ) * xcorr[2 * i + 1]; - Spd_L[i] = hStereoDft->winner_gain_L[i] * Spd_L[i]; - Spd_R[i] = hStereoDft->winner_gain_R[i] * Spd_R[i]; - } - } - } -#endif if ( hCPE->element_mode == IVAS_CPE_DFT && ( hItd->td_itd[k_offset] - hItd->td_itd[k_offset - 1] ) ) { @@ -1032,23 +874,6 @@ void stereo_dft_enc_compute_itd( } tmpf3 = 2.f; -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - alpha = -0.8f; - } - else - { - if ( flag_noisy_speech_snr ) - { - alpha = -0.8f; - } - else - { - alpha = -1.0f; - } - } -#else if ( flag_noisy_speech_snr ) { alpha = -0.8f; @@ -1057,7 +882,6 @@ void stereo_dft_enc_compute_itd( { alpha = -1.0f; } -#endif if ( hCPE->hCoreCoder[0]->Opt_DTX_ON && hCPE->element_mode == IVAS_CPE_DFT ) { @@ -1140,42 +964,9 @@ void stereo_dft_enc_compute_itd( tmpf1 += EPSILON; tmpf2 = tmpf1; tmpf1 = powf( tmpf1, alpha ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - tmpf4 = 1.0f; - /* Calculate smoothed spectral power density for the L/R channel */ - hStereoDft->spd_L_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_L_smooth_new[i] + sfm_L * Spd_L[i]; - hStereoDft->spd_R_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_R_smooth_new[i] + sfm_L * Spd_R[i]; - /* Calculate cross spectral power density using the smoothed spectral power density*/ - tmpf4 = (float) sqrt( hStereoDft->spd_L_smooth_new[i] ) * sqrt( hStereoDft->spd_R_smooth_new[i] ); - /* Calculate the value of weighted function for each frequency bin */ - tmpf4 += EPSILON; - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf4 = tmpf1 * pow( tmpf2, 2.0f ) * pow( tmpf4, -2.0f ); - tmpf3 += tmpf2 * tmpf1; - tmpf3 -= tmpf2 * tmpf4; - } - else - { - tmpf4 = tmpf2 * pow( tmpf4, -2.0f ); - } - /* Calculate the value of weighted generlized cross-correlation function for each frequency bin */ - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf4; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf4; - } - else - { - tmpf3 += tmpf2 * tmpf1; - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; - } -#else tmpf3 += tmpf2 * tmpf1; xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; -#endif /* Low pass filter L/R power spectrum */ /* Calculate coherence as cross spectral density divided by L*R power spectrum */ @@ -1193,42 +984,9 @@ void stereo_dft_enc_compute_itd( tmpf1 += EPSILON; tmpf2 = tmpf1; tmpf1 = powf( tmpf1, alpha ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - tmpf4 = 1.0f; - /* Calculate smoothed spectral power density for the L/R channel */ - hStereoDft->spd_L_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_L_smooth_new[i] + sfm_L * Spd_L[i]; - hStereoDft->spd_R_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_R_smooth_new[i] + sfm_L * Spd_R[i]; - /* Calculate cross spectral power density using the smoothed spectral power density*/ - tmpf4 = (float) sqrt( hStereoDft->spd_L_smooth_new[i] ) * sqrt( hStereoDft->spd_R_smooth_new[i] ); - /* Calculate the value of weighted function for each frequency bin */ - tmpf4 += EPSILON; - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf4 = tmpf1 * pow( tmpf2, 2.0f ) * pow( tmpf4, -2.0f ); - tmpf3 += tmpf2 * tmpf1; - tmpf3 -= tmpf2 * tmpf4; - } - else - { - tmpf4 = tmpf2 * pow( tmpf4, -2.0f ); - } - /* Calculate the value of weighted generlized cross-correlation function for each frequency bin */ - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf4; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf4; - } - else - { - tmpf3 += tmpf2 * tmpf1; - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; - } -#else tmpf3 += tmpf2 * tmpf1; xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; -#endif } } } @@ -1242,70 +1000,16 @@ void stereo_dft_enc_compute_itd( tmpf1 += EPSILON; tmpf2 = tmpf1; tmpf1 = powf( tmpf1, alpha ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - tmpf4 = 1.0f; - /* Calculate smoothed spectral power density for the L/R channel */ - hStereoDft->spd_L_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_L_smooth_new[i] + sfm_L * Spd_L[i]; - hStereoDft->spd_R_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_R_smooth_new[i] + sfm_L * Spd_R[i]; - /* Calculate cross spectral power density using the smoothed spectral power density*/ - tmpf4 = (float) sqrt( hStereoDft->spd_L_smooth_new[i] ) * sqrt( hStereoDft->spd_R_smooth_new[i] ); - /* Calculate the value of weighted function for each frequency bin */ - tmpf4 += EPSILON; - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf4 = tmpf1 * pow( tmpf2, 2.0f ) * pow( tmpf4, -2.0f ); - tmpf3 += tmpf2 * tmpf1; - tmpf3 -= tmpf2 * tmpf4; - } - else - { - tmpf4 = tmpf2 * pow( tmpf4, -2.0f ); - } - /* Calculate the value of weighted generlized cross-correlation function for each frequency bin */ - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf4; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf4; - } - else - { - tmpf3 += tmpf2 * tmpf1; - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; - } -#else tmpf3 += tmpf2 * tmpf1; xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; -#endif - } - } -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf1 = (float) ( NFFT / 2 + 1 ) / tmpf3; - for ( i = 0; i < NFFT; i++ ) - { - xcorr[i] *= tmpf1; - } - } - else - { - for ( i = NFFT / 2; i < NFFT; i++ ) - { - xcorr[i] = 0.0f; - } } } -#else tmpf1 = (float) ( NFFT / 2 + 1 ) / tmpf3; for ( i = 0; i < NFFT; i++ ) { xcorr[i] *= tmpf1; } -#endif /*calculate mean E ratio of main to background signal for cohSNR*/ if ( hCPE->element_mode == IVAS_CPE_DFT ) { diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index fa9b108f0075e489fd36560a78baaf2b5a978777..2e739cc90651f43dc4f4d7d9adb4e733425e15fd 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -236,9 +236,6 @@ void stereo_mdct_core_enc( ivas_mdct_core_whitening_enc( hCPE, new_samples, old_wsp, pitch_buf, p_mdst_spectrum_long, tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - NULL, -#endif 0, CPE_CHANNELS ); for ( ch = 0; ch < CPE_CHANNELS; ch++ ) @@ -454,9 +451,6 @@ void stereo_mdct_core_enc( #endif ivas_mdct_quant_coder( hCPE, -#ifndef ISSUE_24_CLEANUP_MCT_LFE - 0, -#endif tnsBits, tnsSize, p_param, 0 ); pop_wmops(); diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 0e6fe1496bd03ad3d770befe24a51544b18b4b77..fca3c7785eab9e833c538536f7f61fc9fb99ebf3 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -526,12 +526,7 @@ ivas_error stereo_memory_enc( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) ); } - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); /* allocate and initialize MDCT stereo structure */ if ( ( hCPE->hStereoMdct = (STEREO_MDCT_ENC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 3bda423fadd1f51d543cb07329a919f807e8f044..e334f4d0298b6fc9d00f108b3531f59028e0bacf 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -99,20 +99,10 @@ void stereo_tcx_init_enc( st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode ); st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); st->hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode, st->element_mode ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); if ( st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - st->mct_chan_mode -#endif - ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } st->core_brate = st->total_brate; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index d9bd9d688fffc61b8b26c9595a0719e53bbcafa6..f9deb214e61645872805e91684f6a7291da33173 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -61,9 +61,7 @@ struct IVAS_ENC bool ismMetadataProvided[MAX_NUM_OBJECTS]; bool maxBandwidthUser; /* Was a specific max bandwith selected by the user? */ IVAS_ENC_BANDWIDTH newBandwidthApi; /* maximum encoded bandwidth, as set on API level */ -#ifdef FIX_379_EXT_METADATA - bool extMetadataApi; /* External metadata requested, to be checked against current bit rate */ -#endif + bool extMetadataApi; /* External metadata requested, to be checked against current bit rate */ }; /*---------------------------------------------------------------------* @@ -78,11 +76,7 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); -#ifdef FIX_379_EXT_METADATA static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const IVAS_ENC_HANDLE hIvasEnc ); -#else -static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ); -#endif static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); @@ -394,13 +388,9 @@ ivas_error IVAS_ENC_ConfigureForObjects( st_ivas->hEncoderConfig->ivas_format = ISM_FORMAT; st_ivas->hEncoderConfig->element_mode_init = IVAS_SCE; st_ivas->hEncoderConfig->nchan_inp = numObjects; -#ifdef NCHAN_ISM_PARAMETER st_ivas->hEncoderConfig->nchan_ism = numObjects; -#endif st_ivas->hEncoderConfig->ism_extended_metadata_flag = ism_extended_metadata; -#ifdef FIX_379_EXT_METADATA hIvasEnc->extMetadataApi = ( ism_extended_metadata == 1 ); -#endif hIvasEnc->maxBandwidthUser = max_bwidth_user; error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); @@ -791,11 +781,7 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { -#ifdef FIX_379_EXT_METADATA if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) -#else - if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -893,15 +879,10 @@ static ivas_error configureEncoder( } if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( -#ifndef DISCRETE_ISM_DTX_CNG - ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 2 ) || // ToDo: see Issue 113 - ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 2 && hEncoderConfig->ivas_total_brate != IVAS_24k4 && hEncoderConfig->ivas_total_brate != IVAS_32k ) || // ParamISM -#endif - ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation - ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done - hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD - ) ) + ( ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation + ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done + hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD + ) ) { return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } @@ -932,12 +913,6 @@ static ivas_error configureEncoder( return error; } -#ifndef DISCRETE_ISM_DTX_CNG - if ( hEncoderConfig->Opt_DTX_ON && ( hEncoderConfig->ivas_format == ISM_FORMAT ) && !( st_ivas->ism_mode == ISM_MODE_DISC && hEncoderConfig->nchan_inp == 1 ) && !( st_ivas->ism_mode == ISM_MODE_PARAM && ( hEncoderConfig->nchan_inp == 3 || hEncoderConfig->nchan_inp == 4 ) ) ) - { - return IVAS_ERROR( IVAS_ERR_UNKNOWN, "DTX is not supported in this IVAS format and element mode." ); - } -#endif if ( hEncoderConfig->ivas_format == MONO_FORMAT ) { @@ -1751,11 +1726,7 @@ static ivas_error setBitrate( if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { -#ifdef FIX_379_EXT_METADATA if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) -#else - if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1994,12 +1965,8 @@ static ivas_error sanitizeBandwidth( *---------------------------------------------------------------------*/ static ivas_error sanitizeBitrateISM( -#ifdef FIX_379_EXT_METADATA const ENCODER_CONFIG_HANDLE hEncoderConfig, const IVAS_ENC_HANDLE hIvasEnc ) -#else - const ENCODER_CONFIG_HANDLE hEncoderConfig ) -#endif { if ( hEncoderConfig->ivas_total_brate > IVAS_128k && hEncoderConfig->nchan_inp == 1 ) { @@ -2031,7 +1998,6 @@ static ivas_error sanitizeBitrateISM( return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } -#ifdef FIX_379_EXT_METADATA if ( hIvasEnc->extMetadataApi ) { hEncoderConfig->ism_extended_metadata_flag = ( hEncoderConfig->ivas_total_brate >= ISM_EXTENDED_METADATA_BRATE ); @@ -2040,12 +2006,6 @@ static ivas_error sanitizeBitrateISM( { hEncoderConfig->ism_extended_metadata_flag = 0; } -#else - if ( hEncoderConfig->ivas_total_brate < ISM_EXTENDED_METADATA_BRATE && hEncoderConfig->ism_extended_metadata_flag == 1 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for extended metadata format specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); - } -#endif return IVAS_ERR_OK; } @@ -2302,9 +2262,7 @@ static void init_encoder_config( hEncoderConfig->var_SID_rate_flag = 1; hEncoderConfig->mc_input_setup = MC_LS_SETUP_INVALID; hEncoderConfig->stereo_dmx_evs = 0; -#ifdef NCHAN_ISM_PARAMETER hEncoderConfig->nchan_ism = 0; -#endif hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; hEncoderConfig->ism_extended_metadata_flag = 0; diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c old mode 100755 new mode 100644 index feb0df75ca24bd5feabfe8006d6ce07b51746384..4c4bf686749e22177ccd728598b50c398a29a09d --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -219,12 +219,8 @@ void pre_proc( * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect( st, st->input, NULL, enerBuffer -#ifdef FIX_MDCT_BASED_BWD - , - 0 -#endif - ); + bw_detect( st, st->input, NULL, enerBuffer, + 0 ); /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation @@ -621,12 +617,7 @@ void pre_proc( st->gamma = GAMMA16k; } - st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - MCT_CHAN_MODE_REGULAR -#endif - ); + st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode ); } st->coder_type = st->coder_type_raw; diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index 83f9e2e7a09e26353b7a8ded866256d33fae89d4..1f8b36819f22bfa028814c617b723c4f0760a872 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -324,89 +324,74 @@ void SetTCXModeInfo( hTcxEnc->tcxMode = NO_TCX; } } -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + /* set the left window overlap */ + if ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) + { + st->hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; + } + else if ( ( hTcxEnc->tcxMode == TCX_10 ) && ( st->hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ) ) + { + st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; + } + else { - hTcxEnc->tcxMode = TCX_20; - *tcxModeOverlap = FULL_OVERLAP; st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; } -#endif -#ifndef ISSUE_24_CLEANUP_MCT_LFE - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + + /* determine the right window overlap */ + if ( hTcxEnc->tcxMode == TCX_10 ) { -#endif - /* set the left window overlap */ - if ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) + if ( hTranDet->transientDetector.attackIndex < 0 ) { - st->hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; - } - else if ( ( hTcxEnc->tcxMode == TCX_10 ) && ( st->hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ) ) - { - st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; + *tcxModeOverlap = HALF_OVERLAP; } else { - st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; - } - - /* determine the right window overlap */ - if ( hTcxEnc->tcxMode == TCX_10 ) - { - if ( hTranDet->transientDetector.attackIndex < 0 ) - { - *tcxModeOverlap = HALF_OVERLAP; - } - else + *tcxModeOverlap = hTranDet->transientDetector.attackIndex % 4; + if ( *tcxModeOverlap == 1 ) { - *tcxModeOverlap = hTranDet->transientDetector.attackIndex % 4; - if ( *tcxModeOverlap == 1 ) - { - *tcxModeOverlap = FULL_OVERLAP; - } - } - if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) - { - if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) - { - *tcxModeOverlap = HALF_OVERLAP; - } + *tcxModeOverlap = FULL_OVERLAP; } } - else if ( hTcxEnc->tcxMode == TCX_20 ) + if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) { - if ( hTranDet->transientDetector.attackIndex == 7 ) + if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) { *tcxModeOverlap = HALF_OVERLAP; } - else if ( hTranDet->transientDetector.attackIndex == 6 ) - { - *tcxModeOverlap = MIN_OVERLAP; - } - else - { - *tcxModeOverlap = ALDO_WINDOW; - } - if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) - { - if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) - { - *tcxModeOverlap = HALF_OVERLAP; - } - } + } + } + else if ( hTcxEnc->tcxMode == TCX_20 ) + { + if ( hTranDet->transientDetector.attackIndex == 7 ) + { + *tcxModeOverlap = HALF_OVERLAP; + } + else if ( hTranDet->transientDetector.attackIndex == 6 ) + { + *tcxModeOverlap = MIN_OVERLAP; } else { - /* NO_TCX */ - *tcxModeOverlap = TRANSITION_OVERLAP; - if ( st->element_mode == IVAS_CPE_MDCT ) + *tcxModeOverlap = ALDO_WINDOW; + } + if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) + { + if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) { - hTcxEnc->tfm_mem = 0.75f; + *tcxModeOverlap = HALF_OVERLAP; } } -#ifndef ISSUE_24_CLEANUP_MCT_LFE } -#endif + else + { + /* NO_TCX */ + *tcxModeOverlap = TRANSITION_OVERLAP; + if ( st->element_mode == IVAS_CPE_MDCT ) + { + hTcxEnc->tfm_mem = 0.75f; + } + } /* for the ACELP -> TCX transition frames use full right window overlap */ if ( ( st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) && ( *tcxModeOverlap == ALDO_WINDOW ) ) diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index b194de06d5d117483e8b0b3e936a878d8866298a..6b8c595f5e1ca9b36c3c728a48a6c8711b78772b 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -408,12 +408,7 @@ void updt_enc_common( st->gamma = GAMMA16k; } - st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode -#ifndef ISSUE_24_CLEANUP_MCT_LFE - , - MCT_CHAN_MODE_REGULAR -#endif - ); + st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode ); } /* update FER clas */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 09704b969e21ba1cd443e6ed929fffcf6b459b9f..35819cf8cb16eb3b60e6b1e1edc8ee5d462c52f7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -40,9 +40,7 @@ #include "ivas_cnst.h" #include "ivas_rom_binauralRenderer.h" #include "ivas_rom_rend.h" -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS #include "ivas_rom_com.h" -#endif #ifdef DEBUGGING #include "debug.h" @@ -58,19 +56,13 @@ #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT /* powf(0.95f, 4.0f) for sub-frame smoothing instead of CLDFB slot */ #define ADAPT_HTPROTO_IIR_FAC 0.81450625f -#else -#define ADAPT_HTPROTO_IIR_FAC 0.95f -#endif #define ADAPT_HTPROTO_ILD_LIM_DB0 1.0f #define ADAPT_HTPROTO_ILD_LIM_DB1 4.0f #define ADAPT_HTPROTO_ROT_LIM_0 0.4f #define ADAPT_HTPROTO_ROT_LIM_1 0.8f -#endif /*------------------------------------------------------------------------- * Local function prototypes @@ -86,9 +78,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struc static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); -#endif static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); @@ -102,9 +92,7 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); -#ifdef NOKIA_PARAMBIN_REQULARIZATION static float configure_reqularization_factor( const IVAS_FORMAT ivas_format, const int32_t ivas_brate ); -#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() @@ -293,9 +281,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( ivas_td_decorr_dec_close( &( hBinaural->hTdDecorr ) ); } -#ifdef NOKIA_PARAMBIN_REQULARIZATION hBinaural->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); -#endif st_ivas->hDiracDecBin = hBinaural; @@ -576,9 +562,7 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, nBins, Rmat ); -#endif ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); } @@ -1097,19 +1081,11 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( CrEneR = 0.0f; /* Formulate main processing matrix M */ -#ifdef NOKIA_PARAMBIN_REQULARIZATION formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], h->ChCrossRe[bin], h->ChCrossIm[bin], h->ChEneOut[0][bin], h->ChEneOut[1][bin], h->ChCrossReOut[bin], h->ChCrossImOut[bin], prototypeMtx, Mre, Mim, h->reqularizationFactor ); -#else - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], - h->ChCrossRe[bin], h->ChCrossIm[bin], - h->ChEneOut[0][bin], h->ChEneOut[1][bin], - h->ChCrossReOut[bin], h->ChCrossImOut[bin], - prototypeMtx, Mre, Mim, 1.0f ); -#endif /* Load estimated covariance matrix to the [2][2] matrix form */ CxRe[0][0] = h->ChEne[0][bin]; @@ -1358,7 +1334,6 @@ static void ivas_dirac_dec_binaural_process_output( } -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1369,14 +1344,9 @@ static void adaptTransportSignalsHeadtracked( float Rmat[3][3] ) { int16_t slot, ch, bin, louderCh; -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; uint8_t n_slots_per_sf, sf_idx, n_sf; int16_t max_band; -#else - float re[2], im[2], ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val; - float proc_re[2], proc_im[2], sum_re, sum_im, ene_proc, ene_target, mf; -#endif /* Determine head-orientation-based mono factor. Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ @@ -1385,7 +1355,6 @@ static void adaptTransportSignalsHeadtracked( mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); /* Adapt transport signals in frequency bands */ -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ n_slots_per_sf = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; n_sf = ( slotEnd - firstSlot ) / n_slots_per_sf; @@ -1488,66 +1457,9 @@ static void adaptTransportSignalsHeadtracked( } } } -#else - /* original contribution */ - for ( slot = firstSlot; slot < slotEnd; slot++ ) - { - float eqVal[60]; - - for ( bin = 0; bin < nBins; bin++ ) - { - /* Determine channel energies */ - for ( ch = 0; ch < 2; ch++ ) - { - re[ch] = inRe[ch][slot][bin]; - im[ch] = inIm[ch][slot][bin]; - - hHeadTrackData->chEneIIR[ch][bin] *= ADAPT_HTPROTO_IIR_FAC; - hHeadTrackData->chEneIIR[ch][bin] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ( ( re[ch] * re[ch] ) + ( im[ch] * im[ch] ) ); - } - - /* Determine ILD */ - ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][bin] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][bin] ) ) ); - louderCh = ( hHeadTrackData->chEneIIR[1][bin] > hHeadTrackData->chEneIIR[0][bin] ); - - /* Determine ILD-based mono factor */ - mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); - mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); - - /* Combine mono factors */ - mono_factor = mono_factor_ILD * mono_factor_rotation; - - /* Mix original audio and sum signal according to determined mono factor */ - sum_re = re[0] + re[1]; - sum_im = im[0] + im[1]; - for ( ch = 0; ch < 2; ch++ ) - { - mf = ( ch == louderCh ) ? 0.0f : mono_factor; - - proc_re[ch] = mf * sum_re + ( 1.0f - mf ) * re[ch]; - proc_im[ch] = mf * sum_im + ( 1.0f - mf ) * im[ch]; - - hHeadTrackData->procChEneIIR[ch][bin] *= ADAPT_HTPROTO_IIR_FAC; - hHeadTrackData->procChEneIIR[ch][bin] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ( ( proc_re[ch] * proc_re[ch] ) + ( proc_im[ch] * proc_im[ch] ) ); - } - - /* Equalize */ - ene_target = hHeadTrackData->chEneIIR[0][bin] + hHeadTrackData->chEneIIR[1][bin]; - ene_proc = hHeadTrackData->procChEneIIR[0][bin] + hHeadTrackData->procChEneIIR[1][bin]; - eqVal[bin] = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); - - for ( ch = 0; ch < 2; ch++ ) - { - inRe[ch][slot][bin] = proc_re[ch] * eqVal[bin]; - inIm[ch][slot][bin] = proc_im[ch] * eqVal[bin]; - } - } - } -#endif return; } -#endif static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( @@ -2089,7 +2001,6 @@ static void hrtfShGetHrtf( } -#ifdef NOKIA_PARAMBIN_REQULARIZATION /*------------------------------------------------------------------------- * configure_reqularization_factor() * @@ -2165,4 +2076,3 @@ static float configure_reqularization_factor( return reqularizationFactor; } -#endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index b454f061795d68e561fd74ade0ab1e2bdfa5a0b9..0618534448deec903f1f016e8d2f8030f84e028f 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -258,13 +258,9 @@ ivas_error ivas_td_binaural_renderer_unwrap( ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ -#ifdef FIX_406_IVAS_POSITION - const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ -#else - const IVAS_POSITION *Pos, /* i : Listener position data per subframe */ -#endif - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ + const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ ) { int16_t subframe_length; @@ -466,11 +462,7 @@ void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ -#ifdef FIX_406_IVAS_POSITION - const IVAS_VECTOR3 *Pos /* i : Listener Position */ -#else - const IVAS_POSITION *Pos /* i : Listener Position */ -#endif + const IVAS_VECTOR3 *Pos /* i : Listener Position */ ) { float FrontVec[3]; diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index b14db0b7c2f69c0d784f3f528c4dfa4bc7e8cabe..6ed9184786d2b544692c2861dff7ea1cfa6b1dbe 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -460,11 +460,7 @@ static void TDREND_SRC_SPATIAL_Init( SrcSpatial_p->DistAttenEnabled = FALSE; SrcSpatial_p->DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; SrcSpatial_p->DistAtten.RefDist = 1.0f; -#ifdef FIX_379_EXT_METADATA SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ -#else - SrcSpatial_p->DistAtten.MaxDist = 10.0f; -#endif SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; return; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 9d13ba9b36f4ac2afdcb4ce4b088445f4fc8e681..b810ed09d850529a8d04d8799a391be08c604bda 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -221,11 +221,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ -#ifdef FIX_406_IVAS_POSITION const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ -#else - const IVAS_POSITION *Pos, /* i : Listener position data per subframe */ -#endif float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ); @@ -277,11 +273,7 @@ void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ -#ifdef FIX_406_IVAS_POSITION const IVAS_VECTOR3 *Pos /* i : Listener Position */ -#else - const IVAS_POSITION *Pos /* i : Listener Position */ -#endif ); void TDREND_Update_object_positions( diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index d31d1bd1a6b6359158ea54483cd388d4222aa5c5..65a7c60ed9aaa3c76801d20030d3d4fbcacdcead 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1895,7 +1895,6 @@ ivas_error ivas_binaural_reverb_open( } -#ifdef FIX_103_RA_PARAMS_PARAM_BIN_REND if ( ( roomAcoustics ) && ( roomAcoustics->override ) ) { ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); @@ -1915,28 +1914,6 @@ ivas_error ivas_binaural_reverb_open( ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } } -#else - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - if ( !roomAcoustics->override ) - { - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections ); - ivas_binaural_reverb_setPreDelay( hReverb, 10 ); - } - else - { - ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); - ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); - } - } - else - { - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ); - ivas_binaural_reverb_setPreDelay( hReverb, 10 ); - } - -#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 58536df19f343eff092a44f56a2f31d3b15c6739..ddfdcb6763cf84430b7fdca47e58c0592741f079 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -85,19 +85,10 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f; } -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT set_zero( ( *hHeadTrackData )->chEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hHeadTrackData )->chEneIIR[1], MASA_FREQUENCY_BANDS ); set_zero( ( *hHeadTrackData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hHeadTrackData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); -#else - set_zero( ( *hHeadTrackData )->chEneIIR[0], CLDFB_NO_CHANNELS_MAX ); - set_zero( ( *hHeadTrackData )->chEneIIR[1], CLDFB_NO_CHANNELS_MAX ); - set_zero( ( *hHeadTrackData )->procChEneIIR[0], CLDFB_NO_CHANNELS_MAX ); - set_zero( ( *hHeadTrackData )->procChEneIIR[1], CLDFB_NO_CHANNELS_MAX ); -#endif -#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index faa22abd5655a761e7ee4558bd9dcaaa7e35542f..fac5781a7e8fa282278ecf628faea4b3a4233384 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -140,9 +140,7 @@ typedef struct ivas_dirac_dec_binaural_data_structure uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; -#ifdef NOKIA_PARAMBIN_REQULARIZATION float reqularizationFactor; -#endif } DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; @@ -250,11 +248,7 @@ typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#ifdef FIX_406_IVAS_POSITION IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#else - IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#endif float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; ivas_orient_trk_state_t *hOrientationTracker; @@ -264,11 +258,7 @@ typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef FIX_406_IVAS_POSITION IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; -#else - IVAS_POSITION Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; -#endif float Rmat[3][3]; float Rmat_prev[3][3]; @@ -276,15 +266,8 @@ typedef struct ivas_binaural_head_track_struct uint8_t lrSwitchedCurrent; float lrSwitchInterpVal; -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ float procChEneIIR[2][MASA_FREQUENCY_BANDS]; -#else - float chEneIIR[2][CLDFB_NO_CHANNELS_MAX]; - float procChEneIIR[2][CLDFB_NO_CHANNELS_MAX]; -#endif -#endif int16_t shd_rot_max_order; ivas_orient_trk_state_t *OrientationTracker; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e24c34d73e8fbe414a4027f2887c943409200e2f..7744a6582b1e019890f23f5c7417d340e7ed0876 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2222,9 +2222,7 @@ static ivas_error initMasaDummyDecForMcOut( { return error; } -#ifdef FIX_390_EXT_REND_MASA_META_COPY decDummy->hDirAC->dirac_bs_md_write_idx = 0; -#endif if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -2301,9 +2299,7 @@ static ivas_error initMasaDummyDecForSbaOut( { return error; } -#ifdef FIX_390_EXT_REND_MASA_META_COPY decDummy->hDirAC->dirac_bs_md_write_idx = 0; -#endif numCldfbAnalyses = decDummy->nchan_transport; numCldfbSyntheses = decDummy->hDecoderConfig->nchan_out; @@ -2372,9 +2368,7 @@ static ivas_error initMasaDummyDecForBinauralOut( { return error; } -#ifdef FIX_390_EXT_REND_MASA_META_COPY decDummy->hDirAC->dirac_bs_md_write_idx = 0; -#endif if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -3657,20 +3651,14 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef FIX_392_LATE_REVERB + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ -#else - const bool rendererConfigEnabled /* i : flag indicating if a renderer configuration file was supplied */ -#endif ) { ivas_error error; -#ifdef FIX_392_LATE_REVERB bool rendererConfigEnabled; rendererConfigEnabled = ( getAudioConfigType( outAudioConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ); -#endif if ( rendererConfigEnabled ) { @@ -3687,11 +3675,7 @@ ivas_error IVAS_REND_InitConfig( { return error; } -#ifdef FIX_392_LATE_REVERB if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, outAudioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, hIvasRend->rendererConfigEnabled ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -3807,11 +3791,7 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ -#ifdef FIX_406_IVAS_POSITION - const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#else - const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#endif + const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ ) { int16_t i; @@ -5312,61 +5292,38 @@ static void copyMasaMetadataToDiracRenderer( DIRAC_DEC_HANDLE hDirAC ) { int16_t band, sf, bin; -#ifdef FIX_390_EXT_REND_MASA_META_COPY int16_t meta_write_index; -#endif hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { -#ifdef FIX_390_EXT_REND_MASA_META_COPY meta_write_index = ( hDirAC->dirac_bs_md_write_idx + sf ) % hDirAC->dirac_md_buffer_length; -#endif for ( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { for ( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1]; bin++ ) { -#ifdef FIX_390_EXT_REND_MASA_META_COPY hDirAC->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; hDirAC->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; hDirAC->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; hDirAC->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; hDirAC->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; hDirAC->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; -#else - hDirAC->azimuth[sf][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; - hDirAC->elevation[sf][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; - hDirAC->energy_ratio1[sf][bin] = meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[sf][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->spreadCoherence[sf][bin] = meta->directional_meta[0].spread_coherence[sf][band]; - hDirAC->surroundingCoherence[sf][bin] = meta->common_meta.surround_coherence[sf][band]; -#endif if ( hDirAC->numSimultaneousDirections == 2 ) { -#ifdef FIX_390_EXT_REND_MASA_META_COPY hDirAC->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; hDirAC->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; hDirAC->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; hDirAC->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; hDirAC->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; -#else - hDirAC->azimuth2[sf][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; - hDirAC->elevation2[sf][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; - hDirAC->energy_ratio2[sf][bin] = meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[sf][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->spreadCoherence2[sf][bin] = meta->directional_meta[1].spread_coherence[sf][band]; -#endif } } } } -#ifdef FIX_390_EXT_REND_MASA_META_COPY hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; -#endif return; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index ca5ae9ab264769015d018fa94bc223519695b7fb..1e9d41fd38c1c49044b537b6d5826ab3f520acb3 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -229,11 +229,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef FIX_392_LATE_REVERB const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ -#else - const bool rendererConfigEnabled /* i : flag indicating if a renderer configuration file was supplied */ -#endif ); int16_t IVAS_REND_GetRenderConfig( @@ -249,11 +245,7 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ -#ifdef FIX_406_IVAS_POSITION const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#else - const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#endif ); ivas_error IVAS_REND_SetOrientationTrackingMode( diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index fda8154b326ac711c359ecd1038e7c1cded9d743..0283c292334daec7e88a2ffa6f54eb790f455257 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -94,11 +94,7 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ -#ifdef FIX_406_IVAS_POSITION - IVAS_VECTOR3 *pPos /* o : listener position */ -#else - IVAS_POSITION *pPos /* o : listener position */ -#endif + IVAS_VECTOR3 *pPos /* o : listener position */ ) { float w, x, y, z; diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index 2625bbe3f8945610902b8b5250e908266ec58ebe..52b97ae1c3db0417fb308b47b484bb0b11feea61 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -60,11 +60,7 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ -#ifdef FIX_406_IVAS_POSITION - IVAS_VECTOR3 *pPos /* o : listener position */ -#else - IVAS_POSITION *pPos /* o : listener position */ -#endif + IVAS_VECTOR3 *pPos /* o : listener position */ ); /*-----------------------------------------------------------------------* diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 0aeca6d6a06e36cdf8df76f6971670d356fb0923..fa449512e403dc3e49634206a26b2d15e894b96f 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -135,21 +135,12 @@ ivas_error IsmFileReader_readNextFrame( meta_prm[i++] = (float) atof( char_ptr ); } -#ifdef FIX_379_EXT_METADATA /* Verify the number of metadata values. */ if ( i < NUM_MIN_ISM_METADATA || char_ptr != NULL ) { /* Invalid number of metadata parameters (2-7 supported) */ return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; } -#else - /* Check if minimum number of metadata values were read. Additional values are ignored. */ - if ( i < NUM_MIN_ISM_METADATA ) - { - /* Not enough values provided in one line */ - return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; - } -#endif ismMetadata->azimuth = meta_prm[0]; @@ -171,11 +162,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } -#ifdef FIX_379_EXT_METADATA if ( ismMetadata->radius < 0 ) /* Negative radius not supported. Max quantized radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ -#else - if ( ismMetadata->radius < 0 ) // Ivas_fmToDo: to be reviewed -#endif { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 5667968ece8b39c4a1a8ecc783a9efcea63b2011..e7f3aca0b69b6089973f63ca433d33df36aa73c6 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -32,15 +32,12 @@ #include "masa_file_writer.h" #include "ivas_stat_com.h" -#ifdef FIX_350_MASA_DELAY_COMP #include "ivas_stat_dec.h" -#endif #include "ivas_cnst.h" #include #include #include -#ifdef FIX_350_MASA_DELAY_COMP typedef struct masaMetaDelayStorage { MASA_DECRIPTIVE_META descriptiveMeta; @@ -51,24 +48,18 @@ typedef struct masaMetaDelayStorage uint8_t diffuseToTotalRatio[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; } MASA_META_DELAY_STORAGE; -#endif struct MasaFileWriter { FILE *file; char *file_path; -#ifdef FIX_350_MASA_DELAY_COMP MASA_META_DELAY_STORAGE *delayStorage; -#endif }; /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ -#ifndef FIX_350_MASA_DELAY_COMP -#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ -#endif /*-----------------------------------------------------------------------* * Local functions @@ -93,7 +84,6 @@ static void getExtMasaMetadataFileName( return; } -#ifdef FIX_350_MASA_DELAY_COMP static void delayMasaMetadata( MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o : New input metadata which is inplace replaced with delayed metadata frame */ MASA_META_DELAY_STORAGE *delayStorage /* i/o : Storage for 10 ms of metadata and related descriptive metadata */ @@ -150,7 +140,6 @@ static void delayMasaMetadata( return; } -#endif /*---------------------------------------------------------------------* * MasaFileWriter_open() @@ -159,11 +148,9 @@ static void delayMasaMetadata( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_open( - const char *outputWavFilename, /* i : name of the output audio file */ -#ifdef FIX_350_MASA_DELAY_COMP + const char *outputWavFilename, /* i : name of the output audio file */ const bool delayCompensationEnabled, /* i : is delay compensation enabled */ -#endif - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ) { MasaFileWriter *self; @@ -189,12 +176,10 @@ ivas_error MasaFileWriter_open( self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); strcpy( self->file_path, filePath ); -#ifdef FIX_350_MASA_DELAY_COMP if ( !delayCompensationEnabled ) { self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); } -#endif *masaWriter = self; @@ -209,12 +194,8 @@ ivas_error MasaFileWriter_open( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ -#ifdef FIX_350_MASA_DELAY_COMP + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ -#else - IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ -#endif ) { if ( self == NULL ) @@ -222,29 +203,10 @@ ivas_error MasaFileWriter_writeFrame( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_350_MASA_DELAY_COMP uint16_t descMetaTemp = 0; int16_t i, sf, dir, numDirections; uint8_t writeTempOther[MASA_FREQUENCY_BANDS]; -#else - const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ - uint16_t descMetaTemp = 0; - int16_t i, sf, b_old, b_new, dir; - uint16_t writeTempIndex[MASA_FREQUENCY_BANDS]; - uint8_t writeTempOther[MASA_FREQUENCY_BANDS]; - MASA_DECRIPTIVE_META descMeta; - int16_t *bandMap; - uint8_t numCodingBands; - uint8_t numDirections; - int16_t nchan_transport; - - numDirections = (uint8_t) hMasaQMetadata->no_directions; - numCodingBands = hMasaQMetadata->numCodingBands; - bandMap = hMasaQMetadata->bandMap; - nchan_transport = hMasaQMetadata->nchan_transport; -#endif - -#ifdef FIX_350_MASA_DELAY_COMP + /* If delay storage has been reserved, then we are in the normal mode for the decoder * (i.e., no delay compensation for PCM) which means that metadata should be delayed * by two subframes (10 ms). Descriptive metadata is a combined result. */ @@ -280,47 +242,6 @@ ivas_error MasaFileWriter_writeFrame( descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelAngle << 6u; /* 6 LSB remain at zero */ } -#else - /* Construct descriptive meta */ - for ( i = 0; i < 8; i++ ) - { - descMeta.formatDescriptor[i] = ivasmasaFormatDescriptor[i]; - descMeta.numberOfDirections = numDirections - 1; - descMeta.numberOfChannels = (uint8_t) ( nchan_transport - 1 ); - /* Following correspond to "unknown" values until transmission is implemented */ - descMeta.sourceFormat = 0x0u; - descMeta.transportDefinition = 0x0u; - descMeta.channelAngle = 0x0u; - descMeta.channelDistance = 0x0u; - descMeta.channelLayout = 0x0u; - } - - if ( fwrite( &( descMeta.formatDescriptor ), sizeof( uint8_t ), 8, self->file ) != 8 ) - { - return IVAS_ERR_FAILED_FILE_WRITE; - } - - descMetaTemp += descMeta.numberOfDirections << 15u; - descMetaTemp += descMeta.numberOfChannels << 14u; - descMetaTemp += descMeta.sourceFormat << 12u; - if ( descMeta.sourceFormat == 0x0 || descMeta.sourceFormat == 0x1 ) - { - descMetaTemp += descMeta.transportDefinition << 9u; - descMetaTemp += descMeta.channelAngle << 6u; - descMetaTemp += descMeta.channelDistance; - } - else if ( descMeta.sourceFormat == 0x2 ) - { - descMetaTemp += descMeta.channelLayout << 9u; - /* 9 LSB remain at zero */ - } - else if ( descMeta.sourceFormat == 0x3 ) - { - descMetaTemp += descMeta.transportDefinition << 9u; - descMetaTemp += descMeta.channelAngle << 6u; - /* 6 LSB remain at zero */ - } -#endif if ( fwrite( &( descMetaTemp ), sizeof( uint16_t ), 1, self->file ) != 1 ) { @@ -332,73 +253,19 @@ ivas_error MasaFileWriter_writeFrame( for ( dir = 0; dir < numDirections; dir++ ) { /* Spherical index */ -#ifdef FIX_350_MASA_DELAY_COMP if ( fwrite( hMasaExtOutMeta->directionIndex[dir][sf], sizeof( uint16_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#else - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempIndex[i] = SPH_IDX_FRONT; - } - - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempIndex[b_new] = hMasaQMetadata->q_direction[dir].band_data[b_old].spherical_index[sf]; - } - } - - if ( fwrite( writeTempIndex, sizeof( uint16_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Direct-to-total ratio */ -#ifdef FIX_350_MASA_DELAY_COMP if ( fwrite( hMasaExtOutMeta->directToTotalRatio[dir][sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#else - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempOther[i] = 0; - } - - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = (uint8_t) floorf( hMasaQMetadata->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Spread coherence */ -#ifdef FIX_350_MASA_DELAY_COMP if ( fwrite( hMasaExtOutMeta->spreadCoherence[dir][sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#else - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempOther[i] = 0; - } - - if ( hMasaQMetadata->q_direction[dir].coherence_band_data != NULL ) - { - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = hMasaQMetadata->q_direction[dir].coherence_band_data[b_old].spread_coherence[sf]; - } - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#endif { return IVAS_ERR_FAILED_FILE_WRITE; } @@ -406,72 +273,23 @@ ivas_error MasaFileWriter_writeFrame( /* Common spatial meta */ /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ -#ifdef FIX_350_MASA_DELAY_COMP if ( fwrite( hMasaExtOutMeta->diffuseToTotalRatio[sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#else - for ( b_new = 0; b_new < MASA_FREQUENCY_BANDS; b_new++ ) - { - writeTempOther[b_new] = UINT8_MAX; - } - - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = UINT8_MAX; - for ( dir = 0; dir < numDirections; dir++ ) - { - writeTempOther[b_new] -= (uint8_t) floorf( hMasaQMetadata->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); - } - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Surround coherence */ -#ifdef FIX_350_MASA_DELAY_COMP if ( fwrite( hMasaExtOutMeta->surroundCoherence[sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#else - /* Surround coherence */ - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempOther[i] = 0; - } - - if ( hMasaQMetadata->surcoh_band_data != NULL ) - { - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = hMasaQMetadata->surcoh_band_data[b_old].surround_coherence[sf]; - } - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) -#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Remainder-to-total ratio */ /* This is zero after codec */ -#ifdef FIX_350_MASA_DELAY_COMP for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) { writeTempOther[i] = 0u; } -#else - for ( b_new = 0; b_new < MASA_FREQUENCY_BANDS; b_new++ ) - { - writeTempOther[b_new] = 0u; - } -#endif if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { @@ -500,9 +318,7 @@ void MasaFileWriter_close( fclose( ( *selfPtr )->file ); free( ( *selfPtr )->file_path ); -#ifdef FIX_350_MASA_DELAY_COMP free( ( *selfPtr )->delayStorage ); -#endif free( *selfPtr ); *selfPtr = NULL; diff --git a/lib_util/masa_file_writer.h b/lib_util/masa_file_writer.h index cb7d8f3d1efdb608e5e880be8a18a49bd43bffec..62aa8c6b48c0c990138621689f05fc665cabe914 100644 --- a/lib_util/masa_file_writer.h +++ b/lib_util/masa_file_writer.h @@ -35,9 +35,7 @@ #include #include "options.h" -#ifdef FIX_350_MASA_DELAY_COMP #include -#endif #include "common_api_types.h" @@ -45,20 +43,14 @@ struct MasaFileWriter; typedef struct MasaFileWriter MasaFileWriter; ivas_error MasaFileWriter_open( - const char *outputWavFilename, /* i : name of the output audio file */ -#ifdef FIX_350_MASA_DELAY_COMP + const char *outputWavFilename, /* i : name of the output audio file */ const bool delayCompensationEnabled, /* i : is delay compensation enabled */ -#endif - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ); ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ -#ifdef FIX_350_MASA_DELAY_COMP + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ -#else - IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ -#endif ); void MasaFileWriter_close(